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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
|
/* { dg-do compile } */
/* { dg-require-effective-target powerpc_vsx_ok } */
/* { dg-options "-O2 -mvsx -mcpu=power6" } */
/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power6" } } */
#include <altivec.h>
vector bool char
test_eq_char (vector bool char x, vector bool char y)
{
return vec_cmpeq (x, y);
}
vector bool short
test_eq_short (vector bool short x, vector bool short y)
{
return vec_cmpeq (x, y);
}
vector bool int
test_eq_int (vector bool int x, vector bool int y)
{
return vec_cmpeq (x, y);
}
vector double
test_shift_left_double (vector double x, vector double y)
{
return vec_sld (x, y, /* shift_by */ 10);
}
vector signed char
test_nabs_char (vector signed char x)
{
return vec_nabs (x);
}
vector short
test_nabs_short (vector short x)
{
return vec_nabs (x);
}
vector int
test_nabs_int (vector int x)
{
return vec_nabs (x);
}
vector float
test_nabs_float (vector float x)
{
return vec_nabs (x);
}
vector double
test_nabs_double (vector double x)
{
return vec_nabs (x);
}
vector signed char
test_sll_vsc_vsc_vsuc (vector signed char x, vector unsigned char y)
{
return vec_sll (x, y);
}
vector unsigned char
test_sll_vuc_vuc_vuc (vector unsigned char x, vector unsigned char y)
{
return vec_sll (x, y);
}
vector signed int
test_sll_vsi_vsi_vuc (vector signed int x, vector unsigned char y)
{
return vec_sll (x, y);
}
vector unsigned int
test_sll_vui_vui_vuc (vector unsigned int x, vector unsigned char y)
{
return vec_sll (x, y);
}
vector bool long long
test_sll_vbll_vbll_vuc (vector bool long long x,
vector unsigned char y)
{
return vec_sll (x, y);
}
vector bool long long
test_sll_vbll_vbll_vull (vector bool long long x,
vector unsigned long long y)
{
return vec_sll (x, y);
}
vector bool long long
test_sll_vbll_vbll_vus (vector bool long long x,
vector unsigned short y)
{
return vec_sll (x, y);
}
vector pixel
test_sll_vp_vp_vuc (vector pixel x, vector unsigned char y)
{
return vec_sll (x, y);
}
vector signed short int
test_sll_vssi_vssi_vuc (vector signed short x, vector unsigned char y)
{
return vec_sll (x, y);
}
vector unsigned short int
test_sll_vusi_vusi_vuc (vector unsigned short x, vector unsigned char y)
{
return vec_sll (x, y);
}
vector signed char
test_slo_vsc_vsc_vsc (vector signed char x, vector signed char y)
{
return vec_slo (x, y);
}
vector signed char
test_slo_vsc_vsc_vuc (vector signed char x, vector unsigned char y)
{
return vec_slo (x, y);
}
vector unsigned char
test_slo_vuc_vuc_vsc (vector unsigned char x, vector signed char y)
{
return vec_slo (x, y);
}
vector unsigned char
test_slo_vuc_vuc_vuc (vector unsigned char x, vector unsigned char y)
{
return vec_slo (x, y);
}
vector signed int
test_slo_vsi_vsi_vsc (vector signed int x, vector signed char y)
{
return vec_slo (x, y);
}
vector signed int
test_slo_vsi_vsi_vuc (vector signed int x, vector unsigned char y)
{
return vec_slo (x, y);
}
vector unsigned int
test_slo_vui_vui_vsc (vector unsigned int x, vector signed char y)
{
return vec_slo (x, y);
}
vector unsigned int
test_slo_vui_vui_vuc (vector unsigned int x, vector unsigned char y)
{
return vec_slo (x, y);
}
vector signed long long
test_slo_vsll_slo_vsll_vsc (vector signed long long x, vector signed char y)
{
return vec_slo (x, y);
}
vector signed long long
test_slo_vsll_slo_vsll_vuc (vector signed long long x, vector unsigned char y)
{
return vec_slo (x, y);
}
vector unsigned long long
test_slo_vull_slo_vull_vsc (vector unsigned long long x, vector signed char y)
{
return vec_slo (x, y);
}
vector unsigned long long
test_slo_vull_slo_vull_vuc (vector unsigned long long x,
vector unsigned char y)
{
return vec_slo (x, y);
}
vector pixel
test_slo_vp_vp_vsc (vector pixel int x, vector signed char y)
{
return vec_slo (x, y);
}
vector pixel
test_slo_vp_vp_vuc (vector pixel int x, vector unsigned char y)
{
return vec_slo (x, y);
}
vector signed short int
test_slo_vssi_vssi_vsc (vector signed short int x, vector signed char y)
{
return vec_slo (x, y);
}
vector signed short int
test_slo_vssi_vssi_vuc (vector signed short int x, vector unsigned char y)
{
return vec_slo (x, y);
}
vector unsigned short int
test_slo_vusi_vusi_vsc (vector unsigned short int x, vector signed char y)
{
return vec_slo (x, y);
}
vector unsigned short int
test_slo_vusi_vusi_vuc (vector unsigned short int x, vector unsigned char y)
{
return vec_slo (x, y);
}
vector float
test_slo_vf_vf_vsc (vector float x, vector signed char y)
{
return vec_slo (x, y);
}
vector float
test_slo_vf_vf_vuc (vector float x, vector unsigned char y)
{
return vec_slo (x, y);
}
vector signed char
test_vsc_sldw_vsc_vsc (vector signed char x, vector signed char y)
{
return vec_sldw (x, y, 1);
}
vector unsigned char
test_vuc_sldw_vuc_vuc (vector unsigned char x, vector unsigned char y)
{
return vec_sldw (x, y, 3);
}
vector signed short int
test_vssi_sldw_vssi_vssi (vector signed short int x,
vector signed short int y)
{
return vec_sldw (x, y, 1);
}
vector unsigned short int
test_vusi_sldw_vusi_vusi (vector unsigned short int x,
vector unsigned short int y)
{
return vec_sldw (x, y, 3);
}
vector signed int
test_vsi_sldw_vsi_vsi (vector signed int x, vector signed int y)
{
return vec_sldw (x, y, 1);
}
vector unsigned int
test_vui_sldw_vui_vui (vector unsigned int x, vector unsigned int y)
{
return vec_sldw (x, y, 3);
}
vector signed long long
test_vsl_sldw_vsl_vsl (vector signed long long x, vector signed long long y)
{
return vec_sldw (x, y, 1);
}
vector unsigned long long
test_vul_sldw_vul_vul (vector unsigned long long x,
vector unsigned long long y)
{
return vec_sldw (x, y, 3);
}
vector int
test_cmpb_float (vector float x, vector float y)
{
return vec_cmpb (x, y);
}
/* Expected test results:
test_eq_char 1 vcmpequb inst
test_eq_short 1 vcmpequh inst
test_eq_int 1 vcmpequw inst
test_shift_left_double 1 vsldoi inst
test_nabs_char 1 vspltisw, 1 vsububm, 1 vminsb
test_nabs_short 1 vspltisw, 1 vsubuhm, 1 vminsh
test_nabs_int 1 vspltisw, 1 vsubuwm, 1 vminsw
test_nabs_float 1 xvnabssp
test_nabs_double 1 xvnabsdp
test_vsll_slo_vsll_vsc 1 vslo
test_vsll_slo_vsll_vuc 1 vslo
test_vull_slo_vsll_vsc 1 vslo
test_vull_slo_vsll_vuc 1 vslo
test_vsc_mulo_vsc_vsc 1 xxsldwi
test_vuc_mulo_vuc_vuc 1 xxsldwi
test_vssi_mulo_vssi_vssi 1 xxsldwi
test_vusi_mulo_vusi_vusi 1 xxsldwi
test_vsi_mulo_vsi_vsi 1 xxsldwi
test_vui_mulo_vui_vui 1 xxsldwi
test_vsl_mulo_vsl_vsl 1 xxsldwi
test_vul_mulo_vul_vul 1 xxsldwi
test_cmpb_float 1 vcmpbfp */
/* { dg-final { scan-assembler-times "vcmpequb" 1 } } */
/* { dg-final { scan-assembler-times "vcmpequh" 1 } } */
/* { dg-final { scan-assembler-times "vcmpequw" 1 } } */
/* { dg-final { scan-assembler-times "vsldoi" 1 } } */
/* { dg-final { scan-assembler-times "vsububm" 1 } } */
/* { dg-final { scan-assembler-times "vsubuhm" 1 } } */
/* { dg-final { scan-assembler-times "vsubuwm" 1 } } */
/* { dg-final { scan-assembler-times "vminsb" 1 } } */
/* { dg-final { scan-assembler-times "vminsh" 1 } } */
/* { dg-final { scan-assembler-times "vminsw" 1 } } */
/* { dg-final { scan-assembler-times "vspltisw" 3 } } */
/* { dg-final { scan-assembler-times "xvnabssp" 1 } } */
/* { dg-final { scan-assembler-times "xvnabsdp" 1 } } */
/* { dg-final { scan-assembler-times "vslo" 20 } } */
/* { dg-final { scan-assembler-times "xxsldwi" 8 } } */
/* { dg-final { scan-assembler-times "vcmpbfp" 1 } } */
|