Question: Consider the following C code, which adds d to first 100 elements of array B and stores the result in array A. Both A

Consider the following C code, which adds d to first 100 elements 

Consider the following C code, which adds d to first 100 elements of array B and stores the result in array A. Both A and B are arrays of 64-bit integers, and d is a 64-bit integer. Assume A, B, and d are stored in memory. The address of d is 5000. The address of A and B are in R1 and R2, respectively. Variable i is kept in a register. for (i=0; i < 100; i++) A[i]B[i] +d; Implement the loop with ten (10) MIPS64 instructions. What is the size (in bytes) of your code? What is the total number of instructions that would be executed? What is the total number of data memory accesses? Hints: MIPS64 instructions can be found in Figure A.26 on page A-40. Load d once before the loop. Increment i by 8 in each iteration. It can also be used as offset for accessing A and B.

Step by Step Solution

3.42 Rating (165 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To implement the loop with ten MIPS64 instructions we can follow these steps Load d from memory once ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!