Translate f g A4 to ARM Assume f and g are in registers X9
Translate f = g - A[4] to ARM. Assume f and g are in registers X9, X10, the base address of array A is in X11, arid A contains 64 bit doublewords. You may also use any other registers.
Solution
Given statement
f=g-A[4]
where X9, X10 and X11 are registers
values f ,g and A are stored in the registers
$X9=f
$X10=g
$X11=A
Instructins to perform the statement f=g-A[4]
Since the array, A at index 4
To get value from the index,4 is 16 bytes away from array,A
Then subtract A[4] from g using sub command
lw $to , 16($X11) #$t0=A[4]
sub $X9, $X10, $to #f=X9 = g-A[4]
![Translate f = g - A[4] to ARM. Assume f and g are in registers X9, X10, the base address of array A is in X11, arid A contains 64 bit doublewords. You may also Translate f = g - A[4] to ARM. Assume f and g are in registers X9, X10, the base address of array A is in X11, arid A contains 64 bit doublewords. You may also](/WebImages/17/translate-f-g-a4-to-arm-assume-f-and-g-are-in-registers-x9-1033926-1761536195-0.webp)