Question: Consider a program P, which runs on a 1 GHz machine M in TP = 10s. An optimization is made to P, replacing all instances

Consider a program P, which runs on a 1 GHz machine M in TP = 10s. An optimization is made to P, replacing all instances of multiplying a value by 4 (mult X, X, 4) with two instructions that set X to X+X twice (add X, X, X; add X, X, X). Call this new optimized program Q. The CPI of the multiply instruction is 4, and the CPI of the add is 1. After recompiling, the program now runs in TQ = 9s on machine M.Consider a program P, which runs on a 1 GHz machine M

2 Performance Consider a program P, which runs on a 1 GHz machine M in TP-10s. An optimization is made to P, replacing all instances of multiplying a value by 4 (mult X, X, 4) with two instructions that set X to X+X twice (add X, X, X; add X, X, X). Call this new optimized program Q. The CPI of the multiply instruction is 4, and the CPI of the add is . After recompiling, the program now runs in TQ = 98 on machine M. 1. Express the time spent using multiplication in program P (Tmul) in terms of the CPI of the multiply instruction (CPIml), the number of multiply instructions (N), and the clock cycle time of machine M (teycle) 2. Express the time spent performing multiplication in program Q using the add instruction (Tadd in tems of the CPI of the add instruction (CPladd), the number of multiply inst ructions in program P (N), and the clock cycle time of machine M (teycle). 3. How many multiply instructions (N) were replaced by the compiler? 4. If we fix the number of multiply instructions to the N solved in (3), what must be the CPI of the adod instruction if we want the execution time To to be 8.5s instead of 9s

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!