Arduino inline assembly: 16 bit x 8 bit multiplication!

robtillaart:
I would code x = x* 5 as x = x + x <<2; if I wanted to optimize

don'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.