Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

DQuestion 5 6 pts f=g+h+B[4]; For the program statement above, what is the corre

ID: 3879980 • Letter: D

Question

DQuestion 5 6 pts f=g+h+B[4]; For the program statement above, what is the corresponding LEGv8 assembly code? Assume that the variables f, g, and h are assigned to registers X9, X10 and X11 respectively. Assume that the base address of the arrays A and B are in registers X12 and X13, respectively. Assume that B holds 64-bit integers. Assembly Code Description Add g and h and store the result in the register for f Load the 5th element of B putting the value in register X15 Add the value from the previous step to the values computed in the first step.

Explanation / Answer

i.) ADD X9, X10, X11 // f = g + h

ii.) Index 4 requires offset of 32

LDUR X15,[X13,#32] // U for unscaled

iii.) ADD X9, X9, X15 // f = f + B[4]

Hope it helps, do give your valuable response.