The following C code:
xdata at 0x7FC6 char FOO;
char fun(unsigned char tmp)
tmp = 2 * (tmp-1);
return ((xdata char *)(&FOO))[tmp];
is compiled inefficiently by the version of SDCC I got
from CVS on 1-September-2002.
My older copy of SDCC (2.2.1, which I'm trying to
upgrade from) generates reasonably efficient code
involving a decrement and an add. The new version
(2.3.2-devel) generates much more elaborate code using
an actual MUL instruction, instead of optimizing the
MUL to an ADD.