summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/vmx/gcc-bug-f.c
blob: fb61bb15a76eec789d627df939d8102684e26a37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/* { dg-do compile } */
#include <altivec.h>
typedef short Word16;
typedef int   Word32;
typedef int   Flag;

extern Flag Overflow;
extern Flag Carry;

extern vector  signed short table[8];
extern vector  signed short slope_cos[8];

void Lsf_lsp(
  vector  signed short lsfq[],   
  vector  signed short lspq[]    
)
{
  vector  signed short Q17_con = ((vector signed short){20861,20861,20861,20861,20861,20861,20861,20861});
  vector  unsigned char perm1 = ((vector  unsigned char){0, 8, 1, 9, 2, 10, 3, 
							    11, 4, 12, 5 ,13, 6, 14, 7, 15});
  vector  unsigned char PerIndex, tmpIndex;
  vector  signed short tmp0, tmp1, tmp2, tmp3;
  vector  signed short stmp0, stmp1, stmp2, stmp3;
  vector  signed short index0, index1, offset0, offset1;
  vector  signed short table0, table1, slope0, slope1;
  vector  unsigned short select;
  vector  signed int L_tmp0, L_tmp1, L_tmp2, L_tmp3;
 
   
  tmp0 = vec_madds(lsfq[0], Q17_con, (((vector signed short){0,0,0,0,0,0,0,0})) );
  tmp1 = vec_madds(lsfq[1], Q17_con, (((vector signed short){0,0,0,0,0,0,0,0})) );

   
  offset0 = vec_and(tmp0, (((vector signed short){0x00ff,0x00ff,0x00ff,0x00ff,0x00ff,0x00ff,0x00ff,0x00ff})) );
  offset1 = vec_and(tmp1, (((vector signed short){0x00ff,0x00ff,0x00ff,0x00ff,0x00ff,0x00ff,0x00ff,0x00ff})) );
  
   
  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})) );
  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})) );
  
   
   
  tmp0 = vec_sl(index0, (vector  unsigned short)((((vector signed short){1,1,1,1,1,1,1,1})) ));
  PerIndex = (vector  unsigned char)vec_packs(tmp0, vec_add(tmp0, (((vector signed short){1,1,1,1,1,1,1,1})) ));
  PerIndex = vec_perm(PerIndex, PerIndex, perm1);
  
    
  tmp0 = vec_perm(table[0], table[1], PerIndex);
  stmp0 = vec_perm(slope_cos[0], slope_cos[1], PerIndex);

  tmpIndex = vec_sub(PerIndex, (((vector unsigned char){32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32})) );
  tmp1 = vec_perm(table[2], table[3], tmpIndex);
  stmp1 = vec_perm(slope_cos[2], slope_cos[3], tmpIndex);

  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})) );
  tmp2 = vec_sel(tmp0, tmp1, select);
  stmp2 = vec_sel(stmp0, stmp1, select);

  tmpIndex = vec_sub(tmpIndex, (((vector unsigned char){32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32})) );
  tmp0 = vec_perm(table[4], table[5], tmpIndex);
  stmp0 = vec_perm(slope_cos[4], slope_cos[5], tmpIndex);
  
  tmpIndex = vec_sub(tmpIndex, (((vector unsigned char){32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32})) );
  tmp1 = vec_perm(table[6], table[7], tmpIndex);
  stmp1 = vec_perm(slope_cos[6], slope_cos[7], tmpIndex);

  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})) );
  tmp3 = vec_sel(tmp0, tmp1, select);
  stmp3 = vec_sel(stmp0, stmp1, select);
  
  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})) );
  table0 = vec_sel(tmp2, tmp3, select);
  slope0 = vec_sel(stmp2, stmp3, select);

  tmp0 = vec_sl(index1, (vector  unsigned short)((((vector signed short){1,1,1,1,1,1,1,1})) ));
  PerIndex = (vector  unsigned char)vec_packs(tmp0, vec_add(tmp0, (((vector signed short){1,1,1,1,1,1,1,1})) ));
  PerIndex = vec_perm(PerIndex, PerIndex, perm1);

   
  tmp0 = vec_perm(table[0], table[1], PerIndex);
  stmp0 = vec_perm(slope_cos[0], slope_cos[1], PerIndex);

  tmpIndex = vec_sub(PerIndex, (((vector unsigned char){32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32})) );
  tmp1 = vec_perm(table[2], table[3], tmpIndex);
  stmp1 = vec_perm(slope_cos[2], slope_cos[3], tmpIndex);

  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})) );
  tmp2 = vec_sel(tmp0, tmp1, select);
  stmp2 = vec_sel(stmp0, stmp1, select);

  tmpIndex = vec_sub(tmpIndex, (((vector unsigned char){32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32})) );
  tmp0 = vec_perm(table[4], table[5], tmpIndex);
  stmp0 = vec_perm(slope_cos[4], slope_cos[5], tmpIndex);
  
  tmpIndex = vec_sub(tmpIndex, (((vector unsigned char){32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32})) );
  tmp1 = vec_perm(table[6], table[7], tmpIndex);
  stmp1 = vec_perm(slope_cos[6], slope_cos[7], tmpIndex);

  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})) );
  tmp3 = vec_sel(tmp0, tmp1, select);
  stmp3 = vec_sel(stmp0, stmp1, select);
  
  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})) );
  table1 = vec_sel(tmp2, tmp3, select);
  slope1 = vec_sel(stmp2, stmp3, select);


   
  L_tmp0 = vec_sra(vec_mule(slope0, offset0), (((vector unsigned int){12,12,12,12})) );
  L_tmp1 = vec_sra(vec_mulo(slope0, offset0), (((vector unsigned int){12,12,12,12})) );
  L_tmp2 = vec_sra(vec_mule(slope1, offset1), (((vector unsigned int){12,12,12,12})) );
  L_tmp3 = vec_sra(vec_mulo(slope1, offset1), (((vector unsigned int){12,12,12,12})) );

  
  tmp0 = vec_packs(L_tmp0, L_tmp2);
  tmp1 = vec_packs(L_tmp1, L_tmp3);
  tmp2 = vec_mergeh(tmp0, tmp1);
  tmp3 = vec_mergel(tmp0, tmp1);
  
   
  lspq[0] = vec_adds(table0, tmp2);
  lspq[1] = vec_adds(table1, tmp3);

  return;
}