blob: 59d9d2d3fd6031500e848e61bcef358ce69a5cdd [file] [log] [blame]
Chris Lattnerdd173942010-04-14 03:54:58 +00001/*===---- altivec.h - Standard header for type generic math ---------------===*\
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21\*===----------------------------------------------------------------------===*/
22
23#ifndef __ALTIVEC_H
24#define __ALTIVEC_H
25
26#ifndef __ALTIVEC__
27#error "AltiVec support not enabled"
28#endif
29
30/* constants for mapping CR6 bits to predicate result. */
31
32#define __CR6_EQ 0
33#define __CR6_EQ_REV 1
34#define __CR6_LT 2
35#define __CR6_LT_REV 3
36
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000037#define __ATTRS_o_ai __attribute__((__overloadable__, __always_inline__))
38
39static vector signed char __ATTRS_o_ai
40vec_perm(vector signed char a, vector signed char b, vector unsigned char c);
41
42static vector unsigned char __ATTRS_o_ai
Anton Yartsev3ed32722010-09-18 00:39:16 +000043vec_perm(vector unsigned char a,
44 vector unsigned char b,
45 vector unsigned char c);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000046
Anton Yartsevf54dbfd2010-08-19 03:00:09 +000047static vector bool char __ATTRS_o_ai
48vec_perm(vector bool char a, vector bool char b, vector unsigned char c);
49
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000050static vector short __ATTRS_o_ai
51vec_perm(vector short a, vector short b, vector unsigned char c);
52
53static vector unsigned short __ATTRS_o_ai
Anton Yartsev3ed32722010-09-18 00:39:16 +000054vec_perm(vector unsigned short a,
55 vector unsigned short b,
56 vector unsigned char c);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000057
Anton Yartsevf54dbfd2010-08-19 03:00:09 +000058static vector bool short __ATTRS_o_ai
59vec_perm(vector bool short a, vector bool short b, vector unsigned char c);
60
61static vector pixel __ATTRS_o_ai
62vec_perm(vector pixel a, vector pixel b, vector unsigned char c);
63
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000064static vector int __ATTRS_o_ai
65vec_perm(vector int a, vector int b, vector unsigned char c);
66
67static vector unsigned int __ATTRS_o_ai
68vec_perm(vector unsigned int a, vector unsigned int b, vector unsigned char c);
69
Anton Yartsevf54dbfd2010-08-19 03:00:09 +000070static vector bool int __ATTRS_o_ai
71vec_perm(vector bool int a, vector bool int b, vector unsigned char c);
72
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000073static vector float __ATTRS_o_ai
74vec_perm(vector float a, vector float b, vector unsigned char c);
Chris Lattnerdd173942010-04-14 03:54:58 +000075
76/* vec_abs */
77
Chris Lattnerdd173942010-04-14 03:54:58 +000078#define __builtin_altivec_abs_v16qi vec_abs
79#define __builtin_altivec_abs_v8hi vec_abs
80#define __builtin_altivec_abs_v4si vec_abs
81
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000082static vector signed char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +000083vec_abs(vector signed char a)
84{
85 return __builtin_altivec_vmaxsb(a, -a);
86}
87
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000088static vector signed short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +000089vec_abs(vector signed short a)
90{
91 return __builtin_altivec_vmaxsh(a, -a);
92}
93
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000094static vector signed int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +000095vec_abs(vector signed int a)
96{
97 return __builtin_altivec_vmaxsw(a, -a);
98}
99
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000100static vector float __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000101vec_abs(vector float a)
102{
Anton Yartsev3ed32722010-09-18 00:39:16 +0000103 vector unsigned int res = (vector unsigned int)a
104 & (vector unsigned int)(0x7FFFFFFF);
Chris Lattnerab866b42010-04-14 20:35:39 +0000105 return (vector float)res;
Chris Lattnerdd173942010-04-14 03:54:58 +0000106}
107
108/* vec_abss */
109
Chris Lattnerdd173942010-04-14 03:54:58 +0000110#define __builtin_altivec_abss_v16qi vec_abss
111#define __builtin_altivec_abss_v8hi vec_abss
112#define __builtin_altivec_abss_v4si vec_abss
113
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000114static vector signed char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000115vec_abss(vector signed char a)
116{
Anton Yartsev3ed32722010-09-18 00:39:16 +0000117 return __builtin_altivec_vmaxsb
118 (a, __builtin_altivec_vsubsbs((vector signed char)(0), a));
Chris Lattnerdd173942010-04-14 03:54:58 +0000119}
120
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000121static vector signed short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000122vec_abss(vector signed short a)
123{
Anton Yartsev3ed32722010-09-18 00:39:16 +0000124 return __builtin_altivec_vmaxsh
125 (a, __builtin_altivec_vsubshs((vector signed short)(0), a));
Chris Lattnerdd173942010-04-14 03:54:58 +0000126}
127
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000128static vector signed int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000129vec_abss(vector signed int a)
130{
Anton Yartsev3ed32722010-09-18 00:39:16 +0000131 return __builtin_altivec_vmaxsw
132 (a, __builtin_altivec_vsubsws((vector signed int)(0), a));
Chris Lattnerdd173942010-04-14 03:54:58 +0000133}
134
135/* vec_add */
136
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000137static vector signed char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000138vec_add(vector signed char a, vector signed char b)
139{
140 return a + b;
141}
142
Anton Yartsev05e35552010-08-16 16:22:12 +0000143static vector signed char __ATTRS_o_ai
144vec_add(vector bool char a, vector signed char b)
145{
146 return (vector signed char)a + b;
147}
148
149static vector signed char __ATTRS_o_ai
150vec_add(vector signed char a, vector bool char b)
151{
152 return a + (vector signed char)b;
153}
154
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000155static vector unsigned char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000156vec_add(vector unsigned char a, vector unsigned char b)
157{
158 return a + b;
159}
160
Anton Yartsev05e35552010-08-16 16:22:12 +0000161static vector unsigned char __ATTRS_o_ai
162vec_add(vector bool char a, vector unsigned char b)
163{
164 return (vector unsigned char)a + b;
165}
166
167static vector unsigned char __ATTRS_o_ai
168vec_add(vector unsigned char a, vector bool char b)
169{
170 return a + (vector unsigned char)b;
171}
172
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000173static vector short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000174vec_add(vector short a, vector short b)
175{
176 return a + b;
177}
178
Anton Yartsev05e35552010-08-16 16:22:12 +0000179static vector short __ATTRS_o_ai
180vec_add(vector bool short a, vector short b)
181{
182 return (vector short)a + b;
183}
184
185static vector short __ATTRS_o_ai
186vec_add(vector short a, vector bool short b)
187{
188 return a + (vector short)b;
189}
190
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000191static vector unsigned short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000192vec_add(vector unsigned short a, vector unsigned short b)
193{
194 return a + b;
195}
196
Anton Yartsev05e35552010-08-16 16:22:12 +0000197static vector unsigned short __ATTRS_o_ai
198vec_add(vector bool short a, vector unsigned short b)
199{
200 return (vector unsigned short)a + b;
201}
202
203static vector unsigned short __ATTRS_o_ai
204vec_add(vector unsigned short a, vector bool short b)
205{
206 return a + (vector unsigned short)b;
207}
208
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000209static vector int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000210vec_add(vector int a, vector int b)
211{
212 return a + b;
213}
214
Anton Yartsev05e35552010-08-16 16:22:12 +0000215static vector int __ATTRS_o_ai
216vec_add(vector bool int a, vector int b)
217{
218 return (vector int)a + b;
219}
220
221static vector int __ATTRS_o_ai
222vec_add(vector int a, vector bool int b)
223{
224 return a + (vector int)b;
225}
226
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000227static vector unsigned int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000228vec_add(vector unsigned int a, vector unsigned int b)
229{
230 return a + b;
231}
232
Anton Yartsev05e35552010-08-16 16:22:12 +0000233static vector unsigned int __ATTRS_o_ai
234vec_add(vector bool int a, vector unsigned int b)
235{
236 return (vector unsigned int)a + b;
237}
238
239static vector unsigned int __ATTRS_o_ai
240vec_add(vector unsigned int a, vector bool int b)
241{
242 return a + (vector unsigned int)b;
243}
244
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000245static vector float __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000246vec_add(vector float a, vector float b)
247{
248 return a + b;
249}
250
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000251/* vec_vaddubm */
252
253#define __builtin_altivec_vaddubm vec_vaddubm
254
255static vector signed char __ATTRS_o_ai
256vec_vaddubm(vector signed char a, vector signed char b)
257{
258 return a + b;
259}
260
Anton Yartsev05e35552010-08-16 16:22:12 +0000261static vector signed char __ATTRS_o_ai
262vec_vaddubm(vector bool char a, vector signed char b)
263{
264 return (vector signed char)a + b;
265}
266
267static vector signed char __ATTRS_o_ai
268vec_vaddubm(vector signed char a, vector bool char b)
269{
270 return a + (vector signed char)b;
271}
272
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000273static vector unsigned char __ATTRS_o_ai
274vec_vaddubm(vector unsigned char a, vector unsigned char b)
275{
276 return a + b;
277}
278
Anton Yartsev05e35552010-08-16 16:22:12 +0000279static vector unsigned char __ATTRS_o_ai
280vec_vaddubm(vector bool char a, vector unsigned char b)
281{
282 return (vector unsigned char)a + b;
283}
284
285static vector unsigned char __ATTRS_o_ai
286vec_vaddubm(vector unsigned char a, vector bool char b)
287{
288 return a + (vector unsigned char)b;
289}
290
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000291/* vec_vadduhm */
292
293#define __builtin_altivec_vadduhm vec_vadduhm
294
295static vector short __ATTRS_o_ai
296vec_vadduhm(vector short a, vector short b)
297{
298 return a + b;
299}
300
Anton Yartsev05e35552010-08-16 16:22:12 +0000301static vector short __ATTRS_o_ai
302vec_vadduhm(vector bool short a, vector short b)
303{
304 return (vector short)a + b;
305}
306
307static vector short __ATTRS_o_ai
308vec_vadduhm(vector short a, vector bool short b)
309{
310 return a + (vector short)b;
311}
312
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000313static vector unsigned short __ATTRS_o_ai
314vec_vadduhm(vector unsigned short a, vector unsigned short b)
315{
316 return a + b;
317}
318
Anton Yartsev05e35552010-08-16 16:22:12 +0000319static vector unsigned short __ATTRS_o_ai
320vec_vadduhm(vector bool short a, vector unsigned short b)
321{
322 return (vector unsigned short)a + b;
323}
324
325static vector unsigned short __ATTRS_o_ai
326vec_vadduhm(vector unsigned short a, vector bool short b)
327{
328 return a + (vector unsigned short)b;
329}
330
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000331/* vec_vadduwm */
332
333#define __builtin_altivec_vadduwm vec_vadduwm
334
335static vector int __ATTRS_o_ai
336vec_vadduwm(vector int a, vector int b)
337{
338 return a + b;
339}
340
Anton Yartsev05e35552010-08-16 16:22:12 +0000341static vector int __ATTRS_o_ai
342vec_vadduwm(vector bool int a, vector int b)
343{
344 return (vector int)a + b;
345}
346
347static vector int __ATTRS_o_ai
348vec_vadduwm(vector int a, vector bool int b)
349{
350 return a + (vector int)b;
351}
352
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000353static vector unsigned int __ATTRS_o_ai
354vec_vadduwm(vector unsigned int a, vector unsigned int b)
355{
356 return a + b;
357}
358
Anton Yartsev05e35552010-08-16 16:22:12 +0000359static vector unsigned int __ATTRS_o_ai
360vec_vadduwm(vector bool int a, vector unsigned int b)
361{
362 return (vector unsigned int)a + b;
363}
364
365static vector unsigned int __ATTRS_o_ai
366vec_vadduwm(vector unsigned int a, vector bool int b)
367{
368 return a + (vector unsigned int)b;
369}
370
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000371/* vec_vaddfp */
372
373#define __builtin_altivec_vaddfp vec_vaddfp
374
375static vector float __attribute__((__always_inline__))
376vec_vaddfp(vector float a, vector float b)
377{
378 return a + b;
379}
380
Chris Lattnerdd173942010-04-14 03:54:58 +0000381/* vec_addc */
382
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000383static vector unsigned int __attribute__((__always_inline__))
384vec_addc(vector unsigned int a, vector unsigned int b)
385{
386 return __builtin_altivec_vaddcuw(a, b);
387}
388
389/* vec_vaddcuw */
390
391static vector unsigned int __attribute__((__always_inline__))
392vec_vaddcuw(vector unsigned int a, vector unsigned int b)
393{
394 return __builtin_altivec_vaddcuw(a, b);
395}
Chris Lattnerdd173942010-04-14 03:54:58 +0000396
397/* vec_adds */
398
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000399static vector signed char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000400vec_adds(vector signed char a, vector signed char b)
401{
402 return __builtin_altivec_vaddsbs(a, b);
403}
404
Anton Yartsev05e35552010-08-16 16:22:12 +0000405static vector signed char __ATTRS_o_ai
406vec_adds(vector bool char a, vector signed char b)
407{
408 return __builtin_altivec_vaddsbs((vector signed char)a, b);
409}
410
411static vector signed char __ATTRS_o_ai
412vec_adds(vector signed char a, vector bool char b)
413{
414 return __builtin_altivec_vaddsbs(a, (vector signed char)b);
415}
416
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000417static vector unsigned char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000418vec_adds(vector unsigned char a, vector unsigned char b)
419{
420 return __builtin_altivec_vaddubs(a, b);
421}
422
Anton Yartsev05e35552010-08-16 16:22:12 +0000423static vector unsigned char __ATTRS_o_ai
424vec_adds(vector bool char a, vector unsigned char b)
425{
426 return __builtin_altivec_vaddubs((vector unsigned char)a, b);
427}
428
429static vector unsigned char __ATTRS_o_ai
430vec_adds(vector unsigned char a, vector bool char b)
431{
432 return __builtin_altivec_vaddubs(a, (vector unsigned char)b);
433}
434
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000435static vector short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000436vec_adds(vector short a, vector short b)
437{
438 return __builtin_altivec_vaddshs(a, b);
439}
440
Anton Yartsev05e35552010-08-16 16:22:12 +0000441static vector short __ATTRS_o_ai
442vec_adds(vector bool short a, vector short b)
443{
444 return __builtin_altivec_vaddshs((vector short)a, b);
445}
446
447static vector short __ATTRS_o_ai
448vec_adds(vector short a, vector bool short b)
449{
450 return __builtin_altivec_vaddshs(a, (vector short)b);
451}
452
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000453static vector unsigned short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000454vec_adds(vector unsigned short a, vector unsigned short b)
455{
456 return __builtin_altivec_vadduhs(a, b);
457}
458
Anton Yartsev05e35552010-08-16 16:22:12 +0000459static vector unsigned short __ATTRS_o_ai
460vec_adds(vector bool short a, vector unsigned short b)
461{
462 return __builtin_altivec_vadduhs((vector unsigned short)a, b);
463}
464
465static vector unsigned short __ATTRS_o_ai
466vec_adds(vector unsigned short a, vector bool short b)
467{
468 return __builtin_altivec_vadduhs(a, (vector unsigned short)b);
469}
470
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000471static vector int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000472vec_adds(vector int a, vector int b)
473{
474 return __builtin_altivec_vaddsws(a, b);
475}
476
Anton Yartsev05e35552010-08-16 16:22:12 +0000477static vector int __ATTRS_o_ai
478vec_adds(vector bool int a, vector int b)
479{
480 return __builtin_altivec_vaddsws((vector int)a, b);
481}
482
483static vector int __ATTRS_o_ai
484vec_adds(vector int a, vector bool int b)
485{
486 return __builtin_altivec_vaddsws(a, (vector int)b);
487}
488
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000489static vector unsigned int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000490vec_adds(vector unsigned int a, vector unsigned int b)
491{
492 return __builtin_altivec_vadduws(a, b);
493}
494
Anton Yartsev05e35552010-08-16 16:22:12 +0000495static vector unsigned int __ATTRS_o_ai
496vec_adds(vector bool int a, vector unsigned int b)
497{
498 return __builtin_altivec_vadduws((vector unsigned int)a, b);
499}
500
501static vector unsigned int __ATTRS_o_ai
502vec_adds(vector unsigned int a, vector bool int b)
503{
504 return __builtin_altivec_vadduws(a, (vector unsigned int)b);
505}
506
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000507/* vec_vaddsbs */
Chris Lattnerdd173942010-04-14 03:54:58 +0000508
Anton Yartsev05e35552010-08-16 16:22:12 +0000509static vector signed char __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000510vec_vaddsbs(vector signed char a, vector signed char b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000511{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000512 return __builtin_altivec_vaddsbs(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +0000513}
514
Anton Yartsev05e35552010-08-16 16:22:12 +0000515static vector signed char __ATTRS_o_ai
516vec_vaddsbs(vector bool char a, vector signed char b)
517{
518 return __builtin_altivec_vaddsbs((vector signed char)a, b);
519}
520
521static vector signed char __ATTRS_o_ai
522vec_vaddsbs(vector signed char a, vector bool char b)
523{
524 return __builtin_altivec_vaddsbs(a, (vector signed char)b);
525}
526
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000527/* vec_vaddubs */
528
Anton Yartsev05e35552010-08-16 16:22:12 +0000529static vector unsigned char __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000530vec_vaddubs(vector unsigned char a, vector unsigned char b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000531{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000532 return __builtin_altivec_vaddubs(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +0000533}
534
Anton Yartsev05e35552010-08-16 16:22:12 +0000535static vector unsigned char __ATTRS_o_ai
536vec_vaddubs(vector bool char a, vector unsigned char b)
537{
538 return __builtin_altivec_vaddubs((vector unsigned char)a, b);
539}
540
541static vector unsigned char __ATTRS_o_ai
542vec_vaddubs(vector unsigned char a, vector bool char b)
543{
544 return __builtin_altivec_vaddubs(a, (vector unsigned char)b);
545}
546
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000547/* vec_vaddshs */
548
Anton Yartsev05e35552010-08-16 16:22:12 +0000549static vector short __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000550vec_vaddshs(vector short a, vector short b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000551{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000552 return __builtin_altivec_vaddshs(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +0000553}
554
Anton Yartsev05e35552010-08-16 16:22:12 +0000555static vector short __ATTRS_o_ai
556vec_vaddshs(vector bool short a, vector short b)
557{
558 return __builtin_altivec_vaddshs((vector short)a, b);
559}
560
561static vector short __ATTRS_o_ai
562vec_vaddshs(vector short a, vector bool short b)
563{
564 return __builtin_altivec_vaddshs(a, (vector short)b);
565}
566
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000567/* vec_vadduhs */
568
Anton Yartsev05e35552010-08-16 16:22:12 +0000569static vector unsigned short __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000570vec_vadduhs(vector unsigned short a, vector unsigned short b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000571{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000572 return __builtin_altivec_vadduhs(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +0000573}
574
Anton Yartsev05e35552010-08-16 16:22:12 +0000575static vector unsigned short __ATTRS_o_ai
576vec_vadduhs(vector bool short a, vector unsigned short b)
577{
578 return __builtin_altivec_vadduhs((vector unsigned short)a, b);
579}
580
581static vector unsigned short __ATTRS_o_ai
582vec_vadduhs(vector unsigned short a, vector bool short b)
583{
584 return __builtin_altivec_vadduhs(a, (vector unsigned short)b);
585}
586
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000587/* vec_vaddsws */
588
Anton Yartsev05e35552010-08-16 16:22:12 +0000589static vector int __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000590vec_vaddsws(vector int a, vector int b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000591{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000592 return __builtin_altivec_vaddsws(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +0000593}
594
Anton Yartsev05e35552010-08-16 16:22:12 +0000595static vector int __ATTRS_o_ai
596vec_vaddsws(vector bool int a, vector int b)
597{
598 return __builtin_altivec_vaddsws((vector int)a, b);
599}
600
601static vector int __ATTRS_o_ai
602vec_vaddsws(vector int a, vector bool int b)
603{
604 return __builtin_altivec_vaddsws(a, (vector int)b);
605}
606
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000607/* vec_vadduws */
608
Anton Yartsev05e35552010-08-16 16:22:12 +0000609static vector unsigned int __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000610vec_vadduws(vector unsigned int a, vector unsigned int b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000611{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000612 return __builtin_altivec_vadduws(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +0000613}
614
Anton Yartsev05e35552010-08-16 16:22:12 +0000615static vector unsigned int __ATTRS_o_ai
616vec_vadduws(vector bool int a, vector unsigned int b)
617{
618 return __builtin_altivec_vadduws((vector unsigned int)a, b);
619}
620
621static vector unsigned int __ATTRS_o_ai
622vec_vadduws(vector unsigned int a, vector bool int b)
623{
624 return __builtin_altivec_vadduws(a, (vector unsigned int)b);
625}
626
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000627/* vec_and */
628
629#define __builtin_altivec_vand vec_and
630
631static vector signed char __ATTRS_o_ai
632vec_and(vector signed char a, vector signed char b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000633{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000634 return a & b;
Chris Lattnerdd173942010-04-14 03:54:58 +0000635}
636
Anton Yartsev05e35552010-08-16 16:22:12 +0000637static vector signed char __ATTRS_o_ai
638vec_and(vector bool char a, vector signed char b)
639{
640 return (vector signed char)a & b;
641}
642
643static vector signed char __ATTRS_o_ai
644vec_and(vector signed char a, vector bool char b)
645{
646 return a & (vector signed char)b;
647}
648
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000649static vector unsigned char __ATTRS_o_ai
650vec_and(vector unsigned char a, vector unsigned char b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000651{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000652 return a & b;
Chris Lattnerdd173942010-04-14 03:54:58 +0000653}
654
Anton Yartsev05e35552010-08-16 16:22:12 +0000655static vector unsigned char __ATTRS_o_ai
656vec_and(vector bool char a, vector unsigned char b)
657{
658 return (vector unsigned char)a & b;
659}
660
661static vector unsigned char __ATTRS_o_ai
662vec_and(vector unsigned char a, vector bool char b)
663{
664 return a & (vector unsigned char)b;
665}
666
667static vector bool char __ATTRS_o_ai
668vec_and(vector bool char a, vector bool char b)
669{
670 return a & b;
671}
672
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000673static vector short __ATTRS_o_ai
674vec_and(vector short a, vector short b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000675{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000676 return a & b;
Chris Lattnerdd173942010-04-14 03:54:58 +0000677}
678
Anton Yartsev05e35552010-08-16 16:22:12 +0000679static vector short __ATTRS_o_ai
680vec_and(vector bool short a, vector short b)
681{
682 return (vector short)a & b;
683}
684
685static vector short __ATTRS_o_ai
686vec_and(vector short a, vector bool short b)
687{
688 return a & (vector short)b;
689}
690
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000691static vector unsigned short __ATTRS_o_ai
692vec_and(vector unsigned short a, vector unsigned short b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000693{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000694 return a & b;
Chris Lattnerdd173942010-04-14 03:54:58 +0000695}
696
Anton Yartsev05e35552010-08-16 16:22:12 +0000697static vector unsigned short __ATTRS_o_ai
698vec_and(vector bool short a, vector unsigned short b)
699{
700 return (vector unsigned short)a & b;
701}
702
703static vector unsigned short __ATTRS_o_ai
704vec_and(vector unsigned short a, vector bool short b)
705{
706 return a & (vector unsigned short)b;
707}
708
709static vector bool short __ATTRS_o_ai
710vec_and(vector bool short a, vector bool short b)
711{
712 return a & b;
713}
714
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000715static vector int __ATTRS_o_ai
716vec_and(vector int a, vector int b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000717{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000718 return a & b;
Chris Lattnerdd173942010-04-14 03:54:58 +0000719}
720
Anton Yartsev05e35552010-08-16 16:22:12 +0000721static vector int __ATTRS_o_ai
722vec_and(vector bool int a, vector int b)
723{
724 return (vector int)a & b;
725}
726
727static vector int __ATTRS_o_ai
728vec_and(vector int a, vector bool int b)
729{
730 return a & (vector int)b;
731}
732
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000733static vector unsigned int __ATTRS_o_ai
734vec_and(vector unsigned int a, vector unsigned int b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000735{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000736 return a & b;
Chris Lattnerdd173942010-04-14 03:54:58 +0000737}
738
Anton Yartsev05e35552010-08-16 16:22:12 +0000739static vector unsigned int __ATTRS_o_ai
740vec_and(vector bool int a, vector unsigned int b)
741{
742 return (vector unsigned int)a & b;
743}
744
745static vector unsigned int __ATTRS_o_ai
746vec_and(vector unsigned int a, vector bool int b)
747{
748 return a & (vector unsigned int)b;
749}
750
751static vector bool int __ATTRS_o_ai
752vec_and(vector bool int a, vector bool int b)
753{
754 return a & b;
755}
756
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000757static vector float __ATTRS_o_ai
758vec_and(vector float a, vector float b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000759{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000760 vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b;
761 return (vector float)res;
762}
763
Anton Yartsev05e35552010-08-16 16:22:12 +0000764static vector float __ATTRS_o_ai
765vec_and(vector bool int a, vector float b)
766{
767 vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b;
768 return (vector float)res;
769}
770
771static vector float __ATTRS_o_ai
772vec_and(vector float a, vector bool int b)
773{
774 vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b;
775 return (vector float)res;
776}
777
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000778/* vec_vand */
779
780static vector signed char __ATTRS_o_ai
781vec_vand(vector signed char a, vector signed char b)
782{
783 return a & b;
784}
785
Anton Yartsev05e35552010-08-16 16:22:12 +0000786static vector signed char __ATTRS_o_ai
787vec_vand(vector bool char a, vector signed char b)
788{
789 return (vector signed char)a & b;
790}
791
792static vector signed char __ATTRS_o_ai
793vec_vand(vector signed char a, vector bool char b)
794{
795 return a & (vector signed char)b;
796}
797
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000798static vector unsigned char __ATTRS_o_ai
799vec_vand(vector unsigned char a, vector unsigned char b)
800{
801 return a & b;
802}
803
Anton Yartsev05e35552010-08-16 16:22:12 +0000804static vector unsigned char __ATTRS_o_ai
805vec_vand(vector bool char a, vector unsigned char b)
806{
807 return (vector unsigned char)a & b;
808}
809
810static vector unsigned char __ATTRS_o_ai
811vec_vand(vector unsigned char a, vector bool char b)
812{
813 return a & (vector unsigned char)b;
814}
815
816static vector bool char __ATTRS_o_ai
817vec_vand(vector bool char a, vector bool char b)
818{
819 return a & b;
820}
821
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000822static vector short __ATTRS_o_ai
823vec_vand(vector short a, vector short b)
824{
825 return a & b;
826}
827
Anton Yartsev05e35552010-08-16 16:22:12 +0000828static vector short __ATTRS_o_ai
829vec_vand(vector bool short a, vector short b)
830{
831 return (vector short)a & b;
832}
833
834static vector short __ATTRS_o_ai
835vec_vand(vector short a, vector bool short b)
836{
837 return a & (vector short)b;
838}
839
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000840static vector unsigned short __ATTRS_o_ai
841vec_vand(vector unsigned short a, vector unsigned short b)
842{
843 return a & b;
844}
845
Anton Yartsev05e35552010-08-16 16:22:12 +0000846static vector unsigned short __ATTRS_o_ai
847vec_vand(vector bool short a, vector unsigned short b)
848{
849 return (vector unsigned short)a & b;
850}
851
852static vector unsigned short __ATTRS_o_ai
853vec_vand(vector unsigned short a, vector bool short b)
854{
855 return a & (vector unsigned short)b;
856}
857
858static vector bool short __ATTRS_o_ai
859vec_vand(vector bool short a, vector bool short b)
860{
861 return a & b;
862}
863
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000864static vector int __ATTRS_o_ai
865vec_vand(vector int a, vector int b)
866{
867 return a & b;
868}
869
Anton Yartsev05e35552010-08-16 16:22:12 +0000870static vector int __ATTRS_o_ai
871vec_vand(vector bool int a, vector int b)
872{
873 return (vector int)a & b;
874}
875
876static vector int __ATTRS_o_ai
877vec_vand(vector int a, vector bool int b)
878{
879 return a & (vector int)b;
880}
881
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000882static vector unsigned int __ATTRS_o_ai
883vec_vand(vector unsigned int a, vector unsigned int b)
884{
885 return a & b;
886}
887
Anton Yartsev05e35552010-08-16 16:22:12 +0000888static vector unsigned int __ATTRS_o_ai
889vec_vand(vector bool int a, vector unsigned int b)
890{
891 return (vector unsigned int)a & b;
892}
893
894static vector unsigned int __ATTRS_o_ai
895vec_vand(vector unsigned int a, vector bool int b)
896{
897 return a & (vector unsigned int)b;
898}
899
900static vector bool int __ATTRS_o_ai
901vec_vand(vector bool int a, vector bool int b)
902{
903 return a & b;
904}
905
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000906static vector float __ATTRS_o_ai
907vec_vand(vector float a, vector float b)
908{
909 vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b;
910 return (vector float)res;
911}
912
Anton Yartsev05e35552010-08-16 16:22:12 +0000913static vector float __ATTRS_o_ai
914vec_vand(vector bool int a, vector float b)
915{
916 vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b;
917 return (vector float)res;
918}
919
920static vector float __ATTRS_o_ai
921vec_vand(vector float a, vector bool int b)
922{
923 vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b;
924 return (vector float)res;
925}
926
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000927/* vec_andc */
928
929#define __builtin_altivec_vandc vec_andc
930
931static vector signed char __ATTRS_o_ai
932vec_andc(vector signed char a, vector signed char b)
933{
934 return a & ~b;
935}
936
Anton Yartsev05e35552010-08-16 16:22:12 +0000937static vector signed char __ATTRS_o_ai
938vec_andc(vector bool char a, vector signed char b)
939{
940 return (vector signed char)a & ~b;
941}
942
943static vector signed char __ATTRS_o_ai
944vec_andc(vector signed char a, vector bool char b)
945{
946 return a & ~(vector signed char)b;
947}
948
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000949static vector unsigned char __ATTRS_o_ai
950vec_andc(vector unsigned char a, vector unsigned char b)
951{
952 return a & ~b;
953}
954
Anton Yartsev05e35552010-08-16 16:22:12 +0000955static vector unsigned char __ATTRS_o_ai
956vec_andc(vector bool char a, vector unsigned char b)
957{
958 return (vector unsigned char)a & ~b;
959}
960
961static vector unsigned char __ATTRS_o_ai
962vec_andc(vector unsigned char a, vector bool char b)
963{
964 return a & ~(vector unsigned char)b;
965}
966
967static vector bool char __ATTRS_o_ai
968vec_andc(vector bool char a, vector bool char b)
969{
970 return a & ~b;
971}
972
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000973static vector short __ATTRS_o_ai
974vec_andc(vector short a, vector short b)
975{
976 return a & ~b;
977}
978
Anton Yartsev05e35552010-08-16 16:22:12 +0000979static vector short __ATTRS_o_ai
980vec_andc(vector bool short a, vector short b)
981{
982 return (vector short)a & ~b;
983}
984
985static vector short __ATTRS_o_ai
986vec_andc(vector short a, vector bool short b)
987{
988 return a & ~(vector short)b;
989}
990
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000991static vector unsigned short __ATTRS_o_ai
992vec_andc(vector unsigned short a, vector unsigned short b)
993{
994 return a & ~b;
995}
996
Anton Yartsev05e35552010-08-16 16:22:12 +0000997static vector unsigned short __ATTRS_o_ai
998vec_andc(vector bool short a, vector unsigned short b)
999{
1000 return (vector unsigned short)a & ~b;
1001}
1002
1003static vector unsigned short __ATTRS_o_ai
1004vec_andc(vector unsigned short a, vector bool short b)
1005{
1006 return a & ~(vector unsigned short)b;
1007}
1008
1009static vector bool short __ATTRS_o_ai
1010vec_andc(vector bool short a, vector bool short b)
1011{
1012 return a & ~b;
1013}
1014
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001015static vector int __ATTRS_o_ai
1016vec_andc(vector int a, vector int b)
1017{
1018 return a & ~b;
1019}
1020
Anton Yartsev05e35552010-08-16 16:22:12 +00001021static vector int __ATTRS_o_ai
1022vec_andc(vector bool int a, vector int b)
1023{
1024 return (vector int)a & ~b;
1025}
1026
1027static vector int __ATTRS_o_ai
1028vec_andc(vector int a, vector bool int b)
1029{
1030 return a & ~(vector int)b;
1031}
1032
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001033static vector unsigned int __ATTRS_o_ai
1034vec_andc(vector unsigned int a, vector unsigned int b)
1035{
1036 return a & ~b;
1037}
1038
Anton Yartsev05e35552010-08-16 16:22:12 +00001039static vector unsigned int __ATTRS_o_ai
1040vec_andc(vector bool int a, vector unsigned int b)
1041{
1042 return (vector unsigned int)a & ~b;
1043}
1044
1045static vector unsigned int __ATTRS_o_ai
1046vec_andc(vector unsigned int a, vector bool int b)
1047{
1048 return a & ~(vector unsigned int)b;
1049}
1050
1051static vector bool int __ATTRS_o_ai
1052vec_andc(vector bool int a, vector bool int b)
1053{
1054 return a & ~b;
1055}
1056
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001057static vector float __ATTRS_o_ai
1058vec_andc(vector float a, vector float b)
1059{
1060 vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b;
1061 return (vector float)res;
1062}
1063
Anton Yartsev05e35552010-08-16 16:22:12 +00001064static vector float __ATTRS_o_ai
1065vec_andc(vector bool int a, vector float b)
1066{
1067 vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b;
1068 return (vector float)res;
1069}
1070
1071static vector float __ATTRS_o_ai
1072vec_andc(vector float a, vector bool int b)
1073{
1074 vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b;
1075 return (vector float)res;
1076}
1077
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001078/* vec_vandc */
1079
1080static vector signed char __ATTRS_o_ai
1081vec_vandc(vector signed char a, vector signed char b)
1082{
1083 return a & ~b;
1084}
1085
Anton Yartsev05e35552010-08-16 16:22:12 +00001086static vector signed char __ATTRS_o_ai
1087vec_vandc(vector bool char a, vector signed char b)
1088{
1089 return (vector signed char)a & ~b;
1090}
1091
1092static vector signed char __ATTRS_o_ai
1093vec_vandc(vector signed char a, vector bool char b)
1094{
1095 return a & ~(vector signed char)b;
1096}
1097
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001098static vector unsigned char __ATTRS_o_ai
1099vec_vandc(vector unsigned char a, vector unsigned char b)
1100{
1101 return a & ~b;
1102}
1103
Anton Yartsev05e35552010-08-16 16:22:12 +00001104static vector unsigned char __ATTRS_o_ai
1105vec_vandc(vector bool char a, vector unsigned char b)
1106{
1107 return (vector unsigned char)a & ~b;
1108}
1109
1110static vector unsigned char __ATTRS_o_ai
1111vec_vandc(vector unsigned char a, vector bool char b)
1112{
1113 return a & ~(vector unsigned char)b;
1114}
1115
1116static vector bool char __ATTRS_o_ai
1117vec_vandc(vector bool char a, vector bool char b)
1118{
1119 return a & ~b;
1120}
1121
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001122static vector short __ATTRS_o_ai
1123vec_vandc(vector short a, vector short b)
1124{
1125 return a & ~b;
1126}
1127
Anton Yartsev05e35552010-08-16 16:22:12 +00001128static vector short __ATTRS_o_ai
1129vec_vandc(vector bool short a, vector short b)
1130{
1131 return (vector short)a & ~b;
1132}
1133
1134static vector short __ATTRS_o_ai
1135vec_vandc(vector short a, vector bool short b)
1136{
1137 return a & ~(vector short)b;
1138}
1139
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001140static vector unsigned short __ATTRS_o_ai
1141vec_vandc(vector unsigned short a, vector unsigned short b)
1142{
1143 return a & ~b;
1144}
1145
Anton Yartsev05e35552010-08-16 16:22:12 +00001146static vector unsigned short __ATTRS_o_ai
1147vec_vandc(vector bool short a, vector unsigned short b)
1148{
1149 return (vector unsigned short)a & ~b;
1150}
1151
1152static vector unsigned short __ATTRS_o_ai
1153vec_vandc(vector unsigned short a, vector bool short b)
1154{
1155 return a & ~(vector unsigned short)b;
1156}
1157
1158static vector bool short __ATTRS_o_ai
1159vec_vandc(vector bool short a, vector bool short b)
1160{
1161 return a & ~b;
1162}
1163
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001164static vector int __ATTRS_o_ai
1165vec_vandc(vector int a, vector int b)
1166{
1167 return a & ~b;
1168}
1169
Anton Yartsev05e35552010-08-16 16:22:12 +00001170static vector int __ATTRS_o_ai
1171vec_vandc(vector bool int a, vector int b)
1172{
1173 return (vector int)a & ~b;
1174}
1175
1176static vector int __ATTRS_o_ai
1177vec_vandc(vector int a, vector bool int b)
1178{
1179 return a & ~(vector int)b;
1180}
1181
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001182static vector unsigned int __ATTRS_o_ai
1183vec_vandc(vector unsigned int a, vector unsigned int b)
1184{
1185 return a & ~b;
1186}
1187
Anton Yartsev05e35552010-08-16 16:22:12 +00001188static vector unsigned int __ATTRS_o_ai
1189vec_vandc(vector bool int a, vector unsigned int b)
1190{
1191 return (vector unsigned int)a & ~b;
1192}
1193
1194static vector unsigned int __ATTRS_o_ai
1195vec_vandc(vector unsigned int a, vector bool int b)
1196{
1197 return a & ~(vector unsigned int)b;
1198}
1199
1200static vector bool int __ATTRS_o_ai
1201vec_vandc(vector bool int a, vector bool int b)
1202{
1203 return a & ~b;
1204}
1205
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001206static vector float __ATTRS_o_ai
1207vec_vandc(vector float a, vector float b)
1208{
1209 vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b;
1210 return (vector float)res;
Chris Lattnerdd173942010-04-14 03:54:58 +00001211}
1212
Anton Yartsev05e35552010-08-16 16:22:12 +00001213static vector float __ATTRS_o_ai
1214vec_vandc(vector bool int a, vector float b)
1215{
1216 vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b;
1217 return (vector float)res;
1218}
1219
1220static vector float __ATTRS_o_ai
1221vec_vandc(vector float a, vector bool int b)
1222{
1223 vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b;
1224 return (vector float)res;
1225}
1226
Chris Lattnerdd173942010-04-14 03:54:58 +00001227/* vec_avg */
1228
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001229static vector signed char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001230vec_avg(vector signed char a, vector signed char b)
1231{
1232 return __builtin_altivec_vavgsb(a, b);
1233}
1234
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001235static vector unsigned char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001236vec_avg(vector unsigned char a, vector unsigned char b)
1237{
1238 return __builtin_altivec_vavgub(a, b);
1239}
1240
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001241static vector short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001242vec_avg(vector short a, vector short b)
1243{
1244 return __builtin_altivec_vavgsh(a, b);
1245}
1246
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001247static vector unsigned short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001248vec_avg(vector unsigned short a, vector unsigned short b)
1249{
1250 return __builtin_altivec_vavguh(a, b);
1251}
1252
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001253static vector int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001254vec_avg(vector int a, vector int b)
1255{
1256 return __builtin_altivec_vavgsw(a, b);
1257}
1258
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001259static vector unsigned int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001260vec_avg(vector unsigned int a, vector unsigned int b)
1261{
1262 return __builtin_altivec_vavguw(a, b);
1263}
1264
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001265/* vec_vavgsb */
Chris Lattnerdd173942010-04-14 03:54:58 +00001266
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001267static vector signed char __attribute__((__always_inline__))
1268vec_vavgsb(vector signed char a, vector signed char b)
Chris Lattnerdd173942010-04-14 03:54:58 +00001269{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001270 return __builtin_altivec_vavgsb(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001271}
1272
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001273/* vec_vavgub */
1274
1275static vector unsigned char __attribute__((__always_inline__))
1276vec_vavgub(vector unsigned char a, vector unsigned char b)
Chris Lattnerdd173942010-04-14 03:54:58 +00001277{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001278 return __builtin_altivec_vavgub(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001279}
1280
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001281/* vec_vavgsh */
1282
1283static vector short __attribute__((__always_inline__))
1284vec_vavgsh(vector short a, vector short b)
Chris Lattnerdd173942010-04-14 03:54:58 +00001285{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001286 return __builtin_altivec_vavgsh(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001287}
1288
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001289/* vec_vavguh */
1290
1291static vector unsigned short __attribute__((__always_inline__))
1292vec_vavguh(vector unsigned short a, vector unsigned short b)
Chris Lattnerdd173942010-04-14 03:54:58 +00001293{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001294 return __builtin_altivec_vavguh(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001295}
1296
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001297/* vec_vavgsw */
1298
1299static vector int __attribute__((__always_inline__))
1300vec_vavgsw(vector int a, vector int b)
Chris Lattnerdd173942010-04-14 03:54:58 +00001301{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001302 return __builtin_altivec_vavgsw(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001303}
1304
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001305/* vec_vavguw */
1306
1307static vector unsigned int __attribute__((__always_inline__))
1308vec_vavguw(vector unsigned int a, vector unsigned int b)
Chris Lattnerdd173942010-04-14 03:54:58 +00001309{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001310 return __builtin_altivec_vavguw(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001311}
1312
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001313/* vec_ceil */
1314
1315static vector float __attribute__((__always_inline__))
1316vec_ceil(vector float a)
Chris Lattnerdd173942010-04-14 03:54:58 +00001317{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001318 return __builtin_altivec_vrfip(a);
Chris Lattnerdd173942010-04-14 03:54:58 +00001319}
1320
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001321/* vec_vrfip */
Chris Lattnerdd173942010-04-14 03:54:58 +00001322
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001323static vector float __attribute__((__always_inline__))
1324vec_vrfip(vector float a)
Chris Lattnerdd173942010-04-14 03:54:58 +00001325{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001326 return __builtin_altivec_vrfip(a);
Chris Lattnerdd173942010-04-14 03:54:58 +00001327}
1328
1329/* vec_cmpb */
1330
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001331static vector int __attribute__((__always_inline__))
1332vec_cmpb(vector float a, vector float b)
1333{
1334 return __builtin_altivec_vcmpbfp(a, b);
1335}
1336
1337/* vec_vcmpbfp */
1338
1339static vector int __attribute__((__always_inline__))
1340vec_vcmpbfp(vector float a, vector float b)
1341{
1342 return __builtin_altivec_vcmpbfp(a, b);
1343}
Chris Lattnerdd173942010-04-14 03:54:58 +00001344
1345/* vec_cmpeq */
1346
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001347static vector bool char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001348vec_cmpeq(vector signed char a, vector signed char b)
1349{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001350 return (vector bool char)
1351 __builtin_altivec_vcmpequb((vector char)a, (vector char)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001352}
1353
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001354static vector bool char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001355vec_cmpeq(vector unsigned char a, vector unsigned char b)
1356{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001357 return (vector bool char)
1358 __builtin_altivec_vcmpequb((vector char)a, (vector char)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001359}
1360
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001361static vector bool short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001362vec_cmpeq(vector short a, vector short b)
1363{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001364 return (vector bool short)__builtin_altivec_vcmpequh(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001365}
1366
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001367static vector bool short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001368vec_cmpeq(vector unsigned short a, vector unsigned short b)
1369{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001370 return (vector bool short)
1371 __builtin_altivec_vcmpequh((vector short)a, (vector short)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001372}
1373
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001374static vector bool int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001375vec_cmpeq(vector int a, vector int b)
1376{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001377 return (vector bool int)__builtin_altivec_vcmpequw(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001378}
1379
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001380static vector bool int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001381vec_cmpeq(vector unsigned int a, vector unsigned int b)
1382{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001383 return (vector bool int)
1384 __builtin_altivec_vcmpequw((vector int)a, (vector int)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001385}
1386
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001387static vector bool int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001388vec_cmpeq(vector float a, vector float b)
1389{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001390 return (vector bool int)__builtin_altivec_vcmpeqfp(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001391}
1392
1393/* vec_cmpge */
1394
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001395static vector bool int __attribute__((__always_inline__))
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001396vec_cmpge(vector float a, vector float b)
1397{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001398 return (vector bool int)__builtin_altivec_vcmpgefp(a, b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001399}
1400
1401/* vec_vcmpgefp */
1402
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001403static vector bool int __attribute__((__always_inline__))
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001404vec_vcmpgefp(vector float a, vector float b)
1405{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001406 return (vector bool int)__builtin_altivec_vcmpgefp(a, b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001407}
Chris Lattnerdd173942010-04-14 03:54:58 +00001408
1409/* vec_cmpgt */
1410
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001411static vector bool char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001412vec_cmpgt(vector signed char a, vector signed char b)
1413{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001414 return (vector bool char)__builtin_altivec_vcmpgtsb(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001415}
1416
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001417static vector bool char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001418vec_cmpgt(vector unsigned char a, vector unsigned char b)
1419{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001420 return (vector bool char)__builtin_altivec_vcmpgtub(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001421}
1422
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001423static vector bool short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001424vec_cmpgt(vector short a, vector short b)
1425{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001426 return (vector bool short)__builtin_altivec_vcmpgtsh(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001427}
1428
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001429static vector bool short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001430vec_cmpgt(vector unsigned short a, vector unsigned short b)
1431{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001432 return (vector bool short)__builtin_altivec_vcmpgtuh(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001433}
1434
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001435static vector bool int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001436vec_cmpgt(vector int a, vector int b)
1437{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001438 return (vector bool int)__builtin_altivec_vcmpgtsw(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001439}
1440
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001441static vector bool int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001442vec_cmpgt(vector unsigned int a, vector unsigned int b)
1443{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001444 return (vector bool int)__builtin_altivec_vcmpgtuw(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001445}
1446
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001447static vector bool int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001448vec_cmpgt(vector float a, vector float b)
1449{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001450 return (vector bool int)__builtin_altivec_vcmpgtfp(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001451}
1452
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001453/* vec_vcmpgtsb */
Chris Lattnerdd173942010-04-14 03:54:58 +00001454
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001455static vector bool char __attribute__((__always_inline__))
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001456vec_vcmpgtsb(vector signed char a, vector signed char b)
1457{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001458 return (vector bool char)__builtin_altivec_vcmpgtsb(a, b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001459}
1460
1461/* vec_vcmpgtub */
1462
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001463static vector bool char __attribute__((__always_inline__))
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001464vec_vcmpgtub(vector unsigned char a, vector unsigned char b)
1465{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001466 return (vector bool char)__builtin_altivec_vcmpgtub(a, b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001467}
1468
1469/* vec_vcmpgtsh */
1470
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001471static vector bool short __attribute__((__always_inline__))
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001472vec_vcmpgtsh(vector short a, vector short b)
1473{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001474 return (vector bool short)__builtin_altivec_vcmpgtsh(a, b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001475}
1476
1477/* vec_vcmpgtuh */
1478
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001479static vector bool short __attribute__((__always_inline__))
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001480vec_vcmpgtuh(vector unsigned short a, vector unsigned short b)
1481{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001482 return (vector bool short)__builtin_altivec_vcmpgtuh(a, b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001483}
1484
1485/* vec_vcmpgtsw */
1486
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001487static vector bool int __attribute__((__always_inline__))
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001488vec_vcmpgtsw(vector int a, vector int b)
1489{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001490 return (vector bool int)__builtin_altivec_vcmpgtsw(a, b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001491}
1492
1493/* vec_vcmpgtuw */
1494
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001495static vector bool int __attribute__((__always_inline__))
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001496vec_vcmpgtuw(vector unsigned int a, vector unsigned int b)
1497{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001498 return (vector bool int)__builtin_altivec_vcmpgtuw(a, b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001499}
1500
1501/* vec_vcmpgtfp */
1502
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001503static vector bool int __attribute__((__always_inline__))
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001504vec_vcmpgtfp(vector float a, vector float b)
1505{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001506 return (vector bool int)__builtin_altivec_vcmpgtfp(a, b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001507}
1508
1509/* vec_cmple */
Chris Lattnerdd173942010-04-14 03:54:58 +00001510
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001511static vector bool int __attribute__((__always_inline__))
Chris Lattnerdd173942010-04-14 03:54:58 +00001512vec_cmple(vector float a, vector float b)
1513{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001514 return (vector bool int)__builtin_altivec_vcmpgefp(b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00001515}
1516
1517/* vec_cmplt */
1518
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001519static vector bool char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001520vec_cmplt(vector signed char a, vector signed char b)
1521{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001522 return (vector bool char)__builtin_altivec_vcmpgtsb(b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00001523}
1524
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001525static vector bool char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001526vec_cmplt(vector unsigned char a, vector unsigned char b)
1527{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001528 return (vector bool char)__builtin_altivec_vcmpgtub(b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00001529}
1530
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001531static vector bool short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001532vec_cmplt(vector short a, vector short b)
1533{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001534 return (vector bool short)__builtin_altivec_vcmpgtsh(b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00001535}
1536
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001537static vector bool short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001538vec_cmplt(vector unsigned short a, vector unsigned short b)
1539{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001540 return (vector bool short)__builtin_altivec_vcmpgtuh(b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00001541}
1542
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001543static vector bool int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001544vec_cmplt(vector int a, vector int b)
1545{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001546 return (vector bool int)__builtin_altivec_vcmpgtsw(b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00001547}
1548
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001549static vector bool int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001550vec_cmplt(vector unsigned int a, vector unsigned int b)
1551{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001552 return (vector bool int)__builtin_altivec_vcmpgtuw(b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00001553}
1554
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001555static vector bool int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001556vec_cmplt(vector float a, vector float b)
1557{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001558 return (vector bool int)__builtin_altivec_vcmpgtfp(b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00001559}
1560
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001561/* vec_ctf */
1562
1563static vector float __ATTRS_o_ai
1564vec_ctf(vector int a, int b)
1565{
1566 return __builtin_altivec_vcfsx(a, b);
1567}
1568
1569static vector float __ATTRS_o_ai
1570vec_ctf(vector unsigned int a, int b)
1571{
1572 return __builtin_altivec_vcfux((vector int)a, b);
1573}
1574
1575/* vec_vcfsx */
1576
1577static vector float __attribute__((__always_inline__))
1578vec_vcfsx(vector int a, int b)
1579{
1580 return __builtin_altivec_vcfsx(a, b);
1581}
1582
1583/* vec_vcfux */
1584
1585static vector float __attribute__((__always_inline__))
1586vec_vcfux(vector unsigned int a, int b)
1587{
1588 return __builtin_altivec_vcfux((vector int)a, b);
1589}
1590
1591/* vec_cts */
1592
1593static vector int __attribute__((__always_inline__))
1594vec_cts(vector float a, int b)
1595{
1596 return __builtin_altivec_vctsxs(a, b);
1597}
1598
1599/* vec_vctsxs */
1600
1601static vector int __attribute__((__always_inline__))
1602vec_vctsxs(vector float a, int b)
1603{
1604 return __builtin_altivec_vctsxs(a, b);
1605}
1606
1607/* vec_ctu */
1608
1609static vector unsigned int __attribute__((__always_inline__))
1610vec_ctu(vector float a, int b)
1611{
1612 return __builtin_altivec_vctuxs(a, b);
1613}
1614
1615/* vec_vctuxs */
1616
1617static vector unsigned int __attribute__((__always_inline__))
1618vec_vctuxs(vector float a, int b)
1619{
1620 return __builtin_altivec_vctuxs(a, b);
1621}
1622
1623/* vec_dss */
1624
1625static void __attribute__((__always_inline__))
1626vec_dss(int a)
1627{
1628 __builtin_altivec_dss(a);
1629}
1630
1631/* vec_dssall */
1632
1633static void __attribute__((__always_inline__))
1634vec_dssall(void)
1635{
1636 __builtin_altivec_dssall();
1637}
1638
1639/* vec_dst */
1640
1641static void __attribute__((__always_inline__))
1642vec_dst(void *a, int b, int c)
1643{
1644 __builtin_altivec_dst(a, b, c);
1645}
1646
1647/* vec_dstst */
1648
1649static void __attribute__((__always_inline__))
1650vec_dstst(void *a, int b, int c)
1651{
1652 __builtin_altivec_dstst(a, b, c);
1653}
1654
1655/* vec_dststt */
1656
1657static void __attribute__((__always_inline__))
1658vec_dststt(void *a, int b, int c)
1659{
1660 __builtin_altivec_dststt(a, b, c);
1661}
1662
1663/* vec_dstt */
1664
1665static void __attribute__((__always_inline__))
1666vec_dstt(void *a, int b, int c)
1667{
1668 __builtin_altivec_dstt(a, b, c);
1669}
1670
1671/* vec_expte */
1672
1673static vector float __attribute__((__always_inline__))
1674vec_expte(vector float a)
1675{
1676 return __builtin_altivec_vexptefp(a);
1677}
1678
1679/* vec_vexptefp */
1680
1681static vector float __attribute__((__always_inline__))
1682vec_vexptefp(vector float a)
1683{
1684 return __builtin_altivec_vexptefp(a);
1685}
1686
1687/* vec_floor */
1688
1689static vector float __attribute__((__always_inline__))
1690vec_floor(vector float a)
1691{
1692 return __builtin_altivec_vrfim(a);
1693}
1694
1695/* vec_vrfim */
1696
1697static vector float __attribute__((__always_inline__))
1698vec_vrfim(vector float a)
1699{
1700 return __builtin_altivec_vrfim(a);
1701}
1702
1703/* vec_ld */
1704
1705static vector signed char __ATTRS_o_ai
1706vec_ld(int a, vector signed char *b)
1707{
1708 return (vector signed char)__builtin_altivec_lvx(a, b);
1709}
1710
1711static vector signed char __ATTRS_o_ai
1712vec_ld(int a, signed char *b)
1713{
1714 return (vector signed char)__builtin_altivec_lvx(a, b);
1715}
1716
1717static vector unsigned char __ATTRS_o_ai
1718vec_ld(int a, vector unsigned char *b)
1719{
1720 return (vector unsigned char)__builtin_altivec_lvx(a, b);
1721}
1722
1723static vector unsigned char __ATTRS_o_ai
1724vec_ld(int a, unsigned char *b)
1725{
1726 return (vector unsigned char)__builtin_altivec_lvx(a, b);
1727}
1728
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001729static vector bool char __ATTRS_o_ai
1730vec_ld(int a, vector bool char *b)
1731{
1732 return (vector bool char)__builtin_altivec_lvx(a, b);
1733}
1734
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001735static vector short __ATTRS_o_ai
1736vec_ld(int a, vector short *b)
1737{
1738 return (vector short)__builtin_altivec_lvx(a, b);
1739}
1740
1741static vector short __ATTRS_o_ai
1742vec_ld(int a, short *b)
1743{
1744 return (vector short)__builtin_altivec_lvx(a, b);
1745}
1746
1747static vector unsigned short __ATTRS_o_ai
1748vec_ld(int a, vector unsigned short *b)
1749{
1750 return (vector unsigned short)__builtin_altivec_lvx(a, b);
1751}
1752
1753static vector unsigned short __ATTRS_o_ai
1754vec_ld(int a, unsigned short *b)
1755{
1756 return (vector unsigned short)__builtin_altivec_lvx(a, b);
1757}
1758
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001759static vector bool short __ATTRS_o_ai
1760vec_ld(int a, vector bool short *b)
1761{
1762 return (vector bool short)__builtin_altivec_lvx(a, b);
1763}
1764
1765static vector pixel __ATTRS_o_ai
1766vec_ld(int a, vector pixel *b)
1767{
1768 return (vector pixel)__builtin_altivec_lvx(a, b);
1769}
1770
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001771static vector int __ATTRS_o_ai
1772vec_ld(int a, vector int *b)
1773{
1774 return (vector int)__builtin_altivec_lvx(a, b);
1775}
1776
1777static vector int __ATTRS_o_ai
1778vec_ld(int a, int *b)
1779{
1780 return (vector int)__builtin_altivec_lvx(a, b);
1781}
1782
1783static vector unsigned int __ATTRS_o_ai
1784vec_ld(int a, vector unsigned int *b)
1785{
1786 return (vector unsigned int)__builtin_altivec_lvx(a, b);
1787}
1788
1789static vector unsigned int __ATTRS_o_ai
1790vec_ld(int a, unsigned int *b)
1791{
1792 return (vector unsigned int)__builtin_altivec_lvx(a, b);
1793}
1794
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001795static vector bool int __ATTRS_o_ai
1796vec_ld(int a, vector bool int *b)
1797{
1798 return (vector bool int)__builtin_altivec_lvx(a, b);
1799}
1800
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001801static vector float __ATTRS_o_ai
1802vec_ld(int a, vector float *b)
1803{
1804 return (vector float)__builtin_altivec_lvx(a, b);
1805}
1806
1807static vector float __ATTRS_o_ai
1808vec_ld(int a, float *b)
1809{
1810 return (vector float)__builtin_altivec_lvx(a, b);
1811}
1812
1813/* vec_lvx */
1814
1815static vector signed char __ATTRS_o_ai
1816vec_lvx(int a, vector signed char *b)
1817{
1818 return (vector signed char)__builtin_altivec_lvx(a, b);
1819}
1820
1821static vector signed char __ATTRS_o_ai
1822vec_lvx(int a, signed char *b)
1823{
1824 return (vector signed char)__builtin_altivec_lvx(a, b);
1825}
1826
1827static vector unsigned char __ATTRS_o_ai
1828vec_lvx(int a, vector unsigned char *b)
1829{
1830 return (vector unsigned char)__builtin_altivec_lvx(a, b);
1831}
1832
1833static vector unsigned char __ATTRS_o_ai
1834vec_lvx(int a, unsigned char *b)
1835{
1836 return (vector unsigned char)__builtin_altivec_lvx(a, b);
1837}
1838
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001839static vector bool char __ATTRS_o_ai
1840vec_lvx(int a, vector bool char *b)
1841{
1842 return (vector bool char)__builtin_altivec_lvx(a, b);
1843}
1844
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001845static vector short __ATTRS_o_ai
1846vec_lvx(int a, vector short *b)
1847{
1848 return (vector short)__builtin_altivec_lvx(a, b);
1849}
1850
1851static vector short __ATTRS_o_ai
1852vec_lvx(int a, short *b)
1853{
1854 return (vector short)__builtin_altivec_lvx(a, b);
1855}
1856
1857static vector unsigned short __ATTRS_o_ai
1858vec_lvx(int a, vector unsigned short *b)
1859{
1860 return (vector unsigned short)__builtin_altivec_lvx(a, b);
1861}
1862
1863static vector unsigned short __ATTRS_o_ai
1864vec_lvx(int a, unsigned short *b)
1865{
1866 return (vector unsigned short)__builtin_altivec_lvx(a, b);
1867}
1868
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001869static vector bool short __ATTRS_o_ai
1870vec_lvx(int a, vector bool short *b)
1871{
1872 return (vector bool short)__builtin_altivec_lvx(a, b);
1873}
1874
1875static vector pixel __ATTRS_o_ai
1876vec_lvx(int a, vector pixel *b)
1877{
1878 return (vector pixel)__builtin_altivec_lvx(a, b);
1879}
1880
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001881static vector int __ATTRS_o_ai
1882vec_lvx(int a, vector int *b)
1883{
1884 return (vector int)__builtin_altivec_lvx(a, b);
1885}
1886
1887static vector int __ATTRS_o_ai
1888vec_lvx(int a, int *b)
1889{
1890 return (vector int)__builtin_altivec_lvx(a, b);
1891}
1892
1893static vector unsigned int __ATTRS_o_ai
1894vec_lvx(int a, vector unsigned int *b)
1895{
1896 return (vector unsigned int)__builtin_altivec_lvx(a, b);
1897}
1898
1899static vector unsigned int __ATTRS_o_ai
1900vec_lvx(int a, unsigned int *b)
1901{
1902 return (vector unsigned int)__builtin_altivec_lvx(a, b);
1903}
1904
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001905static vector bool int __ATTRS_o_ai
1906vec_lvx(int a, vector bool int *b)
1907{
1908 return (vector bool int)__builtin_altivec_lvx(a, b);
1909}
1910
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001911static vector float __ATTRS_o_ai
1912vec_lvx(int a, vector float *b)
1913{
1914 return (vector float)__builtin_altivec_lvx(a, b);
1915}
1916
1917static vector float __ATTRS_o_ai
1918vec_lvx(int a, float *b)
1919{
1920 return (vector float)__builtin_altivec_lvx(a, b);
1921}
1922
1923/* vec_lde */
1924
1925static vector signed char __ATTRS_o_ai
1926vec_lde(int a, vector signed char *b)
1927{
1928 return (vector signed char)__builtin_altivec_lvebx(a, b);
1929}
1930
1931static vector unsigned char __ATTRS_o_ai
1932vec_lde(int a, vector unsigned char *b)
1933{
1934 return (vector unsigned char)__builtin_altivec_lvebx(a, b);
1935}
1936
1937static vector short __ATTRS_o_ai
1938vec_lde(int a, vector short *b)
1939{
1940 return (vector short)__builtin_altivec_lvehx(a, b);
1941}
1942
1943static vector unsigned short __ATTRS_o_ai
1944vec_lde(int a, vector unsigned short *b)
1945{
1946 return (vector unsigned short)__builtin_altivec_lvehx(a, b);
1947}
1948
1949static vector int __ATTRS_o_ai
1950vec_lde(int a, vector int *b)
1951{
1952 return (vector int)__builtin_altivec_lvewx(a, b);
1953}
1954
1955static vector unsigned int __ATTRS_o_ai
1956vec_lde(int a, vector unsigned int *b)
1957{
1958 return (vector unsigned int)__builtin_altivec_lvewx(a, b);
1959}
1960
1961static vector float __ATTRS_o_ai
1962vec_lde(int a, vector float *b)
1963{
1964 return (vector float)__builtin_altivec_lvewx(a, b);
1965}
1966
1967/* vec_lvebx */
1968
1969static vector signed char __ATTRS_o_ai
1970vec_lvebx(int a, vector signed char *b)
1971{
1972 return (vector signed char)__builtin_altivec_lvebx(a, b);
1973}
1974
1975static vector unsigned char __ATTRS_o_ai
1976vec_lvebx(int a, vector unsigned char *b)
1977{
1978 return (vector unsigned char)__builtin_altivec_lvebx(a, b);
1979}
1980
1981/* vec_lvehx */
1982
1983static vector short __ATTRS_o_ai
1984vec_lvehx(int a, vector short *b)
1985{
1986 return (vector short)__builtin_altivec_lvehx(a, b);
1987}
1988
1989static vector unsigned short __ATTRS_o_ai
1990vec_lvehx(int a, vector unsigned short *b)
1991{
1992 return (vector unsigned short)__builtin_altivec_lvehx(a, b);
1993}
1994
1995/* vec_lvewx */
1996
1997static vector int __ATTRS_o_ai
1998vec_lvewx(int a, vector int *b)
1999{
2000 return (vector int)__builtin_altivec_lvewx(a, b);
2001}
2002
2003static vector unsigned int __ATTRS_o_ai
2004vec_lvewx(int a, vector unsigned int *b)
2005{
2006 return (vector unsigned int)__builtin_altivec_lvewx(a, b);
2007}
2008
2009static vector float __ATTRS_o_ai
2010vec_lvewx(int a, vector float *b)
2011{
2012 return (vector float)__builtin_altivec_lvewx(a, b);
2013}
2014
2015/* vec_ldl */
2016
2017static vector signed char __ATTRS_o_ai
2018vec_ldl(int a, vector signed char *b)
2019{
2020 return (vector signed char)__builtin_altivec_lvxl(a, b);
2021}
2022
2023static vector signed char __ATTRS_o_ai
2024vec_ldl(int a, signed char *b)
2025{
2026 return (vector signed char)__builtin_altivec_lvxl(a, b);
2027}
2028
2029static vector unsigned char __ATTRS_o_ai
2030vec_ldl(int a, vector unsigned char *b)
2031{
2032 return (vector unsigned char)__builtin_altivec_lvxl(a, b);
2033}
2034
2035static vector unsigned char __ATTRS_o_ai
2036vec_ldl(int a, unsigned char *b)
2037{
2038 return (vector unsigned char)__builtin_altivec_lvxl(a, b);
2039}
2040
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002041static vector bool char __ATTRS_o_ai
2042vec_ldl(int a, vector bool char *b)
2043{
2044 return (vector bool char)__builtin_altivec_lvxl(a, b);
2045}
2046
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002047static vector short __ATTRS_o_ai
2048vec_ldl(int a, vector short *b)
2049{
2050 return (vector short)__builtin_altivec_lvxl(a, b);
2051}
2052
2053static vector short __ATTRS_o_ai
2054vec_ldl(int a, short *b)
2055{
2056 return (vector short)__builtin_altivec_lvxl(a, b);
2057}
2058
2059static vector unsigned short __ATTRS_o_ai
2060vec_ldl(int a, vector unsigned short *b)
2061{
2062 return (vector unsigned short)__builtin_altivec_lvxl(a, b);
2063}
2064
2065static vector unsigned short __ATTRS_o_ai
2066vec_ldl(int a, unsigned short *b)
2067{
2068 return (vector unsigned short)__builtin_altivec_lvxl(a, b);
2069}
2070
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002071static vector bool short __ATTRS_o_ai
2072vec_ldl(int a, vector bool short *b)
2073{
2074 return (vector bool short)__builtin_altivec_lvxl(a, b);
2075}
2076
2077static vector pixel __ATTRS_o_ai
2078vec_ldl(int a, vector pixel *b)
2079{
2080 return (vector pixel short)__builtin_altivec_lvxl(a, b);
2081}
2082
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002083static vector int __ATTRS_o_ai
2084vec_ldl(int a, vector int *b)
2085{
2086 return (vector int)__builtin_altivec_lvxl(a, b);
2087}
2088
2089static vector int __ATTRS_o_ai
2090vec_ldl(int a, int *b)
2091{
2092 return (vector int)__builtin_altivec_lvxl(a, b);
2093}
2094
2095static vector unsigned int __ATTRS_o_ai
2096vec_ldl(int a, vector unsigned int *b)
2097{
2098 return (vector unsigned int)__builtin_altivec_lvxl(a, b);
2099}
2100
2101static vector unsigned int __ATTRS_o_ai
2102vec_ldl(int a, unsigned int *b)
2103{
2104 return (vector unsigned int)__builtin_altivec_lvxl(a, b);
2105}
2106
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002107static vector bool int __ATTRS_o_ai
2108vec_ldl(int a, vector bool int *b)
2109{
2110 return (vector bool int)__builtin_altivec_lvxl(a, b);
2111}
2112
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002113static vector float __ATTRS_o_ai
2114vec_ldl(int a, vector float *b)
2115{
2116 return (vector float)__builtin_altivec_lvxl(a, b);
2117}
2118
2119static vector float __ATTRS_o_ai
2120vec_ldl(int a, float *b)
2121{
2122 return (vector float)__builtin_altivec_lvxl(a, b);
2123}
2124
2125/* vec_lvxl */
2126
2127static vector signed char __ATTRS_o_ai
2128vec_lvxl(int a, vector signed char *b)
2129{
2130 return (vector signed char)__builtin_altivec_lvxl(a, b);
2131}
2132
2133static vector signed char __ATTRS_o_ai
2134vec_lvxl(int a, signed char *b)
2135{
2136 return (vector signed char)__builtin_altivec_lvxl(a, b);
2137}
2138
2139static vector unsigned char __ATTRS_o_ai
2140vec_lvxl(int a, vector unsigned char *b)
2141{
2142 return (vector unsigned char)__builtin_altivec_lvxl(a, b);
2143}
2144
2145static vector unsigned char __ATTRS_o_ai
2146vec_lvxl(int a, unsigned char *b)
2147{
2148 return (vector unsigned char)__builtin_altivec_lvxl(a, b);
2149}
2150
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002151static vector bool char __ATTRS_o_ai
2152vec_lvxl(int a, vector bool char *b)
2153{
2154 return (vector bool char)__builtin_altivec_lvxl(a, b);
2155}
2156
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002157static vector short __ATTRS_o_ai
2158vec_lvxl(int a, vector short *b)
2159{
2160 return (vector short)__builtin_altivec_lvxl(a, b);
2161}
2162
2163static vector short __ATTRS_o_ai
2164vec_lvxl(int a, short *b)
2165{
2166 return (vector short)__builtin_altivec_lvxl(a, b);
2167}
2168
2169static vector unsigned short __ATTRS_o_ai
2170vec_lvxl(int a, vector unsigned short *b)
2171{
2172 return (vector unsigned short)__builtin_altivec_lvxl(a, b);
2173}
2174
2175static vector unsigned short __ATTRS_o_ai
2176vec_lvxl(int a, unsigned short *b)
2177{
2178 return (vector unsigned short)__builtin_altivec_lvxl(a, b);
2179}
2180
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002181static vector bool short __ATTRS_o_ai
2182vec_lvxl(int a, vector bool short *b)
2183{
2184 return (vector bool short)__builtin_altivec_lvxl(a, b);
2185}
2186
2187static vector pixel __ATTRS_o_ai
2188vec_lvxl(int a, vector pixel *b)
2189{
2190 return (vector pixel)__builtin_altivec_lvxl(a, b);
2191}
2192
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002193static vector int __ATTRS_o_ai
2194vec_lvxl(int a, vector int *b)
2195{
2196 return (vector int)__builtin_altivec_lvxl(a, b);
2197}
2198
2199static vector int __ATTRS_o_ai
2200vec_lvxl(int a, int *b)
2201{
2202 return (vector int)__builtin_altivec_lvxl(a, b);
2203}
2204
2205static vector unsigned int __ATTRS_o_ai
2206vec_lvxl(int a, vector unsigned int *b)
2207{
2208 return (vector unsigned int)__builtin_altivec_lvxl(a, b);
2209}
2210
2211static vector unsigned int __ATTRS_o_ai
2212vec_lvxl(int a, unsigned int *b)
2213{
2214 return (vector unsigned int)__builtin_altivec_lvxl(a, b);
2215}
2216
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002217static vector bool int __ATTRS_o_ai
2218vec_lvxl(int a, vector bool int *b)
2219{
2220 return (vector bool int)__builtin_altivec_lvxl(a, b);
2221}
2222
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002223static vector float __ATTRS_o_ai
2224vec_lvxl(int a, vector float *b)
2225{
2226 return (vector float)__builtin_altivec_lvxl(a, b);
2227}
2228
2229static vector float __ATTRS_o_ai
2230vec_lvxl(int a, float *b)
2231{
2232 return (vector float)__builtin_altivec_lvxl(a, b);
2233}
2234
2235/* vec_loge */
2236
2237static vector float __attribute__((__always_inline__))
2238vec_loge(vector float a)
2239{
2240 return __builtin_altivec_vlogefp(a);
2241}
2242
2243/* vec_vlogefp */
2244
2245static vector float __attribute__((__always_inline__))
2246vec_vlogefp(vector float a)
2247{
2248 return __builtin_altivec_vlogefp(a);
2249}
2250
2251/* vec_lvsl */
2252
2253static vector unsigned char __ATTRS_o_ai
2254vec_lvsl(int a, signed char *b)
2255{
2256 return (vector unsigned char)__builtin_altivec_lvsl(a, b);
2257}
2258
2259static vector unsigned char __ATTRS_o_ai
2260vec_lvsl(int a, unsigned char *b)
2261{
2262 return (vector unsigned char)__builtin_altivec_lvsl(a, b);
2263}
2264
2265static vector unsigned char __ATTRS_o_ai
2266vec_lvsl(int a, short *b)
2267{
2268 return (vector unsigned char)__builtin_altivec_lvsl(a, b);
2269}
2270
2271static vector unsigned char __ATTRS_o_ai
2272vec_lvsl(int a, unsigned short *b)
2273{
2274 return (vector unsigned char)__builtin_altivec_lvsl(a, b);
2275}
2276
2277static vector unsigned char __ATTRS_o_ai
2278vec_lvsl(int a, int *b)
2279{
2280 return (vector unsigned char)__builtin_altivec_lvsl(a, b);
2281}
2282
2283static vector unsigned char __ATTRS_o_ai
2284vec_lvsl(int a, unsigned int *b)
2285{
2286 return (vector unsigned char)__builtin_altivec_lvsl(a, b);
2287}
2288
2289static vector unsigned char __ATTRS_o_ai
2290vec_lvsl(int a, float *b)
2291{
2292 return (vector unsigned char)__builtin_altivec_lvsl(a, b);
2293}
2294
2295/* vec_lvsr */
2296
2297static vector unsigned char __ATTRS_o_ai
2298vec_lvsr(int a, signed char *b)
2299{
2300 return (vector unsigned char)__builtin_altivec_lvsr(a, b);
2301}
2302
2303static vector unsigned char __ATTRS_o_ai
2304vec_lvsr(int a, unsigned char *b)
2305{
2306 return (vector unsigned char)__builtin_altivec_lvsr(a, b);
2307}
2308
2309static vector unsigned char __ATTRS_o_ai
2310vec_lvsr(int a, short *b)
2311{
2312 return (vector unsigned char)__builtin_altivec_lvsr(a, b);
2313}
2314
2315static vector unsigned char __ATTRS_o_ai
2316vec_lvsr(int a, unsigned short *b)
2317{
2318 return (vector unsigned char)__builtin_altivec_lvsr(a, b);
2319}
2320
2321static vector unsigned char __ATTRS_o_ai
2322vec_lvsr(int a, int *b)
2323{
2324 return (vector unsigned char)__builtin_altivec_lvsr(a, b);
2325}
2326
2327static vector unsigned char __ATTRS_o_ai
2328vec_lvsr(int a, unsigned int *b)
2329{
2330 return (vector unsigned char)__builtin_altivec_lvsr(a, b);
2331}
2332
2333static vector unsigned char __ATTRS_o_ai
2334vec_lvsr(int a, float *b)
2335{
2336 return (vector unsigned char)__builtin_altivec_lvsr(a, b);
2337}
2338
2339/* vec_madd */
2340
2341static vector float __attribute__((__always_inline__))
2342vec_madd(vector float a, vector float b, vector float c)
2343{
2344 return __builtin_altivec_vmaddfp(a, b, c);
2345}
2346
2347/* vec_vmaddfp */
2348
2349static vector float __attribute__((__always_inline__))
2350vec_vmaddfp(vector float a, vector float b, vector float c)
2351{
2352 return __builtin_altivec_vmaddfp(a, b, c);
2353}
2354
2355/* vec_madds */
2356
2357static vector signed short __attribute__((__always_inline__))
2358vec_madds(vector signed short a, vector signed short b, vector signed short c)
2359{
2360 return __builtin_altivec_vmhaddshs(a, b, c);
2361}
2362
2363/* vec_vmhaddshs */
2364static vector signed short __attribute__((__always_inline__))
Anton Yartsev3ed32722010-09-18 00:39:16 +00002365vec_vmhaddshs(vector signed short a,
2366 vector signed short b,
2367 vector signed short c)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002368{
2369 return __builtin_altivec_vmhaddshs(a, b, c);
2370}
2371
Chris Lattnerdd173942010-04-14 03:54:58 +00002372/* vec_max */
2373
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002374static vector signed char __ATTRS_o_ai
Anton Yartseva816ec82010-08-12 18:51:55 +00002375vec_max(vector signed char a, vector signed char b)
Chris Lattnerdd173942010-04-14 03:54:58 +00002376{
2377 return __builtin_altivec_vmaxsb(a, b);
2378}
2379
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002380static vector signed char __ATTRS_o_ai
2381vec_max(vector bool char a, vector signed char b)
2382{
2383 return __builtin_altivec_vmaxsb((vector signed char)a, b);
2384}
2385
2386static vector signed char __ATTRS_o_ai
2387vec_max(vector signed char a, vector bool char b)
2388{
2389 return __builtin_altivec_vmaxsb(a, (vector signed char)b);
2390}
2391
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002392static vector unsigned char __ATTRS_o_ai
Anton Yartseva816ec82010-08-12 18:51:55 +00002393vec_max(vector unsigned char a, vector unsigned char b)
Chris Lattnerdd173942010-04-14 03:54:58 +00002394{
2395 return __builtin_altivec_vmaxub(a, b);
2396}
2397
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002398static vector unsigned char __ATTRS_o_ai
2399vec_max(vector bool char a, vector unsigned char b)
2400{
2401 return __builtin_altivec_vmaxub((vector unsigned char)a, b);
2402}
2403
2404static vector unsigned char __ATTRS_o_ai
2405vec_max(vector unsigned char a, vector bool char b)
2406{
2407 return __builtin_altivec_vmaxub(a, (vector unsigned char)b);
2408}
2409
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002410static vector short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00002411vec_max(vector short a, vector short b)
2412{
2413 return __builtin_altivec_vmaxsh(a, b);
2414}
2415
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002416static vector short __ATTRS_o_ai
2417vec_max(vector bool short a, vector short b)
2418{
2419 return __builtin_altivec_vmaxsh((vector short)a, b);
2420}
2421
2422static vector short __ATTRS_o_ai
2423vec_max(vector short a, vector bool short b)
2424{
2425 return __builtin_altivec_vmaxsh(a, (vector short)b);
2426}
2427
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002428static vector unsigned short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00002429vec_max(vector unsigned short a, vector unsigned short b)
2430{
2431 return __builtin_altivec_vmaxuh(a, b);
2432}
2433
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002434static vector unsigned short __ATTRS_o_ai
2435vec_max(vector bool short a, vector unsigned short b)
2436{
2437 return __builtin_altivec_vmaxuh((vector unsigned short)a, b);
2438}
2439
2440static vector unsigned short __ATTRS_o_ai
2441vec_max(vector unsigned short a, vector bool short b)
2442{
2443 return __builtin_altivec_vmaxuh(a, (vector unsigned short)b);
2444}
2445
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002446static vector int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00002447vec_max(vector int a, vector int b)
2448{
2449 return __builtin_altivec_vmaxsw(a, b);
2450}
2451
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002452static vector int __ATTRS_o_ai
2453vec_max(vector bool int a, vector int b)
2454{
2455 return __builtin_altivec_vmaxsw((vector int)a, b);
2456}
2457
2458static vector int __ATTRS_o_ai
2459vec_max(vector int a, vector bool int b)
2460{
2461 return __builtin_altivec_vmaxsw(a, (vector int)b);
2462}
2463
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002464static vector unsigned int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00002465vec_max(vector unsigned int a, vector unsigned int b)
2466{
2467 return __builtin_altivec_vmaxuw(a, b);
2468}
2469
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002470static vector unsigned int __ATTRS_o_ai
2471vec_max(vector bool int a, vector unsigned int b)
2472{
2473 return __builtin_altivec_vmaxuw((vector unsigned int)a, b);
2474}
2475
2476static vector unsigned int __ATTRS_o_ai
2477vec_max(vector unsigned int a, vector bool int b)
2478{
2479 return __builtin_altivec_vmaxuw(a, (vector unsigned int)b);
2480}
2481
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002482static vector float __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00002483vec_max(vector float a, vector float b)
2484{
2485 return __builtin_altivec_vmaxfp(a, b);
2486}
2487
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002488/* vec_vmaxsb */
2489
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002490static vector signed char __ATTRS_o_ai
Anton Yartseva816ec82010-08-12 18:51:55 +00002491vec_vmaxsb(vector signed char a, vector signed char b)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002492{
2493 return __builtin_altivec_vmaxsb(a, b);
2494}
2495
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002496static vector signed char __ATTRS_o_ai
2497vec_vmaxsb(vector bool char a, vector signed char b)
2498{
2499 return __builtin_altivec_vmaxsb((vector signed char)a, b);
2500}
2501
2502static vector signed char __ATTRS_o_ai
2503vec_vmaxsb(vector signed char a, vector bool char b)
2504{
2505 return __builtin_altivec_vmaxsb(a, (vector signed char)b);
2506}
2507
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002508/* vec_vmaxub */
2509
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002510static vector unsigned char __ATTRS_o_ai
Anton Yartseva816ec82010-08-12 18:51:55 +00002511vec_vmaxub(vector unsigned char a, vector unsigned char b)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002512{
2513 return __builtin_altivec_vmaxub(a, b);
2514}
2515
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002516static vector unsigned char __ATTRS_o_ai
2517vec_vmaxub(vector bool char a, vector unsigned char b)
2518{
2519 return __builtin_altivec_vmaxub((vector unsigned char)a, b);
2520}
2521
2522static vector unsigned char __ATTRS_o_ai
2523vec_vmaxub(vector unsigned char a, vector bool char b)
2524{
2525 return __builtin_altivec_vmaxub(a, (vector unsigned char)b);
2526}
2527
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002528/* vec_vmaxsh */
2529
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002530static vector short __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002531vec_vmaxsh(vector short a, vector short b)
2532{
2533 return __builtin_altivec_vmaxsh(a, b);
2534}
2535
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002536static vector short __ATTRS_o_ai
2537vec_vmaxsh(vector bool short a, vector short b)
2538{
2539 return __builtin_altivec_vmaxsh((vector short)a, b);
2540}
2541
2542static vector short __ATTRS_o_ai
2543vec_vmaxsh(vector short a, vector bool short b)
2544{
2545 return __builtin_altivec_vmaxsh(a, (vector short)b);
2546}
2547
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002548/* vec_vmaxuh */
2549
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002550static vector unsigned short __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002551vec_vmaxuh(vector unsigned short a, vector unsigned short b)
2552{
2553 return __builtin_altivec_vmaxuh(a, b);
2554}
2555
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002556static vector unsigned short __ATTRS_o_ai
2557vec_vmaxuh(vector bool short a, vector unsigned short b)
2558{
2559 return __builtin_altivec_vmaxuh((vector unsigned short)a, b);
2560}
2561
2562static vector unsigned short __ATTRS_o_ai
2563vec_vmaxuh(vector unsigned short a, vector bool short b)
2564{
2565 return __builtin_altivec_vmaxuh(a, (vector unsigned short)b);
2566}
2567
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002568/* vec_vmaxsw */
2569
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002570static vector int __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002571vec_vmaxsw(vector int a, vector int b)
2572{
2573 return __builtin_altivec_vmaxsw(a, b);
2574}
2575
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002576static vector int __ATTRS_o_ai
2577vec_vmaxsw(vector bool int a, vector int b)
2578{
2579 return __builtin_altivec_vmaxsw((vector int)a, b);
2580}
2581
2582static vector int __ATTRS_o_ai
2583vec_vmaxsw(vector int a, vector bool int b)
2584{
2585 return __builtin_altivec_vmaxsw(a, (vector int)b);
2586}
2587
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002588/* vec_vmaxuw */
2589
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002590static vector unsigned int __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002591vec_vmaxuw(vector unsigned int a, vector unsigned int b)
2592{
2593 return __builtin_altivec_vmaxuw(a, b);
2594}
2595
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002596static vector unsigned int __ATTRS_o_ai
2597vec_vmaxuw(vector bool int a, vector unsigned int b)
2598{
2599 return __builtin_altivec_vmaxuw((vector unsigned int)a, b);
2600}
2601
2602static vector unsigned int __ATTRS_o_ai
2603vec_vmaxuw(vector unsigned int a, vector bool int b)
2604{
2605 return __builtin_altivec_vmaxuw(a, (vector unsigned int)b);
2606}
2607
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002608/* vec_vmaxfp */
2609
2610static vector float __attribute__((__always_inline__))
2611vec_vmaxfp(vector float a, vector float b)
2612{
2613 return __builtin_altivec_vmaxfp(a, b);
2614}
2615
2616/* vec_mergeh */
2617
2618static vector signed char __ATTRS_o_ai
2619vec_mergeh(vector signed char a, vector signed char b)
2620{
2621 return vec_perm(a, b, (vector unsigned char)
2622 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2623 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2624}
2625
2626static vector unsigned char __ATTRS_o_ai
2627vec_mergeh(vector unsigned char a, vector unsigned char b)
2628{
2629 return vec_perm(a, b, (vector unsigned char)
2630 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2631 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2632}
2633
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00002634static vector bool char __ATTRS_o_ai
2635vec_mergeh(vector bool char a, vector bool char b)
2636{
2637 return vec_perm(a, b, (vector unsigned char)
2638 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2639 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2640}
2641
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002642static vector short __ATTRS_o_ai
2643vec_mergeh(vector short a, vector short b)
2644{
2645 return vec_perm(a, b, (vector unsigned char)
2646 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2647 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2648}
2649
2650static vector unsigned short __ATTRS_o_ai
2651vec_mergeh(vector unsigned short a, vector unsigned short b)
2652{
2653 return vec_perm(a, b, (vector unsigned char)
2654 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2655 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2656}
2657
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00002658static vector bool short __ATTRS_o_ai
2659vec_mergeh(vector bool short a, vector bool short b)
2660{
2661 return vec_perm(a, b, (vector unsigned char)
2662 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2663 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2664}
2665
2666static vector pixel __ATTRS_o_ai
2667vec_mergeh(vector pixel a, vector pixel b)
2668{
2669 return vec_perm(a, b, (vector unsigned char)
2670 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2671 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2672}
2673
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002674static vector int __ATTRS_o_ai
2675vec_mergeh(vector int a, vector int b)
2676{
2677 return vec_perm(a, b, (vector unsigned char)
2678 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2679 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2680}
2681
2682static vector unsigned int __ATTRS_o_ai
2683vec_mergeh(vector unsigned int a, vector unsigned int b)
2684{
2685 return vec_perm(a, b, (vector unsigned char)
2686 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2687 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2688}
2689
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00002690static vector bool int __ATTRS_o_ai
2691vec_mergeh(vector bool int a, vector bool int b)
2692{
2693 return vec_perm(a, b, (vector unsigned char)
2694 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2695 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2696}
2697
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002698static vector float __ATTRS_o_ai
2699vec_mergeh(vector float a, vector float b)
2700{
2701 return vec_perm(a, b, (vector unsigned char)
2702 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2703 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2704}
2705
2706/* vec_vmrghb */
2707
2708#define __builtin_altivec_vmrghb vec_vmrghb
2709
2710static vector signed char __ATTRS_o_ai
2711vec_vmrghb(vector signed char a, vector signed char b)
2712{
2713 return vec_perm(a, b, (vector unsigned char)
2714 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2715 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2716}
2717
2718static vector unsigned char __ATTRS_o_ai
2719vec_vmrghb(vector unsigned char a, vector unsigned char b)
2720{
2721 return vec_perm(a, b, (vector unsigned char)
2722 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2723 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2724}
2725
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00002726static vector bool char __ATTRS_o_ai
2727vec_vmrghb(vector bool char a, vector bool char b)
2728{
2729 return vec_perm(a, b, (vector unsigned char)
2730 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2731 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2732}
2733
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002734/* vec_vmrghh */
2735
2736#define __builtin_altivec_vmrghh vec_vmrghh
2737
2738static vector short __ATTRS_o_ai
2739vec_vmrghh(vector short a, vector short b)
2740{
2741 return vec_perm(a, b, (vector unsigned char)
2742 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2743 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2744}
2745
2746static vector unsigned short __ATTRS_o_ai
2747vec_vmrghh(vector unsigned short a, vector unsigned short b)
2748{
2749 return vec_perm(a, b, (vector unsigned char)
2750 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2751 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2752}
2753
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00002754static vector bool short __ATTRS_o_ai
2755vec_vmrghh(vector bool short a, vector bool short b)
2756{
2757 return vec_perm(a, b, (vector unsigned char)
2758 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2759 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2760}
2761
2762static vector pixel __ATTRS_o_ai
2763vec_vmrghh(vector pixel a, vector pixel b)
2764{
2765 return vec_perm(a, b, (vector unsigned char)
2766 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2767 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2768}
2769
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002770/* vec_vmrghw */
2771
2772#define __builtin_altivec_vmrghw vec_vmrghw
2773
2774static vector int __ATTRS_o_ai
2775vec_vmrghw(vector int a, vector int b)
2776{
2777 return vec_perm(a, b, (vector unsigned char)
2778 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2779 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2780}
2781
2782static vector unsigned int __ATTRS_o_ai
2783vec_vmrghw(vector unsigned int a, vector unsigned int b)
2784{
2785 return vec_perm(a, b, (vector unsigned char)
2786 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2787 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2788}
2789
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00002790static vector bool int __ATTRS_o_ai
2791vec_vmrghw(vector bool int a, vector bool int b)
2792{
2793 return vec_perm(a, b, (vector unsigned char)
2794 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2795 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2796}
2797
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002798static vector float __ATTRS_o_ai
2799vec_vmrghw(vector float a, vector float b)
2800{
2801 return vec_perm(a, b, (vector unsigned char)
2802 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2803 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2804}
2805
2806/* vec_mergel */
2807
2808static vector signed char __ATTRS_o_ai
2809vec_mergel(vector signed char a, vector signed char b)
2810{
2811 return vec_perm(a, b, (vector unsigned char)
2812 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
2813 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
2814}
2815
2816static vector unsigned char __ATTRS_o_ai
2817vec_mergel(vector unsigned char a, vector unsigned char b)
2818{
2819 return vec_perm(a, b, (vector unsigned char)
2820 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
2821 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
2822}
2823
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00002824static vector bool char __ATTRS_o_ai
2825vec_mergel(vector bool char a, vector bool char b)
2826{
2827 return vec_perm(a, b, (vector unsigned char)
2828 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
2829 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
2830}
2831
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002832static vector short __ATTRS_o_ai
2833vec_mergel(vector short a, vector short b)
2834{
2835 return vec_perm(a, b, (vector unsigned char)
2836 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
2837 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
2838}
2839
2840static vector unsigned short __ATTRS_o_ai
2841vec_mergel(vector unsigned short a, vector unsigned short b)
2842{
2843 return vec_perm(a, b, (vector unsigned char)
2844 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
2845 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
2846}
2847
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00002848static vector bool short __ATTRS_o_ai
2849vec_mergel(vector bool short a, vector bool short b)
2850{
2851 return vec_perm(a, b, (vector unsigned char)
2852 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
2853 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
2854}
2855
2856static vector pixel __ATTRS_o_ai
2857vec_mergel(vector pixel a, vector pixel b)
2858{
2859 return vec_perm(a, b, (vector unsigned char)
2860 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
2861 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
2862}
2863
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002864static vector int __ATTRS_o_ai
2865vec_mergel(vector int a, vector int b)
2866{
2867 return vec_perm(a, b, (vector unsigned char)
2868 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
2869 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
2870}
2871
2872static vector unsigned int __ATTRS_o_ai
2873vec_mergel(vector unsigned int a, vector unsigned int b)
2874{
2875 return vec_perm(a, b, (vector unsigned char)
2876 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
2877 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
2878}
2879
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00002880static vector bool int __ATTRS_o_ai
2881vec_mergel(vector bool int a, vector bool int b)
2882{
2883 return vec_perm(a, b, (vector unsigned char)
2884 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
2885 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
2886}
2887
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002888static vector float __ATTRS_o_ai
2889vec_mergel(vector float a, vector float b)
2890{
2891 return vec_perm(a, b, (vector unsigned char)
2892 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
2893 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
2894}
2895
2896/* vec_vmrglb */
2897
2898#define __builtin_altivec_vmrglb vec_vmrglb
2899
2900static vector signed char __ATTRS_o_ai
2901vec_vmrglb(vector signed char a, vector signed char b)
2902{
2903 return vec_perm(a, b, (vector unsigned char)
2904 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
2905 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
2906}
2907
2908static vector unsigned char __ATTRS_o_ai
2909vec_vmrglb(vector unsigned char a, vector unsigned char b)
2910{
2911 return vec_perm(a, b, (vector unsigned char)
2912 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
2913 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
2914}
2915
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00002916static vector bool char __ATTRS_o_ai
2917vec_vmrglb(vector bool char a, vector bool char b)
2918{
2919 return vec_perm(a, b, (vector unsigned char)
2920 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
2921 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
2922}
2923
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002924/* vec_vmrglh */
2925
2926#define __builtin_altivec_vmrglh vec_vmrglh
2927
2928static vector short __ATTRS_o_ai
2929vec_vmrglh(vector short a, vector short b)
2930{
2931 return vec_perm(a, b, (vector unsigned char)
2932 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
2933 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
2934}
2935
2936static vector unsigned short __ATTRS_o_ai
2937vec_vmrglh(vector unsigned short a, vector unsigned short b)
2938{
2939 return vec_perm(a, b, (vector unsigned char)
2940 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
2941 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
2942}
2943
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00002944static vector bool short __ATTRS_o_ai
2945vec_vmrglh(vector bool short a, vector bool short b)
2946{
2947 return vec_perm(a, b, (vector unsigned char)
2948 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
2949 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
2950}
2951
2952static vector pixel __ATTRS_o_ai
2953vec_vmrglh(vector pixel a, vector pixel b)
2954{
2955 return vec_perm(a, b, (vector unsigned char)
2956 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
2957 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
2958}
2959
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002960/* vec_vmrglw */
2961
2962#define __builtin_altivec_vmrglw vec_vmrglw
2963
2964static vector int __ATTRS_o_ai
2965vec_vmrglw(vector int a, vector int b)
2966{
2967 return vec_perm(a, b, (vector unsigned char)
2968 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
2969 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
2970}
2971
2972static vector unsigned int __ATTRS_o_ai
2973vec_vmrglw(vector unsigned int a, vector unsigned int b)
2974{
2975 return vec_perm(a, b, (vector unsigned char)
2976 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
2977 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
2978}
2979
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00002980static vector bool int __ATTRS_o_ai
2981vec_vmrglw(vector bool int a, vector bool int b)
2982{
2983 return vec_perm(a, b, (vector unsigned char)
2984 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
2985 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
2986}
2987
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002988static vector float __ATTRS_o_ai
2989vec_vmrglw(vector float a, vector float b)
2990{
2991 return vec_perm(a, b, (vector unsigned char)
2992 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
2993 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
2994}
2995
Chris Lattnerdd173942010-04-14 03:54:58 +00002996/* vec_mfvscr */
2997
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002998static vector unsigned short __attribute__((__always_inline__))
2999vec_mfvscr(void)
3000{
3001 return __builtin_altivec_mfvscr();
3002}
Chris Lattnerdd173942010-04-14 03:54:58 +00003003
3004/* vec_min */
3005
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003006static vector signed char __ATTRS_o_ai
Anton Yartseva816ec82010-08-12 18:51:55 +00003007vec_min(vector signed char a, vector signed char b)
Chris Lattnerdd173942010-04-14 03:54:58 +00003008{
3009 return __builtin_altivec_vminsb(a, b);
3010}
3011
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003012static vector signed char __ATTRS_o_ai
3013vec_min(vector bool char a, vector signed char b)
3014{
3015 return __builtin_altivec_vminsb((vector signed char)a, b);
3016}
3017
3018static vector signed char __ATTRS_o_ai
3019vec_min(vector signed char a, vector bool char b)
3020{
3021 return __builtin_altivec_vminsb(a, (vector signed char)b);
3022}
3023
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003024static vector unsigned char __ATTRS_o_ai
Anton Yartseva816ec82010-08-12 18:51:55 +00003025vec_min(vector unsigned char a, vector unsigned char b)
Chris Lattnerdd173942010-04-14 03:54:58 +00003026{
3027 return __builtin_altivec_vminub(a, b);
3028}
3029
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003030static vector unsigned char __ATTRS_o_ai
3031vec_min(vector bool char a, vector unsigned char b)
3032{
3033 return __builtin_altivec_vminub((vector unsigned char)a, b);
3034}
3035
3036static vector unsigned char __ATTRS_o_ai
3037vec_min(vector unsigned char a, vector bool char b)
3038{
3039 return __builtin_altivec_vminub(a, (vector unsigned char)b);
3040}
3041
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003042static vector short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00003043vec_min(vector short a, vector short b)
3044{
3045 return __builtin_altivec_vminsh(a, b);
3046}
3047
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003048static vector short __ATTRS_o_ai
3049vec_min(vector bool short a, vector short b)
3050{
3051 return __builtin_altivec_vminsh((vector short)a, b);
3052}
3053
3054static vector short __ATTRS_o_ai
3055vec_min(vector short a, vector bool short b)
3056{
3057 return __builtin_altivec_vminsh(a, (vector short)b);
3058}
3059
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003060static vector unsigned short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00003061vec_min(vector unsigned short a, vector unsigned short b)
3062{
3063 return __builtin_altivec_vminuh(a, b);
3064}
3065
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003066static vector unsigned short __ATTRS_o_ai
3067vec_min(vector bool short a, vector unsigned short b)
3068{
3069 return __builtin_altivec_vminuh((vector unsigned short)a, b);
3070}
3071
3072static vector unsigned short __ATTRS_o_ai
3073vec_min(vector unsigned short a, vector bool short b)
3074{
3075 return __builtin_altivec_vminuh(a, (vector unsigned short)b);
3076}
3077
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003078static vector int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00003079vec_min(vector int a, vector int b)
3080{
3081 return __builtin_altivec_vminsw(a, b);
3082}
3083
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003084static vector int __ATTRS_o_ai
3085vec_min(vector bool int a, vector int b)
3086{
3087 return __builtin_altivec_vminsw((vector int)a, b);
3088}
3089
3090static vector int __ATTRS_o_ai
3091vec_min(vector int a, vector bool int b)
3092{
3093 return __builtin_altivec_vminsw(a, (vector int)b);
3094}
3095
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003096static vector unsigned int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00003097vec_min(vector unsigned int a, vector unsigned int b)
3098{
3099 return __builtin_altivec_vminuw(a, b);
3100}
3101
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003102static vector unsigned int __ATTRS_o_ai
3103vec_min(vector bool int a, vector unsigned int b)
3104{
3105 return __builtin_altivec_vminuw((vector unsigned int)a, b);
3106}
3107
3108static vector unsigned int __ATTRS_o_ai
3109vec_min(vector unsigned int a, vector bool int b)
3110{
3111 return __builtin_altivec_vminuw(a, (vector unsigned int)b);
3112}
3113
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003114static vector float __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00003115vec_min(vector float a, vector float b)
3116{
3117 return __builtin_altivec_vminfp(a, b);
3118}
3119
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003120/* vec_vminsb */
3121
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003122static vector signed char __ATTRS_o_ai
Anton Yartseva816ec82010-08-12 18:51:55 +00003123vec_vminsb(vector signed char a, vector signed char b)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003124{
3125 return __builtin_altivec_vminsb(a, b);
3126}
3127
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003128static vector signed char __ATTRS_o_ai
3129vec_vminsb(vector bool char a, vector signed char b)
3130{
3131 return __builtin_altivec_vminsb((vector signed char)a, b);
3132}
3133
3134static vector signed char __ATTRS_o_ai
3135vec_vminsb(vector signed char a, vector bool char b)
3136{
3137 return __builtin_altivec_vminsb(a, (vector signed char)b);
3138}
3139
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003140/* vec_vminub */
3141
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003142static vector unsigned char __ATTRS_o_ai
Anton Yartseva816ec82010-08-12 18:51:55 +00003143vec_vminub(vector unsigned char a, vector unsigned char b)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003144{
3145 return __builtin_altivec_vminub(a, b);
3146}
3147
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003148static vector unsigned char __ATTRS_o_ai
3149vec_vminub(vector bool char a, vector unsigned char b)
3150{
3151 return __builtin_altivec_vminub((vector unsigned char)a, b);
3152}
3153
3154static vector unsigned char __ATTRS_o_ai
3155vec_vminub(vector unsigned char a, vector bool char b)
3156{
3157 return __builtin_altivec_vminub(a, (vector unsigned char)b);
3158}
3159
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003160/* vec_vminsh */
3161
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003162static vector short __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003163vec_vminsh(vector short a, vector short b)
3164{
3165 return __builtin_altivec_vminsh(a, b);
3166}
3167
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003168static vector short __ATTRS_o_ai
3169vec_vminsh(vector bool short a, vector short b)
3170{
3171 return __builtin_altivec_vminsh((vector short)a, b);
3172}
3173
3174static vector short __ATTRS_o_ai
3175vec_vminsh(vector short a, vector bool short b)
3176{
3177 return __builtin_altivec_vminsh(a, (vector short)b);
3178}
3179
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003180/* vec_vminuh */
3181
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003182static vector unsigned short __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003183vec_vminuh(vector unsigned short a, vector unsigned short b)
3184{
3185 return __builtin_altivec_vminuh(a, b);
3186}
3187
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003188static vector unsigned short __ATTRS_o_ai
3189vec_vminuh(vector bool short a, vector unsigned short b)
3190{
3191 return __builtin_altivec_vminuh((vector unsigned short)a, b);
3192}
3193
3194static vector unsigned short __ATTRS_o_ai
3195vec_vminuh(vector unsigned short a, vector bool short b)
3196{
3197 return __builtin_altivec_vminuh(a, (vector unsigned short)b);
3198}
3199
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003200/* vec_vminsw */
3201
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003202static vector int __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003203vec_vminsw(vector int a, vector int b)
3204{
3205 return __builtin_altivec_vminsw(a, b);
3206}
3207
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003208static vector int __ATTRS_o_ai
3209vec_vminsw(vector bool int a, vector int b)
3210{
3211 return __builtin_altivec_vminsw((vector int)a, b);
3212}
3213
3214static vector int __ATTRS_o_ai
3215vec_vminsw(vector int a, vector bool int b)
3216{
3217 return __builtin_altivec_vminsw(a, (vector int)b);
3218}
3219
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003220/* vec_vminuw */
3221
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003222static vector unsigned int __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003223vec_vminuw(vector unsigned int a, vector unsigned int b)
3224{
3225 return __builtin_altivec_vminuw(a, b);
3226}
3227
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003228static vector unsigned int __ATTRS_o_ai
3229vec_vminuw(vector bool int a, vector unsigned int b)
3230{
3231 return __builtin_altivec_vminuw((vector unsigned int)a, b);
3232}
3233
3234static vector unsigned int __ATTRS_o_ai
3235vec_vminuw(vector unsigned int a, vector bool int b)
3236{
3237 return __builtin_altivec_vminuw(a, (vector unsigned int)b);
3238}
3239
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003240/* vec_vminfp */
3241
3242static vector float __attribute__((__always_inline__))
3243vec_vminfp(vector float a, vector float b)
3244{
3245 return __builtin_altivec_vminfp(a, b);
3246}
3247
3248/* vec_mladd */
3249
3250#define __builtin_altivec_vmladduhm vec_mladd
3251
3252static vector short __ATTRS_o_ai
3253vec_mladd(vector short a, vector short b, vector short c)
3254{
3255 return a * b + c;
3256}
3257
3258static vector short __ATTRS_o_ai
3259vec_mladd(vector short a, vector unsigned short b, vector unsigned short c)
3260{
3261 return a * (vector short)b + (vector short)c;
3262}
3263
3264static vector short __ATTRS_o_ai
3265vec_mladd(vector unsigned short a, vector short b, vector short c)
3266{
3267 return (vector short)a * b + c;
3268}
3269
3270static vector unsigned short __ATTRS_o_ai
Anton Yartsev3ed32722010-09-18 00:39:16 +00003271vec_mladd(vector unsigned short a,
3272 vector unsigned short b,
3273 vector unsigned short c)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003274{
3275 return a * b + c;
3276}
3277
3278/* vec_vmladduhm */
3279
3280static vector short __ATTRS_o_ai
3281vec_vmladduhm(vector short a, vector short b, vector short c)
3282{
3283 return a * b + c;
3284}
3285
3286static vector short __ATTRS_o_ai
3287vec_vmladduhm(vector short a, vector unsigned short b, vector unsigned short c)
3288{
3289 return a * (vector short)b + (vector short)c;
3290}
3291
3292static vector short __ATTRS_o_ai
3293vec_vmladduhm(vector unsigned short a, vector short b, vector short c)
3294{
3295 return (vector short)a * b + c;
3296}
3297
3298static vector unsigned short __ATTRS_o_ai
Anton Yartsev3ed32722010-09-18 00:39:16 +00003299vec_vmladduhm(vector unsigned short a,
3300 vector unsigned short b,
3301 vector unsigned short c)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003302{
3303 return a * b + c;
3304}
3305
3306/* vec_mradds */
3307
3308static vector short __attribute__((__always_inline__))
3309vec_mradds(vector short a, vector short b, vector short c)
3310{
3311 return __builtin_altivec_vmhraddshs(a, b, c);
3312}
3313
3314/* vec_vmhraddshs */
3315
3316static vector short __attribute__((__always_inline__))
3317vec_vmhraddshs(vector short a, vector short b, vector short c)
3318{
3319 return __builtin_altivec_vmhraddshs(a, b, c);
3320}
3321
3322/* vec_msum */
3323
3324static vector int __ATTRS_o_ai
3325vec_msum(vector signed char a, vector unsigned char b, vector int c)
3326{
3327 return __builtin_altivec_vmsummbm(a, b, c);
3328}
3329
3330static vector unsigned int __ATTRS_o_ai
3331vec_msum(vector unsigned char a, vector unsigned char b, vector unsigned int c)
3332{
3333 return __builtin_altivec_vmsumubm(a, b, c);
3334}
3335
3336static vector int __ATTRS_o_ai
3337vec_msum(vector short a, vector short b, vector int c)
3338{
3339 return __builtin_altivec_vmsumshm(a, b, c);
3340}
3341
3342static vector unsigned int __ATTRS_o_ai
Anton Yartsev3ed32722010-09-18 00:39:16 +00003343vec_msum(vector unsigned short a,
3344 vector unsigned short b,
3345 vector unsigned int c)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003346{
3347 return __builtin_altivec_vmsumuhm(a, b, c);
3348}
3349
3350/* vec_vmsummbm */
3351
3352static vector int __attribute__((__always_inline__))
3353vec_vmsummbm(vector signed char a, vector unsigned char b, vector int c)
3354{
3355 return __builtin_altivec_vmsummbm(a, b, c);
3356}
3357
3358/* vec_vmsumubm */
3359
3360static vector unsigned int __attribute__((__always_inline__))
Anton Yartsev3ed32722010-09-18 00:39:16 +00003361vec_vmsumubm(vector unsigned char a,
3362 vector unsigned char b,
3363 vector unsigned int c)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003364{
3365 return __builtin_altivec_vmsumubm(a, b, c);
3366}
3367
3368/* vec_vmsumshm */
3369
3370static vector int __attribute__((__always_inline__))
3371vec_vmsumshm(vector short a, vector short b, vector int c)
3372{
3373 return __builtin_altivec_vmsumshm(a, b, c);
3374}
3375
3376/* vec_vmsumuhm */
3377
3378static vector unsigned int __attribute__((__always_inline__))
Anton Yartsev3ed32722010-09-18 00:39:16 +00003379vec_vmsumuhm(vector unsigned short a,
3380 vector unsigned short b,
3381 vector unsigned int c)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003382{
3383 return __builtin_altivec_vmsumuhm(a, b, c);
3384}
3385
3386/* vec_msums */
3387
3388static vector int __ATTRS_o_ai
3389vec_msums(vector short a, vector short b, vector int c)
3390{
3391 return __builtin_altivec_vmsumshs(a, b, c);
3392}
3393
3394static vector unsigned int __ATTRS_o_ai
Anton Yartsev3ed32722010-09-18 00:39:16 +00003395vec_msums(vector unsigned short a,
3396 vector unsigned short b,
3397 vector unsigned int c)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003398{
3399 return __builtin_altivec_vmsumuhs(a, b, c);
3400}
3401
3402/* vec_vmsumshs */
3403
3404static vector int __attribute__((__always_inline__))
3405vec_vmsumshs(vector short a, vector short b, vector int c)
3406{
3407 return __builtin_altivec_vmsumshs(a, b, c);
3408}
3409
3410/* vec_vmsumuhs */
3411
3412static vector unsigned int __attribute__((__always_inline__))
Anton Yartsev3ed32722010-09-18 00:39:16 +00003413vec_vmsumuhs(vector unsigned short a,
3414 vector unsigned short b,
3415 vector unsigned int c)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003416{
3417 return __builtin_altivec_vmsumuhs(a, b, c);
3418}
3419
Chris Lattnerdd173942010-04-14 03:54:58 +00003420/* vec_mtvscr */
3421
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003422static void __ATTRS_o_ai
3423vec_mtvscr(vector signed char a)
3424{
3425 __builtin_altivec_mtvscr((vector int)a);
3426}
3427
3428static void __ATTRS_o_ai
3429vec_mtvscr(vector unsigned char a)
3430{
3431 __builtin_altivec_mtvscr((vector int)a);
3432}
3433
3434static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003435vec_mtvscr(vector bool char a)
3436{
3437 __builtin_altivec_mtvscr((vector int)a);
3438}
3439
3440static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003441vec_mtvscr(vector short a)
3442{
3443 __builtin_altivec_mtvscr((vector int)a);
3444}
3445
3446static void __ATTRS_o_ai
3447vec_mtvscr(vector unsigned short a)
3448{
3449 __builtin_altivec_mtvscr((vector int)a);
3450}
3451
3452static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003453vec_mtvscr(vector bool short a)
3454{
3455 __builtin_altivec_mtvscr((vector int)a);
3456}
3457
3458static void __ATTRS_o_ai
3459vec_mtvscr(vector pixel a)
3460{
3461 __builtin_altivec_mtvscr((vector int)a);
3462}
3463
3464static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003465vec_mtvscr(vector int a)
3466{
3467 __builtin_altivec_mtvscr((vector int)a);
3468}
3469
3470static void __ATTRS_o_ai
3471vec_mtvscr(vector unsigned int a)
3472{
3473 __builtin_altivec_mtvscr((vector int)a);
3474}
3475
3476static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003477vec_mtvscr(vector bool int a)
3478{
3479 __builtin_altivec_mtvscr((vector int)a);
3480}
3481
3482static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003483vec_mtvscr(vector float a)
3484{
3485 __builtin_altivec_mtvscr((vector int)a);
3486}
3487
3488/* vec_mule */
3489
3490static vector short __ATTRS_o_ai
3491vec_mule(vector signed char a, vector signed char b)
3492{
3493 return __builtin_altivec_vmulesb(a, b);
3494}
3495
3496static vector unsigned short __ATTRS_o_ai
3497vec_mule(vector unsigned char a, vector unsigned char b)
3498{
3499 return __builtin_altivec_vmuleub(a, b);
3500}
3501
3502static vector int __ATTRS_o_ai
3503vec_mule(vector short a, vector short b)
3504{
3505 return __builtin_altivec_vmulesh(a, b);
3506}
3507
3508static vector unsigned int __ATTRS_o_ai
3509vec_mule(vector unsigned short a, vector unsigned short b)
3510{
3511 return __builtin_altivec_vmuleuh(a, b);
3512}
3513
3514/* vec_vmulesb */
3515
3516static vector short __attribute__((__always_inline__))
3517vec_vmulesb(vector signed char a, vector signed char b)
3518{
3519 return __builtin_altivec_vmulesb(a, b);
3520}
3521
3522/* vec_vmuleub */
3523
3524static vector unsigned short __attribute__((__always_inline__))
3525vec_vmuleub(vector unsigned char a, vector unsigned char b)
3526{
3527 return __builtin_altivec_vmuleub(a, b);
3528}
3529
3530/* vec_vmulesh */
3531
3532static vector int __attribute__((__always_inline__))
3533vec_vmulesh(vector short a, vector short b)
3534{
3535 return __builtin_altivec_vmulesh(a, b);
3536}
3537
3538/* vec_vmuleuh */
3539
3540static vector unsigned int __attribute__((__always_inline__))
3541vec_vmuleuh(vector unsigned short a, vector unsigned short b)
3542{
3543 return __builtin_altivec_vmuleuh(a, b);
3544}
3545
3546/* vec_mulo */
3547
3548static vector short __ATTRS_o_ai
3549vec_mulo(vector signed char a, vector signed char b)
3550{
3551 return __builtin_altivec_vmulosb(a, b);
3552}
3553
3554static vector unsigned short __ATTRS_o_ai
3555vec_mulo(vector unsigned char a, vector unsigned char b)
3556{
3557 return __builtin_altivec_vmuloub(a, b);
3558}
3559
3560static vector int __ATTRS_o_ai
3561vec_mulo(vector short a, vector short b)
3562{
3563 return __builtin_altivec_vmulosh(a, b);
3564}
3565
3566static vector unsigned int __ATTRS_o_ai
3567vec_mulo(vector unsigned short a, vector unsigned short b)
3568{
3569 return __builtin_altivec_vmulouh(a, b);
3570}
3571
3572/* vec_vmulosb */
3573
3574static vector short __attribute__((__always_inline__))
3575vec_vmulosb(vector signed char a, vector signed char b)
3576{
3577 return __builtin_altivec_vmulosb(a, b);
3578}
3579
3580/* vec_vmuloub */
3581
3582static vector unsigned short __attribute__((__always_inline__))
3583vec_vmuloub(vector unsigned char a, vector unsigned char b)
3584{
3585 return __builtin_altivec_vmuloub(a, b);
3586}
3587
3588/* vec_vmulosh */
3589
3590static vector int __attribute__((__always_inline__))
3591vec_vmulosh(vector short a, vector short b)
3592{
3593 return __builtin_altivec_vmulosh(a, b);
3594}
3595
3596/* vec_vmulouh */
3597
3598static vector unsigned int __attribute__((__always_inline__))
3599vec_vmulouh(vector unsigned short a, vector unsigned short b)
3600{
3601 return __builtin_altivec_vmulouh(a, b);
3602}
3603
3604/* vec_nmsub */
3605
3606static vector float __attribute__((__always_inline__))
3607vec_nmsub(vector float a, vector float b, vector float c)
3608{
3609 return __builtin_altivec_vnmsubfp(a, b, c);
3610}
3611
3612/* vec_vnmsubfp */
3613
3614static vector float __attribute__((__always_inline__))
3615vec_vnmsubfp(vector float a, vector float b, vector float c)
3616{
3617 return __builtin_altivec_vnmsubfp(a, b, c);
3618}
3619
3620/* vec_nor */
3621
3622#define __builtin_altivec_vnor vec_nor
3623
3624static vector signed char __ATTRS_o_ai
3625vec_nor(vector signed char a, vector signed char b)
3626{
3627 return ~(a | b);
3628}
3629
3630static vector unsigned char __ATTRS_o_ai
3631vec_nor(vector unsigned char a, vector unsigned char b)
3632{
3633 return ~(a | b);
3634}
3635
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003636static vector bool char __ATTRS_o_ai
3637vec_nor(vector bool char a, vector bool char b)
3638{
3639 return ~(a | b);
3640}
3641
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003642static vector short __ATTRS_o_ai
3643vec_nor(vector short a, vector short b)
3644{
3645 return ~(a | b);
3646}
3647
3648static vector unsigned short __ATTRS_o_ai
3649vec_nor(vector unsigned short a, vector unsigned short b)
3650{
3651 return ~(a | b);
3652}
3653
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003654static vector bool short __ATTRS_o_ai
3655vec_nor(vector bool short a, vector bool short b)
3656{
3657 return ~(a | b);
3658}
3659
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003660static vector int __ATTRS_o_ai
3661vec_nor(vector int a, vector int b)
3662{
3663 return ~(a | b);
3664}
3665
3666static vector unsigned int __ATTRS_o_ai
3667vec_nor(vector unsigned int a, vector unsigned int b)
3668{
3669 return ~(a | b);
3670}
3671
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003672static vector bool int __ATTRS_o_ai
3673vec_nor(vector bool int a, vector bool int b)
3674{
3675 return ~(a | b);
3676}
3677
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003678static vector float __ATTRS_o_ai
3679vec_nor(vector float a, vector float b)
3680{
3681 vector unsigned int res = ~((vector unsigned int)a | (vector unsigned int)b);
3682 return (vector float)res;
3683}
3684
3685/* vec_vnor */
3686
3687static vector signed char __ATTRS_o_ai
3688vec_vnor(vector signed char a, vector signed char b)
3689{
3690 return ~(a | b);
3691}
3692
3693static vector unsigned char __ATTRS_o_ai
3694vec_vnor(vector unsigned char a, vector unsigned char b)
3695{
3696 return ~(a | b);
3697}
3698
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003699static vector bool char __ATTRS_o_ai
3700vec_vnor(vector bool char a, vector bool char b)
3701{
3702 return ~(a | b);
3703}
3704
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003705static vector short __ATTRS_o_ai
3706vec_vnor(vector short a, vector short b)
3707{
3708 return ~(a | b);
3709}
3710
3711static vector unsigned short __ATTRS_o_ai
3712vec_vnor(vector unsigned short a, vector unsigned short b)
3713{
3714 return ~(a | b);
3715}
3716
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003717static vector bool short __ATTRS_o_ai
3718vec_vnor(vector bool short a, vector bool short b)
3719{
3720 return ~(a | b);
3721}
3722
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003723static vector int __ATTRS_o_ai
3724vec_vnor(vector int a, vector int b)
3725{
3726 return ~(a | b);
3727}
3728
3729static vector unsigned int __ATTRS_o_ai
3730vec_vnor(vector unsigned int a, vector unsigned int b)
3731{
3732 return ~(a | b);
3733}
3734
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003735static vector bool int __ATTRS_o_ai
3736vec_vnor(vector bool int a, vector bool int b)
3737{
3738 return ~(a | b);
3739}
3740
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003741static vector float __ATTRS_o_ai
3742vec_vnor(vector float a, vector float b)
3743{
3744 vector unsigned int res = ~((vector unsigned int)a | (vector unsigned int)b);
3745 return (vector float)res;
3746}
3747
3748/* vec_or */
3749
3750#define __builtin_altivec_vor vec_or
3751
3752static vector signed char __ATTRS_o_ai
3753vec_or(vector signed char a, vector signed char b)
3754{
3755 return a | b;
3756}
3757
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003758static vector signed char __ATTRS_o_ai
3759vec_or(vector bool char a, vector signed char b)
3760{
3761 return (vector signed char)a | b;
3762}
3763
3764static vector signed char __ATTRS_o_ai
3765vec_or(vector signed char a, vector bool char b)
3766{
3767 return a | (vector signed char)b;
3768}
3769
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003770static vector unsigned char __ATTRS_o_ai
3771vec_or(vector unsigned char a, vector unsigned char b)
3772{
3773 return a | b;
3774}
3775
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003776static vector unsigned char __ATTRS_o_ai
3777vec_or(vector bool char a, vector unsigned char b)
3778{
3779 return (vector unsigned char)a | b;
3780}
3781
3782static vector unsigned char __ATTRS_o_ai
3783vec_or(vector unsigned char a, vector bool char b)
3784{
3785 return a | (vector unsigned char)b;
3786}
3787
3788static vector bool char __ATTRS_o_ai
3789vec_or(vector bool char a, vector bool char b)
3790{
3791 return a | b;
3792}
3793
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003794static vector short __ATTRS_o_ai
3795vec_or(vector short a, vector short b)
3796{
3797 return a | b;
3798}
3799
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003800static vector short __ATTRS_o_ai
3801vec_or(vector bool short a, vector short b)
3802{
3803 return (vector short)a | b;
3804}
3805
3806static vector short __ATTRS_o_ai
3807vec_or(vector short a, vector bool short b)
3808{
3809 return a | (vector short)b;
3810}
3811
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003812static vector unsigned short __ATTRS_o_ai
3813vec_or(vector unsigned short a, vector unsigned short b)
3814{
3815 return a | b;
3816}
3817
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003818static vector unsigned short __ATTRS_o_ai
3819vec_or(vector bool short a, vector unsigned short b)
3820{
3821 return (vector unsigned short)a | b;
3822}
3823
3824static vector unsigned short __ATTRS_o_ai
3825vec_or(vector unsigned short a, vector bool short b)
3826{
3827 return a | (vector unsigned short)b;
3828}
3829
3830static vector bool short __ATTRS_o_ai
3831vec_or(vector bool short a, vector bool short b)
3832{
3833 return a | b;
3834}
3835
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003836static vector int __ATTRS_o_ai
3837vec_or(vector int a, vector int b)
3838{
3839 return a | b;
3840}
3841
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003842static vector int __ATTRS_o_ai
3843vec_or(vector bool int a, vector int b)
3844{
3845 return (vector int)a | b;
3846}
3847
3848static vector int __ATTRS_o_ai
3849vec_or(vector int a, vector bool int b)
3850{
3851 return a | (vector int)b;
3852}
3853
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003854static vector unsigned int __ATTRS_o_ai
3855vec_or(vector unsigned int a, vector unsigned int b)
3856{
3857 return a | b;
3858}
3859
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003860static vector unsigned int __ATTRS_o_ai
3861vec_or(vector bool int a, vector unsigned int b)
3862{
3863 return (vector unsigned int)a | b;
3864}
3865
3866static vector unsigned int __ATTRS_o_ai
3867vec_or(vector unsigned int a, vector bool int b)
3868{
3869 return a | (vector unsigned int)b;
3870}
3871
3872static vector bool int __ATTRS_o_ai
3873vec_or(vector bool int a, vector bool int b)
3874{
3875 return a | b;
3876}
3877
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003878static vector float __ATTRS_o_ai
3879vec_or(vector float a, vector float b)
3880{
3881 vector unsigned int res = (vector unsigned int)a | (vector unsigned int)b;
3882 return (vector float)res;
3883}
3884
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003885static vector float __ATTRS_o_ai
3886vec_or(vector bool int a, vector float b)
3887{
3888 vector unsigned int res = (vector unsigned int)a | (vector unsigned int)b;
3889 return (vector float)res;
3890}
3891
3892static vector float __ATTRS_o_ai
3893vec_or(vector float a, vector bool int b)
3894{
3895 vector unsigned int res = (vector unsigned int)a | (vector unsigned int)b;
3896 return (vector float)res;
3897}
3898
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003899/* vec_vor */
3900
3901static vector signed char __ATTRS_o_ai
3902vec_vor(vector signed char a, vector signed char b)
3903{
3904 return a | b;
3905}
3906
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003907static vector signed char __ATTRS_o_ai
3908vec_vor(vector bool char a, vector signed char b)
3909{
3910 return (vector signed char)a | b;
3911}
3912
3913static vector signed char __ATTRS_o_ai
3914vec_vor(vector signed char a, vector bool char b)
3915{
3916 return a | (vector signed char)b;
3917}
3918
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003919static vector unsigned char __ATTRS_o_ai
3920vec_vor(vector unsigned char a, vector unsigned char b)
3921{
3922 return a | b;
3923}
3924
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003925static vector unsigned char __ATTRS_o_ai
3926vec_vor(vector bool char a, vector unsigned char b)
3927{
3928 return (vector unsigned char)a | b;
3929}
3930
3931static vector unsigned char __ATTRS_o_ai
3932vec_vor(vector unsigned char a, vector bool char b)
3933{
3934 return a | (vector unsigned char)b;
3935}
3936
3937static vector bool char __ATTRS_o_ai
3938vec_vor(vector bool char a, vector bool char b)
3939{
3940 return a | b;
3941}
3942
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003943static vector short __ATTRS_o_ai
3944vec_vor(vector short a, vector short b)
3945{
3946 return a | b;
3947}
3948
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003949static vector short __ATTRS_o_ai
3950vec_vor(vector bool short a, vector short b)
3951{
3952 return (vector short)a | b;
3953}
3954
3955static vector short __ATTRS_o_ai
3956vec_vor(vector short a, vector bool short b)
3957{
3958 return a | (vector short)b;
3959}
3960
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003961static vector unsigned short __ATTRS_o_ai
3962vec_vor(vector unsigned short a, vector unsigned short b)
3963{
3964 return a | b;
3965}
3966
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003967static vector unsigned short __ATTRS_o_ai
3968vec_vor(vector bool short a, vector unsigned short b)
3969{
3970 return (vector unsigned short)a | b;
3971}
3972
3973static vector unsigned short __ATTRS_o_ai
3974vec_vor(vector unsigned short a, vector bool short b)
3975{
3976 return a | (vector unsigned short)b;
3977}
3978
3979static vector bool short __ATTRS_o_ai
3980vec_vor(vector bool short a, vector bool short b)
3981{
3982 return a | b;
3983}
3984
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003985static vector int __ATTRS_o_ai
3986vec_vor(vector int a, vector int b)
3987{
3988 return a | b;
3989}
3990
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003991static vector int __ATTRS_o_ai
3992vec_vor(vector bool int a, vector int b)
3993{
3994 return (vector int)a | b;
3995}
3996
3997static vector int __ATTRS_o_ai
3998vec_vor(vector int a, vector bool int b)
3999{
4000 return a | (vector int)b;
4001}
4002
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004003static vector unsigned int __ATTRS_o_ai
4004vec_vor(vector unsigned int a, vector unsigned int b)
4005{
4006 return a | b;
4007}
4008
Anton Yartseva2fc0f52010-08-19 03:21:36 +00004009static vector unsigned int __ATTRS_o_ai
4010vec_vor(vector bool int a, vector unsigned int b)
4011{
4012 return (vector unsigned int)a | b;
4013}
4014
4015static vector unsigned int __ATTRS_o_ai
4016vec_vor(vector unsigned int a, vector bool int b)
4017{
4018 return a | (vector unsigned int)b;
4019}
4020
4021static vector bool int __ATTRS_o_ai
4022vec_vor(vector bool int a, vector bool int b)
4023{
4024 return a | b;
4025}
4026
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004027static vector float __ATTRS_o_ai
4028vec_vor(vector float a, vector float b)
4029{
4030 vector unsigned int res = (vector unsigned int)a | (vector unsigned int)b;
4031 return (vector float)res;
4032}
4033
Anton Yartseva2fc0f52010-08-19 03:21:36 +00004034static vector float __ATTRS_o_ai
4035vec_vor(vector bool int a, vector float b)
4036{
4037 vector unsigned int res = (vector unsigned int)a | (vector unsigned int)b;
4038 return (vector float)res;
4039}
4040
4041static vector float __ATTRS_o_ai
4042vec_vor(vector float a, vector bool int b)
4043{
4044 vector unsigned int res = (vector unsigned int)a | (vector unsigned int)b;
4045 return (vector float)res;
4046}
4047
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004048/* vec_pack */
4049
4050static vector signed char __ATTRS_o_ai
4051vec_pack(vector signed short a, vector signed short b)
4052{
4053 return (vector signed char)vec_perm(a, b, (vector unsigned char)
4054 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4055 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
4056}
4057
4058static vector unsigned char __ATTRS_o_ai
4059vec_pack(vector unsigned short a, vector unsigned short b)
4060{
4061 return (vector unsigned char)vec_perm(a, b, (vector unsigned char)
4062 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4063 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
4064}
4065
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004066static vector bool char __ATTRS_o_ai
4067vec_pack(vector bool short a, vector bool short b)
4068{
4069 return (vector bool char)vec_perm(a, b, (vector unsigned char)
4070 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4071 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
4072}
4073
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004074static vector short __ATTRS_o_ai
4075vec_pack(vector int a, vector int b)
4076{
4077 return (vector short)vec_perm(a, b, (vector unsigned char)
4078 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4079 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
4080}
4081
4082static vector unsigned short __ATTRS_o_ai
4083vec_pack(vector unsigned int a, vector unsigned int b)
4084{
4085 return (vector unsigned short)vec_perm(a, b, (vector unsigned char)
4086 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4087 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
4088}
4089
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004090static vector bool short __ATTRS_o_ai
4091vec_pack(vector bool int a, vector bool int b)
4092{
4093 return (vector bool short)vec_perm(a, b, (vector unsigned char)
4094 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4095 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
4096}
4097
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004098/* vec_vpkuhum */
4099
4100#define __builtin_altivec_vpkuhum vec_vpkuhum
4101
4102static vector signed char __ATTRS_o_ai
4103vec_vpkuhum(vector signed short a, vector signed short b)
4104{
4105 return (vector signed char)vec_perm(a, b, (vector unsigned char)
4106 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4107 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
4108}
4109
4110static vector unsigned char __ATTRS_o_ai
4111vec_vpkuhum(vector unsigned short a, vector unsigned short b)
4112{
4113 return (vector unsigned char)vec_perm(a, b, (vector unsigned char)
4114 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4115 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
4116}
4117
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004118static vector bool char __ATTRS_o_ai
4119vec_vpkuhum(vector bool short a, vector bool short b)
4120{
4121 return (vector bool char)vec_perm(a, b, (vector unsigned char)
4122 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4123 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
4124}
4125
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004126/* vec_vpkuwum */
4127
4128#define __builtin_altivec_vpkuwum vec_vpkuwum
4129
4130static vector short __ATTRS_o_ai
4131vec_vpkuwum(vector int a, vector int b)
4132{
4133 return (vector short)vec_perm(a, b, (vector unsigned char)
4134 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4135 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
4136}
4137
4138static vector unsigned short __ATTRS_o_ai
4139vec_vpkuwum(vector unsigned int a, vector unsigned int b)
4140{
4141 return (vector unsigned short)vec_perm(a, b, (vector unsigned char)
4142 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4143 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
4144}
4145
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004146static vector bool short __ATTRS_o_ai
4147vec_vpkuwum(vector bool int a, vector bool int b)
4148{
4149 return (vector bool short)vec_perm(a, b, (vector unsigned char)
4150 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4151 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
4152}
4153
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004154/* vec_packpx */
4155
4156static vector pixel __attribute__((__always_inline__))
4157vec_packpx(vector unsigned int a, vector unsigned int b)
4158{
4159 return (vector pixel)__builtin_altivec_vpkpx(a, b);
4160}
4161
4162/* vec_vpkpx */
4163
4164static vector pixel __attribute__((__always_inline__))
4165vec_vpkpx(vector unsigned int a, vector unsigned int b)
4166{
4167 return (vector pixel)__builtin_altivec_vpkpx(a, b);
4168}
4169
4170/* vec_packs */
4171
4172static vector signed char __ATTRS_o_ai
4173vec_packs(vector short a, vector short b)
4174{
4175 return __builtin_altivec_vpkshss(a, b);
4176}
4177
4178static vector unsigned char __ATTRS_o_ai
4179vec_packs(vector unsigned short a, vector unsigned short b)
4180{
4181 return __builtin_altivec_vpkuhus(a, b);
4182}
4183
4184static vector signed short __ATTRS_o_ai
4185vec_packs(vector int a, vector int b)
4186{
4187 return __builtin_altivec_vpkswss(a, b);
4188}
4189
4190static vector unsigned short __ATTRS_o_ai
4191vec_packs(vector unsigned int a, vector unsigned int b)
4192{
4193 return __builtin_altivec_vpkuwus(a, b);
4194}
4195
4196/* vec_vpkshss */
4197
4198static vector signed char __attribute__((__always_inline__))
4199vec_vpkshss(vector short a, vector short b)
4200{
4201 return __builtin_altivec_vpkshss(a, b);
4202}
4203
4204/* vec_vpkuhus */
4205
4206static vector unsigned char __attribute__((__always_inline__))
4207vec_vpkuhus(vector unsigned short a, vector unsigned short b)
4208{
4209 return __builtin_altivec_vpkuhus(a, b);
4210}
4211
4212/* vec_vpkswss */
4213
4214static vector signed short __attribute__((__always_inline__))
4215vec_vpkswss(vector int a, vector int b)
4216{
4217 return __builtin_altivec_vpkswss(a, b);
4218}
4219
4220/* vec_vpkuwus */
4221
4222static vector unsigned short __attribute__((__always_inline__))
4223vec_vpkuwus(vector unsigned int a, vector unsigned int b)
4224{
4225 return __builtin_altivec_vpkuwus(a, b);
4226}
4227
4228/* vec_packsu */
4229
4230static vector unsigned char __ATTRS_o_ai
4231vec_packsu(vector short a, vector short b)
4232{
4233 return __builtin_altivec_vpkshus(a, b);
4234}
4235
4236static vector unsigned char __ATTRS_o_ai
4237vec_packsu(vector unsigned short a, vector unsigned short b)
4238{
4239 return __builtin_altivec_vpkuhus(a, b);
4240}
4241
4242static vector unsigned short __ATTRS_o_ai
4243vec_packsu(vector int a, vector int b)
4244{
4245 return __builtin_altivec_vpkswus(a, b);
4246}
4247
4248static vector unsigned short __ATTRS_o_ai
4249vec_packsu(vector unsigned int a, vector unsigned int b)
4250{
4251 return __builtin_altivec_vpkuwus(a, b);
4252}
4253
4254/* vec_vpkshus */
4255
4256static vector unsigned char __ATTRS_o_ai
4257vec_vpkshus(vector short a, vector short b)
4258{
4259 return __builtin_altivec_vpkshus(a, b);
4260}
4261
4262static vector unsigned char __ATTRS_o_ai
4263vec_vpkshus(vector unsigned short a, vector unsigned short b)
4264{
4265 return __builtin_altivec_vpkuhus(a, b);
4266}
4267
4268/* vec_vpkswus */
4269
4270static vector unsigned short __ATTRS_o_ai
4271vec_vpkswus(vector int a, vector int b)
4272{
4273 return __builtin_altivec_vpkswus(a, b);
4274}
4275
4276static vector unsigned short __ATTRS_o_ai
4277vec_vpkswus(vector unsigned int a, vector unsigned int b)
4278{
4279 return __builtin_altivec_vpkuwus(a, b);
4280}
4281
4282/* vec_perm */
4283
4284vector signed char __ATTRS_o_ai
4285vec_perm(vector signed char a, vector signed char b, vector unsigned char c)
4286{
Anton Yartsev3ed32722010-09-18 00:39:16 +00004287 return (vector signed char)
4288 __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004289}
4290
4291vector unsigned char __ATTRS_o_ai
Anton Yartsev3ed32722010-09-18 00:39:16 +00004292vec_perm(vector unsigned char a,
4293 vector unsigned char b,
4294 vector unsigned char c)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004295{
Anton Yartsev3ed32722010-09-18 00:39:16 +00004296 return (vector unsigned char)
4297 __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004298}
4299
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004300vector bool char __ATTRS_o_ai
4301vec_perm(vector bool char a, vector bool char b, vector unsigned char c)
4302{
Anton Yartsev3ed32722010-09-18 00:39:16 +00004303 return (vector bool char)
4304 __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004305}
4306
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004307vector short __ATTRS_o_ai
4308vec_perm(vector short a, vector short b, vector unsigned char c)
4309{
Anton Yartsev3ed32722010-09-18 00:39:16 +00004310 return (vector short)
4311 __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004312}
4313
4314vector unsigned short __ATTRS_o_ai
Anton Yartsev3ed32722010-09-18 00:39:16 +00004315vec_perm(vector unsigned short a,
4316 vector unsigned short b,
4317 vector unsigned char c)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004318{
Anton Yartsev3ed32722010-09-18 00:39:16 +00004319 return (vector unsigned short)
4320 __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004321}
4322
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004323vector bool short __ATTRS_o_ai
4324vec_perm(vector bool short a, vector bool short b, vector unsigned char c)
4325{
Anton Yartsev3ed32722010-09-18 00:39:16 +00004326 return (vector bool short)
4327 __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004328}
4329
4330vector pixel __ATTRS_o_ai
4331vec_perm(vector pixel a, vector pixel b, vector unsigned char c)
4332{
Anton Yartsev3ed32722010-09-18 00:39:16 +00004333 return (vector pixel)
4334 __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004335}
4336
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004337vector int __ATTRS_o_ai
4338vec_perm(vector int a, vector int b, vector unsigned char c)
4339{
4340 return (vector int)__builtin_altivec_vperm_4si(a, b, c);
4341}
4342
4343vector unsigned int __ATTRS_o_ai
4344vec_perm(vector unsigned int a, vector unsigned int b, vector unsigned char c)
4345{
Anton Yartsev3ed32722010-09-18 00:39:16 +00004346 return (vector unsigned int)
4347 __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004348}
4349
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004350vector bool int __ATTRS_o_ai
4351vec_perm(vector bool int a, vector bool int b, vector unsigned char c)
4352{
Anton Yartsev3ed32722010-09-18 00:39:16 +00004353 return (vector bool int)
4354 __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004355}
4356
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004357vector float __ATTRS_o_ai
4358vec_perm(vector float a, vector float b, vector unsigned char c)
4359{
Anton Yartsev3ed32722010-09-18 00:39:16 +00004360 return (vector float)
4361 __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004362}
4363
4364/* vec_vperm */
4365
4366vector signed char __ATTRS_o_ai
4367vec_vperm(vector signed char a, vector signed char b, vector unsigned char c)
4368{
Anton Yartsev3ed32722010-09-18 00:39:16 +00004369 return (vector signed char)
4370 __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004371}
4372
4373vector unsigned char __ATTRS_o_ai
Anton Yartsev3ed32722010-09-18 00:39:16 +00004374vec_vperm(vector unsigned char a,
4375 vector unsigned char b,
4376 vector unsigned char c)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004377{
Anton Yartsev3ed32722010-09-18 00:39:16 +00004378 return (vector unsigned char)
4379 __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004380}
4381
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004382vector bool char __ATTRS_o_ai
4383vec_vperm(vector bool char a, vector bool char b, vector unsigned char c)
4384{
Anton Yartsev3ed32722010-09-18 00:39:16 +00004385 return (vector bool char)
4386 __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004387}
4388
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004389vector short __ATTRS_o_ai
4390vec_vperm(vector short a, vector short b, vector unsigned char c)
4391{
Anton Yartsev3ed32722010-09-18 00:39:16 +00004392 return (vector short)
4393 __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004394}
4395
4396vector unsigned short __ATTRS_o_ai
Anton Yartsev3ed32722010-09-18 00:39:16 +00004397vec_vperm(vector unsigned short a,
4398 vector unsigned short b,
4399 vector unsigned char c)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004400{
Anton Yartsev3ed32722010-09-18 00:39:16 +00004401 return (vector unsigned short)
4402 __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004403}
4404
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004405vector bool short __ATTRS_o_ai
4406vec_vperm(vector bool short a, vector bool short b, vector unsigned char c)
4407{
Anton Yartsev3ed32722010-09-18 00:39:16 +00004408 return (vector bool short)
4409 __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004410}
4411
4412vector pixel __ATTRS_o_ai
4413vec_vperm(vector pixel a, vector pixel b, vector unsigned char c)
4414{
Anton Yartsev3ed32722010-09-18 00:39:16 +00004415 return (vector pixel)
4416 __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004417}
4418
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004419vector int __ATTRS_o_ai
4420vec_vperm(vector int a, vector int b, vector unsigned char c)
4421{
4422 return (vector int)__builtin_altivec_vperm_4si(a, b, c);
4423}
4424
4425vector unsigned int __ATTRS_o_ai
4426vec_vperm(vector unsigned int a, vector unsigned int b, vector unsigned char c)
4427{
Anton Yartsev3ed32722010-09-18 00:39:16 +00004428 return (vector unsigned int)
4429 __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004430}
4431
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004432vector bool int __ATTRS_o_ai
4433vec_vperm(vector bool int a, vector bool int b, vector unsigned char c)
4434{
Anton Yartsev3ed32722010-09-18 00:39:16 +00004435 return (vector bool int)
4436 __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004437}
4438
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004439vector float __ATTRS_o_ai
4440vec_vperm(vector float a, vector float b, vector unsigned char c)
4441{
Anton Yartsev3ed32722010-09-18 00:39:16 +00004442 return (vector float)
4443 __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004444}
4445
4446/* vec_re */
4447
4448vector float __attribute__((__always_inline__))
4449vec_re(vector float a)
4450{
4451 return __builtin_altivec_vrefp(a);
4452}
4453
4454/* vec_vrefp */
4455
4456vector float __attribute__((__always_inline__))
4457vec_vrefp(vector float a)
4458{
4459 return __builtin_altivec_vrefp(a);
4460}
4461
4462/* vec_rl */
4463
4464static vector signed char __ATTRS_o_ai
4465vec_rl(vector signed char a, vector unsigned char b)
4466{
4467 return (vector signed char)__builtin_altivec_vrlb((vector char)a, b);
4468}
4469
4470static vector unsigned char __ATTRS_o_ai
4471vec_rl(vector unsigned char a, vector unsigned char b)
4472{
4473 return (vector unsigned char)__builtin_altivec_vrlb((vector char)a, b);
4474}
4475
4476static vector short __ATTRS_o_ai
4477vec_rl(vector short a, vector unsigned short b)
4478{
4479 return __builtin_altivec_vrlh(a, b);
4480}
4481
4482static vector unsigned short __ATTRS_o_ai
4483vec_rl(vector unsigned short a, vector unsigned short b)
4484{
4485 return (vector unsigned short)__builtin_altivec_vrlh((vector short)a, b);
4486}
4487
4488static vector int __ATTRS_o_ai
4489vec_rl(vector int a, vector unsigned int b)
4490{
4491 return __builtin_altivec_vrlw(a, b);
4492}
4493
4494static vector unsigned int __ATTRS_o_ai
4495vec_rl(vector unsigned int a, vector unsigned int b)
4496{
4497 return (vector unsigned int)__builtin_altivec_vrlw((vector int)a, b);
4498}
4499
4500/* vec_vrlb */
4501
4502static vector signed char __ATTRS_o_ai
4503vec_vrlb(vector signed char a, vector unsigned char b)
4504{
4505 return (vector signed char)__builtin_altivec_vrlb((vector char)a, b);
4506}
4507
4508static vector unsigned char __ATTRS_o_ai
4509vec_vrlb(vector unsigned char a, vector unsigned char b)
4510{
4511 return (vector unsigned char)__builtin_altivec_vrlb((vector char)a, b);
4512}
4513
4514/* vec_vrlh */
4515
4516static vector short __ATTRS_o_ai
4517vec_vrlh(vector short a, vector unsigned short b)
4518{
4519 return __builtin_altivec_vrlh(a, b);
4520}
4521
4522static vector unsigned short __ATTRS_o_ai
4523vec_vrlh(vector unsigned short a, vector unsigned short b)
4524{
4525 return (vector unsigned short)__builtin_altivec_vrlh((vector short)a, b);
4526}
4527
4528/* vec_vrlw */
4529
4530static vector int __ATTRS_o_ai
4531vec_vrlw(vector int a, vector unsigned int b)
4532{
4533 return __builtin_altivec_vrlw(a, b);
4534}
4535
4536static vector unsigned int __ATTRS_o_ai
4537vec_vrlw(vector unsigned int a, vector unsigned int b)
4538{
4539 return (vector unsigned int)__builtin_altivec_vrlw((vector int)a, b);
4540}
4541
4542/* vec_round */
4543
4544static vector float __attribute__((__always_inline__))
4545vec_round(vector float a)
4546{
4547 return __builtin_altivec_vrfin(a);
4548}
4549
4550/* vec_vrfin */
4551
4552static vector float __attribute__((__always_inline__))
4553vec_vrfin(vector float a)
4554{
4555 return __builtin_altivec_vrfin(a);
4556}
4557
4558/* vec_rsqrte */
4559
4560static __vector float __attribute__((__always_inline__))
4561vec_rsqrte(vector float a)
4562{
4563 return __builtin_altivec_vrsqrtefp(a);
4564}
4565
4566/* vec_vrsqrtefp */
4567
4568static __vector float __attribute__((__always_inline__))
4569vec_vrsqrtefp(vector float a)
4570{
4571 return __builtin_altivec_vrsqrtefp(a);
4572}
4573
4574/* vec_sel */
4575
4576#define __builtin_altivec_vsel_4si vec_sel
4577
4578static vector signed char __ATTRS_o_ai
4579vec_sel(vector signed char a, vector signed char b, vector unsigned char c)
4580{
4581 return (a & ~(vector signed char)c) | (b & (vector signed char)c);
4582}
4583
Anton Yartseva2fc0f52010-08-19 03:21:36 +00004584static vector signed char __ATTRS_o_ai
4585vec_sel(vector signed char a, vector signed char b, vector bool char c)
4586{
4587 return (a & ~(vector signed char)c) | (b & (vector signed char)c);
4588}
4589
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004590static vector unsigned char __ATTRS_o_ai
4591vec_sel(vector unsigned char a, vector unsigned char b, vector unsigned char c)
4592{
4593 return (a & ~c) | (b & c);
4594}
4595
Anton Yartseva2fc0f52010-08-19 03:21:36 +00004596static vector unsigned char __ATTRS_o_ai
4597vec_sel(vector unsigned char a, vector unsigned char b, vector bool char c)
4598{
4599 return (a & ~(vector unsigned char)c) | (b & (vector unsigned char)c);
4600}
4601
4602static vector bool char __ATTRS_o_ai
4603vec_sel(vector bool char a, vector bool char b, vector unsigned char c)
4604{
4605 return (a & ~(vector bool char)c) | (b & (vector bool char)c);
4606}
4607
4608static vector bool char __ATTRS_o_ai
4609vec_sel(vector bool char a, vector bool char b, vector bool char c)
4610{
4611 return (a & ~c) | (b & c);
4612}
4613
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004614static vector short __ATTRS_o_ai
4615vec_sel(vector short a, vector short b, vector unsigned short c)
4616{
4617 return (a & ~(vector short)c) | (b & (vector short)c);
4618}
4619
Anton Yartseva2fc0f52010-08-19 03:21:36 +00004620static vector short __ATTRS_o_ai
4621vec_sel(vector short a, vector short b, vector bool short c)
4622{
4623 return (a & ~(vector short)c) | (b & (vector short)c);
4624}
4625
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004626static vector unsigned short __ATTRS_o_ai
Anton Yartsev3ed32722010-09-18 00:39:16 +00004627vec_sel(vector unsigned short a,
4628 vector unsigned short b,
4629 vector unsigned short c)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004630{
4631 return (a & ~c) | (b & c);
4632}
4633
Anton Yartseva2fc0f52010-08-19 03:21:36 +00004634static vector unsigned short __ATTRS_o_ai
4635vec_sel(vector unsigned short a, vector unsigned short b, vector bool short c)
4636{
4637 return (a & ~(vector unsigned short)c) | (b & (vector unsigned short)c);
4638}
4639
4640static vector bool short __ATTRS_o_ai
4641vec_sel(vector bool short a, vector bool short b, vector unsigned short c)
4642{
4643 return (a & ~(vector bool short)c) | (b & (vector bool short)c);
4644}
4645
4646static vector bool short __ATTRS_o_ai
4647vec_sel(vector bool short a, vector bool short b, vector bool short c)
4648{
4649 return (a & ~c) | (b & c);
4650}
4651
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004652static vector int __ATTRS_o_ai
4653vec_sel(vector int a, vector int b, vector unsigned int c)
4654{
4655 return (a & ~(vector int)c) | (b & (vector int)c);
4656}
4657
Anton Yartseva2fc0f52010-08-19 03:21:36 +00004658static vector int __ATTRS_o_ai
4659vec_sel(vector int a, vector int b, vector bool int c)
4660{
4661 return (a & ~(vector int)c) | (b & (vector int)c);
4662}
4663
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004664static vector unsigned int __ATTRS_o_ai
4665vec_sel(vector unsigned int a, vector unsigned int b, vector unsigned int c)
4666{
4667 return (a & ~c) | (b & c);
4668}
4669
Anton Yartseva2fc0f52010-08-19 03:21:36 +00004670static vector unsigned int __ATTRS_o_ai
4671vec_sel(vector unsigned int a, vector unsigned int b, vector bool int c)
4672{
4673 return (a & ~(vector unsigned int)c) | (b & (vector unsigned int)c);
4674}
4675
4676static vector bool int __ATTRS_o_ai
4677vec_sel(vector bool int a, vector bool int b, vector unsigned int c)
4678{
4679 return (a & ~(vector bool int)c) | (b & (vector bool int)c);
4680}
4681
4682static vector bool int __ATTRS_o_ai
4683vec_sel(vector bool int a, vector bool int b, vector bool int c)
4684{
4685 return (a & ~c) | (b & c);
4686}
4687
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004688static vector float __ATTRS_o_ai
4689vec_sel(vector float a, vector float b, vector unsigned int c)
4690{
Anton Yartsev3ed32722010-09-18 00:39:16 +00004691 vector int res = ((vector int)a & ~(vector int)c)
4692 | ((vector int)b & (vector int)c);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004693 return (vector float)res;
4694}
4695
Anton Yartseva2fc0f52010-08-19 03:21:36 +00004696static vector float __ATTRS_o_ai
4697vec_sel(vector float a, vector float b, vector bool int c)
4698{
Anton Yartsev3ed32722010-09-18 00:39:16 +00004699 vector int res = ((vector int)a & ~(vector int)c)
4700 | ((vector int)b & (vector int)c);
Anton Yartseva2fc0f52010-08-19 03:21:36 +00004701 return (vector float)res;
4702}
4703
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004704/* vec_vsel */
4705
4706static vector signed char __ATTRS_o_ai
4707vec_vsel(vector signed char a, vector signed char b, vector unsigned char c)
4708{
4709 return (a & ~(vector signed char)c) | (b & (vector signed char)c);
4710}
4711
Anton Yartseva2fc0f52010-08-19 03:21:36 +00004712static vector signed char __ATTRS_o_ai
4713vec_vsel(vector signed char a, vector signed char b, vector bool char c)
4714{
4715 return (a & ~(vector signed char)c) | (b & (vector signed char)c);
4716}
4717
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004718static vector unsigned char __ATTRS_o_ai
4719vec_vsel(vector unsigned char a, vector unsigned char b, vector unsigned char c)
4720{
4721 return (a & ~c) | (b & c);
4722}
4723
Anton Yartseva2fc0f52010-08-19 03:21:36 +00004724static vector unsigned char __ATTRS_o_ai
4725vec_vsel(vector unsigned char a, vector unsigned char b, vector bool char c)
4726{
4727 return (a & ~(vector unsigned char)c) | (b & (vector unsigned char)c);
4728}
4729
4730static vector bool char __ATTRS_o_ai
4731vec_vsel(vector bool char a, vector bool char b, vector unsigned char c)
4732{
4733 return (a & ~(vector bool char)c) | (b & (vector bool char)c);
4734}
4735
4736static vector bool char __ATTRS_o_ai
4737vec_vsel(vector bool char a, vector bool char b, vector bool char c)
4738{
4739 return (a & ~c) | (b & c);
4740}
4741
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004742static vector short __ATTRS_o_ai
4743vec_vsel(vector short a, vector short b, vector unsigned short c)
4744{
4745 return (a & ~(vector short)c) | (b & (vector short)c);
4746}
4747
Anton Yartseva2fc0f52010-08-19 03:21:36 +00004748static vector short __ATTRS_o_ai
4749vec_vsel(vector short a, vector short b, vector bool short c)
4750{
4751 return (a & ~(vector short)c) | (b & (vector short)c);
4752}
4753
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004754static vector unsigned short __ATTRS_o_ai
Anton Yartsev3ed32722010-09-18 00:39:16 +00004755vec_vsel(vector unsigned short a,
4756 vector unsigned short b,
4757 vector unsigned short c)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004758{
4759 return (a & ~c) | (b & c);
4760}
4761
Anton Yartseva2fc0f52010-08-19 03:21:36 +00004762static vector unsigned short __ATTRS_o_ai
4763vec_vsel(vector unsigned short a, vector unsigned short b, vector bool short c)
4764{
4765 return (a & ~(vector unsigned short)c) | (b & (vector unsigned short)c);
4766}
4767
4768static vector bool short __ATTRS_o_ai
4769vec_vsel(vector bool short a, vector bool short b, vector unsigned short c)
4770{
4771 return (a & ~(vector bool short)c) | (b & (vector bool short)c);
4772}
4773
4774static vector bool short __ATTRS_o_ai
4775vec_vsel(vector bool short a, vector bool short b, vector bool short c)
4776{
4777 return (a & ~c) | (b & c);
4778}
4779
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004780static vector int __ATTRS_o_ai
4781vec_vsel(vector int a, vector int b, vector unsigned int c)
4782{
4783 return (a & ~(vector int)c) | (b & (vector int)c);
4784}
4785
Anton Yartseva2fc0f52010-08-19 03:21:36 +00004786static vector int __ATTRS_o_ai
4787vec_vsel(vector int a, vector int b, vector bool int c)
4788{
4789 return (a & ~(vector int)c) | (b & (vector int)c);
4790}
4791
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004792static vector unsigned int __ATTRS_o_ai
4793vec_vsel(vector unsigned int a, vector unsigned int b, vector unsigned int c)
4794{
4795 return (a & ~c) | (b & c);
4796}
4797
Anton Yartseva2fc0f52010-08-19 03:21:36 +00004798static vector unsigned int __ATTRS_o_ai
4799vec_vsel(vector unsigned int a, vector unsigned int b, vector bool int c)
4800{
4801 return (a & ~(vector unsigned int)c) | (b & (vector unsigned int)c);
4802}
4803
4804static vector bool int __ATTRS_o_ai
4805vec_vsel(vector bool int a, vector bool int b, vector unsigned int c)
4806{
4807 return (a & ~(vector bool int)c) | (b & (vector bool int)c);
4808}
4809
4810static vector bool int __ATTRS_o_ai
4811vec_vsel(vector bool int a, vector bool int b, vector bool int c)
4812{
4813 return (a & ~c) | (b & c);
4814}
4815
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004816static vector float __ATTRS_o_ai
4817vec_vsel(vector float a, vector float b, vector unsigned int c)
4818{
Anton Yartsev3ed32722010-09-18 00:39:16 +00004819 vector int res = ((vector int)a & ~(vector int)c)
4820 | ((vector int)b & (vector int)c);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004821 return (vector float)res;
4822}
4823
Anton Yartseva2fc0f52010-08-19 03:21:36 +00004824static vector float __ATTRS_o_ai
4825vec_vsel(vector float a, vector float b, vector bool int c)
4826{
Anton Yartsev3ed32722010-09-18 00:39:16 +00004827 vector int res = ((vector int)a & ~(vector int)c)
4828 | ((vector int)b & (vector int)c);
Anton Yartseva2fc0f52010-08-19 03:21:36 +00004829 return (vector float)res;
4830}
4831
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004832/* vec_sl */
4833
4834static vector signed char __ATTRS_o_ai
4835vec_sl(vector signed char a, vector unsigned char b)
4836{
4837 return a << (vector signed char)b;
4838}
4839
4840static vector unsigned char __ATTRS_o_ai
4841vec_sl(vector unsigned char a, vector unsigned char b)
4842{
4843 return a << b;
4844}
4845
4846static vector short __ATTRS_o_ai
4847vec_sl(vector short a, vector unsigned short b)
4848{
4849 return a << (vector short)b;
4850}
4851
4852static vector unsigned short __ATTRS_o_ai
4853vec_sl(vector unsigned short a, vector unsigned short b)
4854{
4855 return a << b;
4856}
4857
4858static vector int __ATTRS_o_ai
4859vec_sl(vector int a, vector unsigned int b)
4860{
4861 return a << (vector int)b;
4862}
4863
4864static vector unsigned int __ATTRS_o_ai
4865vec_sl(vector unsigned int a, vector unsigned int b)
4866{
4867 return a << b;
4868}
4869
4870/* vec_vslb */
4871
4872#define __builtin_altivec_vslb vec_vslb
4873
4874static vector signed char __ATTRS_o_ai
4875vec_vslb(vector signed char a, vector unsigned char b)
4876{
4877 return vec_sl(a, b);
4878}
4879
4880static vector unsigned char __ATTRS_o_ai
4881vec_vslb(vector unsigned char a, vector unsigned char b)
4882{
4883 return vec_sl(a, b);
4884}
4885
4886/* vec_vslh */
4887
4888#define __builtin_altivec_vslh vec_vslh
4889
4890static vector short __ATTRS_o_ai
4891vec_vslh(vector short a, vector unsigned short b)
4892{
4893 return vec_sl(a, b);
4894}
4895
4896static vector unsigned short __ATTRS_o_ai
4897vec_vslh(vector unsigned short a, vector unsigned short b)
4898{
4899 return vec_sl(a, b);
4900}
4901
4902/* vec_vslw */
4903
4904#define __builtin_altivec_vslw vec_vslw
4905
4906static vector int __ATTRS_o_ai
4907vec_vslw(vector int a, vector unsigned int b)
4908{
4909 return vec_sl(a, b);
4910}
4911
4912static vector unsigned int __ATTRS_o_ai
4913vec_vslw(vector unsigned int a, vector unsigned int b)
4914{
4915 return vec_sl(a, b);
4916}
4917
4918/* vec_sld */
4919
4920#define __builtin_altivec_vsldoi_4si vec_sld
4921
4922static vector signed char __ATTRS_o_ai
4923vec_sld(vector signed char a, vector signed char b, unsigned char c)
4924{
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004925 return vec_perm(a, b, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004926 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
4927 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
4928}
4929
4930static vector unsigned char __ATTRS_o_ai
4931vec_sld(vector unsigned char a, vector unsigned char b, unsigned char c)
4932{
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004933 return vec_perm(a, b, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004934 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
4935 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
4936}
4937
4938static vector short __ATTRS_o_ai
4939vec_sld(vector short a, vector short b, unsigned char c)
4940{
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004941 return vec_perm(a, b, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004942 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
4943 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
4944}
4945
4946static vector unsigned short __ATTRS_o_ai
4947vec_sld(vector unsigned short a, vector unsigned short b, unsigned char c)
4948{
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004949 return vec_perm(a, b, (vector unsigned char)
4950 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
4951 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
4952}
4953
4954static vector pixel __ATTRS_o_ai
4955vec_sld(vector pixel a, vector pixel b, unsigned char c)
4956{
4957 return vec_perm(a, b, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004958 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
4959 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
4960}
4961
4962static vector int __ATTRS_o_ai
4963vec_sld(vector int a, vector int b, unsigned char c)
4964{
4965 return vec_perm(a, b, (vector unsigned char)
4966 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
4967 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
4968}
4969
4970static vector unsigned int __ATTRS_o_ai
4971vec_sld(vector unsigned int a, vector unsigned int b, unsigned char c)
4972{
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004973 return vec_perm(a, b, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004974 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
4975 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
4976}
4977
4978static vector float __ATTRS_o_ai
4979vec_sld(vector float a, vector float b, unsigned char c)
4980{
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004981 return vec_perm(a, b, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004982 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
4983 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
4984}
4985
4986/* vec_vsldoi */
4987
4988static vector signed char __ATTRS_o_ai
4989vec_vsldoi(vector signed char a, vector signed char b, unsigned char c)
4990{
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004991 return vec_perm(a, b, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004992 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
4993 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
4994}
4995
4996static vector unsigned char __ATTRS_o_ai
4997vec_vsldoi(vector unsigned char a, vector unsigned char b, unsigned char c)
4998{
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004999 return vec_perm(a, b, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005000 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
5001 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
5002}
5003
5004static vector short __ATTRS_o_ai
5005vec_vsldoi(vector short a, vector short b, unsigned char c)
5006{
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00005007 return vec_perm(a, b, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005008 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
5009 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
5010}
5011
5012static vector unsigned short __ATTRS_o_ai
5013vec_vsldoi(vector unsigned short a, vector unsigned short b, unsigned char c)
5014{
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00005015 return vec_perm(a, b, (vector unsigned char)
5016 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
5017 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
5018}
5019
5020static vector pixel __ATTRS_o_ai
5021vec_vsldoi(vector pixel a, vector pixel b, unsigned char c)
5022{
5023 return vec_perm(a, b, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005024 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
5025 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
5026}
5027
5028static vector int __ATTRS_o_ai
5029vec_vsldoi(vector int a, vector int b, unsigned char c)
5030{
5031 return vec_perm(a, b, (vector unsigned char)
5032 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
5033 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
5034}
5035
5036static vector unsigned int __ATTRS_o_ai
5037vec_vsldoi(vector unsigned int a, vector unsigned int b, unsigned char c)
5038{
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00005039 return vec_perm(a, b, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005040 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
5041 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
5042}
5043
5044static vector float __ATTRS_o_ai
5045vec_vsldoi(vector float a, vector float b, unsigned char c)
5046{
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00005047 return vec_perm(a, b, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005048 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
5049 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
5050}
5051
5052/* vec_sll */
5053
5054static vector signed char __ATTRS_o_ai
5055vec_sll(vector signed char a, vector unsigned char b)
5056{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005057 return (vector signed char)
5058 __builtin_altivec_vsl((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005059}
5060
5061static vector signed char __ATTRS_o_ai
5062vec_sll(vector signed char a, vector unsigned short b)
5063{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005064 return (vector signed char)
5065 __builtin_altivec_vsl((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005066}
5067
5068static vector signed char __ATTRS_o_ai
5069vec_sll(vector signed char a, vector unsigned int b)
5070{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005071 return (vector signed char)
5072 __builtin_altivec_vsl((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005073}
5074
5075static vector unsigned char __ATTRS_o_ai
5076vec_sll(vector unsigned char a, vector unsigned char b)
5077{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005078 return (vector unsigned char)
5079 __builtin_altivec_vsl((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005080}
5081
5082static vector unsigned char __ATTRS_o_ai
5083vec_sll(vector unsigned char a, vector unsigned short b)
5084{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005085 return (vector unsigned char)
5086 __builtin_altivec_vsl((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005087}
5088
5089static vector unsigned char __ATTRS_o_ai
5090vec_sll(vector unsigned char a, vector unsigned int b)
5091{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005092 return (vector unsigned char)
5093 __builtin_altivec_vsl((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005094}
5095
Anton Yartseva2fc0f52010-08-19 03:21:36 +00005096static vector bool char __ATTRS_o_ai
5097vec_sll(vector bool char a, vector unsigned char b)
5098{
5099 return (vector bool char)__builtin_altivec_vsl((vector int)a, (vector int)b);
5100}
5101
5102static vector bool char __ATTRS_o_ai
5103vec_sll(vector bool char a, vector unsigned short b)
5104{
5105 return (vector bool char)__builtin_altivec_vsl((vector int)a, (vector int)b);
5106}
5107
5108static vector bool char __ATTRS_o_ai
5109vec_sll(vector bool char a, vector unsigned int b)
5110{
5111 return (vector bool char)__builtin_altivec_vsl((vector int)a, (vector int)b);
5112}
5113
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005114static vector short __ATTRS_o_ai
5115vec_sll(vector short a, vector unsigned char b)
5116{
5117 return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b);
5118}
5119
5120static vector short __ATTRS_o_ai
5121vec_sll(vector short a, vector unsigned short b)
5122{
5123 return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b);
5124}
5125
5126static vector short __ATTRS_o_ai
5127vec_sll(vector short a, vector unsigned int b)
5128{
5129 return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b);
5130}
5131
5132static vector unsigned short __ATTRS_o_ai
5133vec_sll(vector unsigned short a, vector unsigned char b)
5134{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005135 return (vector unsigned short)
5136 __builtin_altivec_vsl((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005137}
5138
5139static vector unsigned short __ATTRS_o_ai
5140vec_sll(vector unsigned short a, vector unsigned short b)
5141{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005142 return (vector unsigned short)
5143 __builtin_altivec_vsl((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005144}
5145
5146static vector unsigned short __ATTRS_o_ai
5147vec_sll(vector unsigned short a, vector unsigned int b)
5148{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005149 return (vector unsigned short)
5150 __builtin_altivec_vsl((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005151}
5152
Anton Yartseva2fc0f52010-08-19 03:21:36 +00005153static vector bool short __ATTRS_o_ai
5154vec_sll(vector bool short a, vector unsigned char b)
5155{
5156 return (vector bool short)__builtin_altivec_vsl((vector int)a, (vector int)b);
5157}
5158
5159static vector bool short __ATTRS_o_ai
5160vec_sll(vector bool short a, vector unsigned short b)
5161{
5162 return (vector bool short)__builtin_altivec_vsl((vector int)a, (vector int)b);
5163}
5164
5165static vector bool short __ATTRS_o_ai
5166vec_sll(vector bool short a, vector unsigned int b)
5167{
5168 return (vector bool short)__builtin_altivec_vsl((vector int)a, (vector int)b);
5169}
5170
5171static vector pixel __ATTRS_o_ai
5172vec_sll(vector pixel a, vector unsigned char b)
5173{
5174 return (vector pixel)__builtin_altivec_vsl((vector int)a, (vector int)b);
5175}
5176
5177static vector pixel __ATTRS_o_ai
5178vec_sll(vector pixel a, vector unsigned short b)
5179{
5180 return (vector pixel)__builtin_altivec_vsl((vector int)a, (vector int)b);
5181}
5182
5183static vector pixel __ATTRS_o_ai
5184vec_sll(vector pixel a, vector unsigned int b)
5185{
5186 return (vector pixel)__builtin_altivec_vsl((vector int)a, (vector int)b);
5187}
5188
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005189static vector int __ATTRS_o_ai
5190vec_sll(vector int a, vector unsigned char b)
5191{
5192 return (vector int)__builtin_altivec_vsl(a, (vector int)b);
5193}
5194
5195static vector int __ATTRS_o_ai
5196vec_sll(vector int a, vector unsigned short b)
5197{
5198 return (vector int)__builtin_altivec_vsl(a, (vector int)b);
5199}
5200
5201static vector int __ATTRS_o_ai
5202vec_sll(vector int a, vector unsigned int b)
5203{
5204 return (vector int)__builtin_altivec_vsl(a, (vector int)b);
5205}
5206
5207static vector unsigned int __ATTRS_o_ai
5208vec_sll(vector unsigned int a, vector unsigned char b)
5209{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005210 return (vector unsigned int)
5211 __builtin_altivec_vsl((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005212}
5213
5214static vector unsigned int __ATTRS_o_ai
5215vec_sll(vector unsigned int a, vector unsigned short b)
5216{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005217 return (vector unsigned int)
5218 __builtin_altivec_vsl((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005219}
5220
5221static vector unsigned int __ATTRS_o_ai
5222vec_sll(vector unsigned int a, vector unsigned int b)
5223{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005224 return (vector unsigned int)
5225 __builtin_altivec_vsl((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005226}
5227
Anton Yartseva2fc0f52010-08-19 03:21:36 +00005228static vector bool int __ATTRS_o_ai
5229vec_sll(vector bool int a, vector unsigned char b)
5230{
5231 return (vector bool int)__builtin_altivec_vsl((vector int)a, (vector int)b);
5232}
5233
5234static vector bool int __ATTRS_o_ai
5235vec_sll(vector bool int a, vector unsigned short b)
5236{
5237 return (vector bool int)__builtin_altivec_vsl((vector int)a, (vector int)b);
5238}
5239
5240static vector bool int __ATTRS_o_ai
5241vec_sll(vector bool int a, vector unsigned int b)
5242{
5243 return (vector bool int)__builtin_altivec_vsl((vector int)a, (vector int)b);
5244}
5245
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005246/* vec_vsl */
5247
5248static vector signed char __ATTRS_o_ai
5249vec_vsl(vector signed char a, vector unsigned char b)
5250{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005251 return (vector signed char)
5252 __builtin_altivec_vsl((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005253}
5254
5255static vector signed char __ATTRS_o_ai
5256vec_vsl(vector signed char a, vector unsigned short b)
5257{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005258 return (vector signed char)
5259 __builtin_altivec_vsl((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005260}
5261
5262static vector signed char __ATTRS_o_ai
5263vec_vsl(vector signed char a, vector unsigned int b)
5264{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005265 return (vector signed char)
5266 __builtin_altivec_vsl((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005267}
5268
5269static vector unsigned char __ATTRS_o_ai
5270vec_vsl(vector unsigned char a, vector unsigned char b)
5271{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005272 return (vector unsigned char)
5273 __builtin_altivec_vsl((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005274}
5275
5276static vector unsigned char __ATTRS_o_ai
5277vec_vsl(vector unsigned char a, vector unsigned short b)
5278{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005279 return (vector unsigned char)
5280 __builtin_altivec_vsl((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005281}
5282
5283static vector unsigned char __ATTRS_o_ai
5284vec_vsl(vector unsigned char a, vector unsigned int b)
5285{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005286 return (vector unsigned char)
5287 __builtin_altivec_vsl((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005288}
5289
Anton Yartseva2fc0f52010-08-19 03:21:36 +00005290static vector bool char __ATTRS_o_ai
5291vec_vsl(vector bool char a, vector unsigned char b)
5292{
5293 return (vector bool char)__builtin_altivec_vsl((vector int)a, (vector int)b);
5294}
5295
5296static vector bool char __ATTRS_o_ai
5297vec_vsl(vector bool char a, vector unsigned short b)
5298{
5299 return (vector bool char)__builtin_altivec_vsl((vector int)a, (vector int)b);
5300}
5301
5302static vector bool char __ATTRS_o_ai
5303vec_vsl(vector bool char a, vector unsigned int b)
5304{
5305 return (vector bool char)__builtin_altivec_vsl((vector int)a, (vector int)b);
5306}
5307
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005308static vector short __ATTRS_o_ai
5309vec_vsl(vector short a, vector unsigned char b)
5310{
5311 return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b);
5312}
5313
5314static vector short __ATTRS_o_ai
5315vec_vsl(vector short a, vector unsigned short b)
5316{
5317 return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b);
5318}
5319
5320static vector short __ATTRS_o_ai
5321vec_vsl(vector short a, vector unsigned int b)
5322{
5323 return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b);
5324}
5325
5326static vector unsigned short __ATTRS_o_ai
5327vec_vsl(vector unsigned short a, vector unsigned char b)
5328{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005329 return (vector unsigned short)
5330 __builtin_altivec_vsl((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005331}
5332
5333static vector unsigned short __ATTRS_o_ai
5334vec_vsl(vector unsigned short a, vector unsigned short b)
5335{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005336 return (vector unsigned short)
5337 __builtin_altivec_vsl((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005338}
5339
5340static vector unsigned short __ATTRS_o_ai
5341vec_vsl(vector unsigned short a, vector unsigned int b)
5342{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005343 return (vector unsigned short)
5344 __builtin_altivec_vsl((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005345}
5346
Anton Yartseva2fc0f52010-08-19 03:21:36 +00005347static vector bool short __ATTRS_o_ai
5348vec_vsl(vector bool short a, vector unsigned char b)
5349{
5350 return (vector bool short)__builtin_altivec_vsl((vector int)a, (vector int)b);
5351}
5352
5353static vector bool short __ATTRS_o_ai
5354vec_vsl(vector bool short a, vector unsigned short b)
5355{
5356 return (vector bool short)__builtin_altivec_vsl((vector int)a, (vector int)b);
5357}
5358
5359static vector bool short __ATTRS_o_ai
5360vec_vsl(vector bool short a, vector unsigned int b)
5361{
5362 return (vector bool short)__builtin_altivec_vsl((vector int)a, (vector int)b);
5363}
5364
5365static vector pixel __ATTRS_o_ai
5366vec_vsl(vector pixel a, vector unsigned char b)
5367{
5368 return (vector pixel)__builtin_altivec_vsl((vector int)a, (vector int)b);
5369}
5370
5371static vector pixel __ATTRS_o_ai
5372vec_vsl(vector pixel a, vector unsigned short b)
5373{
5374 return (vector pixel)__builtin_altivec_vsl((vector int)a, (vector int)b);
5375}
5376
5377static vector pixel __ATTRS_o_ai
5378vec_vsl(vector pixel a, vector unsigned int b)
5379{
5380 return (vector pixel)__builtin_altivec_vsl((vector int)a, (vector int)b);
5381}
5382
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005383static vector int __ATTRS_o_ai
5384vec_vsl(vector int a, vector unsigned char b)
5385{
5386 return (vector int)__builtin_altivec_vsl(a, (vector int)b);
5387}
5388
5389static vector int __ATTRS_o_ai
5390vec_vsl(vector int a, vector unsigned short b)
5391{
5392 return (vector int)__builtin_altivec_vsl(a, (vector int)b);
5393}
5394
5395static vector int __ATTRS_o_ai
5396vec_vsl(vector int a, vector unsigned int b)
5397{
5398 return (vector int)__builtin_altivec_vsl(a, (vector int)b);
5399}
5400
5401static vector unsigned int __ATTRS_o_ai
5402vec_vsl(vector unsigned int a, vector unsigned char b)
5403{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005404 return (vector unsigned int)
5405 __builtin_altivec_vsl((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005406}
5407
5408static vector unsigned int __ATTRS_o_ai
5409vec_vsl(vector unsigned int a, vector unsigned short b)
5410{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005411 return (vector unsigned int)
5412 __builtin_altivec_vsl((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005413}
5414
5415static vector unsigned int __ATTRS_o_ai
5416vec_vsl(vector unsigned int a, vector unsigned int b)
5417{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005418 return (vector unsigned int)
5419 __builtin_altivec_vsl((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005420}
5421
Anton Yartseva2fc0f52010-08-19 03:21:36 +00005422static vector bool int __ATTRS_o_ai
5423vec_vsl(vector bool int a, vector unsigned char b)
5424{
5425 return (vector bool int)__builtin_altivec_vsl((vector int)a, (vector int)b);
5426}
5427
5428static vector bool int __ATTRS_o_ai
5429vec_vsl(vector bool int a, vector unsigned short b)
5430{
5431 return (vector bool int)__builtin_altivec_vsl((vector int)a, (vector int)b);
5432}
5433
5434static vector bool int __ATTRS_o_ai
5435vec_vsl(vector bool int a, vector unsigned int b)
5436{
5437 return (vector bool int)__builtin_altivec_vsl((vector int)a, (vector int)b);
5438}
5439
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005440/* vec_slo */
5441
5442static vector signed char __ATTRS_o_ai
5443vec_slo(vector signed char a, vector signed char b)
5444{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005445 return (vector signed char)
5446 __builtin_altivec_vslo((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005447}
5448
5449static vector signed char __ATTRS_o_ai
5450vec_slo(vector signed char a, vector unsigned char b)
5451{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005452 return (vector signed char)
5453 __builtin_altivec_vslo((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005454}
5455
5456static vector unsigned char __ATTRS_o_ai
5457vec_slo(vector unsigned char a, vector signed char b)
5458{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005459 return (vector unsigned char)
5460 __builtin_altivec_vslo((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005461}
5462
5463static vector unsigned char __ATTRS_o_ai
5464vec_slo(vector unsigned char a, vector unsigned char b)
5465{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005466 return (vector unsigned char)
5467 __builtin_altivec_vslo((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005468}
5469
5470static vector short __ATTRS_o_ai
5471vec_slo(vector short a, vector signed char b)
5472{
5473 return (vector short)__builtin_altivec_vslo((vector int)a, (vector int)b);
5474}
5475
5476static vector short __ATTRS_o_ai
5477vec_slo(vector short a, vector unsigned char b)
5478{
5479 return (vector short)__builtin_altivec_vslo((vector int)a, (vector int)b);
5480}
5481
5482static vector unsigned short __ATTRS_o_ai
5483vec_slo(vector unsigned short a, vector signed char b)
5484{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005485 return (vector unsigned short)
5486 __builtin_altivec_vslo((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005487}
5488
5489static vector unsigned short __ATTRS_o_ai
5490vec_slo(vector unsigned short a, vector unsigned char b)
5491{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005492 return (vector unsigned short)
5493 __builtin_altivec_vslo((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005494}
5495
Anton Yartseva2fc0f52010-08-19 03:21:36 +00005496static vector pixel __ATTRS_o_ai
5497vec_slo(vector pixel a, vector signed char b)
5498{
5499 return (vector pixel)__builtin_altivec_vslo((vector int)a, (vector int)b);
5500}
5501
5502static vector pixel __ATTRS_o_ai
5503vec_slo(vector pixel a, vector unsigned char b)
5504{
5505 return (vector pixel)__builtin_altivec_vslo((vector int)a, (vector int)b);
5506}
5507
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005508static vector int __ATTRS_o_ai
5509vec_slo(vector int a, vector signed char b)
5510{
5511 return (vector int)__builtin_altivec_vslo(a, (vector int)b);
5512}
5513
5514static vector int __ATTRS_o_ai
5515vec_slo(vector int a, vector unsigned char b)
5516{
5517 return (vector int)__builtin_altivec_vslo(a, (vector int)b);
5518}
5519
5520static vector unsigned int __ATTRS_o_ai
5521vec_slo(vector unsigned int a, vector signed char b)
5522{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005523 return (vector unsigned int)
5524 __builtin_altivec_vslo((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005525}
5526
5527static vector unsigned int __ATTRS_o_ai
5528vec_slo(vector unsigned int a, vector unsigned char b)
5529{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005530 return (vector unsigned int)
5531 __builtin_altivec_vslo((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005532}
5533
5534static vector float __ATTRS_o_ai
5535vec_slo(vector float a, vector signed char b)
5536{
5537 return (vector float)__builtin_altivec_vslo((vector int)a, (vector int)b);
5538}
5539
5540static vector float __ATTRS_o_ai
5541vec_slo(vector float a, vector unsigned char b)
5542{
5543 return (vector float)__builtin_altivec_vslo((vector int)a, (vector int)b);
5544}
5545
5546/* vec_vslo */
5547
5548static vector signed char __ATTRS_o_ai
5549vec_vslo(vector signed char a, vector signed char b)
5550{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005551 return (vector signed char)
5552 __builtin_altivec_vslo((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005553}
5554
5555static vector signed char __ATTRS_o_ai
5556vec_vslo(vector signed char a, vector unsigned char b)
5557{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005558 return (vector signed char)
5559 __builtin_altivec_vslo((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005560}
5561
5562static vector unsigned char __ATTRS_o_ai
5563vec_vslo(vector unsigned char a, vector signed char b)
5564{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005565 return (vector unsigned char)
5566 __builtin_altivec_vslo((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005567}
5568
5569static vector unsigned char __ATTRS_o_ai
5570vec_vslo(vector unsigned char a, vector unsigned char b)
5571{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005572 return (vector unsigned char)
5573 __builtin_altivec_vslo((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005574}
5575
5576static vector short __ATTRS_o_ai
5577vec_vslo(vector short a, vector signed char b)
5578{
5579 return (vector short)__builtin_altivec_vslo((vector int)a, (vector int)b);
5580}
5581
5582static vector short __ATTRS_o_ai
5583vec_vslo(vector short a, vector unsigned char b)
5584{
5585 return (vector short)__builtin_altivec_vslo((vector int)a, (vector int)b);
5586}
5587
5588static vector unsigned short __ATTRS_o_ai
5589vec_vslo(vector unsigned short a, vector signed char b)
5590{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005591 return (vector unsigned short)
5592 __builtin_altivec_vslo((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005593}
5594
5595static vector unsigned short __ATTRS_o_ai
5596vec_vslo(vector unsigned short a, vector unsigned char b)
5597{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005598 return (vector unsigned short)
5599 __builtin_altivec_vslo((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005600}
5601
Anton Yartseva2fc0f52010-08-19 03:21:36 +00005602static vector pixel __ATTRS_o_ai
5603vec_vslo(vector pixel a, vector signed char b)
5604{
5605 return (vector pixel)__builtin_altivec_vslo((vector int)a, (vector int)b);
5606}
5607
5608static vector pixel __ATTRS_o_ai
5609vec_vslo(vector pixel a, vector unsigned char b)
5610{
5611 return (vector pixel)__builtin_altivec_vslo((vector int)a, (vector int)b);
5612}
5613
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005614static vector int __ATTRS_o_ai
5615vec_vslo(vector int a, vector signed char b)
5616{
5617 return (vector int)__builtin_altivec_vslo(a, (vector int)b);
5618}
5619
5620static vector int __ATTRS_o_ai
5621vec_vslo(vector int a, vector unsigned char b)
5622{
5623 return (vector int)__builtin_altivec_vslo(a, (vector int)b);
5624}
5625
5626static vector unsigned int __ATTRS_o_ai
5627vec_vslo(vector unsigned int a, vector signed char b)
5628{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005629 return (vector unsigned int)
5630 __builtin_altivec_vslo((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005631}
5632
5633static vector unsigned int __ATTRS_o_ai
5634vec_vslo(vector unsigned int a, vector unsigned char b)
5635{
Anton Yartsev3ed32722010-09-18 00:39:16 +00005636 return (vector unsigned int)
5637 __builtin_altivec_vslo((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005638}
5639
5640static vector float __ATTRS_o_ai
5641vec_vslo(vector float a, vector signed char b)
5642{
5643 return (vector float)__builtin_altivec_vslo((vector int)a, (vector int)b);
5644}
5645
5646static vector float __ATTRS_o_ai
5647vec_vslo(vector float a, vector unsigned char b)
5648{
5649 return (vector float)__builtin_altivec_vslo((vector int)a, (vector int)b);
5650}
5651
5652/* vec_splat */
5653
5654static vector signed char __ATTRS_o_ai
5655vec_splat(vector signed char a, unsigned char b)
5656{
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00005657 return vec_perm(a, a, (vector unsigned char)(b));
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005658}
5659
5660static vector unsigned char __ATTRS_o_ai
5661vec_splat(vector unsigned char a, unsigned char b)
5662{
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00005663 return vec_perm(a, a, (vector unsigned char)(b));
5664}
5665
5666static vector bool char __ATTRS_o_ai
5667vec_splat(vector bool char a, unsigned char b)
5668{
5669 return vec_perm(a, a, (vector unsigned char)(b));
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005670}
5671
5672static vector short __ATTRS_o_ai
5673vec_splat(vector short a, unsigned char b)
5674{
5675 b *= 2;
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00005676 return vec_perm(a, a, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005677 (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1));
5678}
5679
5680static vector unsigned short __ATTRS_o_ai
5681vec_splat(vector unsigned short a, unsigned char b)
5682{
5683 b *= 2;
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00005684 return vec_perm(a, a, (vector unsigned char)
5685 (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1));
5686}
5687
5688static vector bool short __ATTRS_o_ai
5689vec_splat(vector bool short a, unsigned char b)
5690{
5691 b *= 2;
5692 return vec_perm(a, a, (vector unsigned char)
5693 (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1));
5694}
5695
5696static vector pixel __ATTRS_o_ai
5697vec_splat(vector pixel a, unsigned char b)
5698{
5699 b *= 2;
5700 return vec_perm(a, a, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005701 (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1));
5702}
5703
5704static vector int __ATTRS_o_ai
5705vec_splat(vector int a, unsigned char b)
5706{
5707 b *= 4;
5708 return vec_perm(a, a, (vector unsigned char)
5709 (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3));
5710}
5711
5712static vector unsigned int __ATTRS_o_ai
5713vec_splat(vector unsigned int a, unsigned char b)
5714{
5715 b *= 4;
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00005716 return vec_perm(a, a, (vector unsigned char)
5717 (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3));
5718}
5719
5720static vector bool int __ATTRS_o_ai
5721vec_splat(vector bool int a, unsigned char b)
5722{
5723 b *= 4;
5724 return vec_perm(a, a, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005725 (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3));
5726}
5727
5728static vector float __ATTRS_o_ai
5729vec_splat(vector float a, unsigned char b)
5730{
5731 b *= 4;
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00005732 return vec_perm(a, a, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005733 (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3));
5734}
5735
5736/* vec_vspltb */
5737
5738#define __builtin_altivec_vspltb vec_vspltb
5739
5740static vector signed char __ATTRS_o_ai
5741vec_vspltb(vector signed char a, unsigned char b)
5742{
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00005743 return vec_perm(a, a, (vector unsigned char)(b));
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005744}
5745
5746static vector unsigned char __ATTRS_o_ai
5747vec_vspltb(vector unsigned char a, unsigned char b)
5748{
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00005749 return vec_perm(a, a, (vector unsigned char)(b));
5750}
5751
5752static vector bool char __ATTRS_o_ai
5753vec_vspltb(vector bool char a, unsigned char b)
5754{
5755 return vec_perm(a, a, (vector unsigned char)(b));
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005756}
5757
5758/* vec_vsplth */
5759
5760#define __builtin_altivec_vsplth vec_vsplth
5761
5762static vector short __ATTRS_o_ai
5763vec_vsplth(vector short a, unsigned char b)
5764{
5765 b *= 2;
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00005766 return vec_perm(a, a, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005767 (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1));
5768}
5769
5770static vector unsigned short __ATTRS_o_ai
5771vec_vsplth(vector unsigned short a, unsigned char b)
5772{
5773 b *= 2;
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00005774 return vec_perm(a, a, (vector unsigned char)
5775 (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1));
5776}
5777
5778static vector bool short __ATTRS_o_ai
5779vec_vsplth(vector bool short a, unsigned char b)
5780{
5781 b *= 2;
5782 return vec_perm(a, a, (vector unsigned char)
5783 (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1));
5784}
5785
5786static vector pixel __ATTRS_o_ai
5787vec_vsplth(vector pixel a, unsigned char b)
5788{
5789 b *= 2;
5790 return vec_perm(a, a, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005791 (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1));
5792}
5793
5794/* vec_vspltw */
5795
5796#define __builtin_altivec_vspltw vec_vspltw
5797
5798static vector int __ATTRS_o_ai
5799vec_vspltw(vector int a, unsigned char b)
5800{
5801 b *= 4;
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00005802 return vec_perm(a, a, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005803 (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3));
5804}
5805
5806static vector unsigned int __ATTRS_o_ai
5807vec_vspltw(vector unsigned int a, unsigned char b)
5808{
5809 b *= 4;
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00005810 return vec_perm(a, a, (vector unsigned char)
5811 (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3));
5812}
5813
5814static vector bool int __ATTRS_o_ai
5815vec_vspltw(vector bool int a, unsigned char b)
5816{
5817 b *= 4;
5818 return vec_perm(a, a, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005819 (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3));
5820}
5821
5822static vector float __ATTRS_o_ai
5823vec_vspltw(vector float a, unsigned char b)
5824{
5825 b *= 4;
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00005826 return vec_perm(a, a, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005827 (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3));
5828}
5829
5830/* vec_splat_s8 */
5831
5832#define __builtin_altivec_vspltisb vec_splat_s8
5833
5834// FIXME: parameter should be treated as 5-bit signed literal
5835static vector signed char __ATTRS_o_ai
5836vec_splat_s8(signed char a)
5837{
5838 return (vector signed char)(a);
5839}
5840
5841/* vec_vspltisb */
5842
5843// FIXME: parameter should be treated as 5-bit signed literal
5844static vector signed char __ATTRS_o_ai
5845vec_vspltisb(signed char a)
5846{
5847 return (vector signed char)(a);
5848}
5849
5850/* vec_splat_s16 */
5851
5852#define __builtin_altivec_vspltish vec_splat_s16
5853
5854// FIXME: parameter should be treated as 5-bit signed literal
5855static vector short __ATTRS_o_ai
5856vec_splat_s16(signed char a)
5857{
5858 return (vector short)(a);
5859}
5860
5861/* vec_vspltish */
5862
5863// FIXME: parameter should be treated as 5-bit signed literal
5864static vector short __ATTRS_o_ai
5865vec_vspltish(signed char a)
5866{
5867 return (vector short)(a);
5868}
5869
5870/* vec_splat_s32 */
5871
5872#define __builtin_altivec_vspltisw vec_splat_s32
5873
5874// FIXME: parameter should be treated as 5-bit signed literal
5875static vector int __ATTRS_o_ai
5876vec_splat_s32(signed char a)
5877{
5878 return (vector int)(a);
5879}
5880
5881/* vec_vspltisw */
5882
5883// FIXME: parameter should be treated as 5-bit signed literal
5884static vector int __ATTRS_o_ai
5885vec_vspltisw(signed char a)
5886{
5887 return (vector int)(a);
5888}
5889
5890/* vec_splat_u8 */
5891
5892// FIXME: parameter should be treated as 5-bit signed literal
5893static vector unsigned char __ATTRS_o_ai
5894vec_splat_u8(unsigned char a)
5895{
5896 return (vector unsigned char)(a);
5897}
5898
5899/* vec_splat_u16 */
5900
5901// FIXME: parameter should be treated as 5-bit signed literal
5902static vector unsigned short __ATTRS_o_ai
5903vec_splat_u16(signed char a)
5904{
5905 return (vector unsigned short)(a);
5906}
5907
5908/* vec_splat_u32 */
5909
5910// FIXME: parameter should be treated as 5-bit signed literal
5911static vector unsigned int __ATTRS_o_ai
5912vec_splat_u32(signed char a)
5913{
5914 return (vector unsigned int)(a);
5915}
5916
5917/* vec_sr */
5918
5919static vector signed char __ATTRS_o_ai
5920vec_sr(vector signed char a, vector unsigned char b)
5921{
5922 return a >> (vector signed char)b;
5923}
5924
5925static vector unsigned char __ATTRS_o_ai
5926vec_sr(vector unsigned char a, vector unsigned char b)
5927{
5928 return a >> b;
5929}
5930
5931static vector short __ATTRS_o_ai
5932vec_sr(vector short a, vector unsigned short b)
5933{
5934 return a >> (vector short)b;
5935}
5936
5937static vector unsigned short __ATTRS_o_ai
5938vec_sr(vector unsigned short a, vector unsigned short b)
5939{
5940 return a >> b;
5941}
5942
5943static vector int __ATTRS_o_ai
5944vec_sr(vector int a, vector unsigned int b)
5945{
5946 return a >> (vector int)b;
5947}
5948
5949static vector unsigned int __ATTRS_o_ai
5950vec_sr(vector unsigned int a, vector unsigned int b)
5951{
5952 return a >> b;
5953}
5954
5955/* vec_vsrb */
5956
5957#define __builtin_altivec_vsrb vec_vsrb
5958
5959static vector signed char __ATTRS_o_ai
5960vec_vsrb(vector signed char a, vector unsigned char b)
5961{
5962 return a >> (vector signed char)b;
5963}
5964
5965static vector unsigned char __ATTRS_o_ai
5966vec_vsrb(vector unsigned char a, vector unsigned char b)
5967{
5968 return a >> b;
5969}
5970
5971/* vec_vsrh */
5972
5973#define __builtin_altivec_vsrh vec_vsrh
5974
5975static vector short __ATTRS_o_ai
5976vec_vsrh(vector short a, vector unsigned short b)
5977{
5978 return a >> (vector short)b;
5979}
5980
5981static vector unsigned short __ATTRS_o_ai
5982vec_vsrh(vector unsigned short a, vector unsigned short b)
5983{
5984 return a >> b;
5985}
5986
5987/* vec_vsrw */
5988
5989#define __builtin_altivec_vsrw vec_vsrw
5990
5991static vector int __ATTRS_o_ai
5992vec_vsrw(vector int a, vector unsigned int b)
5993{
5994 return a >> (vector int)b;
5995}
5996
5997static vector unsigned int __ATTRS_o_ai
5998vec_vsrw(vector unsigned int a, vector unsigned int b)
5999{
6000 return a >> b;
6001}
6002
6003/* vec_sra */
6004
6005static vector signed char __ATTRS_o_ai
6006vec_sra(vector signed char a, vector unsigned char b)
6007{
6008 return (vector signed char)__builtin_altivec_vsrab((vector char)a, b);
6009}
6010
6011static vector unsigned char __ATTRS_o_ai
6012vec_sra(vector unsigned char a, vector unsigned char b)
6013{
6014 return (vector unsigned char)__builtin_altivec_vsrab((vector char)a, b);
6015}
6016
6017static vector short __ATTRS_o_ai
6018vec_sra(vector short a, vector unsigned short b)
6019{
6020 return __builtin_altivec_vsrah(a, (vector unsigned short)b);
6021}
6022
6023static vector unsigned short __ATTRS_o_ai
6024vec_sra(vector unsigned short a, vector unsigned short b)
6025{
6026 return (vector unsigned short)__builtin_altivec_vsrah((vector short)a, b);
6027}
6028
6029static vector int __ATTRS_o_ai
6030vec_sra(vector int a, vector unsigned int b)
6031{
6032 return __builtin_altivec_vsraw(a, b);
6033}
6034
6035static vector unsigned int __ATTRS_o_ai
6036vec_sra(vector unsigned int a, vector unsigned int b)
6037{
6038 return (vector unsigned int)__builtin_altivec_vsraw((vector int)a, b);
6039}
6040
6041/* vec_vsrab */
6042
6043static vector signed char __ATTRS_o_ai
6044vec_vsrab(vector signed char a, vector unsigned char b)
6045{
6046 return (vector signed char)__builtin_altivec_vsrab((vector char)a, b);
6047}
6048
6049static vector unsigned char __ATTRS_o_ai
6050vec_vsrab(vector unsigned char a, vector unsigned char b)
6051{
6052 return (vector unsigned char)__builtin_altivec_vsrab((vector char)a, b);
6053}
6054
6055/* vec_vsrah */
6056
6057static vector short __ATTRS_o_ai
6058vec_vsrah(vector short a, vector unsigned short b)
6059{
6060 return __builtin_altivec_vsrah(a, (vector unsigned short)b);
6061}
6062
6063static vector unsigned short __ATTRS_o_ai
6064vec_vsrah(vector unsigned short a, vector unsigned short b)
6065{
6066 return (vector unsigned short)__builtin_altivec_vsrah((vector short)a, b);
6067}
6068
6069/* vec_vsraw */
6070
6071static vector int __ATTRS_o_ai
6072vec_vsraw(vector int a, vector unsigned int b)
6073{
6074 return __builtin_altivec_vsraw(a, b);
6075}
6076
6077static vector unsigned int __ATTRS_o_ai
6078vec_vsraw(vector unsigned int a, vector unsigned int b)
6079{
6080 return (vector unsigned int)__builtin_altivec_vsraw((vector int)a, b);
6081}
6082
6083/* vec_srl */
6084
6085static vector signed char __ATTRS_o_ai
6086vec_srl(vector signed char a, vector unsigned char b)
6087{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006088 return (vector signed char)
6089 __builtin_altivec_vsr((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006090}
6091
6092static vector signed char __ATTRS_o_ai
6093vec_srl(vector signed char a, vector unsigned short b)
6094{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006095 return (vector signed char)
6096 __builtin_altivec_vsr((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006097}
6098
6099static vector signed char __ATTRS_o_ai
6100vec_srl(vector signed char a, vector unsigned int b)
6101{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006102 return (vector signed char)
6103 __builtin_altivec_vsr((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006104}
6105
6106static vector unsigned char __ATTRS_o_ai
6107vec_srl(vector unsigned char a, vector unsigned char b)
6108{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006109 return (vector unsigned char)
6110 __builtin_altivec_vsr((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006111}
6112
6113static vector unsigned char __ATTRS_o_ai
6114vec_srl(vector unsigned char a, vector unsigned short b)
6115{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006116 return (vector unsigned char)
6117 __builtin_altivec_vsr((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006118}
6119
6120static vector unsigned char __ATTRS_o_ai
6121vec_srl(vector unsigned char a, vector unsigned int b)
6122{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006123 return (vector unsigned char)
6124 __builtin_altivec_vsr((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006125}
6126
Anton Yartseva2fc0f52010-08-19 03:21:36 +00006127static vector bool char __ATTRS_o_ai
6128vec_srl(vector bool char a, vector unsigned char b)
6129{
6130 return (vector bool char)__builtin_altivec_vsr((vector int)a, (vector int)b);
6131}
6132
6133static vector bool char __ATTRS_o_ai
6134vec_srl(vector bool char a, vector unsigned short b)
6135{
6136 return (vector bool char)__builtin_altivec_vsr((vector int)a, (vector int)b);
6137}
6138
6139static vector bool char __ATTRS_o_ai
6140vec_srl(vector bool char a, vector unsigned int b)
6141{
6142 return (vector bool char)__builtin_altivec_vsr((vector int)a, (vector int)b);
6143}
6144
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006145static vector short __ATTRS_o_ai
6146vec_srl(vector short a, vector unsigned char b)
6147{
6148 return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b);
6149}
6150
6151static vector short __ATTRS_o_ai
6152vec_srl(vector short a, vector unsigned short b)
6153{
6154 return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b);
6155}
6156
6157static vector short __ATTRS_o_ai
6158vec_srl(vector short a, vector unsigned int b)
6159{
6160 return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b);
6161}
6162
6163static vector unsigned short __ATTRS_o_ai
6164vec_srl(vector unsigned short a, vector unsigned char b)
6165{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006166 return (vector unsigned short)
6167 __builtin_altivec_vsr((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006168}
6169
6170static vector unsigned short __ATTRS_o_ai
6171vec_srl(vector unsigned short a, vector unsigned short b)
6172{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006173 return (vector unsigned short)
6174 __builtin_altivec_vsr((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006175}
6176
6177static vector unsigned short __ATTRS_o_ai
6178vec_srl(vector unsigned short a, vector unsigned int b)
6179{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006180 return (vector unsigned short)
6181 __builtin_altivec_vsr((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006182}
6183
Anton Yartseva2fc0f52010-08-19 03:21:36 +00006184static vector bool short __ATTRS_o_ai
6185vec_srl(vector bool short a, vector unsigned char b)
6186{
6187 return (vector bool short)__builtin_altivec_vsr((vector int)a, (vector int)b);
6188}
6189
6190static vector bool short __ATTRS_o_ai
6191vec_srl(vector bool short a, vector unsigned short b)
6192{
6193 return (vector bool short)__builtin_altivec_vsr((vector int)a, (vector int)b);
6194}
6195
6196static vector bool short __ATTRS_o_ai
6197vec_srl(vector bool short a, vector unsigned int b)
6198{
6199 return (vector bool short)__builtin_altivec_vsr((vector int)a, (vector int)b);
6200}
6201
6202static vector pixel __ATTRS_o_ai
6203vec_srl(vector pixel a, vector unsigned char b)
6204{
6205 return (vector pixel)__builtin_altivec_vsr((vector int)a, (vector int)b);
6206}
6207
6208static vector pixel __ATTRS_o_ai
6209vec_srl(vector pixel a, vector unsigned short b)
6210{
6211 return (vector pixel)__builtin_altivec_vsr((vector int)a, (vector int)b);
6212}
6213
6214static vector pixel __ATTRS_o_ai
6215vec_srl(vector pixel a, vector unsigned int b)
6216{
6217 return (vector pixel)__builtin_altivec_vsr((vector int)a, (vector int)b);
6218}
6219
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006220static vector int __ATTRS_o_ai
6221vec_srl(vector int a, vector unsigned char b)
6222{
6223 return (vector int)__builtin_altivec_vsr(a, (vector int)b);
6224}
6225
6226static vector int __ATTRS_o_ai
6227vec_srl(vector int a, vector unsigned short b)
6228{
6229 return (vector int)__builtin_altivec_vsr(a, (vector int)b);
6230}
6231
6232static vector int __ATTRS_o_ai
6233vec_srl(vector int a, vector unsigned int b)
6234{
6235 return (vector int)__builtin_altivec_vsr(a, (vector int)b);
6236}
6237
6238static vector unsigned int __ATTRS_o_ai
6239vec_srl(vector unsigned int a, vector unsigned char b)
6240{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006241 return (vector unsigned int)
6242 __builtin_altivec_vsr((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006243}
6244
6245static vector unsigned int __ATTRS_o_ai
6246vec_srl(vector unsigned int a, vector unsigned short b)
6247{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006248 return (vector unsigned int)
6249 __builtin_altivec_vsr((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006250}
6251
6252static vector unsigned int __ATTRS_o_ai
6253vec_srl(vector unsigned int a, vector unsigned int b)
6254{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006255 return (vector unsigned int)
6256 __builtin_altivec_vsr((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006257}
6258
Anton Yartseva2fc0f52010-08-19 03:21:36 +00006259static vector bool int __ATTRS_o_ai
6260vec_srl(vector bool int a, vector unsigned char b)
6261{
6262 return (vector bool int)__builtin_altivec_vsr((vector int)a, (vector int)b);
6263}
6264
6265static vector bool int __ATTRS_o_ai
6266vec_srl(vector bool int a, vector unsigned short b)
6267{
6268 return (vector bool int)__builtin_altivec_vsr((vector int)a, (vector int)b);
6269}
6270
6271static vector bool int __ATTRS_o_ai
6272vec_srl(vector bool int a, vector unsigned int b)
6273{
6274 return (vector bool int)__builtin_altivec_vsr((vector int)a, (vector int)b);
6275}
6276
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006277/* vec_vsr */
6278
6279static vector signed char __ATTRS_o_ai
6280vec_vsr(vector signed char a, vector unsigned char b)
6281{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006282 return (vector signed char)
6283 __builtin_altivec_vsr((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006284}
6285
6286static vector signed char __ATTRS_o_ai
6287vec_vsr(vector signed char a, vector unsigned short b)
6288{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006289 return (vector signed char)
6290 __builtin_altivec_vsr((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006291}
6292
6293static vector signed char __ATTRS_o_ai
6294vec_vsr(vector signed char a, vector unsigned int b)
6295{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006296 return (vector signed char)
6297 __builtin_altivec_vsr((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006298}
6299
6300static vector unsigned char __ATTRS_o_ai
6301vec_vsr(vector unsigned char a, vector unsigned char b)
6302{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006303 return (vector unsigned char)
6304 __builtin_altivec_vsr((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006305}
6306
6307static vector unsigned char __ATTRS_o_ai
6308vec_vsr(vector unsigned char a, vector unsigned short b)
6309{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006310 return (vector unsigned char)
6311 __builtin_altivec_vsr((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006312}
6313
6314static vector unsigned char __ATTRS_o_ai
6315vec_vsr(vector unsigned char a, vector unsigned int b)
6316{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006317 return (vector unsigned char)
6318 __builtin_altivec_vsr((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006319}
6320
Anton Yartseva2fc0f52010-08-19 03:21:36 +00006321static vector bool char __ATTRS_o_ai
6322vec_vsr(vector bool char a, vector unsigned char b)
6323{
6324 return (vector bool char)__builtin_altivec_vsr((vector int)a, (vector int)b);
6325}
6326
6327static vector bool char __ATTRS_o_ai
6328vec_vsr(vector bool char a, vector unsigned short b)
6329{
6330 return (vector bool char)__builtin_altivec_vsr((vector int)a, (vector int)b);
6331}
6332
6333static vector bool char __ATTRS_o_ai
6334vec_vsr(vector bool char a, vector unsigned int b)
6335{
6336 return (vector bool char)__builtin_altivec_vsr((vector int)a, (vector int)b);
6337}
6338
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006339static vector short __ATTRS_o_ai
6340vec_vsr(vector short a, vector unsigned char b)
6341{
6342 return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b);
6343}
6344
6345static vector short __ATTRS_o_ai
6346vec_vsr(vector short a, vector unsigned short b)
6347{
6348 return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b);
6349}
6350
6351static vector short __ATTRS_o_ai
6352vec_vsr(vector short a, vector unsigned int b)
6353{
6354 return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b);
6355}
6356
6357static vector unsigned short __ATTRS_o_ai
6358vec_vsr(vector unsigned short a, vector unsigned char b)
6359{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006360 return (vector unsigned short)
6361 __builtin_altivec_vsr((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006362}
6363
6364static vector unsigned short __ATTRS_o_ai
6365vec_vsr(vector unsigned short a, vector unsigned short b)
6366{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006367 return (vector unsigned short)
6368 __builtin_altivec_vsr((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006369}
6370
6371static vector unsigned short __ATTRS_o_ai
6372vec_vsr(vector unsigned short a, vector unsigned int b)
6373{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006374 return (vector unsigned short)
6375 __builtin_altivec_vsr((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006376}
6377
Anton Yartseva2fc0f52010-08-19 03:21:36 +00006378static vector bool short __ATTRS_o_ai
6379vec_vsr(vector bool short a, vector unsigned char b)
6380{
6381 return (vector bool short)__builtin_altivec_vsr((vector int)a, (vector int)b);
6382}
6383
6384static vector bool short __ATTRS_o_ai
6385vec_vsr(vector bool short a, vector unsigned short b)
6386{
6387 return (vector bool short)__builtin_altivec_vsr((vector int)a, (vector int)b);
6388}
6389
6390static vector bool short __ATTRS_o_ai
6391vec_vsr(vector bool short a, vector unsigned int b)
6392{
6393 return (vector bool short)__builtin_altivec_vsr((vector int)a, (vector int)b);
6394}
6395
6396static vector pixel __ATTRS_o_ai
6397vec_vsr(vector pixel a, vector unsigned char b)
6398{
6399 return (vector pixel)__builtin_altivec_vsr((vector int)a, (vector int)b);
6400}
6401
6402static vector pixel __ATTRS_o_ai
6403vec_vsr(vector pixel a, vector unsigned short b)
6404{
6405 return (vector pixel)__builtin_altivec_vsr((vector int)a, (vector int)b);
6406}
6407
6408static vector pixel __ATTRS_o_ai
6409vec_vsr(vector pixel a, vector unsigned int b)
6410{
6411 return (vector pixel)__builtin_altivec_vsr((vector int)a, (vector int)b);
6412}
6413
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006414static vector int __ATTRS_o_ai
6415vec_vsr(vector int a, vector unsigned char b)
6416{
6417 return (vector int)__builtin_altivec_vsr(a, (vector int)b);
6418}
6419
6420static vector int __ATTRS_o_ai
6421vec_vsr(vector int a, vector unsigned short b)
6422{
6423 return (vector int)__builtin_altivec_vsr(a, (vector int)b);
6424}
6425
6426static vector int __ATTRS_o_ai
6427vec_vsr(vector int a, vector unsigned int b)
6428{
6429 return (vector int)__builtin_altivec_vsr(a, (vector int)b);
6430}
6431
6432static vector unsigned int __ATTRS_o_ai
6433vec_vsr(vector unsigned int a, vector unsigned char b)
6434{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006435 return (vector unsigned int)
6436 __builtin_altivec_vsr((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006437}
6438
6439static vector unsigned int __ATTRS_o_ai
6440vec_vsr(vector unsigned int a, vector unsigned short b)
6441{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006442 return (vector unsigned int)
6443 __builtin_altivec_vsr((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006444}
6445
6446static vector unsigned int __ATTRS_o_ai
6447vec_vsr(vector unsigned int a, vector unsigned int b)
6448{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006449 return (vector unsigned int)
6450 __builtin_altivec_vsr((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006451}
6452
Anton Yartseva2fc0f52010-08-19 03:21:36 +00006453static vector bool int __ATTRS_o_ai
6454vec_vsr(vector bool int a, vector unsigned char b)
6455{
6456 return (vector bool int)__builtin_altivec_vsr((vector int)a, (vector int)b);
6457}
6458
6459static vector bool int __ATTRS_o_ai
6460vec_vsr(vector bool int a, vector unsigned short b)
6461{
6462 return (vector bool int)__builtin_altivec_vsr((vector int)a, (vector int)b);
6463}
6464
6465static vector bool int __ATTRS_o_ai
6466vec_vsr(vector bool int a, vector unsigned int b)
6467{
6468 return (vector bool int)__builtin_altivec_vsr((vector int)a, (vector int)b);
6469}
6470
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006471/* vec_sro */
6472
6473static vector signed char __ATTRS_o_ai
6474vec_sro(vector signed char a, vector signed char b)
6475{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006476 return (vector signed char)
6477 __builtin_altivec_vsro((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006478}
6479
6480static vector signed char __ATTRS_o_ai
6481vec_sro(vector signed char a, vector unsigned char b)
6482{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006483 return (vector signed char)
6484 __builtin_altivec_vsro((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006485}
6486
6487static vector unsigned char __ATTRS_o_ai
6488vec_sro(vector unsigned char a, vector signed char b)
6489{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006490 return (vector unsigned char)
6491 __builtin_altivec_vsro((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006492}
6493
6494static vector unsigned char __ATTRS_o_ai
6495vec_sro(vector unsigned char a, vector unsigned char b)
6496{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006497 return (vector unsigned char)
6498 __builtin_altivec_vsro((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006499}
6500
6501static vector short __ATTRS_o_ai
6502vec_sro(vector short a, vector signed char b)
6503{
6504 return (vector short)__builtin_altivec_vsro((vector int)a, (vector int)b);
6505}
6506
6507static vector short __ATTRS_o_ai
6508vec_sro(vector short a, vector unsigned char b)
6509{
6510 return (vector short)__builtin_altivec_vsro((vector int)a, (vector int)b);
6511}
6512
6513static vector unsigned short __ATTRS_o_ai
6514vec_sro(vector unsigned short a, vector signed char b)
6515{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006516 return (vector unsigned short)
6517 __builtin_altivec_vsro((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006518}
6519
6520static vector unsigned short __ATTRS_o_ai
6521vec_sro(vector unsigned short a, vector unsigned char b)
6522{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006523 return (vector unsigned short)
6524 __builtin_altivec_vsro((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006525}
6526
Anton Yartseva2fc0f52010-08-19 03:21:36 +00006527static vector pixel __ATTRS_o_ai
6528vec_sro(vector pixel a, vector signed char b)
6529{
6530 return (vector pixel)__builtin_altivec_vsro((vector int)a, (vector int)b);
6531}
6532
6533static vector pixel __ATTRS_o_ai
6534vec_sro(vector pixel a, vector unsigned char b)
6535{
6536 return (vector pixel)__builtin_altivec_vsro((vector int)a, (vector int)b);
6537}
6538
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006539static vector int __ATTRS_o_ai
6540vec_sro(vector int a, vector signed char b)
6541{
6542 return (vector int)__builtin_altivec_vsro(a, (vector int)b);
6543}
6544
6545static vector int __ATTRS_o_ai
6546vec_sro(vector int a, vector unsigned char b)
6547{
6548 return (vector int)__builtin_altivec_vsro(a, (vector int)b);
6549}
6550
6551static vector unsigned int __ATTRS_o_ai
6552vec_sro(vector unsigned int a, vector signed char b)
6553{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006554 return (vector unsigned int)
6555 __builtin_altivec_vsro((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006556}
6557
6558static vector unsigned int __ATTRS_o_ai
6559vec_sro(vector unsigned int a, vector unsigned char b)
6560{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006561 return (vector unsigned int)
6562 __builtin_altivec_vsro((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006563}
6564
6565static vector float __ATTRS_o_ai
6566vec_sro(vector float a, vector signed char b)
6567{
6568 return (vector float)__builtin_altivec_vsro((vector int)a, (vector int)b);
6569}
6570
6571static vector float __ATTRS_o_ai
6572vec_sro(vector float a, vector unsigned char b)
6573{
6574 return (vector float)__builtin_altivec_vsro((vector int)a, (vector int)b);
6575}
6576
6577/* vec_vsro */
6578
6579static vector signed char __ATTRS_o_ai
6580vec_vsro(vector signed char a, vector signed char b)
6581{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006582 return (vector signed char)
6583 __builtin_altivec_vsro((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006584}
6585
6586static vector signed char __ATTRS_o_ai
6587vec_vsro(vector signed char a, vector unsigned char b)
6588{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006589 return (vector signed char)
6590 __builtin_altivec_vsro((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006591}
6592
6593static vector unsigned char __ATTRS_o_ai
6594vec_vsro(vector unsigned char a, vector signed char b)
6595{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006596 return (vector unsigned char)
6597 __builtin_altivec_vsro((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006598}
6599
6600static vector unsigned char __ATTRS_o_ai
6601vec_vsro(vector unsigned char a, vector unsigned char b)
6602{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006603 return (vector unsigned char)
6604 __builtin_altivec_vsro((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006605}
6606
6607static vector short __ATTRS_o_ai
6608vec_vsro(vector short a, vector signed char b)
6609{
6610 return (vector short)__builtin_altivec_vsro((vector int)a, (vector int)b);
6611}
6612
6613static vector short __ATTRS_o_ai
6614vec_vsro(vector short a, vector unsigned char b)
6615{
6616 return (vector short)__builtin_altivec_vsro((vector int)a, (vector int)b);
6617}
6618
6619static vector unsigned short __ATTRS_o_ai
6620vec_vsro(vector unsigned short a, vector signed char b)
6621{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006622 return (vector unsigned short)
6623 __builtin_altivec_vsro((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006624}
6625
6626static vector unsigned short __ATTRS_o_ai
6627vec_vsro(vector unsigned short a, vector unsigned char b)
6628{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006629 return (vector unsigned short)
6630 __builtin_altivec_vsro((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006631}
6632
Anton Yartseva2fc0f52010-08-19 03:21:36 +00006633static vector pixel __ATTRS_o_ai
6634vec_vsro(vector pixel a, vector signed char b)
6635{
6636 return (vector pixel)__builtin_altivec_vsro((vector int)a, (vector int)b);
6637}
6638
6639static vector pixel __ATTRS_o_ai
6640vec_vsro(vector pixel a, vector unsigned char b)
6641{
6642 return (vector pixel)__builtin_altivec_vsro((vector int)a, (vector int)b);
6643}
6644
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006645static vector int __ATTRS_o_ai
6646vec_vsro(vector int a, vector signed char b)
6647{
6648 return (vector int)__builtin_altivec_vsro(a, (vector int)b);
6649}
6650
6651static vector int __ATTRS_o_ai
6652vec_vsro(vector int a, vector unsigned char b)
6653{
6654 return (vector int)__builtin_altivec_vsro(a, (vector int)b);
6655}
6656
6657static vector unsigned int __ATTRS_o_ai
6658vec_vsro(vector unsigned int a, vector signed char b)
6659{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006660 return (vector unsigned int)
6661 __builtin_altivec_vsro((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006662}
6663
6664static vector unsigned int __ATTRS_o_ai
6665vec_vsro(vector unsigned int a, vector unsigned char b)
6666{
Anton Yartsev3ed32722010-09-18 00:39:16 +00006667 return (vector unsigned int)
6668 __builtin_altivec_vsro((vector int)a, (vector int)b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006669}
6670
6671static vector float __ATTRS_o_ai
6672vec_vsro(vector float a, vector signed char b)
6673{
6674 return (vector float)__builtin_altivec_vsro((vector int)a, (vector int)b);
6675}
6676
6677static vector float __ATTRS_o_ai
6678vec_vsro(vector float a, vector unsigned char b)
6679{
6680 return (vector float)__builtin_altivec_vsro((vector int)a, (vector int)b);
6681}
6682
6683/* vec_st */
6684
6685static void __ATTRS_o_ai
6686vec_st(vector signed char a, int b, vector signed char *c)
6687{
6688 __builtin_altivec_stvx((vector int)a, b, c);
6689}
6690
6691static void __ATTRS_o_ai
6692vec_st(vector signed char a, int b, signed char *c)
6693{
6694 __builtin_altivec_stvx((vector int)a, b, c);
6695}
6696
6697static void __ATTRS_o_ai
6698vec_st(vector unsigned char a, int b, vector unsigned char *c)
6699{
6700 __builtin_altivec_stvx((vector int)a, b, c);
6701}
6702
6703static void __ATTRS_o_ai
6704vec_st(vector unsigned char a, int b, unsigned char *c)
6705{
6706 __builtin_altivec_stvx((vector int)a, b, c);
6707}
6708
6709static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00006710vec_st(vector bool char a, int b, signed char *c)
6711{
6712 __builtin_altivec_stvx((vector int)a, b, c);
6713}
6714
6715static void __ATTRS_o_ai
6716vec_st(vector bool char a, int b, unsigned char *c)
6717{
6718 __builtin_altivec_stvx((vector int)a, b, c);
6719}
6720
6721static void __ATTRS_o_ai
6722vec_st(vector bool char a, int b, vector bool char *c)
6723{
6724 __builtin_altivec_stvx((vector int)a, b, c);
6725}
6726
6727static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006728vec_st(vector short a, int b, vector short *c)
6729{
6730 __builtin_altivec_stvx((vector int)a, b, c);
6731}
6732
6733static void __ATTRS_o_ai
6734vec_st(vector short a, int b, short *c)
6735{
6736 __builtin_altivec_stvx((vector int)a, b, c);
6737}
6738
6739static void __ATTRS_o_ai
6740vec_st(vector unsigned short a, int b, vector unsigned short *c)
6741{
6742 __builtin_altivec_stvx((vector int)a, b, c);
6743}
6744
6745static void __ATTRS_o_ai
6746vec_st(vector unsigned short a, int b, unsigned short *c)
6747{
6748 __builtin_altivec_stvx((vector int)a, b, c);
6749}
6750
6751static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00006752vec_st(vector bool short a, int b, short *c)
6753{
6754 __builtin_altivec_stvx((vector int)a, b, c);
6755}
6756
6757static void __ATTRS_o_ai
6758vec_st(vector bool short a, int b, unsigned short *c)
6759{
6760 __builtin_altivec_stvx((vector int)a, b, c);
6761}
6762
6763static void __ATTRS_o_ai
6764vec_st(vector bool short a, int b, vector bool short *c)
6765{
6766 __builtin_altivec_stvx((vector int)a, b, c);
6767}
6768
6769static void __ATTRS_o_ai
6770vec_st(vector pixel a, int b, short *c)
6771{
6772 __builtin_altivec_stvx((vector int)a, b, c);
6773}
6774
6775static void __ATTRS_o_ai
6776vec_st(vector pixel a, int b, unsigned short *c)
6777{
6778 __builtin_altivec_stvx((vector int)a, b, c);
6779}
6780
6781static void __ATTRS_o_ai
6782vec_st(vector pixel a, int b, vector pixel *c)
6783{
6784 __builtin_altivec_stvx((vector int)a, b, c);
6785}
6786
6787static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006788vec_st(vector int a, int b, vector int *c)
6789{
6790 __builtin_altivec_stvx(a, b, c);
6791}
6792
6793static void __ATTRS_o_ai
6794vec_st(vector int a, int b, int *c)
6795{
6796 __builtin_altivec_stvx(a, b, c);
6797}
6798
6799static void __ATTRS_o_ai
6800vec_st(vector unsigned int a, int b, vector unsigned int *c)
6801{
6802 __builtin_altivec_stvx((vector int)a, b, c);
6803}
6804
6805static void __ATTRS_o_ai
6806vec_st(vector unsigned int a, int b, unsigned int *c)
6807{
6808 __builtin_altivec_stvx((vector int)a, b, c);
6809}
6810
6811static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00006812vec_st(vector bool int a, int b, int *c)
6813{
6814 __builtin_altivec_stvx((vector int)a, b, c);
6815}
6816
6817static void __ATTRS_o_ai
6818vec_st(vector bool int a, int b, unsigned int *c)
6819{
6820 __builtin_altivec_stvx((vector int)a, b, c);
6821}
6822
6823static void __ATTRS_o_ai
6824vec_st(vector bool int a, int b, vector bool int *c)
6825{
6826 __builtin_altivec_stvx((vector int)a, b, c);
6827}
6828
6829static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006830vec_st(vector float a, int b, vector float *c)
6831{
6832 __builtin_altivec_stvx((vector int)a, b, c);
6833}
6834
6835static void __ATTRS_o_ai
6836vec_st(vector float a, int b, float *c)
6837{
6838 __builtin_altivec_stvx((vector int)a, b, c);
6839}
6840
6841/* vec_stvx */
6842
6843static void __ATTRS_o_ai
6844vec_stvx(vector signed char a, int b, vector signed char *c)
6845{
6846 __builtin_altivec_stvx((vector int)a, b, c);
6847}
6848
6849static void __ATTRS_o_ai
6850vec_stvx(vector signed char a, int b, signed char *c)
6851{
6852 __builtin_altivec_stvx((vector int)a, b, c);
6853}
6854
6855static void __ATTRS_o_ai
6856vec_stvx(vector unsigned char a, int b, vector unsigned char *c)
6857{
6858 __builtin_altivec_stvx((vector int)a, b, c);
6859}
6860
6861static void __ATTRS_o_ai
6862vec_stvx(vector unsigned char a, int b, unsigned char *c)
6863{
6864 __builtin_altivec_stvx((vector int)a, b, c);
6865}
6866
6867static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00006868vec_stvx(vector bool char a, int b, signed char *c)
6869{
6870 __builtin_altivec_stvx((vector int)a, b, c);
6871}
6872
6873static void __ATTRS_o_ai
6874vec_stvx(vector bool char a, int b, unsigned char *c)
6875{
6876 __builtin_altivec_stvx((vector int)a, b, c);
6877}
6878
6879static void __ATTRS_o_ai
6880vec_stvx(vector bool char a, int b, vector bool char *c)
6881{
6882 __builtin_altivec_stvx((vector int)a, b, c);
6883}
6884
6885static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006886vec_stvx(vector short a, int b, vector short *c)
6887{
6888 __builtin_altivec_stvx((vector int)a, b, c);
6889}
6890
6891static void __ATTRS_o_ai
6892vec_stvx(vector short a, int b, short *c)
6893{
6894 __builtin_altivec_stvx((vector int)a, b, c);
6895}
6896
6897static void __ATTRS_o_ai
6898vec_stvx(vector unsigned short a, int b, vector unsigned short *c)
6899{
6900 __builtin_altivec_stvx((vector int)a, b, c);
6901}
6902
6903static void __ATTRS_o_ai
6904vec_stvx(vector unsigned short a, int b, unsigned short *c)
6905{
6906 __builtin_altivec_stvx((vector int)a, b, c);
6907}
6908
6909static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00006910vec_stvx(vector bool short a, int b, short *c)
6911{
6912 __builtin_altivec_stvx((vector int)a, b, c);
6913}
6914
6915static void __ATTRS_o_ai
6916vec_stvx(vector bool short a, int b, unsigned short *c)
6917{
6918 __builtin_altivec_stvx((vector int)a, b, c);
6919}
6920
6921static void __ATTRS_o_ai
6922vec_stvx(vector bool short a, int b, vector bool short *c)
6923{
6924 __builtin_altivec_stvx((vector int)a, b, c);
6925}
6926
6927static void __ATTRS_o_ai
6928vec_stvx(vector pixel a, int b, short *c)
6929{
6930 __builtin_altivec_stvx((vector int)a, b, c);
6931}
6932
6933static void __ATTRS_o_ai
6934vec_stvx(vector pixel a, int b, unsigned short *c)
6935{
6936 __builtin_altivec_stvx((vector int)a, b, c);
6937}
6938
6939static void __ATTRS_o_ai
6940vec_stvx(vector pixel a, int b, vector pixel *c)
6941{
6942 __builtin_altivec_stvx((vector int)a, b, c);
6943}
6944
6945static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006946vec_stvx(vector int a, int b, vector int *c)
6947{
6948 __builtin_altivec_stvx(a, b, c);
6949}
6950
6951static void __ATTRS_o_ai
6952vec_stvx(vector int a, int b, int *c)
6953{
6954 __builtin_altivec_stvx(a, b, c);
6955}
6956
6957static void __ATTRS_o_ai
6958vec_stvx(vector unsigned int a, int b, vector unsigned int *c)
6959{
6960 __builtin_altivec_stvx((vector int)a, b, c);
6961}
6962
6963static void __ATTRS_o_ai
6964vec_stvx(vector unsigned int a, int b, unsigned int *c)
6965{
6966 __builtin_altivec_stvx((vector int)a, b, c);
6967}
6968
6969static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00006970vec_stvx(vector bool int a, int b, int *c)
6971{
6972 __builtin_altivec_stvx((vector int)a, b, c);
6973}
6974
6975static void __ATTRS_o_ai
6976vec_stvx(vector bool int a, int b, unsigned int *c)
6977{
6978 __builtin_altivec_stvx((vector int)a, b, c);
6979}
6980
6981static void __ATTRS_o_ai
6982vec_stvx(vector bool int a, int b, vector bool int *c)
6983{
6984 __builtin_altivec_stvx((vector int)a, b, c);
6985}
6986
6987static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006988vec_stvx(vector float a, int b, vector float *c)
6989{
6990 __builtin_altivec_stvx((vector int)a, b, c);
6991}
6992
6993static void __ATTRS_o_ai
6994vec_stvx(vector float a, int b, float *c)
6995{
6996 __builtin_altivec_stvx((vector int)a, b, c);
6997}
6998
6999/* vec_ste */
7000
7001static void __ATTRS_o_ai
7002vec_ste(vector signed char a, int b, signed char *c)
7003{
7004 __builtin_altivec_stvebx((vector char)a, b, c);
7005}
7006
7007static void __ATTRS_o_ai
7008vec_ste(vector unsigned char a, int b, unsigned char *c)
7009{
7010 __builtin_altivec_stvebx((vector char)a, b, c);
7011}
7012
7013static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007014vec_ste(vector bool char a, int b, signed char *c)
7015{
7016 __builtin_altivec_stvebx((vector char)a, b, c);
7017}
7018
7019static void __ATTRS_o_ai
7020vec_ste(vector bool char a, int b, unsigned char *c)
7021{
7022 __builtin_altivec_stvebx((vector char)a, b, c);
7023}
7024
7025static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007026vec_ste(vector short a, int b, short *c)
7027{
7028 __builtin_altivec_stvehx(a, b, c);
7029}
7030
7031static void __ATTRS_o_ai
7032vec_ste(vector unsigned short a, int b, unsigned short *c)
7033{
7034 __builtin_altivec_stvehx((vector short)a, b, c);
7035}
7036
7037static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007038vec_ste(vector bool short a, int b, short *c)
7039{
7040 __builtin_altivec_stvehx((vector short)a, b, c);
7041}
7042
7043static void __ATTRS_o_ai
7044vec_ste(vector bool short a, int b, unsigned short *c)
7045{
7046 __builtin_altivec_stvehx((vector short)a, b, c);
7047}
7048
7049static void __ATTRS_o_ai
7050vec_ste(vector pixel a, int b, short *c)
7051{
7052 __builtin_altivec_stvehx((vector short)a, b, c);
7053}
7054
7055static void __ATTRS_o_ai
7056vec_ste(vector pixel a, int b, unsigned short *c)
7057{
7058 __builtin_altivec_stvehx((vector short)a, b, c);
7059}
7060
7061static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007062vec_ste(vector int a, int b, int *c)
7063{
7064 __builtin_altivec_stvewx(a, b, c);
7065}
7066
7067static void __ATTRS_o_ai
7068vec_ste(vector unsigned int a, int b, unsigned int *c)
7069{
7070 __builtin_altivec_stvewx((vector int)a, b, c);
7071}
7072
7073static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007074vec_ste(vector bool int a, int b, int *c)
7075{
7076 __builtin_altivec_stvewx((vector int)a, b, c);
7077}
7078
7079static void __ATTRS_o_ai
7080vec_ste(vector bool int a, int b, unsigned int *c)
7081{
7082 __builtin_altivec_stvewx((vector int)a, b, c);
7083}
7084
7085static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007086vec_ste(vector float a, int b, float *c)
7087{
7088 __builtin_altivec_stvewx((vector int)a, b, c);
7089}
7090
7091/* vec_stvebx */
7092
7093static void __ATTRS_o_ai
7094vec_stvebx(vector signed char a, int b, signed char *c)
7095{
7096 __builtin_altivec_stvebx((vector char)a, b, c);
7097}
7098
7099static void __ATTRS_o_ai
7100vec_stvebx(vector unsigned char a, int b, unsigned char *c)
7101{
7102 __builtin_altivec_stvebx((vector char)a, b, c);
7103}
7104
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007105static void __ATTRS_o_ai
7106vec_stvebx(vector bool char a, int b, signed char *c)
7107{
7108 __builtin_altivec_stvebx((vector char)a, b, c);
7109}
7110
7111static void __ATTRS_o_ai
7112vec_stvebx(vector bool char a, int b, unsigned char *c)
7113{
7114 __builtin_altivec_stvebx((vector char)a, b, c);
7115}
7116
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007117/* vec_stvehx */
7118
7119static void __ATTRS_o_ai
7120vec_stvehx(vector short a, int b, short *c)
7121{
7122 __builtin_altivec_stvehx(a, b, c);
7123}
7124
7125static void __ATTRS_o_ai
7126vec_stvehx(vector unsigned short a, int b, unsigned short *c)
7127{
7128 __builtin_altivec_stvehx((vector short)a, b, c);
7129}
7130
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007131static void __ATTRS_o_ai
7132vec_stvehx(vector bool short a, int b, short *c)
7133{
7134 __builtin_altivec_stvehx((vector short)a, b, c);
7135}
7136
7137static void __ATTRS_o_ai
7138vec_stvehx(vector bool short a, int b, unsigned short *c)
7139{
7140 __builtin_altivec_stvehx((vector short)a, b, c);
7141}
7142
7143static void __ATTRS_o_ai
7144vec_stvehx(vector pixel a, int b, short *c)
7145{
7146 __builtin_altivec_stvehx((vector short)a, b, c);
7147}
7148
7149static void __ATTRS_o_ai
7150vec_stvehx(vector pixel a, int b, unsigned short *c)
7151{
7152 __builtin_altivec_stvehx((vector short)a, b, c);
7153}
7154
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007155/* vec_stvewx */
7156
7157static void __ATTRS_o_ai
7158vec_stvewx(vector int a, int b, int *c)
7159{
7160 __builtin_altivec_stvewx(a, b, c);
7161}
7162
7163static void __ATTRS_o_ai
7164vec_stvewx(vector unsigned int a, int b, unsigned int *c)
7165{
7166 __builtin_altivec_stvewx((vector int)a, b, c);
7167}
7168
7169static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007170vec_stvewx(vector bool int a, int b, int *c)
7171{
7172 __builtin_altivec_stvewx((vector int)a, b, c);
7173}
7174
7175static void __ATTRS_o_ai
7176vec_stvewx(vector bool int a, int b, unsigned int *c)
7177{
7178 __builtin_altivec_stvewx((vector int)a, b, c);
7179}
7180
7181static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007182vec_stvewx(vector float a, int b, float *c)
7183{
7184 __builtin_altivec_stvewx((vector int)a, b, c);
7185}
7186
7187/* vec_stl */
7188
7189static void __ATTRS_o_ai
7190vec_stl(vector signed char a, int b, vector signed char *c)
7191{
7192 __builtin_altivec_stvxl((vector int)a, b, c);
7193}
7194
7195static void __ATTRS_o_ai
7196vec_stl(vector signed char a, int b, signed char *c)
7197{
7198 __builtin_altivec_stvxl((vector int)a, b, c);
7199}
7200
7201static void __ATTRS_o_ai
7202vec_stl(vector unsigned char a, int b, vector unsigned char *c)
7203{
7204 __builtin_altivec_stvxl((vector int)a, b, c);
7205}
7206
7207static void __ATTRS_o_ai
7208vec_stl(vector unsigned char a, int b, unsigned char *c)
7209{
7210 __builtin_altivec_stvxl((vector int)a, b, c);
7211}
7212
7213static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007214vec_stl(vector bool char a, int b, signed char *c)
7215{
7216 __builtin_altivec_stvxl((vector int)a, b, c);
7217}
7218
7219static void __ATTRS_o_ai
7220vec_stl(vector bool char a, int b, unsigned char *c)
7221{
7222 __builtin_altivec_stvxl((vector int)a, b, c);
7223}
7224
7225static void __ATTRS_o_ai
7226vec_stl(vector bool char a, int b, vector bool char *c)
7227{
7228 __builtin_altivec_stvxl((vector int)a, b, c);
7229}
7230
7231static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007232vec_stl(vector short a, int b, vector short *c)
7233{
7234 __builtin_altivec_stvxl((vector int)a, b, c);
7235}
7236
7237static void __ATTRS_o_ai
7238vec_stl(vector short a, int b, short *c)
7239{
7240 __builtin_altivec_stvxl((vector int)a, b, c);
7241}
7242
7243static void __ATTRS_o_ai
7244vec_stl(vector unsigned short a, int b, vector unsigned short *c)
7245{
7246 __builtin_altivec_stvxl((vector int)a, b, c);
7247}
7248
7249static void __ATTRS_o_ai
7250vec_stl(vector unsigned short a, int b, unsigned short *c)
7251{
7252 __builtin_altivec_stvxl((vector int)a, b, c);
7253}
7254
7255static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007256vec_stl(vector bool short a, int b, short *c)
7257{
7258 __builtin_altivec_stvxl((vector int)a, b, c);
7259}
7260
7261static void __ATTRS_o_ai
7262vec_stl(vector bool short a, int b, unsigned short *c)
7263{
7264 __builtin_altivec_stvxl((vector int)a, b, c);
7265}
7266
7267static void __ATTRS_o_ai
7268vec_stl(vector bool short a, int b, vector bool short *c)
7269{
7270 __builtin_altivec_stvxl((vector int)a, b, c);
7271}
7272
7273static void __ATTRS_o_ai
7274vec_stl(vector pixel a, int b, short *c)
7275{
7276 __builtin_altivec_stvxl((vector int)a, b, c);
7277}
7278
7279static void __ATTRS_o_ai
7280vec_stl(vector pixel a, int b, unsigned short *c)
7281{
7282 __builtin_altivec_stvxl((vector int)a, b, c);
7283}
7284
7285static void __ATTRS_o_ai
7286vec_stl(vector pixel a, int b, vector pixel *c)
7287{
7288 __builtin_altivec_stvxl((vector int)a, b, c);
7289}
7290
7291static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007292vec_stl(vector int a, int b, vector int *c)
7293{
7294 __builtin_altivec_stvxl(a, b, c);
7295}
7296
7297static void __ATTRS_o_ai
7298vec_stl(vector int a, int b, int *c)
7299{
7300 __builtin_altivec_stvxl(a, b, c);
7301}
7302
7303static void __ATTRS_o_ai
7304vec_stl(vector unsigned int a, int b, vector unsigned int *c)
7305{
7306 __builtin_altivec_stvxl((vector int)a, b, c);
7307}
7308
7309static void __ATTRS_o_ai
7310vec_stl(vector unsigned int a, int b, unsigned int *c)
7311{
7312 __builtin_altivec_stvxl((vector int)a, b, c);
7313}
7314
7315static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007316vec_stl(vector bool int a, int b, int *c)
7317{
7318 __builtin_altivec_stvxl((vector int)a, b, c);
7319}
7320
7321static void __ATTRS_o_ai
7322vec_stl(vector bool int a, int b, unsigned int *c)
7323{
7324 __builtin_altivec_stvxl((vector int)a, b, c);
7325}
7326
7327static void __ATTRS_o_ai
7328vec_stl(vector bool int a, int b, vector bool int *c)
7329{
7330 __builtin_altivec_stvxl((vector int)a, b, c);
7331}
7332
7333static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007334vec_stl(vector float a, int b, vector float *c)
7335{
7336 __builtin_altivec_stvxl((vector int)a, b, c);
7337}
7338
7339static void __ATTRS_o_ai
7340vec_stl(vector float a, int b, float *c)
7341{
7342 __builtin_altivec_stvxl((vector int)a, b, c);
7343}
7344
7345/* vec_stvxl */
7346
7347static void __ATTRS_o_ai
7348vec_stvxl(vector signed char a, int b, vector signed char *c)
7349{
7350 __builtin_altivec_stvxl((vector int)a, b, c);
7351}
7352
7353static void __ATTRS_o_ai
7354vec_stvxl(vector signed char a, int b, signed char *c)
7355{
7356 __builtin_altivec_stvxl((vector int)a, b, c);
7357}
7358
7359static void __ATTRS_o_ai
7360vec_stvxl(vector unsigned char a, int b, vector unsigned char *c)
7361{
7362 __builtin_altivec_stvxl((vector int)a, b, c);
7363}
7364
7365static void __ATTRS_o_ai
7366vec_stvxl(vector unsigned char a, int b, unsigned char *c)
7367{
7368 __builtin_altivec_stvxl((vector int)a, b, c);
7369}
7370
7371static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007372vec_stvxl(vector bool char a, int b, signed char *c)
7373{
7374 __builtin_altivec_stvxl((vector int)a, b, c);
7375}
7376
7377static void __ATTRS_o_ai
7378vec_stvxl(vector bool char a, int b, unsigned char *c)
7379{
7380 __builtin_altivec_stvxl((vector int)a, b, c);
7381}
7382
7383static void __ATTRS_o_ai
7384vec_stvxl(vector bool char a, int b, vector bool char *c)
7385{
7386 __builtin_altivec_stvxl((vector int)a, b, c);
7387}
7388
7389static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007390vec_stvxl(vector short a, int b, vector short *c)
7391{
7392 __builtin_altivec_stvxl((vector int)a, b, c);
7393}
7394
7395static void __ATTRS_o_ai
7396vec_stvxl(vector short a, int b, short *c)
7397{
7398 __builtin_altivec_stvxl((vector int)a, b, c);
7399}
7400
7401static void __ATTRS_o_ai
7402vec_stvxl(vector unsigned short a, int b, vector unsigned short *c)
7403{
7404 __builtin_altivec_stvxl((vector int)a, b, c);
7405}
7406
7407static void __ATTRS_o_ai
7408vec_stvxl(vector unsigned short a, int b, unsigned short *c)
7409{
7410 __builtin_altivec_stvxl((vector int)a, b, c);
7411}
7412
7413static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007414vec_stvxl(vector bool short a, int b, short *c)
7415{
7416 __builtin_altivec_stvxl((vector int)a, b, c);
7417}
7418
7419static void __ATTRS_o_ai
7420vec_stvxl(vector bool short a, int b, unsigned short *c)
7421{
7422 __builtin_altivec_stvxl((vector int)a, b, c);
7423}
7424
7425static void __ATTRS_o_ai
7426vec_stvxl(vector bool short a, int b, vector bool short *c)
7427{
7428 __builtin_altivec_stvxl((vector int)a, b, c);
7429}
7430
7431static void __ATTRS_o_ai
7432vec_stvxl(vector pixel a, int b, short *c)
7433{
7434 __builtin_altivec_stvxl((vector int)a, b, c);
7435}
7436
7437static void __ATTRS_o_ai
7438vec_stvxl(vector pixel a, int b, unsigned short *c)
7439{
7440 __builtin_altivec_stvxl((vector int)a, b, c);
7441}
7442
7443static void __ATTRS_o_ai
7444vec_stvxl(vector pixel a, int b, vector pixel *c)
7445{
7446 __builtin_altivec_stvxl((vector int)a, b, c);
7447}
7448
7449static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007450vec_stvxl(vector int a, int b, vector int *c)
7451{
7452 __builtin_altivec_stvxl(a, b, c);
7453}
7454
7455static void __ATTRS_o_ai
7456vec_stvxl(vector int a, int b, int *c)
7457{
7458 __builtin_altivec_stvxl(a, b, c);
7459}
7460
7461static void __ATTRS_o_ai
7462vec_stvxl(vector unsigned int a, int b, vector unsigned int *c)
7463{
7464 __builtin_altivec_stvxl((vector int)a, b, c);
7465}
7466
7467static void __ATTRS_o_ai
7468vec_stvxl(vector unsigned int a, int b, unsigned int *c)
7469{
7470 __builtin_altivec_stvxl((vector int)a, b, c);
7471}
7472
7473static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007474vec_stvxl(vector bool int a, int b, int *c)
7475{
7476 __builtin_altivec_stvxl((vector int)a, b, c);
7477}
7478
7479static void __ATTRS_o_ai
7480vec_stvxl(vector bool int a, int b, unsigned int *c)
7481{
7482 __builtin_altivec_stvxl((vector int)a, b, c);
7483}
7484
7485static void __ATTRS_o_ai
7486vec_stvxl(vector bool int a, int b, vector bool int *c)
7487{
7488 __builtin_altivec_stvxl((vector int)a, b, c);
7489}
7490
7491static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007492vec_stvxl(vector float a, int b, vector float *c)
7493{
7494 __builtin_altivec_stvxl((vector int)a, b, c);
7495}
7496
7497static void __ATTRS_o_ai
7498vec_stvxl(vector float a, int b, float *c)
7499{
7500 __builtin_altivec_stvxl((vector int)a, b, c);
7501}
7502
7503/* vec_sub */
7504
7505static vector signed char __ATTRS_o_ai
7506vec_sub(vector signed char a, vector signed char b)
7507{
7508 return a - b;
7509}
7510
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007511static vector signed char __ATTRS_o_ai
7512vec_sub(vector bool char a, vector signed char b)
7513{
7514 return (vector signed char)a - b;
7515}
7516
7517static vector signed char __ATTRS_o_ai
7518vec_sub(vector signed char a, vector bool char b)
7519{
7520 return a - (vector signed char)b;
7521}
7522
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007523static vector unsigned char __ATTRS_o_ai
7524vec_sub(vector unsigned char a, vector unsigned char b)
7525{
7526 return a - b;
7527}
7528
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007529static vector unsigned char __ATTRS_o_ai
7530vec_sub(vector bool char a, vector unsigned char b)
7531{
7532 return (vector unsigned char)a - b;
7533}
7534
7535static vector unsigned char __ATTRS_o_ai
7536vec_sub(vector unsigned char a, vector bool char b)
7537{
7538 return a - (vector unsigned char)b;
7539}
7540
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007541static vector short __ATTRS_o_ai
7542vec_sub(vector short a, vector short b)
7543{
7544 return a - b;
7545}
7546
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007547static vector short __ATTRS_o_ai
7548vec_sub(vector bool short a, vector short b)
7549{
7550 return (vector short)a - b;
7551}
7552
7553static vector short __ATTRS_o_ai
7554vec_sub(vector short a, vector bool short b)
7555{
7556 return a - (vector short)b;
7557}
7558
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007559static vector unsigned short __ATTRS_o_ai
7560vec_sub(vector unsigned short a, vector unsigned short b)
7561{
7562 return a - b;
7563}
7564
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007565static vector unsigned short __ATTRS_o_ai
7566vec_sub(vector bool short a, vector unsigned short b)
7567{
7568 return (vector unsigned short)a - b;
7569}
7570
7571static vector unsigned short __ATTRS_o_ai
7572vec_sub(vector unsigned short a, vector bool short b)
7573{
7574 return a - (vector unsigned short)b;
7575}
7576
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007577static vector int __ATTRS_o_ai
7578vec_sub(vector int a, vector int b)
7579{
7580 return a - b;
7581}
7582
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007583static vector int __ATTRS_o_ai
7584vec_sub(vector bool int a, vector int b)
7585{
7586 return (vector int)a - b;
7587}
7588
7589static vector int __ATTRS_o_ai
7590vec_sub(vector int a, vector bool int b)
7591{
7592 return a - (vector int)b;
7593}
7594
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007595static vector unsigned int __ATTRS_o_ai
7596vec_sub(vector unsigned int a, vector unsigned int b)
7597{
7598 return a - b;
7599}
7600
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007601static vector unsigned int __ATTRS_o_ai
7602vec_sub(vector bool int a, vector unsigned int b)
7603{
7604 return (vector unsigned int)a - b;
7605}
7606
7607static vector unsigned int __ATTRS_o_ai
7608vec_sub(vector unsigned int a, vector bool int b)
7609{
7610 return a - (vector unsigned int)b;
7611}
7612
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007613static vector float __ATTRS_o_ai
7614vec_sub(vector float a, vector float b)
7615{
7616 return a - b;
7617}
7618
7619/* vec_vsububm */
7620
7621#define __builtin_altivec_vsububm vec_vsububm
7622
7623static vector signed char __ATTRS_o_ai
7624vec_vsububm(vector signed char a, vector signed char b)
7625{
7626 return a - b;
7627}
7628
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007629static vector signed char __ATTRS_o_ai
7630vec_vsububm(vector bool char a, vector signed char b)
7631{
7632 return (vector signed char)a - b;
7633}
7634
7635static vector signed char __ATTRS_o_ai
7636vec_vsububm(vector signed char a, vector bool char b)
7637{
7638 return a - (vector signed char)b;
7639}
7640
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007641static vector unsigned char __ATTRS_o_ai
7642vec_vsububm(vector unsigned char a, vector unsigned char b)
7643{
7644 return a - b;
7645}
7646
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007647static vector unsigned char __ATTRS_o_ai
7648vec_vsububm(vector bool char a, vector unsigned char b)
7649{
7650 return (vector unsigned char)a - b;
7651}
7652
7653static vector unsigned char __ATTRS_o_ai
7654vec_vsububm(vector unsigned char a, vector bool char b)
7655{
7656 return a - (vector unsigned char)b;
7657}
7658
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007659/* vec_vsubuhm */
7660
7661#define __builtin_altivec_vsubuhm vec_vsubuhm
7662
7663static vector short __ATTRS_o_ai
7664vec_vsubuhm(vector short a, vector short b)
7665{
7666 return a - b;
7667}
7668
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007669static vector short __ATTRS_o_ai
7670vec_vsubuhm(vector bool short a, vector short b)
7671{
7672 return (vector short)a - b;
7673}
7674
7675static vector short __ATTRS_o_ai
7676vec_vsubuhm(vector short a, vector bool short b)
7677{
7678 return a - (vector short)b;
7679}
7680
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007681static vector unsigned short __ATTRS_o_ai
7682vec_vsubuhm(vector unsigned short a, vector unsigned short b)
7683{
7684 return a - b;
7685}
7686
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007687static vector unsigned short __ATTRS_o_ai
7688vec_vsubuhm(vector bool short a, vector unsigned short b)
7689{
7690 return (vector unsigned short)a - b;
7691}
7692
7693static vector unsigned short __ATTRS_o_ai
7694vec_vsubuhm(vector unsigned short a, vector bool short b)
7695{
7696 return a - (vector unsigned short)b;
7697}
7698
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007699/* vec_vsubuwm */
7700
7701#define __builtin_altivec_vsubuwm vec_vsubuwm
7702
7703static vector int __ATTRS_o_ai
7704vec_vsubuwm(vector int a, vector int b)
7705{
7706 return a - b;
7707}
7708
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007709static vector int __ATTRS_o_ai
7710vec_vsubuwm(vector bool int a, vector int b)
7711{
7712 return (vector int)a - b;
7713}
7714
7715static vector int __ATTRS_o_ai
7716vec_vsubuwm(vector int a, vector bool int b)
7717{
7718 return a - (vector int)b;
7719}
7720
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007721static vector unsigned int __ATTRS_o_ai
7722vec_vsubuwm(vector unsigned int a, vector unsigned int b)
7723{
7724 return a - b;
7725}
7726
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007727static vector unsigned int __ATTRS_o_ai
7728vec_vsubuwm(vector bool int a, vector unsigned int b)
7729{
7730 return (vector unsigned int)a - b;
7731}
7732
7733static vector unsigned int __ATTRS_o_ai
7734vec_vsubuwm(vector unsigned int a, vector bool int b)
7735{
7736 return a - (vector unsigned int)b;
7737}
7738
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007739/* vec_vsubfp */
7740
7741#define __builtin_altivec_vsubfp vec_vsubfp
7742
7743static vector float __attribute__((__always_inline__))
7744vec_vsubfp(vector float a, vector float b)
7745{
7746 return a - b;
7747}
7748
7749/* vec_subc */
7750
7751static vector unsigned int __attribute__((__always_inline__))
7752vec_subc(vector unsigned int a, vector unsigned int b)
7753{
7754 return __builtin_altivec_vsubcuw(a, b);
7755}
7756
7757/* vec_vsubcuw */
7758
7759static vector unsigned int __attribute__((__always_inline__))
7760vec_vsubcuw(vector unsigned int a, vector unsigned int b)
7761{
7762 return __builtin_altivec_vsubcuw(a, b);
7763}
7764
7765/* vec_subs */
7766
7767static vector signed char __ATTRS_o_ai
7768vec_subs(vector signed char a, vector signed char b)
7769{
7770 return __builtin_altivec_vsubsbs(a, b);
7771}
7772
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007773static vector signed char __ATTRS_o_ai
7774vec_subs(vector bool char a, vector signed char b)
7775{
7776 return __builtin_altivec_vsubsbs((vector signed char)a, b);
7777}
7778
7779static vector signed char __ATTRS_o_ai
7780vec_subs(vector signed char a, vector bool char b)
7781{
7782 return __builtin_altivec_vsubsbs(a, (vector signed char)b);
7783}
7784
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007785static vector unsigned char __ATTRS_o_ai
7786vec_subs(vector unsigned char a, vector unsigned char b)
7787{
7788 return __builtin_altivec_vsububs(a, b);
7789}
7790
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007791static vector unsigned char __ATTRS_o_ai
7792vec_subs(vector bool char a, vector unsigned char b)
7793{
7794 return __builtin_altivec_vsububs((vector unsigned char)a, b);
7795}
7796
7797static vector unsigned char __ATTRS_o_ai
7798vec_subs(vector unsigned char a, vector bool char b)
7799{
7800 return __builtin_altivec_vsububs(a, (vector unsigned char)b);
7801}
7802
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007803static vector short __ATTRS_o_ai
7804vec_subs(vector short a, vector short b)
7805{
7806 return __builtin_altivec_vsubshs(a, b);
7807}
7808
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007809static vector short __ATTRS_o_ai
7810vec_subs(vector bool short a, vector short b)
7811{
7812 return __builtin_altivec_vsubshs((vector short)a, b);
7813}
7814
7815static vector short __ATTRS_o_ai
7816vec_subs(vector short a, vector bool short b)
7817{
7818 return __builtin_altivec_vsubshs(a, (vector short)b);
7819}
7820
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007821static vector unsigned short __ATTRS_o_ai
7822vec_subs(vector unsigned short a, vector unsigned short b)
7823{
7824 return __builtin_altivec_vsubuhs(a, b);
7825}
7826
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007827static vector unsigned short __ATTRS_o_ai
7828vec_subs(vector bool short a, vector unsigned short b)
7829{
7830 return __builtin_altivec_vsubuhs((vector unsigned short)a, b);
7831}
7832
7833static vector unsigned short __ATTRS_o_ai
7834vec_subs(vector unsigned short a, vector bool short b)
7835{
7836 return __builtin_altivec_vsubuhs(a, (vector unsigned short)b);
7837}
7838
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007839static vector int __ATTRS_o_ai
7840vec_subs(vector int a, vector int b)
7841{
7842 return __builtin_altivec_vsubsws(a, b);
7843}
7844
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007845static vector int __ATTRS_o_ai
7846vec_subs(vector bool int a, vector int b)
7847{
7848 return __builtin_altivec_vsubsws((vector int)a, b);
7849}
7850
7851static vector int __ATTRS_o_ai
7852vec_subs(vector int a, vector bool int b)
7853{
7854 return __builtin_altivec_vsubsws(a, (vector int)b);
7855}
7856
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007857static vector unsigned int __ATTRS_o_ai
7858vec_subs(vector unsigned int a, vector unsigned int b)
7859{
7860 return __builtin_altivec_vsubuws(a, b);
7861}
7862
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007863static vector unsigned int __ATTRS_o_ai
7864vec_subs(vector bool int a, vector unsigned int b)
7865{
7866 return __builtin_altivec_vsubuws((vector unsigned int)a, b);
7867}
7868
7869static vector unsigned int __ATTRS_o_ai
7870vec_subs(vector unsigned int a, vector bool int b)
7871{
7872 return __builtin_altivec_vsubuws(a, (vector unsigned int)b);
7873}
7874
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007875/* vec_vsubsbs */
7876
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007877static vector signed char __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007878vec_vsubsbs(vector signed char a, vector signed char b)
7879{
7880 return __builtin_altivec_vsubsbs(a, b);
7881}
7882
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007883static vector signed char __ATTRS_o_ai
7884vec_vsubsbs(vector bool char a, vector signed char b)
7885{
7886 return __builtin_altivec_vsubsbs((vector signed char)a, b);
7887}
7888
7889static vector signed char __ATTRS_o_ai
7890vec_vsubsbs(vector signed char a, vector bool char b)
7891{
7892 return __builtin_altivec_vsubsbs(a, (vector signed char)b);
7893}
7894
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007895/* vec_vsububs */
7896
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007897static vector unsigned char __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007898vec_vsububs(vector unsigned char a, vector unsigned char b)
7899{
7900 return __builtin_altivec_vsububs(a, b);
7901}
7902
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007903static vector unsigned char __ATTRS_o_ai
7904vec_vsububs(vector bool char a, vector unsigned char b)
7905{
7906 return __builtin_altivec_vsububs((vector unsigned char)a, b);
7907}
7908
7909static vector unsigned char __ATTRS_o_ai
7910vec_vsububs(vector unsigned char a, vector bool char b)
7911{
7912 return __builtin_altivec_vsububs(a, (vector unsigned char)b);
7913}
7914
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007915/* vec_vsubshs */
7916
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007917static vector short __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007918vec_vsubshs(vector short a, vector short b)
7919{
7920 return __builtin_altivec_vsubshs(a, b);
7921}
7922
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007923static vector short __ATTRS_o_ai
7924vec_vsubshs(vector bool short a, vector short b)
7925{
7926 return __builtin_altivec_vsubshs((vector short)a, b);
7927}
7928
7929static vector short __ATTRS_o_ai
7930vec_vsubshs(vector short a, vector bool short b)
7931{
7932 return __builtin_altivec_vsubshs(a, (vector short)b);
7933}
7934
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007935/* vec_vsubuhs */
7936
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007937static vector unsigned short __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007938vec_vsubuhs(vector unsigned short a, vector unsigned short b)
7939{
7940 return __builtin_altivec_vsubuhs(a, b);
7941}
7942
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007943static vector unsigned short __ATTRS_o_ai
7944vec_vsubuhs(vector bool short a, vector unsigned short b)
7945{
7946 return __builtin_altivec_vsubuhs((vector unsigned short)a, b);
7947}
7948
7949static vector unsigned short __ATTRS_o_ai
7950vec_vsubuhs(vector unsigned short a, vector bool short b)
7951{
7952 return __builtin_altivec_vsubuhs(a, (vector unsigned short)b);
7953}
7954
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007955/* vec_vsubsws */
7956
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007957static vector int __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007958vec_vsubsws(vector int a, vector int b)
7959{
7960 return __builtin_altivec_vsubsws(a, b);
7961}
7962
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007963static vector int __ATTRS_o_ai
7964vec_vsubsws(vector bool int a, vector int b)
7965{
7966 return __builtin_altivec_vsubsws((vector int)a, b);
7967}
7968
7969static vector int __ATTRS_o_ai
7970vec_vsubsws(vector int a, vector bool int b)
7971{
7972 return __builtin_altivec_vsubsws(a, (vector int)b);
7973}
7974
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007975/* vec_vsubuws */
7976
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007977static vector unsigned int __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007978vec_vsubuws(vector unsigned int a, vector unsigned int b)
7979{
7980 return __builtin_altivec_vsubuws(a, b);
7981}
7982
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007983static vector unsigned int __ATTRS_o_ai
7984vec_vsubuws(vector bool int a, vector unsigned int b)
7985{
7986 return __builtin_altivec_vsubuws((vector unsigned int)a, b);
7987}
7988
7989static vector unsigned int __ATTRS_o_ai
7990vec_vsubuws(vector unsigned int a, vector bool int b)
7991{
7992 return __builtin_altivec_vsubuws(a, (vector unsigned int)b);
7993}
7994
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007995/* vec_sum4s */
7996
7997static vector int __ATTRS_o_ai
7998vec_sum4s(vector signed char a, vector int b)
7999{
8000 return __builtin_altivec_vsum4sbs(a, b);
8001}
8002
8003static vector unsigned int __ATTRS_o_ai
8004vec_sum4s(vector unsigned char a, vector unsigned int b)
8005{
8006 return __builtin_altivec_vsum4ubs(a, b);
8007}
8008
8009static vector int __ATTRS_o_ai
8010vec_sum4s(vector signed short a, vector int b)
8011{
8012 return __builtin_altivec_vsum4shs(a, b);
8013}
8014
8015/* vec_vsum4sbs */
8016
8017static vector int __attribute__((__always_inline__))
8018vec_vsum4sbs(vector signed char a, vector int b)
8019{
8020 return __builtin_altivec_vsum4sbs(a, b);
8021}
8022
8023/* vec_vsum4ubs */
8024
8025static vector unsigned int __attribute__((__always_inline__))
8026vec_vsum4ubs(vector unsigned char a, vector unsigned int b)
8027{
8028 return __builtin_altivec_vsum4ubs(a, b);
8029}
8030
8031/* vec_vsum4shs */
8032
8033static vector int __attribute__((__always_inline__))
8034vec_vsum4shs(vector signed short a, vector int b)
8035{
8036 return __builtin_altivec_vsum4shs(a, b);
8037}
8038
8039/* vec_sum2s */
8040
8041static vector signed int __attribute__((__always_inline__))
8042vec_sum2s(vector int a, vector int b)
8043{
8044 return __builtin_altivec_vsum2sws(a, b);
8045}
8046
8047/* vec_vsum2sws */
8048
8049static vector signed int __attribute__((__always_inline__))
8050vec_vsum2sws(vector int a, vector int b)
8051{
8052 return __builtin_altivec_vsum2sws(a, b);
8053}
8054
8055/* vec_sums */
8056
8057static vector signed int __attribute__((__always_inline__))
8058vec_sums(vector signed int a, vector signed int b)
8059{
8060 return __builtin_altivec_vsumsws(a, b);
8061}
8062
8063/* vec_vsumsws */
8064
8065static vector signed int __attribute__((__always_inline__))
8066vec_vsumsws(vector signed int a, vector signed int b)
8067{
8068 return __builtin_altivec_vsumsws(a, b);
8069}
8070
8071/* vec_trunc */
8072
8073static vector float __attribute__((__always_inline__))
8074vec_trunc(vector float a)
8075{
8076 return __builtin_altivec_vrfiz(a);
8077}
8078
8079/* vec_vrfiz */
8080
8081static vector float __attribute__((__always_inline__))
8082vec_vrfiz(vector float a)
8083{
8084 return __builtin_altivec_vrfiz(a);
8085}
8086
8087/* vec_unpackh */
8088
8089static vector short __ATTRS_o_ai
8090vec_unpackh(vector signed char a)
8091{
8092 return __builtin_altivec_vupkhsb((vector char)a);
8093}
8094
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008095static vector bool short __ATTRS_o_ai
8096vec_unpackh(vector bool char a)
8097{
8098 return (vector bool short)__builtin_altivec_vupkhsb((vector char)a);
8099}
8100
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008101static vector int __ATTRS_o_ai
8102vec_unpackh(vector short a)
8103{
8104 return __builtin_altivec_vupkhsh(a);
8105}
8106
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008107static vector bool int __ATTRS_o_ai
8108vec_unpackh(vector bool short a)
8109{
8110 return (vector bool int)__builtin_altivec_vupkhsh((vector short)a);
8111}
8112
8113static vector unsigned int __ATTRS_o_ai
8114vec_unpackh(vector pixel a)
8115{
8116 return (vector unsigned int)__builtin_altivec_vupkhsh((vector short)a);
8117}
8118
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008119/* vec_vupkhsb */
8120
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008121static vector short __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008122vec_vupkhsb(vector signed char a)
8123{
8124 return __builtin_altivec_vupkhsb((vector char)a);
8125}
8126
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008127static vector bool short __ATTRS_o_ai
8128vec_vupkhsb(vector bool char a)
8129{
8130 return (vector bool short)__builtin_altivec_vupkhsb((vector char)a);
8131}
8132
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008133/* vec_vupkhsh */
8134
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008135static vector int __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008136vec_vupkhsh(vector short a)
8137{
8138 return __builtin_altivec_vupkhsh(a);
8139}
8140
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008141static vector bool int __ATTRS_o_ai
8142vec_vupkhsh(vector bool short a)
8143{
8144 return (vector bool int)__builtin_altivec_vupkhsh((vector short)a);
8145}
8146
8147static vector unsigned int __ATTRS_o_ai
8148vec_vupkhsh(vector pixel a)
8149{
8150 return (vector unsigned int)__builtin_altivec_vupkhsh((vector short)a);
8151}
8152
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008153/* vec_unpackl */
8154
8155static vector short __ATTRS_o_ai
8156vec_unpackl(vector signed char a)
8157{
8158 return __builtin_altivec_vupklsb((vector char)a);
8159}
8160
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008161static vector bool short __ATTRS_o_ai
8162vec_unpackl(vector bool char a)
8163{
8164 return (vector bool short)__builtin_altivec_vupklsb((vector char)a);
8165}
8166
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008167static vector int __ATTRS_o_ai
8168vec_unpackl(vector short a)
8169{
8170 return __builtin_altivec_vupklsh(a);
8171}
8172
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008173static vector bool int __ATTRS_o_ai
8174vec_unpackl(vector bool short a)
8175{
8176 return (vector bool int)__builtin_altivec_vupklsh((vector short)a);
8177}
8178
8179static vector unsigned int __ATTRS_o_ai
8180vec_unpackl(vector pixel a)
8181{
8182 return (vector unsigned int)__builtin_altivec_vupklsh((vector short)a);
8183}
8184
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008185/* vec_vupklsb */
8186
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008187static vector short __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008188vec_vupklsb(vector signed char a)
8189{
8190 return __builtin_altivec_vupklsb((vector char)a);
8191}
8192
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008193static vector bool short __ATTRS_o_ai
8194vec_vupklsb(vector bool char a)
8195{
8196 return (vector bool short)__builtin_altivec_vupklsb((vector char)a);
8197}
8198
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008199/* vec_vupklsh */
8200
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008201static vector int __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008202vec_vupklsh(vector short a)
8203{
8204 return __builtin_altivec_vupklsh(a);
8205}
8206
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008207static vector bool int __ATTRS_o_ai
8208vec_vupklsh(vector bool short a)
8209{
8210 return (vector bool int)__builtin_altivec_vupklsh((vector short)a);
8211}
8212
8213static vector unsigned int __ATTRS_o_ai
8214vec_vupklsh(vector pixel a)
8215{
8216 return (vector unsigned int)__builtin_altivec_vupklsh((vector short)a);
8217}
8218
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008219/* vec_xor */
8220
8221#define __builtin_altivec_vxor vec_xor
8222
8223static vector signed char __ATTRS_o_ai
8224vec_xor(vector signed char a, vector signed char b)
8225{
8226 return a ^ b;
8227}
8228
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008229static vector signed char __ATTRS_o_ai
8230vec_xor(vector bool char a, vector signed char b)
8231{
8232 return (vector signed char)a ^ b;
8233}
8234
8235static vector signed char __ATTRS_o_ai
8236vec_xor(vector signed char a, vector bool char b)
8237{
8238 return a ^ (vector signed char)b;
8239}
8240
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008241static vector unsigned char __ATTRS_o_ai
8242vec_xor(vector unsigned char a, vector unsigned char b)
8243{
8244 return a ^ b;
8245}
8246
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008247static vector unsigned char __ATTRS_o_ai
8248vec_xor(vector bool char a, vector unsigned char b)
8249{
8250 return (vector unsigned char)a ^ b;
8251}
8252
8253static vector unsigned char __ATTRS_o_ai
8254vec_xor(vector unsigned char a, vector bool char b)
8255{
8256 return a ^ (vector unsigned char)b;
8257}
8258
8259static vector bool char __ATTRS_o_ai
8260vec_xor(vector bool char a, vector bool char b)
8261{
8262 return a ^ b;
8263}
8264
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008265static vector short __ATTRS_o_ai
8266vec_xor(vector short a, vector short b)
8267{
8268 return a ^ b;
8269}
8270
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008271static vector short __ATTRS_o_ai
8272vec_xor(vector bool short a, vector short b)
8273{
8274 return (vector short)a ^ b;
8275}
8276
8277static vector short __ATTRS_o_ai
8278vec_xor(vector short a, vector bool short b)
8279{
8280 return a ^ (vector short)b;
8281}
8282
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008283static vector unsigned short __ATTRS_o_ai
8284vec_xor(vector unsigned short a, vector unsigned short b)
8285{
8286 return a ^ b;
8287}
8288
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008289static vector unsigned short __ATTRS_o_ai
8290vec_xor(vector bool short a, vector unsigned short b)
8291{
8292 return (vector unsigned short)a ^ b;
8293}
8294
8295static vector unsigned short __ATTRS_o_ai
8296vec_xor(vector unsigned short a, vector bool short b)
8297{
8298 return a ^ (vector unsigned short)b;
8299}
8300
8301static vector bool short __ATTRS_o_ai
8302vec_xor(vector bool short a, vector bool short b)
8303{
8304 return a ^ b;
8305}
8306
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008307static vector int __ATTRS_o_ai
8308vec_xor(vector int a, vector int b)
8309{
8310 return a ^ b;
8311}
8312
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008313static vector int __ATTRS_o_ai
8314vec_xor(vector bool int a, vector int b)
8315{
8316 return (vector int)a ^ b;
8317}
8318
8319static vector int __ATTRS_o_ai
8320vec_xor(vector int a, vector bool int b)
8321{
8322 return a ^ (vector int)b;
8323}
8324
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008325static vector unsigned int __ATTRS_o_ai
8326vec_xor(vector unsigned int a, vector unsigned int b)
8327{
8328 return a ^ b;
8329}
8330
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008331static vector unsigned int __ATTRS_o_ai
8332vec_xor(vector bool int a, vector unsigned int b)
8333{
8334 return (vector unsigned int)a ^ b;
8335}
8336
8337static vector unsigned int __ATTRS_o_ai
8338vec_xor(vector unsigned int a, vector bool int b)
8339{
8340 return a ^ (vector unsigned int)b;
8341}
8342
8343static vector bool int __ATTRS_o_ai
8344vec_xor(vector bool int a, vector bool int b)
8345{
8346 return a ^ b;
8347}
8348
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008349static vector float __ATTRS_o_ai
8350vec_xor(vector float a, vector float b)
8351{
8352 vector unsigned int res = (vector unsigned int)a ^ (vector unsigned int)b;
8353 return (vector float)res;
8354}
8355
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008356static vector float __ATTRS_o_ai
8357vec_xor(vector bool int a, vector float b)
8358{
8359 vector unsigned int res = (vector unsigned int)a ^ (vector unsigned int)b;
8360 return (vector float)res;
8361}
8362
8363static vector float __ATTRS_o_ai
8364vec_xor(vector float a, vector bool int b)
8365{
8366 vector unsigned int res = (vector unsigned int)a ^ (vector unsigned int)b;
8367 return (vector float)res;
8368}
8369
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008370/* vec_vxor */
8371
8372static vector signed char __ATTRS_o_ai
8373vec_vxor(vector signed char a, vector signed char b)
8374{
8375 return a ^ b;
8376}
8377
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008378static vector signed char __ATTRS_o_ai
8379vec_vxor(vector bool char a, vector signed char b)
8380{
8381 return (vector signed char)a ^ b;
8382}
8383
8384static vector signed char __ATTRS_o_ai
8385vec_vxor(vector signed char a, vector bool char b)
8386{
8387 return a ^ (vector signed char)b;
8388}
8389
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008390static vector unsigned char __ATTRS_o_ai
8391vec_vxor(vector unsigned char a, vector unsigned char b)
8392{
8393 return a ^ b;
8394}
8395
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008396static vector unsigned char __ATTRS_o_ai
8397vec_vxor(vector bool char a, vector unsigned char b)
8398{
8399 return (vector unsigned char)a ^ b;
8400}
8401
8402static vector unsigned char __ATTRS_o_ai
8403vec_vxor(vector unsigned char a, vector bool char b)
8404{
8405 return a ^ (vector unsigned char)b;
8406}
8407
8408static vector bool char __ATTRS_o_ai
8409vec_vxor(vector bool char a, vector bool char b)
8410{
8411 return a ^ b;
8412}
8413
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008414static vector short __ATTRS_o_ai
8415vec_vxor(vector short a, vector short b)
8416{
8417 return a ^ b;
8418}
8419
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008420static vector short __ATTRS_o_ai
8421vec_vxor(vector bool short a, vector short b)
8422{
8423 return (vector short)a ^ b;
8424}
8425
8426static vector short __ATTRS_o_ai
8427vec_vxor(vector short a, vector bool short b)
8428{
8429 return a ^ (vector short)b;
8430}
8431
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008432static vector unsigned short __ATTRS_o_ai
8433vec_vxor(vector unsigned short a, vector unsigned short b)
8434{
8435 return a ^ b;
8436}
8437
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008438static vector unsigned short __ATTRS_o_ai
8439vec_vxor(vector bool short a, vector unsigned short b)
8440{
8441 return (vector unsigned short)a ^ b;
8442}
8443
8444static vector unsigned short __ATTRS_o_ai
8445vec_vxor(vector unsigned short a, vector bool short b)
8446{
8447 return a ^ (vector unsigned short)b;
8448}
8449
8450static vector bool short __ATTRS_o_ai
8451vec_vxor(vector bool short a, vector bool short b)
8452{
8453 return a ^ b;
8454}
8455
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008456static vector int __ATTRS_o_ai
8457vec_vxor(vector int a, vector int b)
8458{
8459 return a ^ b;
8460}
8461
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008462static vector int __ATTRS_o_ai
8463vec_vxor(vector bool int a, vector int b)
8464{
8465 return (vector int)a ^ b;
8466}
8467
8468static vector int __ATTRS_o_ai
8469vec_vxor(vector int a, vector bool int b)
8470{
8471 return a ^ (vector int)b;
8472}
8473
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008474static vector unsigned int __ATTRS_o_ai
8475vec_vxor(vector unsigned int a, vector unsigned int b)
8476{
8477 return a ^ b;
8478}
8479
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008480static vector unsigned int __ATTRS_o_ai
8481vec_vxor(vector bool int a, vector unsigned int b)
8482{
8483 return (vector unsigned int)a ^ b;
8484}
8485
8486static vector unsigned int __ATTRS_o_ai
8487vec_vxor(vector unsigned int a, vector bool int b)
8488{
8489 return a ^ (vector unsigned int)b;
8490}
8491
8492static vector bool int __ATTRS_o_ai
8493vec_vxor(vector bool int a, vector bool int b)
8494{
8495 return a ^ b;
8496}
8497
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008498static vector float __ATTRS_o_ai
8499vec_vxor(vector float a, vector float b)
8500{
8501 vector unsigned int res = (vector unsigned int)a ^ (vector unsigned int)b;
8502 return (vector float)res;
8503}
Chris Lattnerdd173942010-04-14 03:54:58 +00008504
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008505static vector float __ATTRS_o_ai
8506vec_vxor(vector bool int a, vector float b)
8507{
8508 vector unsigned int res = (vector unsigned int)a ^ (vector unsigned int)b;
8509 return (vector float)res;
8510}
8511
8512static vector float __ATTRS_o_ai
8513vec_vxor(vector float a, vector bool int b)
8514{
8515 vector unsigned int res = (vector unsigned int)a ^ (vector unsigned int)b;
8516 return (vector float)res;
8517}
8518
Anton Yartsev3ed32722010-09-18 00:39:16 +00008519/* ------------------------ extensions for CBEA ----------------------------- */
8520/* ----------------------------- predicates --------------------------------- */
Chris Lattnerdd173942010-04-14 03:54:58 +00008521
Chris Lattnerdd173942010-04-14 03:54:58 +00008522/* vec_all_eq */
8523
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008524static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008525vec_all_eq(vector signed char a, vector signed char b)
8526{
Chris Lattnerab866b42010-04-14 20:35:39 +00008527 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)a, (vector char)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00008528}
8529
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008530static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00008531vec_all_eq(vector signed char a, vector bool char b)
8532{
8533 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)a, (vector char)b);
8534}
8535
8536static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008537vec_all_eq(vector unsigned char a, vector unsigned char b)
8538{
Chris Lattnerab866b42010-04-14 20:35:39 +00008539 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)a, (vector char)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00008540}
8541
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008542static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00008543vec_all_eq(vector unsigned char a, vector bool char b)
8544{
8545 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)a, (vector char)b);
8546}
8547
8548static int __ATTRS_o_ai
8549vec_all_eq(vector bool char a, vector signed char b)
8550{
8551 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)a, (vector char)b);
8552}
8553
8554static int __ATTRS_o_ai
8555vec_all_eq(vector bool char a, vector unsigned char b)
8556{
8557 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)a, (vector char)b);
8558}
8559
8560static int __ATTRS_o_ai
8561vec_all_eq(vector bool char a, vector bool char b)
8562{
8563 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)a, (vector char)b);
8564}
8565
8566static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008567vec_all_eq(vector short a, vector short b)
8568{
8569 return __builtin_altivec_vcmpequh_p(__CR6_LT, a, b);
8570}
8571
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008572static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00008573vec_all_eq(vector short a, vector bool short b)
8574{
8575 return __builtin_altivec_vcmpequh_p(__CR6_LT, a, (vector short)b);
8576}
8577
8578static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008579vec_all_eq(vector unsigned short a, vector unsigned short b)
8580{
Anton Yartsev3ed32722010-09-18 00:39:16 +00008581 return
8582 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)a, (vector short)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00008583}
8584
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008585static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00008586vec_all_eq(vector unsigned short a, vector bool short b)
8587{
Anton Yartsev3ed32722010-09-18 00:39:16 +00008588 return
8589 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)a, (vector short)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00008590}
8591
8592static int __ATTRS_o_ai
8593vec_all_eq(vector bool short a, vector short b)
8594{
Anton Yartsev3ed32722010-09-18 00:39:16 +00008595 return
8596 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)a, (vector short)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00008597}
8598
8599static int __ATTRS_o_ai
8600vec_all_eq(vector bool short a, vector unsigned short b)
8601{
Anton Yartsev3ed32722010-09-18 00:39:16 +00008602 return
8603 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)a, (vector short)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00008604}
8605
8606static int __ATTRS_o_ai
8607vec_all_eq(vector bool short a, vector bool short b)
8608{
Anton Yartsev3ed32722010-09-18 00:39:16 +00008609 return
8610 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)a, (vector short)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00008611}
8612
8613static int __ATTRS_o_ai
8614vec_all_eq(vector pixel a, vector pixel b)
8615{
Anton Yartsev3ed32722010-09-18 00:39:16 +00008616 return
8617 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)a, (vector short)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00008618}
8619
8620static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008621vec_all_eq(vector int a, vector int b)
8622{
8623 return __builtin_altivec_vcmpequw_p(__CR6_LT, a, b);
8624}
8625
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008626static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00008627vec_all_eq(vector int a, vector bool int b)
8628{
8629 return __builtin_altivec_vcmpequw_p(__CR6_LT, a, (vector int)b);
8630}
8631
8632static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008633vec_all_eq(vector unsigned int a, vector unsigned int b)
8634{
Chris Lattnerab866b42010-04-14 20:35:39 +00008635 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)a, (vector int)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00008636}
8637
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008638static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00008639vec_all_eq(vector unsigned int a, vector bool int b)
8640{
8641 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)a, (vector int)b);
8642}
8643
8644static int __ATTRS_o_ai
8645vec_all_eq(vector bool int a, vector int b)
8646{
8647 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)a, (vector int)b);
8648}
8649
8650static int __ATTRS_o_ai
8651vec_all_eq(vector bool int a, vector unsigned int b)
8652{
8653 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)a, (vector int)b);
8654}
8655
8656static int __ATTRS_o_ai
8657vec_all_eq(vector bool int a, vector bool int b)
8658{
8659 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)a, (vector int)b);
8660}
8661
8662static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008663vec_all_eq(vector float a, vector float b)
8664{
8665 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, a, b);
8666}
8667
8668/* vec_all_ge */
8669
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008670static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008671vec_all_ge(vector signed char a, vector signed char b)
8672{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008673 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00008674}
8675
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008676static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00008677vec_all_ge(vector signed char a, vector bool char b)
8678{
8679 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)b, a);
8680}
8681
8682static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008683vec_all_ge(vector unsigned char a, vector unsigned char b)
8684{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008685 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00008686}
8687
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008688static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00008689vec_all_ge(vector unsigned char a, vector bool char b)
8690{
8691 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)b, a);
8692}
8693
8694static int __ATTRS_o_ai
8695vec_all_ge(vector bool char a, vector signed char b)
8696{
Anton Yartsev3ed32722010-09-18 00:39:16 +00008697 return __builtin_altivec_vcmpgtub_p(__CR6_EQ,
8698 (vector unsigned char)b,
8699 (vector unsigned char)a);
Anton Yartseva4f235b2010-08-19 11:57:49 +00008700}
8701
8702static int __ATTRS_o_ai
8703vec_all_ge(vector bool char a, vector unsigned char b)
8704{
8705 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, b, (vector unsigned char)a);
8706}
8707
8708static int __ATTRS_o_ai
8709vec_all_ge(vector bool char a, vector bool char b)
8710{
Anton Yartsev3ed32722010-09-18 00:39:16 +00008711 return __builtin_altivec_vcmpgtub_p(__CR6_EQ,
8712 (vector unsigned char)b,
8713 (vector unsigned char)a);
Anton Yartseva4f235b2010-08-19 11:57:49 +00008714}
8715
8716static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008717vec_all_ge(vector short a, vector short b)
8718{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008719 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00008720}
8721
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008722static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00008723vec_all_ge(vector short a, vector bool short b)
8724{
8725 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)b, a);
8726}
8727
8728static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008729vec_all_ge(vector unsigned short a, vector unsigned short b)
8730{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008731 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00008732}
8733
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008734static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00008735vec_all_ge(vector unsigned short a, vector bool short b)
8736{
8737 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)b, a);
8738}
8739
8740static int __ATTRS_o_ai
8741vec_all_ge(vector bool short a, vector short b)
8742{
Anton Yartsev3ed32722010-09-18 00:39:16 +00008743 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,
8744 (vector unsigned short)b,
8745 (vector unsigned short)a);
Anton Yartseva4f235b2010-08-19 11:57:49 +00008746}
8747
8748static int __ATTRS_o_ai
8749vec_all_ge(vector bool short a, vector unsigned short b)
8750{
8751 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, b, (vector unsigned short)a);
8752}
8753
8754static int __ATTRS_o_ai
8755vec_all_ge(vector bool short a, vector bool short b)
8756{
Anton Yartsev3ed32722010-09-18 00:39:16 +00008757 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,
8758 (vector unsigned short)b,
8759 (vector unsigned short)a);
Anton Yartseva4f235b2010-08-19 11:57:49 +00008760}
8761
8762static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008763vec_all_ge(vector int a, vector int b)
8764{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008765 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00008766}
8767
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008768static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00008769vec_all_ge(vector int a, vector bool int b)
8770{
8771 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)b, a);
8772}
8773
8774static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008775vec_all_ge(vector unsigned int a, vector unsigned int b)
8776{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008777 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00008778}
8779
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008780static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00008781vec_all_ge(vector unsigned int a, vector bool int b)
8782{
8783 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)b, a);
8784}
8785
8786static int __ATTRS_o_ai
8787vec_all_ge(vector bool int a, vector int b)
8788{
Anton Yartsev3ed32722010-09-18 00:39:16 +00008789 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,
8790 (vector unsigned int)b,
8791 (vector unsigned int)a);
Anton Yartseva4f235b2010-08-19 11:57:49 +00008792}
8793
8794static int __ATTRS_o_ai
8795vec_all_ge(vector bool int a, vector unsigned int b)
8796{
8797 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, b, (vector unsigned int)a);
8798}
8799
8800static int __ATTRS_o_ai
8801vec_all_ge(vector bool int a, vector bool int b)
8802{
Anton Yartsev3ed32722010-09-18 00:39:16 +00008803 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,
8804 (vector unsigned int)b,
8805 (vector unsigned int)a);
Anton Yartseva4f235b2010-08-19 11:57:49 +00008806}
8807
8808static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008809vec_all_ge(vector float a, vector float b)
8810{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008811 return __builtin_altivec_vcmpgefp_p(__CR6_LT, a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00008812}
8813
8814/* vec_all_gt */
8815
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008816static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008817vec_all_gt(vector signed char a, vector signed char b)
8818{
8819 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, a, b);
8820}
8821
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008822static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00008823vec_all_gt(vector signed char a, vector bool char b)
8824{
8825 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, a, (vector signed char)b);
8826}
8827
8828static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008829vec_all_gt(vector unsigned char a, vector unsigned char b)
8830{
8831 return __builtin_altivec_vcmpgtub_p(__CR6_LT, a, b);
8832}
8833
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008834static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00008835vec_all_gt(vector unsigned char a, vector bool char b)
8836{
8837 return __builtin_altivec_vcmpgtub_p(__CR6_LT, a, (vector unsigned char)b);
8838}
8839
8840static int __ATTRS_o_ai
8841vec_all_gt(vector bool char a, vector signed char b)
8842{
Anton Yartsev3ed32722010-09-18 00:39:16 +00008843 return __builtin_altivec_vcmpgtub_p(__CR6_LT,
8844 (vector unsigned char)a,
8845 (vector unsigned char)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00008846}
8847
8848static int __ATTRS_o_ai
8849vec_all_gt(vector bool char a, vector unsigned char b)
8850{
8851 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)a, b);
8852}
8853
8854static int __ATTRS_o_ai
8855vec_all_gt(vector bool char a, vector bool char b)
8856{
Anton Yartsev3ed32722010-09-18 00:39:16 +00008857 return __builtin_altivec_vcmpgtub_p(__CR6_LT,
8858 (vector unsigned char)a,
8859 (vector unsigned char)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00008860}
8861
8862static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008863vec_all_gt(vector short a, vector short b)
8864{
8865 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, a, b);
8866}
8867
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008868static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00008869vec_all_gt(vector short a, vector bool short b)
8870{
8871 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, a, (vector short)b);
8872}
8873
8874static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008875vec_all_gt(vector unsigned short a, vector unsigned short b)
8876{
8877 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, a, b);
8878}
8879
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008880static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00008881vec_all_gt(vector unsigned short a, vector bool short b)
8882{
8883 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, a, (vector unsigned short)b);
8884}
8885
8886static int __ATTRS_o_ai
8887vec_all_gt(vector bool short a, vector short b)
8888{
Anton Yartsev3ed32722010-09-18 00:39:16 +00008889 return __builtin_altivec_vcmpgtuh_p(__CR6_LT,
8890 (vector unsigned short)a,
8891 (vector unsigned short)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00008892}
8893
8894static int __ATTRS_o_ai
8895vec_all_gt(vector bool short a, vector unsigned short b)
8896{
8897 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)a, b);
8898}
8899
8900static int __ATTRS_o_ai
8901vec_all_gt(vector bool short a, vector bool short b)
8902{
Anton Yartsev3ed32722010-09-18 00:39:16 +00008903 return __builtin_altivec_vcmpgtuh_p(__CR6_LT,
8904 (vector unsigned short)a,
8905 (vector unsigned short)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00008906}
8907
8908static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008909vec_all_gt(vector int a, vector int b)
8910{
8911 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, a, b);
8912}
8913
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008914static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00008915vec_all_gt(vector int a, vector bool int b)
8916{
8917 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, a, (vector int)b);
8918}
8919
8920static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008921vec_all_gt(vector unsigned int a, vector unsigned int b)
8922{
8923 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, a, b);
8924}
8925
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008926static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00008927vec_all_gt(vector unsigned int a, vector bool int b)
8928{
8929 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, a, (vector unsigned int)b);
8930}
8931
8932static int __ATTRS_o_ai
8933vec_all_gt(vector bool int a, vector int b)
8934{
Anton Yartsev3ed32722010-09-18 00:39:16 +00008935 return __builtin_altivec_vcmpgtuw_p(__CR6_LT,
8936 (vector unsigned int)a,
8937 (vector unsigned int)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00008938}
8939
8940static int __ATTRS_o_ai
8941vec_all_gt(vector bool int a, vector unsigned int b)
8942{
8943 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)a, b);
8944}
8945
8946static int __ATTRS_o_ai
8947vec_all_gt(vector bool int a, vector bool int b)
8948{
Anton Yartsev3ed32722010-09-18 00:39:16 +00008949 return __builtin_altivec_vcmpgtuw_p(__CR6_LT,
8950 (vector unsigned int)a,
8951 (vector unsigned int)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00008952}
8953
8954static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008955vec_all_gt(vector float a, vector float b)
8956{
8957 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, a, b);
8958}
8959
8960/* vec_all_in */
8961
8962static int __attribute__((__always_inline__))
8963vec_all_in(vector float a, vector float b)
8964{
8965 return __builtin_altivec_vcmpbfp_p(__CR6_EQ, a, b);
8966}
8967
8968/* vec_all_le */
8969
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008970static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008971vec_all_le(vector signed char a, vector signed char b)
8972{
8973 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, a, b);
8974}
8975
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008976static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00008977vec_all_le(vector signed char a, vector bool char b)
8978{
8979 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, a, (vector signed char)b);
8980}
8981
8982static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008983vec_all_le(vector unsigned char a, vector unsigned char b)
8984{
8985 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, a, b);
8986}
8987
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008988static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00008989vec_all_le(vector unsigned char a, vector bool char b)
8990{
8991 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, a, (vector unsigned char)b);
8992}
8993
8994static int __ATTRS_o_ai
8995vec_all_le(vector bool char a, vector signed char b)
8996{
Anton Yartsev3ed32722010-09-18 00:39:16 +00008997 return __builtin_altivec_vcmpgtub_p(__CR6_EQ,
8998 (vector unsigned char)a,
8999 (vector unsigned char)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009000}
9001
9002static int __ATTRS_o_ai
9003vec_all_le(vector bool char a, vector unsigned char b)
9004{
9005 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)a, b);
9006}
9007
9008static int __ATTRS_o_ai
9009vec_all_le(vector bool char a, vector bool char b)
9010{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009011 return __builtin_altivec_vcmpgtub_p(__CR6_EQ,
9012 (vector unsigned char)a,
9013 (vector unsigned char)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009014}
9015
9016static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009017vec_all_le(vector short a, vector short b)
9018{
9019 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, a, b);
9020}
9021
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009022static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009023vec_all_le(vector short a, vector bool short b)
9024{
9025 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, a, (vector short)b);
9026}
9027
9028static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009029vec_all_le(vector unsigned short a, vector unsigned short b)
9030{
9031 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, a, b);
9032}
9033
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009034static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009035vec_all_le(vector unsigned short a, vector bool short b)
9036{
9037 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, a, (vector unsigned short)b);
9038}
9039
9040static int __ATTRS_o_ai
9041vec_all_le(vector bool short a, vector short b)
9042{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009043 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,
9044 (vector unsigned short)a,
9045 (vector unsigned short)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009046}
9047
9048static int __ATTRS_o_ai
9049vec_all_le(vector bool short a, vector unsigned short b)
9050{
9051 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)a, b);
9052}
9053
9054static int __ATTRS_o_ai
9055vec_all_le(vector bool short a, vector bool short b)
9056{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009057 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,
9058 (vector unsigned short)a,
9059 (vector unsigned short)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009060}
9061
9062static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009063vec_all_le(vector int a, vector int b)
9064{
9065 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, a, b);
9066}
9067
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009068static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009069vec_all_le(vector int a, vector bool int b)
9070{
9071 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, a, (vector int)b);
9072}
9073
9074static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009075vec_all_le(vector unsigned int a, vector unsigned int b)
9076{
9077 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, a, b);
9078}
9079
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009080static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009081vec_all_le(vector unsigned int a, vector bool int b)
9082{
9083 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, a, (vector unsigned int)b);
9084}
9085
9086static int __ATTRS_o_ai
9087vec_all_le(vector bool int a, vector int b)
9088{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009089 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,
9090 (vector unsigned int)a,
9091 (vector unsigned int)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009092}
9093
9094static int __ATTRS_o_ai
9095vec_all_le(vector bool int a, vector unsigned int b)
9096{
9097 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)a, b);
9098}
9099
9100static int __ATTRS_o_ai
9101vec_all_le(vector bool int a, vector bool int b)
9102{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009103 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,
9104 (vector unsigned int)a,
9105 (vector unsigned int)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009106}
9107
9108static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009109vec_all_le(vector float a, vector float b)
9110{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009111 return __builtin_altivec_vcmpgefp_p(__CR6_LT, b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00009112}
9113
9114/* vec_all_lt */
9115
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009116static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009117vec_all_lt(vector signed char a, vector signed char b)
9118{
9119 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, b, a);
9120}
9121
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009122static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009123vec_all_lt(vector signed char a, vector bool char b)
9124{
9125 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)b, a);
9126}
9127
9128static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009129vec_all_lt(vector unsigned char a, vector unsigned char b)
9130{
9131 return __builtin_altivec_vcmpgtub_p(__CR6_LT, b, a);
9132}
9133
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009134static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009135vec_all_lt(vector unsigned char a, vector bool char b)
9136{
9137 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)b, a);
9138}
9139
9140static int __ATTRS_o_ai
9141vec_all_lt(vector bool char a, vector signed char b)
9142{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009143 return __builtin_altivec_vcmpgtub_p(__CR6_LT,
9144 (vector unsigned char)b,
9145 (vector unsigned char)a);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009146}
9147
9148static int __ATTRS_o_ai
9149vec_all_lt(vector bool char a, vector unsigned char b)
9150{
9151 return __builtin_altivec_vcmpgtub_p(__CR6_LT, b, (vector unsigned char)a);
9152}
9153
9154static int __ATTRS_o_ai
9155vec_all_lt(vector bool char a, vector bool char b)
9156{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009157 return __builtin_altivec_vcmpgtub_p(__CR6_LT,
9158 (vector unsigned char)b,
9159 (vector unsigned char)a);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009160}
9161
9162static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009163vec_all_lt(vector short a, vector short b)
9164{
9165 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, b, a);
9166}
9167
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009168static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009169vec_all_lt(vector short a, vector bool short b)
9170{
9171 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)b, a);
9172}
9173
9174static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009175vec_all_lt(vector unsigned short a, vector unsigned short b)
9176{
9177 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, b, a);
9178}
9179
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009180static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009181vec_all_lt(vector unsigned short a, vector bool short b)
9182{
9183 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)b, a);
9184}
9185
9186static int __ATTRS_o_ai
9187vec_all_lt(vector bool short a, vector short b)
9188{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009189 return __builtin_altivec_vcmpgtuh_p(__CR6_LT,
9190 (vector unsigned short)b,
9191 (vector unsigned short)a);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009192}
9193
9194static int __ATTRS_o_ai
9195vec_all_lt(vector bool short a, vector unsigned short b)
9196{
9197 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, b, (vector unsigned short)a);
9198}
9199
9200static int __ATTRS_o_ai
9201vec_all_lt(vector bool short a, vector bool short b)
9202{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009203 return __builtin_altivec_vcmpgtuh_p(__CR6_LT,
9204 (vector unsigned short)b,
9205 (vector unsigned short)a);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009206}
9207
9208static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009209vec_all_lt(vector int a, vector int b)
9210{
9211 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, b, a);
9212}
9213
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009214static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009215vec_all_lt(vector int a, vector bool int b)
9216{
9217 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)b, a);
9218}
9219
9220static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009221vec_all_lt(vector unsigned int a, vector unsigned int b)
9222{
9223 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, b, a);
9224}
9225
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009226static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009227vec_all_lt(vector unsigned int a, vector bool int b)
9228{
9229 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)b, a);
9230}
9231
9232static int __ATTRS_o_ai
9233vec_all_lt(vector bool int a, vector int b)
9234{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009235 return __builtin_altivec_vcmpgtuw_p(__CR6_LT,
9236 (vector unsigned int)b,
9237 (vector unsigned int)a);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009238}
9239
9240static int __ATTRS_o_ai
9241vec_all_lt(vector bool int a, vector unsigned int b)
9242{
9243 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, b, (vector unsigned int)a);
9244}
9245
9246static int __ATTRS_o_ai
9247vec_all_lt(vector bool int a, vector bool int b)
9248{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009249 return __builtin_altivec_vcmpgtuw_p(__CR6_LT,
9250 (vector unsigned int)b,
9251 (vector unsigned int)a);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009252}
9253
9254static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009255vec_all_lt(vector float a, vector float b)
9256{
9257 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, b, a);
9258}
9259
9260/* vec_all_nan */
9261
9262static int __attribute__((__always_inline__))
9263vec_all_nan(vector float a)
9264{
9265 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, a, a);
9266}
9267
9268/* vec_all_ne */
9269
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009270static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009271vec_all_ne(vector signed char a, vector signed char b)
9272{
Chris Lattnerab866b42010-04-14 20:35:39 +00009273 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)a, (vector char)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00009274}
9275
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009276static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009277vec_all_ne(vector signed char a, vector bool char b)
9278{
9279 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)a, (vector char)b);
9280}
9281
9282static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009283vec_all_ne(vector unsigned char a, vector unsigned char b)
9284{
Chris Lattnerab866b42010-04-14 20:35:39 +00009285 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)a, (vector char)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00009286}
9287
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009288static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009289vec_all_ne(vector unsigned char a, vector bool char b)
9290{
9291 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)a, (vector char)b);
9292}
9293
9294static int __ATTRS_o_ai
9295vec_all_ne(vector bool char a, vector signed char b)
9296{
9297 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)a, (vector char)b);
9298}
9299
9300static int __ATTRS_o_ai
9301vec_all_ne(vector bool char a, vector unsigned char b)
9302{
9303 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)a, (vector char)b);
9304}
9305
9306static int __ATTRS_o_ai
9307vec_all_ne(vector bool char a, vector bool char b)
9308{
9309 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)a, (vector char)b);
9310}
9311
9312static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009313vec_all_ne(vector short a, vector short b)
9314{
9315 return __builtin_altivec_vcmpequh_p(__CR6_EQ, a, b);
9316}
9317
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009318static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009319vec_all_ne(vector short a, vector bool short b)
9320{
9321 return __builtin_altivec_vcmpequh_p(__CR6_EQ, a, (vector short)b);
9322}
9323
9324static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009325vec_all_ne(vector unsigned short a, vector unsigned short b)
9326{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009327 return
9328 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)a, (vector short)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00009329}
9330
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009331static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009332vec_all_ne(vector unsigned short a, vector bool short b)
9333{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009334 return
9335 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)a, (vector short)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009336}
9337
9338static int __ATTRS_o_ai
9339vec_all_ne(vector bool short a, vector short b)
9340{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009341 return
9342 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)a, (vector short)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009343}
9344
9345static int __ATTRS_o_ai
9346vec_all_ne(vector bool short a, vector unsigned short b)
9347{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009348 return
9349 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)a, (vector short)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009350}
9351
9352static int __ATTRS_o_ai
9353vec_all_ne(vector bool short a, vector bool short b)
9354{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009355 return
9356 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)a, (vector short)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009357}
9358
9359static int __ATTRS_o_ai
9360vec_all_ne(vector pixel a, vector pixel b)
9361{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009362 return
9363 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)a, (vector short)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009364}
9365
9366static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009367vec_all_ne(vector int a, vector int b)
9368{
9369 return __builtin_altivec_vcmpequw_p(__CR6_EQ, a, b);
9370}
9371
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009372static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009373vec_all_ne(vector int a, vector bool int b)
9374{
9375 return __builtin_altivec_vcmpequw_p(__CR6_EQ, a, (vector int)b);
9376}
9377
9378static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009379vec_all_ne(vector unsigned int a, vector unsigned int b)
9380{
Chris Lattnerab866b42010-04-14 20:35:39 +00009381 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)a, (vector int)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00009382}
9383
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009384static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009385vec_all_ne(vector unsigned int a, vector bool int b)
9386{
9387 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)a, (vector int)b);
9388}
9389
9390static int __ATTRS_o_ai
9391vec_all_ne(vector bool int a, vector int b)
9392{
9393 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)a, (vector int)b);
9394}
9395
9396static int __ATTRS_o_ai
9397vec_all_ne(vector bool int a, vector unsigned int b)
9398{
9399 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)a, (vector int)b);
9400}
9401
9402static int __ATTRS_o_ai
9403vec_all_ne(vector bool int a, vector bool int b)
9404{
9405 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)a, (vector int)b);
9406}
9407
9408static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009409vec_all_ne(vector float a, vector float b)
9410{
9411 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, a, b);
9412}
9413
9414/* vec_all_nge */
9415
9416static int __attribute__((__always_inline__))
9417vec_all_nge(vector float a, vector float b)
9418{
9419 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, a, b);
9420}
9421
9422/* vec_all_ngt */
9423
9424static int __attribute__((__always_inline__))
9425vec_all_ngt(vector float a, vector float b)
9426{
9427 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, a, b);
9428}
9429
9430/* vec_all_nle */
9431
9432static int __attribute__((__always_inline__))
9433vec_all_nle(vector float a, vector float b)
9434{
9435 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, b, a);
9436}
9437
9438/* vec_all_nlt */
9439
9440static int __attribute__((__always_inline__))
9441vec_all_nlt(vector float a, vector float b)
9442{
9443 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, b, a);
9444}
9445
9446/* vec_all_numeric */
9447
9448static int __attribute__((__always_inline__))
9449vec_all_numeric(vector float a)
9450{
9451 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, a, a);
9452}
9453
9454/* vec_any_eq */
9455
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009456static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009457vec_any_eq(vector signed char a, vector signed char b)
9458{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009459 return
9460 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)a, (vector char)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00009461}
9462
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009463static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009464vec_any_eq(vector signed char a, vector bool char b)
9465{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009466 return
9467 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)a, (vector char)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009468}
9469
9470static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009471vec_any_eq(vector unsigned char a, vector unsigned char b)
9472{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009473 return
9474 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)a, (vector char)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00009475}
9476
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009477static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009478vec_any_eq(vector unsigned char a, vector bool char b)
9479{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009480 return
9481 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)a, (vector char)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009482}
9483
9484static int __ATTRS_o_ai
9485vec_any_eq(vector bool char a, vector signed char b)
9486{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009487 return
9488 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)a, (vector char)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009489}
9490
9491static int __ATTRS_o_ai
9492vec_any_eq(vector bool char a, vector unsigned char b)
9493{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009494 return
9495 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)a, (vector char)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009496}
9497
9498static int __ATTRS_o_ai
9499vec_any_eq(vector bool char a, vector bool char b)
9500{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009501 return
9502 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)a, (vector char)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009503}
9504
9505static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009506vec_any_eq(vector short a, vector short b)
9507{
9508 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, a, b);
9509}
9510
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009511static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009512vec_any_eq(vector short a, vector bool short b)
9513{
9514 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, a, (vector short)b);
9515}
9516
9517static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009518vec_any_eq(vector unsigned short a, vector unsigned short b)
9519{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009520 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
9521 (vector short)a,
9522 (vector short)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00009523}
9524
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009525static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009526vec_any_eq(vector unsigned short a, vector bool short b)
9527{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009528 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
9529 (vector short)a,
9530 (vector short)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009531}
9532
9533static int __ATTRS_o_ai
9534vec_any_eq(vector bool short a, vector short b)
9535{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009536 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
9537 (vector short)a,
9538 (vector short)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009539}
9540
9541static int __ATTRS_o_ai
9542vec_any_eq(vector bool short a, vector unsigned short b)
9543{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009544 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
9545 (vector short)a,
9546 (vector short)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009547}
9548
9549static int __ATTRS_o_ai
9550vec_any_eq(vector bool short a, vector bool short b)
9551{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009552 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
9553 (vector short)a,
9554 (vector short)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009555}
9556
9557static int __ATTRS_o_ai
9558vec_any_eq(vector pixel a, vector pixel b)
9559{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009560 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
9561 (vector short)a,
9562 (vector short)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009563}
9564
9565static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009566vec_any_eq(vector int a, vector int b)
9567{
9568 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, a, b);
9569}
9570
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009571static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009572vec_any_eq(vector int a, vector bool int b)
9573{
9574 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, a, (vector int)b);
9575}
9576
9577static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009578vec_any_eq(vector unsigned int a, vector unsigned int b)
9579{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009580 return
9581 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)a, (vector int)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00009582}
9583
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009584static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009585vec_any_eq(vector unsigned int a, vector bool int b)
9586{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009587 return
9588 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)a, (vector int)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009589}
9590
9591static int __ATTRS_o_ai
9592vec_any_eq(vector bool int a, vector int b)
9593{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009594 return
9595 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)a, (vector int)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009596}
9597
9598static int __ATTRS_o_ai
9599vec_any_eq(vector bool int a, vector unsigned int b)
9600{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009601 return
9602 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)a, (vector int)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009603}
9604
9605static int __ATTRS_o_ai
9606vec_any_eq(vector bool int a, vector bool int b)
9607{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009608 return
9609 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)a, (vector int)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009610}
9611
9612static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009613vec_any_eq(vector float a, vector float b)
9614{
9615 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, a, b);
9616}
9617
9618/* vec_any_ge */
9619
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009620static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009621vec_any_ge(vector signed char a, vector signed char b)
9622{
9623 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, b, a);
9624}
9625
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009626static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009627vec_any_ge(vector signed char a, vector bool char b)
9628{
9629 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)b, a);
9630}
9631
9632static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009633vec_any_ge(vector unsigned char a, vector unsigned char b)
9634{
9635 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, b, a);
9636}
9637
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009638static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009639vec_any_ge(vector unsigned char a, vector bool char b)
9640{
9641 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)b, a);
9642}
9643
9644static int __ATTRS_o_ai
9645vec_any_ge(vector bool char a, vector signed char b)
9646{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009647 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,
9648 (vector unsigned char)b,
9649 (vector unsigned char)a);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009650}
9651
9652static int __ATTRS_o_ai
9653vec_any_ge(vector bool char a, vector unsigned char b)
9654{
9655 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, b, (vector unsigned char)a);
9656}
9657
9658static int __ATTRS_o_ai
9659vec_any_ge(vector bool char a, vector bool char b)
9660{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009661 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,
9662 (vector unsigned char)b,
9663 (vector unsigned char)a);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009664}
9665
9666static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009667vec_any_ge(vector short a, vector short b)
9668{
9669 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, b, a);
9670}
9671
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009672static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009673vec_any_ge(vector short a, vector bool short b)
9674{
9675 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)b, a);
9676}
9677
9678static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009679vec_any_ge(vector unsigned short a, vector unsigned short b)
9680{
9681 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, b, a);
9682}
9683
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009684static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009685vec_any_ge(vector unsigned short a, vector bool short b)
9686{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009687 return
9688 __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)b, a);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009689}
9690
9691static int __ATTRS_o_ai
9692vec_any_ge(vector bool short a, vector short b)
9693{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009694 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,
9695 (vector unsigned short)b,
9696 (vector unsigned short)a);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009697}
9698
9699static int __ATTRS_o_ai
9700vec_any_ge(vector bool short a, vector unsigned short b)
9701{
9702 return
9703 __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, b, (vector unsigned short)a);
9704}
9705
9706static int __ATTRS_o_ai
9707vec_any_ge(vector bool short a, vector bool short b)
9708{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009709 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,
9710 (vector unsigned short)b,
9711 (vector unsigned short)a);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009712}
9713
9714static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009715vec_any_ge(vector int a, vector int b)
9716{
9717 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, b, a);
9718}
9719
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009720static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009721vec_any_ge(vector int a, vector bool int b)
9722{
9723 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)b, a);
9724}
9725
9726static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009727vec_any_ge(vector unsigned int a, vector unsigned int b)
9728{
9729 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, b, a);
9730}
9731
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009732static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009733vec_any_ge(vector unsigned int a, vector bool int b)
9734{
9735 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)b, a);
9736}
9737
9738static int __ATTRS_o_ai
9739vec_any_ge(vector bool int a, vector int b)
9740{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009741 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,
9742 (vector unsigned int)b,
9743 (vector unsigned int)a);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009744}
9745
9746static int __ATTRS_o_ai
9747vec_any_ge(vector bool int a, vector unsigned int b)
9748{
9749 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, b, (vector unsigned int)a);
9750}
9751
9752static int __ATTRS_o_ai
9753vec_any_ge(vector bool int a, vector bool int b)
9754{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009755 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,
9756 (vector unsigned int)b,
9757 (vector unsigned int)a);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009758}
9759
9760static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009761vec_any_ge(vector float a, vector float b)
9762{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009763 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00009764}
9765
9766/* vec_any_gt */
9767
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009768static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009769vec_any_gt(vector signed char a, vector signed char b)
9770{
9771 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, a, b);
9772}
9773
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009774static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009775vec_any_gt(vector signed char a, vector bool char b)
9776{
9777 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, a, (vector signed char)b);
9778}
9779
9780static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009781vec_any_gt(vector unsigned char a, vector unsigned char b)
9782{
9783 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, a, b);
9784}
9785
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009786static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009787vec_any_gt(vector unsigned char a, vector bool char b)
9788{
9789 return
9790 __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, a, (vector unsigned char)b);
9791}
9792
9793static int __ATTRS_o_ai
9794vec_any_gt(vector bool char a, vector signed char b)
9795{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009796 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,
9797 (vector unsigned char)a,
9798 (vector unsigned char)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009799}
9800
9801static int __ATTRS_o_ai
9802vec_any_gt(vector bool char a, vector unsigned char b)
9803{
9804 return
9805 __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)a, b);
9806}
9807
9808static int __ATTRS_o_ai
9809vec_any_gt(vector bool char a, vector bool char b)
9810{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009811 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,
9812 (vector unsigned char)a,
9813 (vector unsigned char)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009814}
9815
9816static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009817vec_any_gt(vector short a, vector short b)
9818{
9819 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, a, b);
9820}
9821
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009822static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009823vec_any_gt(vector short a, vector bool short b)
9824{
9825 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, a, (vector short)b);
9826}
9827
9828static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009829vec_any_gt(vector unsigned short a, vector unsigned short b)
9830{
9831 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, a, b);
9832}
9833
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009834static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009835vec_any_gt(vector unsigned short a, vector bool short b)
9836{
9837 return
9838 __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, a, (vector unsigned short)b);
9839}
9840
9841static int __ATTRS_o_ai
9842vec_any_gt(vector bool short a, vector short b)
9843{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009844 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,
9845 (vector unsigned short)a,
9846 (vector unsigned short)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009847}
9848
9849static int __ATTRS_o_ai
9850vec_any_gt(vector bool short a, vector unsigned short b)
9851{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009852 return
9853 __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)a, b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009854}
9855
9856static int __ATTRS_o_ai
9857vec_any_gt(vector bool short a, vector bool short b)
9858{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009859 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,
9860 (vector unsigned short)a,
9861 (vector unsigned short)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009862}
9863
9864static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009865vec_any_gt(vector int a, vector int b)
9866{
9867 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, a, b);
9868}
9869
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009870static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009871vec_any_gt(vector int a, vector bool int b)
9872{
9873 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, a, (vector int)b);
9874}
9875
9876static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009877vec_any_gt(vector unsigned int a, vector unsigned int b)
9878{
9879 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, a, b);
9880}
9881
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009882static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009883vec_any_gt(vector unsigned int a, vector bool int b)
9884{
9885 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, a, (vector unsigned int)b);
9886}
9887
9888static int __ATTRS_o_ai
9889vec_any_gt(vector bool int a, vector int b)
9890{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009891 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,
9892 (vector unsigned int)a,
9893 (vector unsigned int)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009894}
9895
9896static int __ATTRS_o_ai
9897vec_any_gt(vector bool int a, vector unsigned int b)
9898{
9899 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)a, b);
9900}
9901
9902static int __ATTRS_o_ai
9903vec_any_gt(vector bool int a, vector bool int b)
9904{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009905 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,
9906 (vector unsigned int)a,
9907 (vector unsigned int)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009908}
9909
9910static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009911vec_any_gt(vector float a, vector float b)
9912{
9913 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, a, b);
9914}
9915
9916/* vec_any_le */
9917
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009918static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009919vec_any_le(vector signed char a, vector signed char b)
9920{
9921 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, a, b);
9922}
9923
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009924static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009925vec_any_le(vector signed char a, vector bool char b)
9926{
9927 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, a, (vector signed char)b);
9928}
9929
9930static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009931vec_any_le(vector unsigned char a, vector unsigned char b)
9932{
9933 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, a, b);
9934}
9935
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009936static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009937vec_any_le(vector unsigned char a, vector bool char b)
9938{
9939 return
9940 __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, a, (vector unsigned char)b);
9941}
9942
9943static int __ATTRS_o_ai
9944vec_any_le(vector bool char a, vector signed char b)
9945{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009946 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,
9947 (vector unsigned char)a,
9948 (vector unsigned char)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009949}
9950
9951static int __ATTRS_o_ai
9952vec_any_le(vector bool char a, vector unsigned char b)
9953{
9954 return
9955 __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)a, b);
9956}
9957
9958static int __ATTRS_o_ai
9959vec_any_le(vector bool char a, vector bool char b)
9960{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009961 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,
9962 (vector unsigned char)a,
9963 (vector unsigned char)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009964}
9965
9966static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009967vec_any_le(vector short a, vector short b)
9968{
9969 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, a, b);
9970}
9971
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009972static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009973vec_any_le(vector short a, vector bool short b)
9974{
9975 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, a, (vector short)b);
9976}
9977
9978static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009979vec_any_le(vector unsigned short a, vector unsigned short b)
9980{
9981 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, a, b);
9982}
9983
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009984static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +00009985vec_any_le(vector unsigned short a, vector bool short b)
9986{
9987 return
9988 __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, a, (vector unsigned short)b);
9989}
9990
9991static int __ATTRS_o_ai
9992vec_any_le(vector bool short a, vector short b)
9993{
Anton Yartsev3ed32722010-09-18 00:39:16 +00009994 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,
9995 (vector unsigned short)a,
9996 (vector unsigned short)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +00009997}
9998
9999static int __ATTRS_o_ai
10000vec_any_le(vector bool short a, vector unsigned short b)
10001{
10002 return
10003 __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)a, b);
10004}
10005
10006static int __ATTRS_o_ai
10007vec_any_le(vector bool short a, vector bool short b)
10008{
Anton Yartsev3ed32722010-09-18 00:39:16 +000010009 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,
10010 (vector unsigned short)a,
10011 (vector unsigned short)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +000010012}
10013
10014static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +000010015vec_any_le(vector int a, vector int b)
10016{
10017 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, a, b);
10018}
10019
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000010020static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +000010021vec_any_le(vector int a, vector bool int b)
10022{
10023 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, a, (vector int)b);
10024}
10025
10026static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +000010027vec_any_le(vector unsigned int a, vector unsigned int b)
10028{
10029 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, a, b);
10030}
10031
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000010032static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +000010033vec_any_le(vector unsigned int a, vector bool int b)
10034{
10035 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, a, (vector unsigned int)b);
10036}
10037
10038static int __ATTRS_o_ai
10039vec_any_le(vector bool int a, vector int b)
10040{
Anton Yartsev3ed32722010-09-18 00:39:16 +000010041 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,
10042 (vector unsigned int)a,
10043 (vector unsigned int)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +000010044}
10045
10046static int __ATTRS_o_ai
10047vec_any_le(vector bool int a, vector unsigned int b)
10048{
10049 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)a, b);
10050}
10051
10052static int __ATTRS_o_ai
10053vec_any_le(vector bool int a, vector bool int b)
10054{
Anton Yartsev3ed32722010-09-18 00:39:16 +000010055 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,
10056 (vector unsigned int)a,
10057 (vector unsigned int)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +000010058}
10059
10060static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +000010061vec_any_le(vector float a, vector float b)
10062{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000010063 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +000010064}
10065
10066/* vec_any_lt */
10067
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000010068static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +000010069vec_any_lt(vector signed char a, vector signed char b)
10070{
10071 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, b, a);
10072}
10073
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000010074static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +000010075vec_any_lt(vector signed char a, vector bool char b)
10076{
10077 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)b, a);
10078}
10079
10080static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +000010081vec_any_lt(vector unsigned char a, vector unsigned char b)
10082{
10083 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, b, a);
10084}
10085
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000010086static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +000010087vec_any_lt(vector unsigned char a, vector bool char b)
10088{
10089 return
10090 __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)b, a);
10091}
10092
10093static int __ATTRS_o_ai
10094vec_any_lt(vector bool char a, vector signed char b)
10095{
Anton Yartsev3ed32722010-09-18 00:39:16 +000010096 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,
10097 (vector unsigned char)b,
10098 (vector unsigned char)a);
Anton Yartseva4f235b2010-08-19 11:57:49 +000010099}
10100
10101static int __ATTRS_o_ai
10102vec_any_lt(vector bool char a, vector unsigned char b)
10103{
10104 return
10105 __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, b, (vector unsigned char)a);
10106}
10107
10108static int __ATTRS_o_ai
10109vec_any_lt(vector bool char a, vector bool char b)
10110{
Anton Yartsev3ed32722010-09-18 00:39:16 +000010111 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,
10112 (vector unsigned char)b,
10113 (vector unsigned char)a);
Anton Yartseva4f235b2010-08-19 11:57:49 +000010114}
10115
10116static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +000010117vec_any_lt(vector short a, vector short b)
10118{
10119 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, b, a);
10120}
10121
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000010122static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +000010123vec_any_lt(vector short a, vector bool short b)
10124{
10125 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)b, a);
10126}
10127
10128static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +000010129vec_any_lt(vector unsigned short a, vector unsigned short b)
10130{
10131 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, b, a);
10132}
10133
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000010134static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +000010135vec_any_lt(vector unsigned short a, vector bool short b)
10136{
10137 return
10138 __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)b, a);
10139}
10140
10141static int __ATTRS_o_ai
10142vec_any_lt(vector bool short a, vector short b)
10143{
Anton Yartsev3ed32722010-09-18 00:39:16 +000010144 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,
10145 (vector unsigned short)b,
10146 (vector unsigned short)a);
Anton Yartseva4f235b2010-08-19 11:57:49 +000010147}
10148
10149static int __ATTRS_o_ai
10150vec_any_lt(vector bool short a, vector unsigned short b)
10151{
10152 return
10153 __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, b, (vector unsigned short)a);
10154}
10155
10156static int __ATTRS_o_ai
10157vec_any_lt(vector bool short a, vector bool short b)
10158{
Anton Yartsev3ed32722010-09-18 00:39:16 +000010159 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,
10160 (vector unsigned short)b,
10161 (vector unsigned short)a);
Anton Yartseva4f235b2010-08-19 11:57:49 +000010162}
10163
10164static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +000010165vec_any_lt(vector int a, vector int b)
10166{
10167 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, b, a);
10168}
10169
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000010170static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +000010171vec_any_lt(vector int a, vector bool int b)
10172{
10173 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)b, a);
10174}
10175
10176static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +000010177vec_any_lt(vector unsigned int a, vector unsigned int b)
10178{
10179 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, b, a);
10180}
10181
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000010182static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +000010183vec_any_lt(vector unsigned int a, vector bool int b)
10184{
10185 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)b, a);
10186}
10187
10188static int __ATTRS_o_ai
10189vec_any_lt(vector bool int a, vector int b)
10190{
Anton Yartsev3ed32722010-09-18 00:39:16 +000010191 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,
10192 (vector unsigned int)b,
10193 (vector unsigned int)a);
Anton Yartseva4f235b2010-08-19 11:57:49 +000010194}
10195
10196static int __ATTRS_o_ai
10197vec_any_lt(vector bool int a, vector unsigned int b)
10198{
10199 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, b, (vector unsigned int)a);
10200}
10201
10202static int __ATTRS_o_ai
10203vec_any_lt(vector bool int a, vector bool int b)
10204{
Anton Yartsev3ed32722010-09-18 00:39:16 +000010205 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,
10206 (vector unsigned int)b,
10207 (vector unsigned int)a);
Anton Yartseva4f235b2010-08-19 11:57:49 +000010208}
10209
10210static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +000010211vec_any_lt(vector float a, vector float b)
10212{
10213 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, b, a);
10214}
10215
10216/* vec_any_nan */
10217
10218static int __attribute__((__always_inline__))
10219vec_any_nan(vector float a)
10220{
10221 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, a, a);
10222}
10223
10224/* vec_any_ne */
10225
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000010226static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +000010227vec_any_ne(vector signed char a, vector signed char b)
10228{
Anton Yartsev3ed32722010-09-18 00:39:16 +000010229 return
10230 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)a, (vector char)b);
Chris Lattnerdd173942010-04-14 03:54:58 +000010231}
10232
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000010233static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +000010234vec_any_ne(vector signed char a, vector bool char b)
10235{
Anton Yartsev3ed32722010-09-18 00:39:16 +000010236 return
10237 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)a, (vector char)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +000010238}
10239
10240static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +000010241vec_any_ne(vector unsigned char a, vector unsigned char b)
10242{
Anton Yartsev3ed32722010-09-18 00:39:16 +000010243 return
10244 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)a, (vector char)b);
Chris Lattnerdd173942010-04-14 03:54:58 +000010245}
10246
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000010247static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +000010248vec_any_ne(vector unsigned char a, vector bool char b)
10249{
Anton Yartsev3ed32722010-09-18 00:39:16 +000010250 return
10251 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)a, (vector char)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +000010252}
10253
10254static int __ATTRS_o_ai
10255vec_any_ne(vector bool char a, vector signed char b)
10256{
Anton Yartsev3ed32722010-09-18 00:39:16 +000010257 return
10258 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)a, (vector char)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +000010259}
10260
10261static int __ATTRS_o_ai
10262vec_any_ne(vector bool char a, vector unsigned char b)
10263{
Anton Yartsev3ed32722010-09-18 00:39:16 +000010264 return
10265 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)a, (vector char)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +000010266}
10267
10268static int __ATTRS_o_ai
10269vec_any_ne(vector bool char a, vector bool char b)
10270{
Anton Yartsev3ed32722010-09-18 00:39:16 +000010271 return
10272 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)a, (vector char)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +000010273}
10274
10275static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +000010276vec_any_ne(vector short a, vector short b)
10277{
10278 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, a, b);
10279}
10280
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000010281static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +000010282vec_any_ne(vector short a, vector bool short b)
10283{
10284 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, a, (vector short)b);
10285}
10286
10287static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +000010288vec_any_ne(vector unsigned short a, vector unsigned short b)
10289{
Anton Yartsev3ed32722010-09-18 00:39:16 +000010290 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
10291 (vector short)a,
10292 (vector short)b);
Chris Lattnerdd173942010-04-14 03:54:58 +000010293}
10294
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000010295static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +000010296vec_any_ne(vector unsigned short a, vector bool short b)
10297{
Anton Yartsev3ed32722010-09-18 00:39:16 +000010298 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
10299 (vector short)a,
10300 (vector short)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +000010301}
10302
10303static int __ATTRS_o_ai
10304vec_any_ne(vector bool short a, vector short b)
10305{
Anton Yartsev3ed32722010-09-18 00:39:16 +000010306 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
10307 (vector short)a,
10308 (vector short)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +000010309}
10310
10311static int __ATTRS_o_ai
10312vec_any_ne(vector bool short a, vector unsigned short b)
10313{
Anton Yartsev3ed32722010-09-18 00:39:16 +000010314 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
10315 (vector short)a,
10316 (vector short)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +000010317}
10318
10319static int __ATTRS_o_ai
10320vec_any_ne(vector bool short a, vector bool short b)
10321{
Anton Yartsev3ed32722010-09-18 00:39:16 +000010322 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
10323 (vector short)a,
10324 (vector short)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +000010325}
10326
10327static int __ATTRS_o_ai
10328vec_any_ne(vector pixel a, vector pixel b)
10329{
Anton Yartsev3ed32722010-09-18 00:39:16 +000010330 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
10331 (vector short)a,
10332 (vector short)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +000010333}
10334
10335static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +000010336vec_any_ne(vector int a, vector int b)
10337{
10338 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, a, b);
10339}
10340
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000010341static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +000010342vec_any_ne(vector int a, vector bool int b)
10343{
10344 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, a, (vector int)b);
10345}
10346
10347static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +000010348vec_any_ne(vector unsigned int a, vector unsigned int b)
10349{
Anton Yartsev3ed32722010-09-18 00:39:16 +000010350 return
10351 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)a, (vector int)b);
Chris Lattnerdd173942010-04-14 03:54:58 +000010352}
10353
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000010354static int __ATTRS_o_ai
Anton Yartseva4f235b2010-08-19 11:57:49 +000010355vec_any_ne(vector unsigned int a, vector bool int b)
10356{
Anton Yartsev3ed32722010-09-18 00:39:16 +000010357 return
10358 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)a, (vector int)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +000010359}
10360
10361static int __ATTRS_o_ai
10362vec_any_ne(vector bool int a, vector int b)
10363{
Anton Yartsev3ed32722010-09-18 00:39:16 +000010364 return
10365 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)a, (vector int)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +000010366}
10367
10368static int __ATTRS_o_ai
10369vec_any_ne(vector bool int a, vector unsigned int b)
10370{
Anton Yartsev3ed32722010-09-18 00:39:16 +000010371 return
10372 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)a, (vector int)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +000010373}
10374
10375static int __ATTRS_o_ai
10376vec_any_ne(vector bool int a, vector bool int b)
10377{
Anton Yartsev3ed32722010-09-18 00:39:16 +000010378 return
10379 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)a, (vector int)b);
Anton Yartseva4f235b2010-08-19 11:57:49 +000010380}
10381
10382static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +000010383vec_any_ne(vector float a, vector float b)
10384{
10385 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, a, b);
10386}
10387
10388/* vec_any_nge */
10389
10390static int __attribute__((__always_inline__))
10391vec_any_nge(vector float a, vector float b)
10392{
10393 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, a, b);
10394}
10395
10396/* vec_any_ngt */
10397
10398static int __attribute__((__always_inline__))
10399vec_any_ngt(vector float a, vector float b)
10400{
10401 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, a, b);
10402}
10403
10404/* vec_any_nle */
10405
10406static int __attribute__((__always_inline__))
10407vec_any_nle(vector float a, vector float b)
10408{
10409 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, b, a);
10410}
10411
10412/* vec_any_nlt */
10413
10414static int __attribute__((__always_inline__))
10415vec_any_nlt(vector float a, vector float b)
10416{
10417 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, b, a);
10418}
10419
10420/* vec_any_numeric */
10421
10422static int __attribute__((__always_inline__))
10423vec_any_numeric(vector float a)
10424{
10425 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, a, a);
10426}
10427
10428/* vec_any_out */
10429
10430static int __attribute__((__always_inline__))
10431vec_any_out(vector float a, vector float b)
10432{
10433 return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, a, b);
10434}
10435
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000010436#undef __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +000010437
10438#endif /* __ALTIVEC_H */