Loop Carry Paths
6-78
6.7.2
Translating C Code to Linear Assembly (Inner Loop)
Example 6–42 shows the ’C6000 instructions that execute the inner loop of the
IIR filter C code. In this example:
-
xptr is not postincremented after loading xi+1, because xi of the next
iteration is actually xi+1 of the current iteration. Thus, the pointer points to
the same address when loading both xi+1 for one iteration and xi for the
next iteration.
-
yptr is also not postincremented after storing yi+1, because yi of the next
iteration is yi+1 for the current iteration.
Example 6–42. Linear Assembly for IIR Inner Loop
LDH
*xptr++,xi
; xi+1
MPY
c1,xi,p0
; c1 * xi
LDH
*xptr,xi+1
; xi+1
MPY
c2,xi+1,p1
; c2 * xi+1
ADD
p0,p1,s0
; c1 * xi + c2 * xi+1
LDH
*yptr++,yi
; yi
MPY
c3,yi,p2
; c3 * yi
ADD
s0,p2,s1
; c1 * xi + c2 * xi+1 + c3 * yi
SHR
s1,15,yi+1
; yi+1
STH
yi+1,*yptr
; store yi+1
[cntr]SUB
cntr,1,cntr
; decrement loop counter
[cntr]B
LOOP
; branch to loop