public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "aph at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/38751] New: Odd performance regression with -Os Date: Wed, 07 Jan 2009 10:04:00 -0000 [thread overview] Message-ID: <bug-38751-511@http.gcc.gnu.org/bugzilla/> (raw) Here's a strange case of poor code generation with -Os. unsigned short foo2 (unsigned char on_off, unsigned short *puls) { return puls[on_off-1]; } With -O2, it's fine: movzbl %dil, %edi movzwl -2(%rsi,%rdi,2), %eax ret With -Os it's really weird: movzbl %dil, %eax movl $1, %edi subq %rax, %rdi imulq $-2, %rdi, %rdi movw (%rdi,%rsi), %ax ret The problem here seems to be that the FE (or the GIMPLE generation) transforms addr + ((on_off-1)*2) into addr + ((1-on_off)*-2) and nothing in -Os has the wit to recover. This badly affects targets with no hardware multiplier, which end up calling libgcc to do the multiply. http://gcc.gnu.org/ml/gcc/2008-12/msg00329.html -- Summary: Odd performance regression with -Os Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: aph at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38751
next reply other threads:[~2009-01-07 10:04 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2009-01-07 10:04 aph at gcc dot gnu dot org [this message] 2009-01-07 10:11 ` [Bug middle-end/38751] [4.2/4.3/4.4] odd " ebotcazou at gcc dot gnu dot org 2009-01-07 10:53 ` [Bug middle-end/38751] [4.2/4.3/4.4 regression] " rguenth at gcc dot gnu dot org 2009-01-15 1:13 ` pinskia at gcc dot gnu dot org 2009-01-15 13:57 ` [Bug middle-end/38751] [4.2/4.3 " jakub at gcc dot gnu dot org 2009-01-15 16:16 ` rguenth at gcc dot gnu dot org 2009-03-31 21:07 ` [Bug middle-end/38751] [4.3 " jsm28 at gcc dot gnu dot org 2009-04-22 15:20 ` rguenth at gcc dot gnu dot org 2009-06-25 12:39 ` [Bug middle-end/38751] [4.3 Regression] " rguenth at gcc dot gnu dot org 2009-06-25 12:39 ` rguenth at gcc dot gnu dot 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-38751-511@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).