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