
25 Apr
2005
25 Apr
'05
10:35 a.m.
Steven Scholz wrote:
How about
a = b / 5; ?
Will that result in
a = (b >> 2) - b;
, i.e. still no division but only shift operations?
Short answer:
${CROSS_COMPILE}gcc a.c -O2 -c -g -o a.o ${CROSS_COMPILE}objdump -S a.o
In other words, YMMV (arch, flags, gcc version, etc.). Some arch pipelines may be faster at division (with divisor on 8 bits), than shift and subtract which must serialize.
Feel free to ask/contribute to the GCC project :-)
--
Stephane