aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/powerpc/vsx-builtin-3.c
blob: 7aeba6cb563ad33174228129b6ff3ebe889ad487 (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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
/* { dg-require-effective-target powerpc_vsx_ok } */
/* { dg-options "-O2 -mcpu=power7" } */
/* { dg-final { scan-assembler "xxsel" } } */
/* { dg-final { scan-assembler "vperm" } } */
/* { dg-final { scan-assembler "xvrdpi" } } */
/* { dg-final { scan-assembler "xvrdpic" } } */
/* { dg-final { scan-assembler "xvrdpim" } } */
/* { dg-final { scan-assembler "xvrdpip" } } */
/* { dg-final { scan-assembler "xvrdpiz" } } */
/* { dg-final { scan-assembler "xvrspi" } } */
/* { dg-final { scan-assembler "xvrspic" } } */
/* { dg-final { scan-assembler "xvrspim" } } */
/* { dg-final { scan-assembler "xvrspip" } } */
/* { dg-final { scan-assembler "xvrspiz" } } */
/* { dg-final { scan-assembler "xsrdpi" } } */
/* { dg-final { scan-assembler "xsrdpic" } } */
/* { dg-final { scan-assembler "xsrdpim\|frim" } } */
/* { dg-final { scan-assembler "xsrdpip\|frip" } } */
/* { dg-final { scan-assembler "xsrdpiz\|friz" } } */
/* { dg-final { scan-assembler "xsmaxdp" } } */
/* { dg-final { scan-assembler "xsmindp" } } */
/* { dg-final { scan-assembler "xxland" } } */
/* { dg-final { scan-assembler "xxlandc" } } */
/* { dg-final { scan-assembler "xxlnor" } } */
/* { dg-final { scan-assembler "xxlor" } } */
/* { dg-final { scan-assembler "xxlxor" } } */
/* { dg-final { scan-assembler "xvcmpeqdp" } } */
/* { dg-final { scan-assembler "xvcmpgtdp" } } */
/* { dg-final { scan-assembler "xvcmpgedp" } } */
/* { dg-final { scan-assembler "xvcmpeqsp" } } */
/* { dg-final { scan-assembler "xvcmpgtsp" } } */
/* { dg-final { scan-assembler "xvcmpgesp" } } */
/* { dg-final { scan-assembler "xxsldwi" } } */
/* { dg-final { scan-assembler-not "call" } } */

extern __vector int si[][4];
extern __vector short ss[][4];
extern __vector signed char sc[][4];
extern __vector float f[][4];
extern __vector unsigned int ui[][4];
extern __vector unsigned short us[][4];
extern __vector unsigned char uc[][4];
extern __vector __bool int bi[][4];
extern __vector __bool short bs[][4];
extern __vector __bool char bc[][4];
extern __vector __pixel p[][4];
#ifdef __VSX__
extern __vector double d[][4];
extern __vector long sl[][4];
extern __vector unsigned long ul[][4];
extern __vector __bool long bl[][4];
#endif

int do_sel(void)
{
  int i = 0;

  si[i][0] = __builtin_vsx_xxsel_4si (si[i][1], si[i][2], si[i][3]); i++;
  ss[i][0] = __builtin_vsx_xxsel_8hi (ss[i][1], ss[i][2], ss[i][3]); i++;
  sc[i][0] = __builtin_vsx_xxsel_16qi (sc[i][1], sc[i][2], sc[i][3]); i++;
  f[i][0] = __builtin_vsx_xxsel_4sf (f[i][1], f[i][2], f[i][3]); i++;
  d[i][0] = __builtin_vsx_xxsel_2df (d[i][1], d[i][2], d[i][3]); i++;

  si[i][0] = __builtin_vsx_xxsel (si[i][1], si[i][2], bi[i][3]); i++;
  ss[i][0] = __builtin_vsx_xxsel (ss[i][1], ss[i][2], bs[i][3]); i++;
  sc[i][0] = __builtin_vsx_xxsel (sc[i][1], sc[i][2], bc[i][3]); i++;
  f[i][0] = __builtin_vsx_xxsel (f[i][1], f[i][2], bi[i][3]); i++;
  d[i][0] = __builtin_vsx_xxsel (d[i][1], d[i][2], bl[i][3]); i++;

  si[i][0] = __builtin_vsx_xxsel (si[i][1], si[i][2], ui[i][3]); i++;
  ss[i][0] = __builtin_vsx_xxsel (ss[i][1], ss[i][2], us[i][3]); i++;
  sc[i][0] = __builtin_vsx_xxsel (sc[i][1], sc[i][2], uc[i][3]); i++;
  f[i][0] = __builtin_vsx_xxsel (f[i][1], f[i][2], ui[i][3]); i++;
  d[i][0] = __builtin_vsx_xxsel (d[i][1], d[i][2], ul[i][3]); i++;

  return i;
}

int do_perm(void)
{
  int i = 0;

  si[i][0] = __builtin_vsx_vperm_4si (si[i][1], si[i][2], uc[i][3]); i++;
  ss[i][0] = __builtin_vsx_vperm_8hi (ss[i][1], ss[i][2], uc[i][3]); i++;
  sc[i][0] = __builtin_vsx_vperm_16qi (sc[i][1], sc[i][2], uc[i][3]); i++;
  f[i][0] = __builtin_vsx_vperm_4sf (f[i][1], f[i][2], uc[i][3]); i++;
  d[i][0] = __builtin_vsx_vperm_2df (d[i][1], d[i][2], uc[i][3]); i++;

  si[i][0] = __builtin_vsx_vperm (si[i][1], si[i][2], uc[i][3]); i++;
  ss[i][0] = __builtin_vsx_vperm (ss[i][1], ss[i][2], uc[i][3]); i++;
  sc[i][0] = __builtin_vsx_vperm (sc[i][1], sc[i][2], uc[i][3]); i++;
  f[i][0] = __builtin_vsx_vperm (f[i][1], f[i][2], uc[i][3]); i++;
  d[i][0] = __builtin_vsx_vperm (d[i][1], d[i][2], uc[i][3]); i++;

  return i;
}

int do_xxperm (void)
{
  int i = 0;

  d[i][0] = __builtin_vsx_xxpermdi_2df (d[i][1], d[i][2], 0); i++;
  d[i][0] = __builtin_vsx_xxpermdi (d[i][1], d[i][2], 1); i++;
  return i;
}

double x, y;
void do_concat (void)
{
  d[0][0] = __builtin_vsx_concat_2df (x, y);
}

void do_set (void)
{
  d[0][0] = __builtin_vsx_set_2df (d[0][1], x, 0);
  d[1][0] = __builtin_vsx_set_2df (d[1][1], y, 1);
}

extern double z[][4];

int do_math (void)
{
  int i = 0;

  d[i][0] = __builtin_vsx_xvrdpi  (d[i][1]); i++;
  d[i][0] = __builtin_vsx_xvrdpic (d[i][1]); i++;
  d[i][0] = __builtin_vsx_xvrdpim (d[i][1]); i++;
  d[i][0] = __builtin_vsx_xvrdpip (d[i][1]); i++;
  d[i][0] = __builtin_vsx_xvrdpiz (d[i][1]); i++;

  f[i][0] = __builtin_vsx_xvrspi  (f[i][1]); i++;
  f[i][0] = __builtin_vsx_xvrspic (f[i][1]); i++;
  f[i][0] = __builtin_vsx_xvrspim (f[i][1]); i++;
  f[i][0] = __builtin_vsx_xvrspip (f[i][1]); i++;
  f[i][0] = __builtin_vsx_xvrspiz (f[i][1]); i++;

  z[i][0] = __builtin_vsx_xsrdpi  (z[i][1]); i++;
  z[i][0] = __builtin_vsx_xsrdpic (z[i][1]); i++;
  z[i][0] = __builtin_vsx_xsrdpim (z[i][1]); i++;
  z[i][0] = __builtin_vsx_xsrdpip (z[i][1]); i++;
  z[i][0] = __builtin_vsx_xsrdpiz (z[i][1]); i++;
  z[i][0] = __builtin_vsx_xsmaxdp (z[i][1], z[i][0]); i++;
  z[i][0] = __builtin_vsx_xsmindp (z[i][1], z[i][0]); i++;
  return i;
}

int do_cmp (void)
{
  int i = 0;

  d[i][0] = __builtin_vsx_xvcmpeqdp (d[i][1], d[i][2]); i++;
  d[i][0] = __builtin_vsx_xvcmpgtdp (d[i][1], d[i][2]); i++;
  d[i][0] = __builtin_vsx_xvcmpgedp (d[i][1], d[i][2]); i++;

  f[i][0] = __builtin_vsx_xvcmpeqsp (f[i][1], f[i][2]); i++;
  f[i][0] = __builtin_vsx_xvcmpgtsp (f[i][1], f[i][2]); i++;
  f[i][0] = __builtin_vsx_xvcmpgesp (f[i][1], f[i][2]); i++;
  return i;
}

int do_logical (void)
{
  int i = 0;

  si[i][0] = __builtin_vsx_xxland (si[i][1], si[i][2]); i++;
  si[i][0] = __builtin_vsx_xxlandc (si[i][1], si[i][2]); i++;
  si[i][0] = __builtin_vsx_xxlnor (si[i][1], si[i][2]); i++;
  si[i][0] = __builtin_vsx_xxlor (si[i][1], si[i][2]); i++;
  si[i][0] = __builtin_vsx_xxlxor (si[i][1], si[i][2]); i++;

  ss[i][0] = __builtin_vsx_xxland (ss[i][1], ss[i][2]); i++;
  ss[i][0] = __builtin_vsx_xxlandc (ss[i][1], ss[i][2]); i++;
  ss[i][0] = __builtin_vsx_xxlnor (ss[i][1], ss[i][2]); i++;
  ss[i][0] = __builtin_vsx_xxlor (ss[i][1], ss[i][2]); i++;
  ss[i][0] = __builtin_vsx_xxlxor (ss[i][1], ss[i][2]); i++;

  sc[i][0] = __builtin_vsx_xxland (sc[i][1], sc[i][2]); i++;
  sc[i][0] = __builtin_vsx_xxlandc (sc[i][1], sc[i][2]); i++;
  sc[i][0] = __builtin_vsx_xxlnor (sc[i][1], sc[i][2]); i++;
  sc[i][0] = __builtin_vsx_xxlor (sc[i][1], sc[i][2]); i++;
  sc[i][0] = __builtin_vsx_xxlxor (sc[i][1], sc[i][2]); i++;

  d[i][0] = __builtin_vsx_xxland (d[i][1], d[i][2]); i++;
  d[i][0] = __builtin_vsx_xxlandc (d[i][1], d[i][2]); i++;
  d[i][0] = __builtin_vsx_xxlnor (d[i][1], d[i][2]); i++;
  d[i][0] = __builtin_vsx_xxlor (d[i][1], d[i][2]); i++;
  d[i][0] = __builtin_vsx_xxlxor (d[i][1], d[i][2]); i++;

  f[i][0] = __builtin_vsx_xxland (f[i][1], f[i][2]); i++;
  f[i][0] = __builtin_vsx_xxlandc (f[i][1], f[i][2]); i++;
  f[i][0] = __builtin_vsx_xxlnor (f[i][1], f[i][2]); i++;
  f[i][0] = __builtin_vsx_xxlor (f[i][1], f[i][2]); i++;
  f[i][0] = __builtin_vsx_xxlxor (f[i][1], f[i][2]); i++;
  return i;
}

int do_xxsldwi (void)
{
  int i = 0;

  si[i][0] = __builtin_vsx_xxsldwi (si[i][1], si[i][2], 0); i++;
  ss[i][0] = __builtin_vsx_xxsldwi (ss[i][1], ss[i][2], 1); i++;
  sc[i][0] = __builtin_vsx_xxsldwi (sc[i][1], sc[i][2], 2); i++;
  ui[i][0] = __builtin_vsx_xxsldwi (ui[i][1], ui[i][2], 3); i++;
  us[i][0] = __builtin_vsx_xxsldwi (us[i][1], us[i][2], 0); i++;
  uc[i][0] = __builtin_vsx_xxsldwi (uc[i][1], uc[i][2], 1); i++;
  f[i][0] = __builtin_vsx_xxsldwi (f[i][1], f[i][2], 2); i++;
  d[i][0] = __builtin_vsx_xxsldwi (d[i][1], d[i][2], 3); i++;
  return i;
}