Your results are correct, at least the first one. According to here your first answer of:
addi $v0, $a0, -2
jr $ra
is correct. It uses the least amount of instructions which will increase execution speed, not to mention that using immediate instructions reduce fetches from memory. Look at the table in the link and will tell you that:
$v0
is the register of where the first return value from a function should go.
$a0
is the register of the first input parameter to use when calling functions.
$ra
is the register holding the return address from a previous jump instruction.
So someone wanted to call your assembly function it would look like:
int x = calc(5); // This line is the `C` equivalent and not part of assembly code.
Assembly would be:
li $a0, 5 # Load immediate the value 5 into register $a0.
jal __calc # Jump to the sub routine '__calc' and store return address in $ra.
# Result will now be in $v0.
...
__calc:
addi $v0, $a0, -2
jr $ra
Try to stay away from instructions like lw
if you can. They go out to RAM and fetch memory which is super slow compared to keeping values in the CPU's registers.