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, and A contains 64 bit double words. You may also use any other registers.
Solution
The LDRD command is used to load double word.
And since it is 64-bit architecture the registers to use X0-X30.
The required instruction set is:
LDRD X12, [X11, #32] ; Temporarily Stores A[4] into X12
; As it is double word, offset is
; 8*4 = 32
SUB X9, X10, X12 ; f = 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, and A contains 64 bit double words. 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, and A contains 64 bit double words. You may also](/WebImages/31/translate-f-g-a4-to-arm-assume-f-and-g-are-in-registers-x9-1086947-1761571689-0.webp)