; TMS320C54x assembly language code ; compute a polynomial y(x) = c0 + c1 x + c2 x^2 + c3 x^3 ; using Horner's form y(x) = c0 + x (c1 + x (c2 + x (c3))) ; ar2 contains address of array [c3 c2 c1 c0] ; poly uses temporary register t to store multiplicand x ; numbers are assumed to be in fixed-point format in [-1, 1) ; four iterations of execution of the poly instruction with ; the value of b being intially c3 << 16 ; 1. a = c3 + x * 0 = c3; b = c2 ; 2. a = c2 + x * c3; b = c1 ; 3. a = c1 + x * (c2 + x * c3); b = c0 ; 4. a = c0 + x (c1 + x * (c2 + x * c3)); b = c? ; Programmer: Brian L. Evans, UT Austin ld *ar2+,16,b ; b = c3 << 16 ld *ar3,t ; t = x (ar3 contains address of x) rptz a,#3 ; a = 0, repeat next instruction 4 times poly *ar2+ ; a = b + x * a || b = c(i-1) << 16 sth a,*ar4 ; store result (ar4 contains address of y)