public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "kazu at cs dot umass dot edu" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug optimization/14721] New: jump optimization involving a sibling call within a jump table Date: Wed, 24 Mar 2004 17:42:00 -0000 [thread overview] Message-ID: <20040324174207.14721.kazu@cs.umass.edu> (raw) We could put a function address in a jump table. void bar0 (void); void bar1 (void); void bar2 (void); void bar3 (void); void bar4 (void); void foo (int i) { switch (i) { case 0: bar0 (); break; case 1: bar1 (); break; case 2: bar2 (); break; case 3: bar3 (); break; case 4: bar4 (); break; } } Here is what I get on i686-pc-linux-gnu. foo: movl 4(%esp), %eax cmpl $4, %eax ja .L1 jmp *.L8(,%eax,4) .section .rodata .align 4 .align 4 .L8: .long .L3 .long .L4 .long .L5 .long .L6 .long .L7 .text .p2align 2,,3 .L1: ret .L7: jmp bar4 .L3: jmp bar0 .L4: jmp bar1 .L5: jmp bar2 .L6: jmp bar3 It would be nice if I can get something like: foo: movl 4(%esp), %eax cmpl $4, %eax ja .L1 jmp *.L8(,%eax,4) .section .rodata .align 4 .align 4 .L8: .long bar0 .long bar1 .long bar2 .long bar3 .long bar4 .text .p2align 2,,3 .L1: ret -- Summary: jump optimization involving a sibling call within a jump table Product: gcc Version: 3.5.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: kazu at cs dot umass dot edu CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: pessimizes-code http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14721
next reply other threads:[~2004-03-24 17:42 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2004-03-24 17:42 kazu at cs dot umass dot edu [this message] 2004-03-24 17:45 ` [Bug optimization/14721] " kazu at cs dot umass dot edu 2004-03-24 17:47 ` kazu at cs dot umass dot edu 2004-03-24 17:48 ` pinskia at gcc dot gnu dot org 2004-12-22 4:34 ` [Bug rtl-optimization/14721] " pinskia 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=20040324174207.14721.kazu@cs.umass.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).