public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "dann at godzilla dot ics dot uci dot edu" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/23100] New: poor code generation for i686 Date: Wed, 27 Jul 2005 19:13:00 -0000 [thread overview] Message-ID: <20050727191234.23100.dann@godzilla.ics.uci.edu> (raw) Compiling the code below (extracted from xterm-202) with -fno-inline -O2 -march=i686 typedef unsigned long Atom; static int CutBuffer(unsigned code) { int cutbuffer; switch (code) { case ((Atom) 9): cutbuffer = 0; break; case ((Atom) 10): cutbuffer = 1; break; case ((Atom) 11): cutbuffer = 2; break; case ((Atom) 12): cutbuffer = 3; break; case ((Atom) 13): cutbuffer = 4; break; case ((Atom) 14): cutbuffer = 5; break; case ((Atom) 15): cutbuffer = 6; break; case ((Atom) 16): cutbuffer = 7; break; default: cutbuffer = -1; break; } return cutbuffer; } int foo (unsigned code) { return CutBuffer (code); } generates: CutBuffer: subl $9, %eax movl $-1, %edx pushl %ebp cmpl $7, %eax movl %esp, %ebp ja .L12 jmp *.L11(,%eax,4) .section .rodata .align 4 .align 4 .L11: .long .L3 .long .L4 .long .L5 .long .L6 .long .L7 .long .L8 .long .L9 .long .L10 .text .L9: movl $6, %edx .p2align 4,,15 .L12: popl %ebp movl %edx, %eax ret .L3: popl %ebp xorl %edx, %edx movl %edx, %eax .p2align 4,,2 ret .L10: popl %ebp movl $7, %edx movl %edx, %eax ret .L8: popl %ebp movl $5, %edx movl %edx, %eax ret .L7: popl %ebp movl $4, %edx movl %edx, %eax ret .L6: popl %ebp movl $3, %edx movl %edx, %eax ret [snip] Note the sequences: movl NUMBER, %edx movl %edx, %eax instead of using only one instruction for the same thing: movl NUMBER, %eax -- Summary: poor code generation for i686 Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: rtl-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dann at godzilla dot ics dot uci dot edu CC: gcc-bugs at gcc dot gnu dot org GCC host triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23100
next reply other threads:[~2005-07-27 19:12 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2005-07-27 19:13 dann at godzilla dot ics dot uci dot edu [this message] 2005-07-27 19:21 ` [Bug rtl-optimization/23100] " pinskia at gcc dot gnu dot org 2005-07-27 21:18 ` dann at godzilla dot ics dot uci dot edu 2005-07-27 22:22 ` pinskia at gcc dot gnu dot org 2005-07-27 22:37 ` dann at godzilla dot ics dot uci dot edu 2005-07-30 15:40 ` pinskia at gcc dot gnu dot org 2005-07-30 15:43 ` pinskia at gcc dot gnu dot org 2005-08-01 18:36 ` dann at godzilla dot ics dot uci dot edu
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=20050727191234.23100.dann@godzilla.ics.uci.edu \ --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).