User`s manual

2-14 Optimizing DSP56300/DSP56600 Applications MOTOROLA
Data Operations
Using Less Straight-Forward Instructions
;determine partial 6th term
mpy -x1,y0,b
rnd b
move b,x1
;determine 5th term and add its contribution
mpy -#$5000,y1,b ;b = 0 - (swTemp4 x
;TERMS_MULTIPLIER)
add b,a
;determine 6th term and add its contribution
macr #$7000,x1,a ;swSqrtOut is contained in a
rts
In this example, the ADDR and MPYR instructions replace a few
instructions in the original code causing some reduction in total
cycle count:
sqroot
;determine 2nd term and add contribution
asr a #<$40,y1
sub y1,a #<$80,x1;a = L_Temp1
sub x1,a a1,x0 ;a = L_Temp1,x0 = swTemp
;determine 3rd term and add contribution
mpy -x0,x0,b ;b = swTemp ^ 2
addr a,b b1,x1 ;x1 = swTemp2, b = L_Temp0
;determine 4th term and add contribution
mpy -x0,x1,a#<$70,y1;a = swTemp x swTemp2
addr b,a a1,y0 ;y0 = swTemp3, a = L_Temp1
;determine partial 5th term
mpyr x0,y0,b#<$50,x0
;determine partial 6th term
mpyr -x1,y0,bb,x1 ;y1=swTemp4
;determine 5th term and add its contribution
mac -x0,x1,ab,x1 ;b = -(swTemp4 x
;TERMS_MULTIPLIER)
;determine 6th term and add its contribution
macr x1,y1,a ;swSqrtOut is contained in a
rts