Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.image text in transcribed

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

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 Design Using Entity Relationship Diagrams

Authors: Sikha Saha Bagui, Richard Walsh Earp

3rd Edition

103201718X, 978-1032017181

More Books

Students also viewed these Databases questions