Redundant Load Elimination
6-116
Example 6–64. Final Assembly Code for FIR Filter With Redundant Load Elimination
MVK
.S1
50,A2
; set up outer loop counter
MVK
.S1
80,A3
; used to rst x ptr outer loop
||
MVK
.S2
82,B6
; used to rst h ptr outer loop
OUTLOOP:
LDH
.D1
*A4++[2],A0
; x0 = x[j]
||
ADD
.L2X
A4,2,B5
; set up pointer to x[j+1]
||
ADD
.D2
B4,2,B4
; set up pointer to h[1]
||
ADD
.L1X
B4,0,A5
; set up pointer to h[0]
||
MVK
.S2
16,B2
; set up inner loop counter
||[A2]
SUB
.S1
A2,1,A2
; decrement outer loop counter
LDH
.D1
*A5++[2],A1
; h0 = h[i]
||
LDH
.D2
*B5++[2],B1
; x1 = x[j+i+1]
||
ZERO
.L1
A9
; zero out sum0
||
ZERO
.L2
B9
; zero out sum1
LDH
.D2
*B4++[2],B0
; h1 = h[i+1]
||
LDH
.D1
*A4++[2],A0
; x0 = x[j+i+2]
LDH
.D1
*A5++[2],A1
;* h0 = h[i]
||
LDH
.D2
*B5++[2],B1
;* x1 = x[j+i+1]
[B2]
SUB
.S2
B2,1,B2
; decrement inner loop counter
||
LDH
.D2
*B4++[2],B0
;* h1 = h[i+1]
||
LDH
.D1
*A4++[2],A0
;* x0 = x[j+i+2]
[B2]
B
.S2
LOOP
; branch to inner loop
||
LDH
.D1
*A5++[2],A1
;** h0 = h[i]
||
LDH
.D2
*B5++[2],B1
;** x1 = x[j+i+1]
MPY
.M1
A0,A1,A7
; x0 * h0
||[B2]
SUB
.S2
B2,1,B2
;* decrement inner loop counter
||
LDH
.D2
*B4++[2],B0
;** h1 = h[i+1]
||
LDH
.D1
*A4++[2],A0
;** x0 = x[j+i+2]
MPY
.M2
B1,B0,B7
; x1 * h1
||
MPY
.M1X
B1,A1,A8
; x1 * h0
||[B2]
B
.S2
LOOP
;* branch to inner loop
||
LDH
.D1
*A5++[2],A1
;*** h0 = h[i]
||
LDH
.D2
*B5++[2],B1
;*** x1 = x[j+i+1]
MPY
.M2X
A0,B0,B8
; x0 * h1
||
MPY
.M1
A0,A1,A7
;* x0 * h0
||[B2]
SUB
.S2
B2,1,B2
;** decrement inner loop counter
||
LDH
.D2
*B4++[2],B0
;*** h1 = h[i+1]
||
LDH
.D1
*A4++[2],A0
;*** x0 = x[j+i+2]
1
2
3
4
5
6
7
8
9