EE 3755  Complier Homework1  Due: TBA

Important: When logging in for the first time select “Common Desktop Environment"

after entering your user name and password.

(If you're reading this after selecting the wrong option, log out and then, from the log in dialog

select Options, Session, Common Desktop Environment.)

Solve this problem by modifying a copy of http://www.ece.lsu.edu/alex/EE3755/fall2004/test2.c

 

Estimated time to finish:

Knowing How to Use C language : Assume you already know (from 1Min to….Inf..).

Prob.1 : 10Mins.

Prob.2 : 10Mins.

Prob.3 : 10Mins.

Prob.4 :  5Mins.

 

Total : 35 Mins..

When you submit the Hw., Please write down how much time did you spend for each problem.

(No penalty for spending too little or too much time. Just want to know how long you spent.)

How to submit: Hard copy during the class.

Use “script “ command to take a snap shot of your program.

After run “script “

Use “cat” command to display your program.

Use “gcc to complier  your program.

Run each compiled programs to show time.

then stop the script.

 

 

Problem 1 : Compile  test2.c and run.

 

Explain briefly what the program is doing( Less than 5 lines)

 

 

 

gettimeofday() command returns the time passed since January 1,1970 in integer format.

If you are not familiar with this command, type “man gettimeofday” at unix prompt.

 

Problem 2: Modify test2.c program and

save on 2 files to show the effect of CSE(common sub expression elimination)

           TestwithoutCSE.c  (run this at least 3 times).

           TestwithCSE.c (run this at least 3 times).

 

           Compare each running time and talk about it briefly.      

 

Problem 3: Modify test2.c program and

save on 2 files to show the effect of LU(loop unrolling)

           TestwithoutLU.c  (run this at least 3 times).

           TestwithLU.c (run this at least 3 times).

 

           Compare each running time and talk about it briefly.      

 

Problem 4: Modify test2.c program and

save on 2 files  to show the effect of DCE(Dead code elimination)

           TestwithoutDCE.c  (run this at least 3 times).

           TestwithDCE.c (run this at least 3 times).

 

           Compare each running time and talk about it briefly.