If-Then-Else Statements in a Loop
6.8.5
Linear Assembly Resource Allocation
Example 6–49. Linear Assembly for Full If-Then-Else Code
.global _if_then
_if_then: .cproc
.reg
MVK
ZERO
LOOP:
.trip 32
AND
[cond]
MVK
CMPEQ
LDH
[if]
ADD
[!if]
SUB
SHL
[cntr]
ADD
[cntr]
B
.return
.endproc
6-90
Now that the graph is split and you know the minimum iteration interval, you
can allocate functional units and registers to the instructions. You must ensure
that no resource is used more than twice.
Example 6–49 shows the linear assembly with the functional units and regis-
ters that are used in the inner loop.
a, cword, mask, theta
cond, if, ai, sum, cntr
32,cntr
sum
.S2X
cword,mask,cond ; cond = codeword & mask
.S2
1,cond
.L2
theta,cond,if
.D1
*a++,ai
.L1
sum,ai,sum
.D1
sum,ai,sum
.S1
mask,1,mask
.L2
–1,cntr,cntr
.S1
LOOP
sum
; cntr = 32
; sum = 0
; !(!(cond))
; (theta == !(!(cond)))
; a[i]
; sum += a[i]
; sum –= a[i]
; mask = mask << 1;
; decrement counter
; for LOOP
Need help?
Do you have a question about the TMS320C6000 and is the answer not in the manual?
Questions and answers