Spaces:
Sleeping
Sleeping
Ticket Name: Linux/TDA2: assembly optimization | |
Query Text: | |
Part Number: TDA2 Other Parts Discussed in Thread: MATHLIB Tool/software: Linux is there any examples of assembly optimization in SDK? vlib_c66x_3_3_0_3 and vxlib_c66x_1_1_1_0 there examples are use Inline instruction! so i am thy to assembly optimization some fuction,but no sample to follow! | |
Responses: | |
Hi Shuai, Since you are looking at vxlib I assume you are interested in DSP optimization. If so please check this post by Jesse for a list of DSP optimization reference guides and trainings: e2e.ti.com/.../2371691 Regards, Yordan | |
Hi: Yordan this is a sample function , document have give out its Linear Assembly code. c code c code i just call it , Assembly code how to call , i put Assembly code in .asm file ? int dot(short a[], short b[]) { int sum0 = 0, sum1 = 0, sum, I; for (I = 0; I < 100/2; I+= 2) { sum0 += a[i] * b[i]; sum1 += a[i + 1] * b[i + 1]; } return sum0 + sum1; } Linear Assembly for Dot Product _dot: .cproc a, b .reg sum0, sum1, I .reg val1, val2, prod1, prod2 MVK 50,i ; I = 100/2 ZERO sum0 ; multiply result = 0 ZERO sum1 ; multiply result = 0 loop: .trip 50 LDW *a++,val1 ; load a[0-1] bank0 LDW *b++,val2 ; load b[0-1] bank2 MPY val1,val2,prod1 ; a[0] * b[0] MPYH val1,val2,prod2 ; a[1] * b[1] ADD prod1,sum0,sum0 ; sum0 += a[0] * b[0] ADD prod2,sum1,sum1 ; sum1 += a[1] * b[1] [I] ADD -1,i,i ; I-- [I] B loop ; if (!I) goto loop ADD sum0,sum1,A4 ; compute final result .return A4 .endproc BESTWISHES SHUAI | |
Hi Shuai, you can use separate .asm file for your assembly code or include it in .c file with: asm(" Some Assembly \n\t" " Some Assembly \n\t" ... " Some Assembly \n\t" ); but this option is better suited for small fragments of assembly code. You can check for example "<VSDK>/ti_components/algorithms/mathlib_c66x_3_1_0_0/" - there are quite a lot functions implemented in .asm files. Regards, Yordan | |