1 |
689 |
jeremybenn |
/* { dg-do compile } */
|
2 |
|
|
#include <altivec.h>
|
3 |
|
|
typedef short Word16;
|
4 |
|
|
typedef int Word32;
|
5 |
|
|
typedef int Flag;
|
6 |
|
|
|
7 |
|
|
extern Flag Overflow;
|
8 |
|
|
extern Flag Carry;
|
9 |
|
|
|
10 |
|
|
extern vector signed short table[8];
|
11 |
|
|
extern vector signed short slope_cos[8];
|
12 |
|
|
|
13 |
|
|
void Lsf_lsp(
|
14 |
|
|
vector signed short lsfq[],
|
15 |
|
|
vector signed short lspq[]
|
16 |
|
|
)
|
17 |
|
|
{
|
18 |
|
|
vector signed short Q17_con = ((vector signed short){20861,20861,20861,20861,20861,20861,20861,20861});
|
19 |
|
|
vector unsigned char perm1 = ((vector unsigned char){0, 8, 1, 9, 2, 10, 3,
|
20 |
|
|
11, 4, 12, 5 ,13, 6, 14, 7, 15});
|
21 |
|
|
vector unsigned char PerIndex, tmpIndex;
|
22 |
|
|
vector signed short tmp0, tmp1, tmp2, tmp3;
|
23 |
|
|
vector signed short stmp0, stmp1, stmp2, stmp3;
|
24 |
|
|
vector signed short index0, index1, offset0, offset1;
|
25 |
|
|
vector signed short table0, table1, slope0, slope1;
|
26 |
|
|
vector unsigned short select;
|
27 |
|
|
vector signed int L_tmp0, L_tmp1, L_tmp2, L_tmp3;
|
28 |
|
|
|
29 |
|
|
|
30 |
|
|
tmp0 = vec_madds(lsfq[0], Q17_con, (((vector signed short){0,0,0,0,0,0,0,0})) );
|
31 |
|
|
tmp1 = vec_madds(lsfq[1], Q17_con, (((vector signed short){0,0,0,0,0,0,0,0})) );
|
32 |
|
|
|
33 |
|
|
|
34 |
|
|
offset0 = vec_and(tmp0, (((vector signed short){0x00ff,0x00ff,0x00ff,0x00ff,0x00ff,0x00ff,0x00ff,0x00ff})) );
|
35 |
|
|
offset1 = vec_and(tmp1, (((vector signed short){0x00ff,0x00ff,0x00ff,0x00ff,0x00ff,0x00ff,0x00ff,0x00ff})) );
|
36 |
|
|
|
37 |
|
|
|
38 |
|
|
index0 = vec_min(vec_sra(tmp0, (((vector unsigned short){8,8,8,8,8,8,8,8})) ), (((vector signed short){63,63,63,63,63,63,63,63})) );
|
39 |
|
|
index1 = vec_min(vec_sra(tmp1, (((vector unsigned short){8,8,8,8,8,8,8,8})) ), (((vector signed short){63,63,63,63,63,63,63,63})) );
|
40 |
|
|
|
41 |
|
|
|
42 |
|
|
|
43 |
|
|
tmp0 = vec_sl(index0, (vector unsigned short)((((vector signed short){1,1,1,1,1,1,1,1})) ));
|
44 |
|
|
PerIndex = (vector unsigned char)vec_packs(tmp0, vec_add(tmp0, (((vector signed short){1,1,1,1,1,1,1,1})) ));
|
45 |
|
|
PerIndex = vec_perm(PerIndex, PerIndex, perm1);
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
tmp0 = vec_perm(table[0], table[1], PerIndex);
|
49 |
|
|
stmp0 = vec_perm(slope_cos[0], slope_cos[1], PerIndex);
|
50 |
|
|
|
51 |
|
|
tmpIndex = vec_sub(PerIndex, (((vector unsigned char){32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32})) );
|
52 |
|
|
tmp1 = vec_perm(table[2], table[3], tmpIndex);
|
53 |
|
|
stmp1 = vec_perm(slope_cos[2], slope_cos[3], tmpIndex);
|
54 |
|
|
|
55 |
|
|
select = (vector unsigned short)vec_cmpgt(PerIndex, (((vector unsigned char){31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31})) );
|
56 |
|
|
tmp2 = vec_sel(tmp0, tmp1, select);
|
57 |
|
|
stmp2 = vec_sel(stmp0, stmp1, select);
|
58 |
|
|
|
59 |
|
|
tmpIndex = vec_sub(tmpIndex, (((vector unsigned char){32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32})) );
|
60 |
|
|
tmp0 = vec_perm(table[4], table[5], tmpIndex);
|
61 |
|
|
stmp0 = vec_perm(slope_cos[4], slope_cos[5], tmpIndex);
|
62 |
|
|
|
63 |
|
|
tmpIndex = vec_sub(tmpIndex, (((vector unsigned char){32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32})) );
|
64 |
|
|
tmp1 = vec_perm(table[6], table[7], tmpIndex);
|
65 |
|
|
stmp1 = vec_perm(slope_cos[6], slope_cos[7], tmpIndex);
|
66 |
|
|
|
67 |
|
|
select = (vector unsigned short)vec_cmpgt(PerIndex, (((vector unsigned char){95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95})) );
|
68 |
|
|
tmp3 = vec_sel(tmp0, tmp1, select);
|
69 |
|
|
stmp3 = vec_sel(stmp0, stmp1, select);
|
70 |
|
|
|
71 |
|
|
select = (vector unsigned short)vec_cmpgt(PerIndex, (((vector unsigned char){63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63})) );
|
72 |
|
|
table0 = vec_sel(tmp2, tmp3, select);
|
73 |
|
|
slope0 = vec_sel(stmp2, stmp3, select);
|
74 |
|
|
|
75 |
|
|
tmp0 = vec_sl(index1, (vector unsigned short)((((vector signed short){1,1,1,1,1,1,1,1})) ));
|
76 |
|
|
PerIndex = (vector unsigned char)vec_packs(tmp0, vec_add(tmp0, (((vector signed short){1,1,1,1,1,1,1,1})) ));
|
77 |
|
|
PerIndex = vec_perm(PerIndex, PerIndex, perm1);
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
tmp0 = vec_perm(table[0], table[1], PerIndex);
|
81 |
|
|
stmp0 = vec_perm(slope_cos[0], slope_cos[1], PerIndex);
|
82 |
|
|
|
83 |
|
|
tmpIndex = vec_sub(PerIndex, (((vector unsigned char){32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32})) );
|
84 |
|
|
tmp1 = vec_perm(table[2], table[3], tmpIndex);
|
85 |
|
|
stmp1 = vec_perm(slope_cos[2], slope_cos[3], tmpIndex);
|
86 |
|
|
|
87 |
|
|
select = (vector unsigned short)vec_cmpgt(PerIndex, (((vector unsigned char){31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31})) );
|
88 |
|
|
tmp2 = vec_sel(tmp0, tmp1, select);
|
89 |
|
|
stmp2 = vec_sel(stmp0, stmp1, select);
|
90 |
|
|
|
91 |
|
|
tmpIndex = vec_sub(tmpIndex, (((vector unsigned char){32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32})) );
|
92 |
|
|
tmp0 = vec_perm(table[4], table[5], tmpIndex);
|
93 |
|
|
stmp0 = vec_perm(slope_cos[4], slope_cos[5], tmpIndex);
|
94 |
|
|
|
95 |
|
|
tmpIndex = vec_sub(tmpIndex, (((vector unsigned char){32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32})) );
|
96 |
|
|
tmp1 = vec_perm(table[6], table[7], tmpIndex);
|
97 |
|
|
stmp1 = vec_perm(slope_cos[6], slope_cos[7], tmpIndex);
|
98 |
|
|
|
99 |
|
|
select = (vector unsigned short)vec_cmpgt(PerIndex, (((vector unsigned char){95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95})) );
|
100 |
|
|
tmp3 = vec_sel(tmp0, tmp1, select);
|
101 |
|
|
stmp3 = vec_sel(stmp0, stmp1, select);
|
102 |
|
|
|
103 |
|
|
select = (vector unsigned short)vec_cmpgt(PerIndex, (((vector unsigned char){63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63})) );
|
104 |
|
|
table1 = vec_sel(tmp2, tmp3, select);
|
105 |
|
|
slope1 = vec_sel(stmp2, stmp3, select);
|
106 |
|
|
|
107 |
|
|
|
108 |
|
|
|
109 |
|
|
L_tmp0 = vec_sra(vec_mule(slope0, offset0), (((vector unsigned int){12,12,12,12})) );
|
110 |
|
|
L_tmp1 = vec_sra(vec_mulo(slope0, offset0), (((vector unsigned int){12,12,12,12})) );
|
111 |
|
|
L_tmp2 = vec_sra(vec_mule(slope1, offset1), (((vector unsigned int){12,12,12,12})) );
|
112 |
|
|
L_tmp3 = vec_sra(vec_mulo(slope1, offset1), (((vector unsigned int){12,12,12,12})) );
|
113 |
|
|
|
114 |
|
|
|
115 |
|
|
tmp0 = vec_packs(L_tmp0, L_tmp2);
|
116 |
|
|
tmp1 = vec_packs(L_tmp1, L_tmp3);
|
117 |
|
|
tmp2 = vec_mergeh(tmp0, tmp1);
|
118 |
|
|
tmp3 = vec_mergel(tmp0, tmp1);
|
119 |
|
|
|
120 |
|
|
|
121 |
|
|
lspq[0] = vec_adds(table0, tmp2);
|
122 |
|
|
lspq[1] = vec_adds(table1, tmp3);
|
123 |
|
|
|
124 |
|
|
return;
|
125 |
|
|
}
|