Thread (1 message) 1 message, 1 author, 2003-10-12

Re: Why does gcc suck at switch()?

From: <hidden>
Date: 2003-10-12 03:20:47

In message [off-list ref], Matthew 
Wilcox writes:
 >
 >Why does gcc generate worse code for switch() statements than for
 >multiple-if?
Because it apparently is trying to do the tests in range form rather
than naively generating a simple test for each case in the switch
(there's no way to actually verify that since you didn't provide a
complete testcase).


The range-forms can be more effective in some cases or at least that's
the claim.  I'm not particularly familiar with that code so I've never
tried to re-tune it.  [ I have noticed it generating spectacularly bad
code in certain circumstances, yours may just be another of those cases. ]


jeff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help