Hi Richard, The problem was with adjusting to be more expansive the load imm + mul sequence and the shift + add sequence were the smake cost when optimizing for size so the code in expmed.c choose the MUL.
I also considered this version also I couldn't decide which was better just went with the other version on a toss of a coin. I submit again with mips target testcase which use scan assember technique to check that we use the shift+add/sub sequence. A simple testcase compiled with -Os int foo(int x) { return x * 17; } will demonstrate that we currently use "LI + MUL" and after the patch we will use "SLL + ADDU". Gtraham