can someone explain to me why MARS translate the pseudo instruction into two instructions: lui & ori? Is there cases when the translation is to only one instruction?
This simple program
.data
msg: .asciiz "This is a string"
.text
la $a0, msg # pseudo-instruction to load the address of the label str
Translates to the instructions
Address Code Basic Source
0x00400000 0x3c011001 lui $1,0x00001001 4 la $a0, msg # pseudo-instruction to load the address of the label str
0x00400004 0x34240000 ori $4,$1,0x00000000
And its always these two instructions AFAIK. The lui instruction makes the immediate value shifted left 16 bits and stored in the register. The lower 16 bits are zeroes.
This way, you can load 32 bit address (in mips32) with 32 bit instructions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With