MIPS move vs add / addi 0 instruction set for storing values?

I am currently taking a computer organization and assembler course, which mainly uses the MIPS instruction set to teach assembler.

I noticed that many of the examples the professor posted on the Internet use add or addi to move the value of $ a0 to the case register to invoke print services, such as the following ...

# store the first integer in $a0 and print add $a0, $zero, $t0 li $v0, 1 syscall 

or...

 # store the first integer in $a0 and print addi $a0, $t0, 0 li $v0, 1 syscall 

I also noticed some examples on the Internet where others simply use the move command to do the same as the following ...

 # store the first integer in $a0 and print move $a0, $t0 li $v0, 1 syscall 

Is the add or addi command used over the simple use of move in this scenario? If so, why? Is there a difference in performance or is it just a matter of taste?

+7
source share
1 answer

The move statement is not a real instruction - it is a pseudo-instruction that is converted to an add statement by assembler.

There are a whole bunch of these pseudo instructions, see for example https://en.wikipedia.org/wiki/MIPS_architecture#Pseudo_instructions

This type of thing is very common in RISC processors, where a minimal set of instructions is required, and a specific instruction can be used for several purposes.

+9
source

All Articles