public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/14721] New: jump optimization involving a sibling call within a jump table
@ 2004-03-24 17:42 kazu at cs dot umass dot edu
  2004-03-24 17:45 ` [Bug optimization/14721] " kazu at cs dot umass dot edu
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-03-24 17:42 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug optimization/14721] jump optimization involving a sibling call within a jump table
  2004-03-24 17:42 [Bug optimization/14721] New: jump optimization involving a sibling call within a jump table kazu at cs dot umass dot edu
@ 2004-03-24 17:45 ` kazu at cs dot umass dot edu
  2004-03-24 17:47 ` kazu at cs dot umass dot edu
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-03-24 17:45 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pessimizes-code


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14721


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug optimization/14721] jump optimization involving a sibling call within a jump table
  2004-03-24 17:42 [Bug optimization/14721] New: jump optimization involving a sibling call within a jump table kazu at cs dot umass dot edu
  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
  3 siblings, 0 replies; 5+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-03-24 17:47 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14721


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug optimization/14721] jump optimization involving a sibling call within a jump table
  2004-03-24 17:42 [Bug optimization/14721] New: jump optimization involving a sibling call within a jump table kazu at cs dot umass dot edu
  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
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-24 17:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-03-24 17:48 -------
Confirmed, yes that would be nice.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-03-24 17:48:16
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14721


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug rtl-optimization/14721] jump optimization involving a sibling call within a jump table
  2004-03-24 17:42 [Bug optimization/14721] New: jump optimization involving a sibling call within a jump table kazu at cs dot umass dot edu
                   ` (2 preceding siblings ...)
  2004-03-24 17:48 ` pinskia at gcc dot gnu dot org
@ 2004-12-22  4:34 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-22  4:34 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
   Last reconfirmed|2004-09-22 13:17:13         |2004-12-22 04:34:49
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14721


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-12-22  4:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-24 17:42 [Bug optimization/14721] New: jump optimization involving a sibling call within a jump table kazu at cs dot umass dot edu
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

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).