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?