Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between load word and move?

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?

like image 731
Niklas Rosencrantz Avatar asked Aug 28 '12 08:08

Niklas Rosencrantz


People also ask

What is the difference between load word and store word?

A load operation copies data from main memory into a register. A store operation copies data from a register into main memory . When a word (4 bytes) is loaded or stored the memory address must be a multiple of four.

What is the difference between MOV and load instructions?

LOAD is used to load data from memory to accumulator. STORE is used to store the accumulator result in memory. Both LOAD and STORE are 1-address instructions. MOV is a 2-address instruction.

What does load mean?

1 : something lifted up and carried : burden. 2 : the quantity of material put into a device at one time He washed a load of clothes. 3 : a large number or amount They collected loads of candy on Halloween. 4 : a mass or weight supported by something. 5 : something that causes worry or sadness That's a load off my mind ...

What does the load word instruction do?

Loads a word of data from a specified location in memory into a general-purpose register. The lwz and l instructions load a word in storage from a specified location in memory addressed by the effective address (EA) into the target general-purpose register (GPR) RT.

What is the difference between LA and LW?

lw loads the value which is stored at a certain address. So lw $a1, input_sz will load the value 80 into the register a1 because the value 80 is stored at the address that is specified by the label input_sz . la loads the address of the label itself into the register.

What is move in assembly?

The mov instruction copies the data item referred to by its second operand (i.e. register contents, memory contents, or a constant value) into the location referred to by its first operand (i.e. a register or memory).


1 Answers

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.

like image 100
paxdiablo Avatar answered Oct 03 '22 11:10

paxdiablo