Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi can you help me with the following questions? This activity will get you familiar with performance measurement, instruction set architecture, and compiler. It should

Hi can you help me with the following questions?

This activity will get you familiar with performance measurement, instruction set architecture, and compiler. It should give you a general idea on how a compiler optimize software. In particular, you will learn how architect measure performance of a system.

We will use the free c compiler from the GNU free compiler collection (GCC) project. If you uses Linux or Mac OS X, be sure to install appropriate packets. (For Mac OS X, you may install X-code command-line tool.)

image text in transcribed

image text in transcribed

Exercises 1. (Instruction Analysis) This exercise will familiar you with several aspects of instruction set and the fundamental of compiler. Given max.c (below), please use "gcc-S max.c to compile the code into assembly code. (The result will be in max.s.) From the result, answer the following questions int max1 (int a, int b) return (a>b) ?a:b; int max2 (int a, int b) t int isaGTb=a>b ; int max; if (isaGTb) max-a; else max b return max; What does the code hint about the kind of instruction set? (e.g. Accumulator, Register Memory, Memory Memory, Register Register) Please justify your answer. Can you tell whether the architecture is either Restricted Alignment or Unrestricted Alignment? Please explain how do you come up with your answer Create a new function (e.g. testMax) to call max1. Generate new assembly code What does the result suggest regarding the register saving (caller save vs. callee save)? Please provide your analysis How does the arguments be passed and the return value returned from a function? Please explain the code Find the part of code (snippet) that do comparison and conditional branch. Explain how does it work. If max.c is complied with optimization turned on (using "gcc -02 -S max.c"), what are the differences that you may observe from the result (comparing to that without optimization). Please provide your analysis Please estimate the CPU Time required by the max1 function (using the equation CPI=ICxCPlxTc). If possible, create a main function to cal maxi and use the time command to measure the performance. Compare the measure to your estimation. What do you think are the factors that cause the difference? Please provide your analysis (You may find references online regarding the CPl of each instruction.)

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

Databases Theory And Applications 27th Australasian Database Conference Adc 20 Sydney Nsw September 28 29 20 Proceedings Lncs 9877

Authors: Muhammad Aamir Cheema ,Wenjie Zhang ,Lijun Chang

1st Edition

3319469215, 978-3319469218

More Books

Students also viewed these Databases questions