Lesson 1: Loop Carry Path From Memory Pointers
2-10
At this point, the Loop Carried Dependency Bound is zero. By simply passing
more information to the compiler, we allowed it to improve a 10–cycle loop to
a 2–cycle loop.
Lesson 4 in this tutorial shows how the compiler retrieves this type of informa-
tion automatically by gaining full view of the entire program with program level
optimization switches.
A special option in the compiler, -mt, tells the compiler to ignore alias disambi-
guation problems like the one described in lesson_c. Try using this option to
rebuild the original lesson_c example and look at the results.
Rebuild lesson_c.c using the –mt option
1) From Project menu, choose Options.
The Build Options dialog window appears.
2) Select the Compiler tab.
3) In the Category box, select Advanced.
4) In the Aliasing drop-down box, select No Bad Alias Code.
The -mt option will appear in the options window.
5) Click OK to set the new options.
6) Select lesson_c.c by selecting it in the project environment, or double–
clicking on it in the Project View window.
7) From the Project menu, choose Build, or click on the Build icon.
If prompted, reload lesson_c.asm.
8) From the File menu, chooose Open and select lesson_c.asm.
You can now view lesson_c.asm in the main window. In the main window, you
see that the file header contains a description of the options that were used
to compile the file under Global File Parameters. The following line implies that
–mt was used:
;* Memory Aliases : Presume not aliases (optimistic)
9) Scroll down until you see the feedback embedded in the lesson_c.asm file.
You now see the following:
;* Loop Carried Dependency Bound(^) : 0
;* ii = 2 Schedule found with 5 iterations in parallel
This indicates that a 2–cycle loop was found. Lesson 2 will address information
about potential improvements to this loop.