Author: Eugene Nalimov
Date: 13:29:41 11/19/02
Go up one level in this thread
You don't need asm file to figure out what is going on. For a large switch table
compiler generated jump table, and code should look like
cmp eax, upper_switch_value+1
jnc default_case
mov eax, jump_table[eax*4]
jmp eax
Here indirect branch is not better than indirect function call. Plus, as Gunnar
mentioned, there is some overhead.
Thanks,
Eugene
On November 19, 2002 at 14:40:50, Robert Hyatt wrote:
>On November 19, 2002 at 04:41:59, Gunnar Andersson wrote:
>
>>On November 18, 2002 at 20:09:27, Eugene Nalimov wrote:
>>
>>>Indirect call costs *at least* the same as conditional branch, sometimes much
>>>more.
>>
>>I've discovered that arrays of function pointers can outperform switch
>>statements, at least with GCC and many cases. To me the generated assembly code
>>for the switch statement contains a jump table anyway, and there's some extra
>>assembly code essentially performing range checking.
>>
>>/ Gunnar
>
>
>It would be interesting to look at the .s file from gcc to see what it is doing.
> The
>indirect calls should be bad. Of course the range checking in a switch is also
>bad,
>but I have seen compilers that would let me turn this off...
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.