[mips] Simplify and optimize code.

No intended functionality change.