Outer Loop Conditionally Executed With Inner Loop
6-141
Optimizing Assembly Code via Linear Assembly
Example 6–76. Linear Assembly for FIR With Outer Loop Conditionally Executed
With Inner Loop
LDW
*h++[2],h01
; h[i+0] & h[i+1]
LDW
*h_1++[2],h23
; h[i+2] & h[i+3]
LDW
*h++[2],h45
; h[i+4] & h[i+5]
LDW
.*h_1++[2],h67
; h[i+6] & h[i+7]
LDW
*x++[2],x01
; x[j+i+0] & x[j+i+1]
LDW
*x_1++[2],x23
; x[j+i+2] & x[j+i+3]
LDW
*x++[2],x45
; x[j+i+4] & x[j+i+5]
LDW
*x_1++[2],x67
; x[j+i+6] & x[j+i+7]
LDH
*x,x8
; x[j+i+8]
[sctr]
SUB
sctr,1,sctr
; dec store lp cntr
[!sctr]
SHR
sum07,15,y0
; (sum0 >> 15)
[!sctr]
SHR
sum17,15,y1
; (sum1 >> 15)
[!sctr]
STH
y0,*y++[2]
; y[j] = (sum0 >> 15)
[!sctr]
STH
y1,*y_1++[2]
; y[j+1] = (sum1 >> 15)
MV
x01,x01b
; move to other reg file
MPYLH
h01,x01b,p10
; p10 = h[i+0]*x[j+i+1]
[sctr]
ADD
p10,sum17,p10
; sum1(p10) = p10 + sum1
MPYHL
h01,x23,p11
; p11 = h[i+1]*x[j+i+2]
ADD
p11,p10,sum11
; sum1 += p11
MPYLH
h23,x23,p12
; p12 = h[i+2]*x[j+i+3]
ADD
p12,sum11,sum12
; sum1 += p12
MPYHL
h23,x45,p13
; p13 = h[i+3]*x[j+i+4]
ADD
p13,sum12,sum13
; sum1 += p13
MPYLH
h45,x45,p14
; p14 = h[i+4]*x[j+i+5]
ADD
p14,sum13,sum14
; sum1 += p14
MPYHL
h45,x67,p15
; p15 = h[i+5]*x[j+i+6]
ADD
p15,sum14,sum15
; sum1 += p15
MPYLH
h67,x67,p16
; p16 = h[i+6]*x[j+i+7]
ADD
p16,sum15,sum16
; sum1 += p16
MPYHL
h67,x8,p17
; p17 = h[i+7]*x[j+i+8]
ADD
p17,sum16,sum17
; sum1 += p17
MPY
h01,x01,p00
; p00 = h[i+0]*x[j+i+0]
[sctr]
ADD
p00,sum07,p00
; sum0(p00) = p00 + sum0
MPYH
h01,x01,p01
; p01 = h[i+1]*x[j+i+1]
ADD
p01,p00,sum01
; sum0 += p01