1 /* Compute the sum of the squares of a vector of signed shorts
2 
3  * Copyright 2004 Phil Karn, KA9Q
4  * May be used under the terms of the GNU Lesser General Public License (LGPL)
5  */
6 
7 #include <stdlib.h>
8 #include "fec.h"
9 
10 unsigned long long sumsq_port(signed short *,int);
11 
12 #ifdef __i386__
13 unsigned long long sumsq_mmx(signed short *,int);
14 unsigned long long sumsq_sse(signed short *,int);
15 unsigned long long sumsq_sse2(signed short *,int);
16 #endif
17 
18 #ifdef __VEC__
19 unsigned long long sumsq_av(signed short *,int);
20 #endif
21 
sumsq(signed short * in,int cnt)22 unsigned long long sumsq(signed short *in,int cnt){
23   switch(Cpu_mode){
24   case PORT:
25   default:
26     return sumsq_port(in,cnt);
27 #ifdef __i386__
28   case SSE:
29   case MMX:
30     return sumsq_mmx(in,cnt);
31   case SSE2:
32     return sumsq_sse2(in,cnt);
33 #endif
34 
35 #ifdef __VEC__
36   case ALTIVEC:
37     return sumsq_av(in,cnt);
38 #endif
39   }
40 }
41