This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to convert this code into Linear Assembly?



I use a function named as AccOuDist(), the definition of it is as follows:

UINT64 AccOuDist(int *a, int * b ,int cnt)

{

        int temp = 0;

        int i = 0;

       UINT64 sum = 0;

       for(i = 0; i < cnt ;i ++)

     {

           temp = a[i]-b[i];

         sum += _mpy32ll(temp,temp) >> 9;

     }

}

It's frequently used in my project, so I tried to convert it into linear assembly format. I named a .sa file with these code in it:

.global _accoudist

_accoudist: .cproc a,b,cnt

zero sum

looP: ldh  *a++, a_4

          ldh  *b++,b_4

         sub   a_4,b_4,val0

         mpy32ll val0,val0,prod

        add   sum,prod, sum

 [cnt] sub  cnt,1,cnt

[cnt] B loop

.return sum

.endproc

The above code can't be built, can somebody tell me why?