Question

Assuming that i and j are in X3, X4 respectively, and assuming that the base address...

Assuming that i and j are in X3, X4 respectively, and assuming that the base address of the long arrays A and B (each element is 8 bytes) are in registers X6 and X7, respectively, write the LEGv8 assembly instructions for the following C statement:

B[8] = A[i - j];

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Compiled LEGv8 Code :

index 8 require offset of 64 (8*8)

LDUR X9,[X7,#64] //(LOAD REGISTER,U FOR UNSCALED IMMEDIATE) temporary register X9 contains B[8]

SUB X9 ,X3, X4 //temporary register X9 contains [i-j]

STUR X6, X9 //(STORE REGISTER ), register X6 gets [i-j]

STUR X9, X6 //store A[i-j] back into B[8]

Add a comment
Know the answer?
Add Answer to:
Assuming that i and j are in X3, X4 respectively, and assuming that the base address...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT