Translating C Code To Linear Assembly - Texas Instruments TMS320C6000 Programmer's Manual

Hide thumbs Also See for TMS320C6000:
Table of Contents

Advertisement

6.9.2

Translating C Code to Linear Assembly

Example 6–53. Linear Assembly for Unrolled If-Then-Else Inner Loop
AND
[condi] MVK
CMPEQ
LDH
[ifi]
ADD
[!ifi] SUB
SHL
AND
[condi+1]MVK
CMPEQ
LDH
[ifi+1] ADD
[!ifi+1] SUB
SHL
[cntr]
ADD
[cntr]
B
Example 6–53 shows the unrolled inner loop with 16 instructions and the
possibility of achieving a loop with a minimum iteration interval of 3.
codeword,maski,condi
1,condi
theta,condi,ifi
*aptr++,ai
sumi,ai,sumi
sumi,ai,sumi
maski,1,maski+1
codeword,maski+1,condi+1 ; condi+1 = codeword & maski+1
1,condi+1
theta,condi+1,ifi+1
*aptr++,ai+1
sumi+1,ai+1,sumi+1
sumi+1,ai+1,sumi+1
maski+1,1,maski
–1,cntr,cntr
LOOP
Optimizing Assembly Code via Linear Assembly
; condi = codeword & maski
; !(!(condi))
; (theta == !(!(condi)))
; a[i]
; sum += a[i]
; sum –= a[i]
; maski+1 = maski << 1;
; !(!(condi+1))
; (theta == !(!(condi+1)))
; a[i+!]
; sum += a[i+1]
; sum –= a[i+1]
; maski = maski+1 << 1;
; decrement counter
; for LOOP
Loop Unrolling
6-95

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

Table of Contents