Lesson 1: Loop Carry Path From Memory Pointers
2-5
Compiler Optimization Tutorial
2.2
Lesson 1: Loop Carry Path From Memory Pointers
Open lesson_c.c
In the Project View window, right–click on lesson_c.c and select Open.
Example 2–2. lesson_c.c
void lesson_c(short *xptr, short *yptr, short *zptr, short *w_sum, int N) {
int i, w_vec1, w_vec2;
short w1,w2;
w1 = zptr[0];
w2 = zptr[1];
for (i = 0; i < N; i++){
w_vec1 = xptr[i] * w1;
w_vec2 = yptr[i] * w2;
w_sum[i] = ( w_vec2) >> 15;
}
}
Compile the project and analyze the feedback in lesson_c.asm
When you rebuilt the project in Getting Ready for Lesson 1, each file was com-
piled with –k –gp –mh –o3. Because option –k was used, a *.asm file for each
*.c file is included in the rebuilt project.
1) From, the File menu, choose File –> Open. From the Files of Type drop–
down menu, select *.asm.
2) Select lesson_c.asm and click Open.
Each .asm file contains software pipelining information. You can see the
results in Example 2–3, Feedback From lesson_c.asm: