I learned that sign extension occurs in immediate value of MIPS addi
instruction.
(http://www.cs.umd.edu/class/sum2003/cmsc311/Notes/Mips/addi.html)
However, I'm not sure when will it sign extend to a minus value.
I tried
main:
addi $t0, $0, 0x8000
jr $31
this code, and qtSpim gave the following error.
immediate value (32768) out of range (-32768 .. 32767) on line 3 of file addi $t0, $0, 0x8000
In order to sign extend to a minus value, MSB has to be '1', but it gets out of range to be an immediate value.
So, what I am guessing is that addi
is not 'in actual' happen to be sign extended.
Am I guessing it correct?
Or if not, can you please tell me where I have led myself wrong? Also an example of a sign extension will help a lot :)