robtillaart:
I would code x = x* 5 as x = x + x <<2; if I wanted to optimizedon't know the assembly for that but it uses no multiply at all..
Actually I tried that too, but in fact it works out to be less efficient than the "double, double again, and add" sequence Bill posted. It appears that GCC knows plenty of multiplication tricks, because it generates quite different and specialised code for different multiplication factors.