You are on page 1of 2

Cycles Int Op 1 Int Op 2 Mem Op 1 Mem Op 2 FP Addition FP Subtraction FP Multiply

1 ADADD R1, R0, R2 ADD R3, R0, R4

2 FLD R5, A(R3) FLD R6, B(R3)

3 FLD R5, A+4(R3) FLD R6, B+4(R3)

5 FADD R9, R5, R6

6 FADD R9, R5, R6

9 FSD R9, C(R3) FSUB R10, R5, R9

10 FSD R9, C+4(R3) FSUB R10, R5, R9

11

12

13 FSD R10, D(R3) FMUL R11, R5, R10

14 FSD R10, D+4(R3) FMUL R11, R5, R10

15

16

17 ADDI R1, R1, -2 FSD R11, E(R3)

18 ADDI R3, R3, 8 BNEZ R1, loop FSD R11, E+4(R3)

First loop starts on cycle 2, second iteration of the loop starts on cycle 19,
and the cycles taken by the floating points operations is 6.
Therefore, performance of the code is as follows:
6 / (19-2) cycles = 0.35
Rubrics:
a) Marks distribution
a. Proper loop unrolling = 8 (-1 for each mistake)
b. Incrementing R1 by 8 = 1
c. Decrementing R1 by -2 = 1
d. Overall optimal scheduling of instruction = 2
e. Flops result = 3

You might also like