Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Perform loop unrolling and code optimization to speed up the following operation. Be sure to report: (i) the number of clock-cycles it takes for unrolled,

Perform loop unrolling and code optimization to speed up the following operation. Be sure to report: (i) the number of clock-cycles it takes for unrolled, un-optimized code, and (ii) the number of clock-cycles it will take after loop unrolling and code optimization are in place. The high level code that needs to be optimized is as follows:

double scalar = 5;

for (int I = 0; I < 1000; i++) {

arr[i] = arr[8] - scalar;

}

MIPS assemble language initialization for this snippet (performed prior to loop-unrolling is as follows:

- Initialize in R2 the address of the last element

- Initialize variable scalar in F2 as 5

- Initialize in R1 the address of the first array element, or arr[0]

With the above in place, the core MIPS code for performing the loop computation is as follows:

Loop: L.D F0, 0(R1) ;F0 = arr[0]

ADDD F4, F0, F2 ;F4 = result

S.D F4, O(R1) ;store arr[i]

DADDUI R1, R1, #8 ;loop i++

BNE R1, R2, Loop

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Carlos Coronel, Steven Morris

14th Edition

978-0357673034

More Books

Students also viewed these Databases questions

Question

What is the purpose of the application form?

Answered: 1 week ago

Question

What is the general purpose of preliminary screening?

Answered: 1 week ago