It is a bit strange since most embedded compilers convert not very dense switch statements with consecutive values to jumptables anyway.
The one where I first noticed this was a GCC derived one even.
So the gain of this is not speed, but not having to manually configure the optimization compiler. (or maybe his architectures backend doesn't do jumptables).
Anyway, if you want the compiler to generate jumptables for case statements, work on the compiler's optimization to generate jumptables, this kind of abusing already dodgy functionality is not the way:
- taking the address of labels is not clean and complicates can confuse optimization
- the fall through switch of C is ugly to begin with
- the order is fixed by the numerical values of the opcodes
The last one requires some explanation; one of the known disadvantages of jumptables is that the order is fixed by the order of the numeric opcode-values. On architectures where the relative jump is more optimal AND short you want the most used opcodes first, so that they use the cheap branch instruction to jump back, and the more rarely used ones at the end can use abs jumps.
BUT then you don't want the compiler to reorder your switch/case :-)