Question: Loop unrolling [15 points] Please refer to the following loop coded in C for (i=100; i>0; i=i-1) 3. The C code is compiled into assembly

 Loop unrolling [15 points] Please refer to the following loop coded

in C for (i=100; i>0; i=i-1) 3. The C code is compiled

Loop unrolling [15 points] Please refer to the following loop coded in C for (i=100; i>0; i=i-1) 3. The C code is compiled into assembly codes. The assembly codes including stall cycles between instructions are shown below. Here are assumptions for this problem. - The array x has 102 elements from x[0] to x[101] (the datatype of the elements in x is double) - R1 contains the address for x[100] initially and s is stored in F2. - Stall cycles between dependent instructions are summarized below. Instruction producing Instruction using result Stalls between instructions in cycles result FP ALU o Another FP ALU o Store double FP ALU op Store double Load double Integer op FP ALU op Load double Load double Store double Integer op 0 0 1 Loop 2 stall 3 ADD.D F4,FO,F2 4 stall 5 stall 6 S.D O(R1),F4 7 DADDUI 8 stall 9BNEZ R1,Loop L.D F0.0(R1) Fo-vector element add scalar in F2 store result R1,R1,-8 decrement pointer 8B (DW) assumes can't forward to branch branch R1!-zero (a) [5 points] There is one bug in the assembly code. Please find it and write down the fixed code Loop unrolling [15 points] Please refer to the following loop coded in C for (i=100; i>0; i=i-1) 3. The C code is compiled into assembly codes. The assembly codes including stall cycles between instructions are shown below. Here are assumptions for this problem. - The array x has 102 elements from x[0] to x[101] (the datatype of the elements in x is double) - R1 contains the address for x[100] initially and s is stored in F2. - Stall cycles between dependent instructions are summarized below. Instruction producing Instruction using result Stalls between instructions in cycles result FP ALU o Another FP ALU o Store double FP ALU op Store double Load double Integer op FP ALU op Load double Load double Store double Integer op 0 0 1 Loop 2 stall 3 ADD.D F4,FO,F2 4 stall 5 stall 6 S.D O(R1),F4 7 DADDUI 8 stall 9BNEZ R1,Loop L.D F0.0(R1) Fo-vector element add scalar in F2 store result R1,R1,-8 decrement pointer 8B (DW) assumes can't forward to branch branch R1!-zero (a) [5 points] There is one bug in the assembly code. Please find it and write down the fixed code

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!