On 09/18/2011 10:22 AM, Paolo Bonzini wrote:
On 09/18/2011 07:49 AM, Stefan Weil wrote:
Is there really any difference in the generated code?
gcc already uses a jump table internally to handle the
switch cases.
You typically save something on range checks, and it enables a lot
more tricks for use later (e.g. using multiple jump tables to perform
simple peephole optimizations, or to divert code execution on
interrupts).
I think it also improves branch target prediction - if you have a tight
loop of a few opcodes the predictor can guess where you're headed (since
there is a separate lookup key for each opcode), whereas with the
original code, there's a single key which cannot be used to predict the
branch target.
--
error compiling committee.c: too many arguments to function