Loop Unrolling Transformation: Difference between revisions

Jump to navigation Jump to search
Line 53: Line 53:


emmtrix Studio implements loop unrolling using #pragma directives or via the GUI. Unrolling will reduce the iteration count and increase the body of the loop, processing statements from multiple iteration steps in a single iteration.
emmtrix Studio implements loop unrolling using #pragma directives or via the GUI. Unrolling will reduce the iteration count and increase the body of the loop, processing statements from multiple iteration steps in a single iteration.
By default, the transformation performs partial loop unrolling and creates two loops. The first loop is the partial unrolled loop and the second loop for the remaining iterations.
emmtrix Studio tries to calculate the trip count that enables two optimizations:
# Full unrolling is applied if the unroll factor >= trip count.
# The loop for the remaining iterations is removed if trip count is dividable by the unroll factor.


===Example===
===Example===
In the following example, partial loop unrolling is applied with an unroll factor of 3.


Please note that a condition of <code>i < n - 2</code> would be incorrect in case of an overflow e.g. for <code>n = INT_MIN</code>.
{| class="wikitable"
{| class="wikitable"
|-
|-
Bots, Bureaucrats, Interface administrators, smwadministrator, smwcurator, smweditor, Administrators
2,557

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu