Difference between load word and move?

16,834

The lw instruction (I assume that's what you meant since ldw isn't a standard MIPS instruction, though all the loads will be similar in the context of this answer) loads a word from the memory address specified by 0 + r4, while move1 simply transfers the value of r4 into r8.

For example, let's say r4 is currently 1234 and the word stored at 1234 in memory is 5678.

The difference is thus:

move r8, r4            ; r8 is now 1234
lw   r8, 0(r4)         ; r8 is now 5678

1 The move instruction" is actually a pseudo-instruction where move $rt, $rs is encoded as addi $rt, $rs, 0.

Share:
16,834
Niklas Rosencrantz
Author by

Niklas Rosencrantz

I'm as simple as possible but not any simpler.

Updated on June 05, 2022

Comments

  • Niklas Rosencrantz
    Niklas Rosencrantz almost 2 years

    What is the difference between

    ldw r8,0(r4)

    and

    mov r8, r4

    Load word says "copy from memory" but when load word copies from r4, it is copying from register and not from memory right?