Assembly Optimizer Options and Directives
6-8
The above loop kernel has no memory bank conflicts in the case where ptr_a
and ptr_b point to the same bank. This means that you have to know how your
data is aligned in C code before using the .mptr directive in your linear assem-
bly code. The ’C6000 compiler supports pragmas in C/C++ that align your data
to a particular boundary (DATA_ALIGN, for example). Use these pragmas to
align your data properly, so that the .mptr directives work in your linear assem-
bly code.
6.2.5
The .trip Directive
The .trip directive is analogous to the _must_ITERATE pragma for C/C++. The
.trip directive looks like:
label: .trip minimum_value[, maximum value[, factor]]
For example if you wanted to say that the linear assembly loop will execute
some minimum number of times, use the .trip directive with just the first para-
meter. This example tells the assembly optimizer that the loop will iterate at
least ten times.
loop: .trip 10
You can also tell the assembly optimizer that your loop will execute exactly
some number of times by setting the minimum_value and maximum_value pa-
rameters to exactly the same value. This next example tells the assembly opti-
mizer that the loop will iterate exactly 20 times.
loop: .trip 20, 20
The maximum_value parameter can also tell the assembly optimizer that the
loop will iterate between some range. The factor parameter allows the assem-
bly optimizer to know that the loop will execute a factor of value times. For ex-
ample, the next loop will iterate either 8, 16, 24, 32, 40, or 48 times when this
particular linear assembly loop is called.
loop: .trip 8, 48, 8
The maximum_value and factor parameters are especially useful when your
loop needs to be interruptible. Refer to section 7.4.4,
Getting the Most Perfor-
mance Out of Interruptible Code.