Question: Consider the following program: Perform at least the following optimizations: Removal of the if in the innermost loop (line 14) Loop unrolling (line 13) Constant

Consider the following program:234 6 #include #define DATALEN 15 #define FILTERTAPS 5 double x [DATALEN]

Perform at least the following optimizations:

  • Removal of the if in the innermost loop (line 14)
  • Loop unrolling (line 13)
  • Constant propagation
  • Floating-point to fixed-point conversion
  • Avoidance of all accesses to arrays

Please provide the optimized version of the program after each of the transformations and do also check for consistent results!

234 6 #include #define DATALEN 15 #define FILTERTAPS 5 double x [DATALEN] = {128.0, 130.0, 180.0, 140.0, 120.0, 110.0, 107.0, 103.5, 102.0, 90.0, 84.0, 70.0, 30.0, 77.3, 95.7 const double h[FILTERTAPS]={0.125,-0.25, 0.5,-0.25, 0.125}; double y [DATALEN]; // result; int main(void) { int i,n; for (i=0; i return 0;

Step by Step Solution

3.41 Rating (157 Votes )

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 Systems Analysis And Design 12th Questions!