Linear Assembly For Full Live-Too-Long Code - Texas Instruments TMS320C6000 Programmer's Manual

Hide thumbs Also See for TMS320C6000:
Table of Contents

Advertisement

Example 6–58. Linear Assembly for Full Live-Too-Long Code
.global _live_long
_live_long:
.cproc
.reg
ai, bi, sum0, sum1, sum
.reg
a0p, a_0, a_1, a_2, a_3, b_0, b0p, b_1, b_2, b_3, cntr
MVK
100,cntr
ZERO
sum0
ZERO
sum1
LOOP: .trip 100
LDH
.D1
LDH
.D2
MPY
.M1
SHR
.S1
MPY
.M1X
MV
.D1
ADD
.L1
ADD
.L1
MPY
.M2X
SHR
.S2
MPY
.M2X
MV
.D2
ADD
.L2
ADD
.L2
[cntr] SUB
.S2
[cntr] B
.S1
ADD
sum0,sum1,sum
.return sum
.endproc
a, b, c, d, e
*a++,ai
*b++,bi
ai,c,a_0
a_0,15,a_1
a_1,d,a_2
a_0,a0p
a_2,a0p,a_3
sum0,a_3,sum0
bi,c,b_0
b_0,15,b_1
b_1,e,b_2
b_0,b0p
b_2,b0p,b_3
sum1,b_3,sum1
cntr,1,cntr
LOOP
Optimizing Assembly Code via Linear Assembly
; cntr = 100
; sum0 = 0
; sum1 = 0
; load ai from memory
; load bi from memory
; a0 = ai * c
; a1 = a0 >> 15
; a2 = a1 * d
; save a0 across iterations
; a3 = a2 + a0
; sum0 += a3
; b0 = bi * ci
; b1 = b0 >> 15
; b2 = b1 * e
; save b0 across iterations
; b3 = b2 + b0
; sum1 += b3
; decrement loop counter
; branch to loop
; Add sumi and sumi+1 for ret value
Live-Too-Long Issues
6-107

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the TMS320C6000 and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Table of Contents