Consider a processor P whose instruction set architecture is the load-store…
2026
Consider a processor P whose instruction set architecture is the load-store architecture. The instruction format is such that the first operand of any instruction is the destination operand.
Which one of the following sequences of instructions corresponds to the high-level language statement Z = X + Y ?
Note: X, Y, and Z are memory operands. R0, R1, and R2 are registers.
- A.
ADD Z, X, Y
- B.
LOAD R0, X
ADD Z, R0, Y
- C.
ADD R0, X, Y
STORE Z, R0
- D.
LOAD R0, X
LOAD R1, Y
ADD R2, R0, R1
STORE Z, R2
Attempted by 184 students.
Show answer & explanation
Correct answer: D
In a load-store architecture, arithmetic operations can only be performed on data stored in registers. Memory operands cannot be directly accessed by arithmetic instructions.
To implement Z = X + Y, where X, Y, and Z are memory operands, the data must first be moved from memory to registers.
The correct sequence involves loading X into a register, loading Y into another register, adding the two registers, and storing the result into Z.
This ensures compliance with the instruction format where the first operand is the destination and all arithmetic sources are registers.