blob: 5d251de2839bde2b1dccd56580b026030a14318d [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
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000023// TODO: add functions for 'vector bool ..' and 'vector pixel' argument types according to
24// the 'AltiVec Technology Programming Interface Manual'
25
Chris Lattnerdd173942010-04-14 03:54:58 +000026#ifndef __ALTIVEC_H
27#define __ALTIVEC_H
28
29#ifndef __ALTIVEC__
30#error "AltiVec support not enabled"
31#endif
32
33/* constants for mapping CR6 bits to predicate result. */
34
35#define __CR6_EQ 0
36#define __CR6_EQ_REV 1
37#define __CR6_LT 2
38#define __CR6_LT_REV 3
39
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000040#define __ATTRS_o_ai __attribute__((__overloadable__, __always_inline__))
41
42static vector signed char __ATTRS_o_ai
43vec_perm(vector signed char a, vector signed char b, vector unsigned char c);
44
45static vector unsigned char __ATTRS_o_ai
46vec_perm(vector unsigned char a, vector unsigned char b, vector unsigned char c);
47
Anton Yartsevf54dbfd2010-08-19 03:00:09 +000048static vector bool char __ATTRS_o_ai
49vec_perm(vector bool char a, vector bool char b, vector unsigned char c);
50
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000051static vector short __ATTRS_o_ai
52vec_perm(vector short a, vector short b, vector unsigned char c);
53
54static vector unsigned short __ATTRS_o_ai
55vec_perm(vector unsigned short a, vector unsigned short b, vector unsigned char c);
56
Anton Yartsevf54dbfd2010-08-19 03:00:09 +000057static vector bool short __ATTRS_o_ai
58vec_perm(vector bool short a, vector bool short b, vector unsigned char c);
59
60static vector pixel __ATTRS_o_ai
61vec_perm(vector pixel a, vector pixel b, vector unsigned char c);
62
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000063static vector int __ATTRS_o_ai
64vec_perm(vector int a, vector int b, vector unsigned char c);
65
66static vector unsigned int __ATTRS_o_ai
67vec_perm(vector unsigned int a, vector unsigned int b, vector unsigned char c);
68
Anton Yartsevf54dbfd2010-08-19 03:00:09 +000069static vector bool int __ATTRS_o_ai
70vec_perm(vector bool int a, vector bool int b, vector unsigned char c);
71
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000072static vector float __ATTRS_o_ai
73vec_perm(vector float a, vector float b, vector unsigned char c);
Chris Lattnerdd173942010-04-14 03:54:58 +000074
75/* vec_abs */
76
Chris Lattnerdd173942010-04-14 03:54:58 +000077#define __builtin_altivec_abs_v16qi vec_abs
78#define __builtin_altivec_abs_v8hi vec_abs
79#define __builtin_altivec_abs_v4si vec_abs
80
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000081static vector signed char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +000082vec_abs(vector signed char a)
83{
84 return __builtin_altivec_vmaxsb(a, -a);
85}
86
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000087static vector signed short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +000088vec_abs(vector signed short a)
89{
90 return __builtin_altivec_vmaxsh(a, -a);
91}
92
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000093static vector signed int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +000094vec_abs(vector signed int a)
95{
96 return __builtin_altivec_vmaxsw(a, -a);
97}
98
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000099static vector float __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000100vec_abs(vector float a)
101{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000102 vector unsigned int res = (vector unsigned int)a & (vector unsigned int)(0x7FFFFFFF);
Chris Lattnerab866b42010-04-14 20:35:39 +0000103 return (vector float)res;
Chris Lattnerdd173942010-04-14 03:54:58 +0000104}
105
106/* vec_abss */
107
Chris Lattnerdd173942010-04-14 03:54:58 +0000108#define __builtin_altivec_abss_v16qi vec_abss
109#define __builtin_altivec_abss_v8hi vec_abss
110#define __builtin_altivec_abss_v4si vec_abss
111
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000112static vector signed char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000113vec_abss(vector signed char a)
114{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000115 return __builtin_altivec_vmaxsb(a, __builtin_altivec_vsubsbs((vector signed char)(0), a));
Chris Lattnerdd173942010-04-14 03:54:58 +0000116}
117
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000118static vector signed short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000119vec_abss(vector signed short a)
120{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000121 return __builtin_altivec_vmaxsh(a, __builtin_altivec_vsubshs((vector signed short)(0), a));
Chris Lattnerdd173942010-04-14 03:54:58 +0000122}
123
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000124static vector signed int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000125vec_abss(vector signed int a)
126{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000127 return __builtin_altivec_vmaxsw(a, __builtin_altivec_vsubsws((vector signed int)(0), a));
Chris Lattnerdd173942010-04-14 03:54:58 +0000128}
129
130/* vec_add */
131
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000132static vector signed char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000133vec_add(vector signed char a, vector signed char b)
134{
135 return a + b;
136}
137
Anton Yartsev05e35552010-08-16 16:22:12 +0000138static vector signed char __ATTRS_o_ai
139vec_add(vector bool char a, vector signed char b)
140{
141 return (vector signed char)a + b;
142}
143
144static vector signed char __ATTRS_o_ai
145vec_add(vector signed char a, vector bool char b)
146{
147 return a + (vector signed char)b;
148}
149
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000150static vector unsigned char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000151vec_add(vector unsigned char a, vector unsigned char b)
152{
153 return a + b;
154}
155
Anton Yartsev05e35552010-08-16 16:22:12 +0000156static vector unsigned char __ATTRS_o_ai
157vec_add(vector bool char a, vector unsigned char b)
158{
159 return (vector unsigned char)a + b;
160}
161
162static vector unsigned char __ATTRS_o_ai
163vec_add(vector unsigned char a, vector bool char b)
164{
165 return a + (vector unsigned char)b;
166}
167
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000168static vector short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000169vec_add(vector short a, vector short b)
170{
171 return a + b;
172}
173
Anton Yartsev05e35552010-08-16 16:22:12 +0000174static vector short __ATTRS_o_ai
175vec_add(vector bool short a, vector short b)
176{
177 return (vector short)a + b;
178}
179
180static vector short __ATTRS_o_ai
181vec_add(vector short a, vector bool short b)
182{
183 return a + (vector short)b;
184}
185
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000186static vector unsigned short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000187vec_add(vector unsigned short a, vector unsigned short b)
188{
189 return a + b;
190}
191
Anton Yartsev05e35552010-08-16 16:22:12 +0000192static vector unsigned short __ATTRS_o_ai
193vec_add(vector bool short a, vector unsigned short b)
194{
195 return (vector unsigned short)a + b;
196}
197
198static vector unsigned short __ATTRS_o_ai
199vec_add(vector unsigned short a, vector bool short b)
200{
201 return a + (vector unsigned short)b;
202}
203
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000204static vector int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000205vec_add(vector int a, vector int b)
206{
207 return a + b;
208}
209
Anton Yartsev05e35552010-08-16 16:22:12 +0000210static vector int __ATTRS_o_ai
211vec_add(vector bool int a, vector int b)
212{
213 return (vector int)a + b;
214}
215
216static vector int __ATTRS_o_ai
217vec_add(vector int a, vector bool int b)
218{
219 return a + (vector int)b;
220}
221
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000222static vector unsigned int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000223vec_add(vector unsigned int a, vector unsigned int b)
224{
225 return a + b;
226}
227
Anton Yartsev05e35552010-08-16 16:22:12 +0000228static vector unsigned int __ATTRS_o_ai
229vec_add(vector bool int a, vector unsigned int b)
230{
231 return (vector unsigned int)a + b;
232}
233
234static vector unsigned int __ATTRS_o_ai
235vec_add(vector unsigned int a, vector bool int b)
236{
237 return a + (vector unsigned int)b;
238}
239
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000240static vector float __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000241vec_add(vector float a, vector float b)
242{
243 return a + b;
244}
245
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000246/* vec_vaddubm */
247
248#define __builtin_altivec_vaddubm vec_vaddubm
249
250static vector signed char __ATTRS_o_ai
251vec_vaddubm(vector signed char a, vector signed char b)
252{
253 return a + b;
254}
255
Anton Yartsev05e35552010-08-16 16:22:12 +0000256static vector signed char __ATTRS_o_ai
257vec_vaddubm(vector bool char a, vector signed char b)
258{
259 return (vector signed char)a + b;
260}
261
262static vector signed char __ATTRS_o_ai
263vec_vaddubm(vector signed char a, vector bool char b)
264{
265 return a + (vector signed char)b;
266}
267
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000268static vector unsigned char __ATTRS_o_ai
269vec_vaddubm(vector unsigned char a, vector unsigned char b)
270{
271 return a + b;
272}
273
Anton Yartsev05e35552010-08-16 16:22:12 +0000274static vector unsigned char __ATTRS_o_ai
275vec_vaddubm(vector bool char a, vector unsigned char b)
276{
277 return (vector unsigned char)a + b;
278}
279
280static vector unsigned char __ATTRS_o_ai
281vec_vaddubm(vector unsigned char a, vector bool char b)
282{
283 return a + (vector unsigned char)b;
284}
285
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000286/* vec_vadduhm */
287
288#define __builtin_altivec_vadduhm vec_vadduhm
289
290static vector short __ATTRS_o_ai
291vec_vadduhm(vector short a, vector short b)
292{
293 return a + b;
294}
295
Anton Yartsev05e35552010-08-16 16:22:12 +0000296static vector short __ATTRS_o_ai
297vec_vadduhm(vector bool short a, vector short b)
298{
299 return (vector short)a + b;
300}
301
302static vector short __ATTRS_o_ai
303vec_vadduhm(vector short a, vector bool short b)
304{
305 return a + (vector short)b;
306}
307
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000308static vector unsigned short __ATTRS_o_ai
309vec_vadduhm(vector unsigned short a, vector unsigned short b)
310{
311 return a + b;
312}
313
Anton Yartsev05e35552010-08-16 16:22:12 +0000314static vector unsigned short __ATTRS_o_ai
315vec_vadduhm(vector bool short a, vector unsigned short b)
316{
317 return (vector unsigned short)a + b;
318}
319
320static vector unsigned short __ATTRS_o_ai
321vec_vadduhm(vector unsigned short a, vector bool short b)
322{
323 return a + (vector unsigned short)b;
324}
325
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000326/* vec_vadduwm */
327
328#define __builtin_altivec_vadduwm vec_vadduwm
329
330static vector int __ATTRS_o_ai
331vec_vadduwm(vector int a, vector int b)
332{
333 return a + b;
334}
335
Anton Yartsev05e35552010-08-16 16:22:12 +0000336static vector int __ATTRS_o_ai
337vec_vadduwm(vector bool int a, vector int b)
338{
339 return (vector int)a + b;
340}
341
342static vector int __ATTRS_o_ai
343vec_vadduwm(vector int a, vector bool int b)
344{
345 return a + (vector int)b;
346}
347
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000348static vector unsigned int __ATTRS_o_ai
349vec_vadduwm(vector unsigned int a, vector unsigned int b)
350{
351 return a + b;
352}
353
Anton Yartsev05e35552010-08-16 16:22:12 +0000354static vector unsigned int __ATTRS_o_ai
355vec_vadduwm(vector bool int a, vector unsigned int b)
356{
357 return (vector unsigned int)a + b;
358}
359
360static vector unsigned int __ATTRS_o_ai
361vec_vadduwm(vector unsigned int a, vector bool int b)
362{
363 return a + (vector unsigned int)b;
364}
365
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000366/* vec_vaddfp */
367
368#define __builtin_altivec_vaddfp vec_vaddfp
369
370static vector float __attribute__((__always_inline__))
371vec_vaddfp(vector float a, vector float b)
372{
373 return a + b;
374}
375
Chris Lattnerdd173942010-04-14 03:54:58 +0000376/* vec_addc */
377
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000378static vector unsigned int __attribute__((__always_inline__))
379vec_addc(vector unsigned int a, vector unsigned int b)
380{
381 return __builtin_altivec_vaddcuw(a, b);
382}
383
384/* vec_vaddcuw */
385
386static vector unsigned int __attribute__((__always_inline__))
387vec_vaddcuw(vector unsigned int a, vector unsigned int b)
388{
389 return __builtin_altivec_vaddcuw(a, b);
390}
Chris Lattnerdd173942010-04-14 03:54:58 +0000391
392/* vec_adds */
393
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000394static vector signed char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000395vec_adds(vector signed char a, vector signed char b)
396{
397 return __builtin_altivec_vaddsbs(a, b);
398}
399
Anton Yartsev05e35552010-08-16 16:22:12 +0000400static vector signed char __ATTRS_o_ai
401vec_adds(vector bool char a, vector signed char b)
402{
403 return __builtin_altivec_vaddsbs((vector signed char)a, b);
404}
405
406static vector signed char __ATTRS_o_ai
407vec_adds(vector signed char a, vector bool char b)
408{
409 return __builtin_altivec_vaddsbs(a, (vector signed char)b);
410}
411
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000412static vector unsigned char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000413vec_adds(vector unsigned char a, vector unsigned char b)
414{
415 return __builtin_altivec_vaddubs(a, b);
416}
417
Anton Yartsev05e35552010-08-16 16:22:12 +0000418static vector unsigned char __ATTRS_o_ai
419vec_adds(vector bool char a, vector unsigned char b)
420{
421 return __builtin_altivec_vaddubs((vector unsigned char)a, b);
422}
423
424static vector unsigned char __ATTRS_o_ai
425vec_adds(vector unsigned char a, vector bool char b)
426{
427 return __builtin_altivec_vaddubs(a, (vector unsigned char)b);
428}
429
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000430static vector short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000431vec_adds(vector short a, vector short b)
432{
433 return __builtin_altivec_vaddshs(a, b);
434}
435
Anton Yartsev05e35552010-08-16 16:22:12 +0000436static vector short __ATTRS_o_ai
437vec_adds(vector bool short a, vector short b)
438{
439 return __builtin_altivec_vaddshs((vector short)a, b);
440}
441
442static vector short __ATTRS_o_ai
443vec_adds(vector short a, vector bool short b)
444{
445 return __builtin_altivec_vaddshs(a, (vector short)b);
446}
447
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000448static vector unsigned short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000449vec_adds(vector unsigned short a, vector unsigned short b)
450{
451 return __builtin_altivec_vadduhs(a, b);
452}
453
Anton Yartsev05e35552010-08-16 16:22:12 +0000454static vector unsigned short __ATTRS_o_ai
455vec_adds(vector bool short a, vector unsigned short b)
456{
457 return __builtin_altivec_vadduhs((vector unsigned short)a, b);
458}
459
460static vector unsigned short __ATTRS_o_ai
461vec_adds(vector unsigned short a, vector bool short b)
462{
463 return __builtin_altivec_vadduhs(a, (vector unsigned short)b);
464}
465
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000466static vector int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000467vec_adds(vector int a, vector int b)
468{
469 return __builtin_altivec_vaddsws(a, b);
470}
471
Anton Yartsev05e35552010-08-16 16:22:12 +0000472static vector int __ATTRS_o_ai
473vec_adds(vector bool int a, vector int b)
474{
475 return __builtin_altivec_vaddsws((vector int)a, b);
476}
477
478static vector int __ATTRS_o_ai
479vec_adds(vector int a, vector bool int b)
480{
481 return __builtin_altivec_vaddsws(a, (vector int)b);
482}
483
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000484static vector unsigned int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000485vec_adds(vector unsigned int a, vector unsigned int b)
486{
487 return __builtin_altivec_vadduws(a, b);
488}
489
Anton Yartsev05e35552010-08-16 16:22:12 +0000490static vector unsigned int __ATTRS_o_ai
491vec_adds(vector bool int a, vector unsigned int b)
492{
493 return __builtin_altivec_vadduws((vector unsigned int)a, b);
494}
495
496static vector unsigned int __ATTRS_o_ai
497vec_adds(vector unsigned int a, vector bool int b)
498{
499 return __builtin_altivec_vadduws(a, (vector unsigned int)b);
500}
501
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000502/* vec_vaddsbs */
Chris Lattnerdd173942010-04-14 03:54:58 +0000503
Anton Yartsev05e35552010-08-16 16:22:12 +0000504static vector signed char __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000505vec_vaddsbs(vector signed char a, vector signed char b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000506{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000507 return __builtin_altivec_vaddsbs(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +0000508}
509
Anton Yartsev05e35552010-08-16 16:22:12 +0000510static vector signed char __ATTRS_o_ai
511vec_vaddsbs(vector bool char a, vector signed char b)
512{
513 return __builtin_altivec_vaddsbs((vector signed char)a, b);
514}
515
516static vector signed char __ATTRS_o_ai
517vec_vaddsbs(vector signed char a, vector bool char b)
518{
519 return __builtin_altivec_vaddsbs(a, (vector signed char)b);
520}
521
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000522/* vec_vaddubs */
523
Anton Yartsev05e35552010-08-16 16:22:12 +0000524static vector unsigned char __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000525vec_vaddubs(vector unsigned char a, vector unsigned char b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000526{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000527 return __builtin_altivec_vaddubs(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +0000528}
529
Anton Yartsev05e35552010-08-16 16:22:12 +0000530static vector unsigned char __ATTRS_o_ai
531vec_vaddubs(vector bool char a, vector unsigned char b)
532{
533 return __builtin_altivec_vaddubs((vector unsigned char)a, b);
534}
535
536static vector unsigned char __ATTRS_o_ai
537vec_vaddubs(vector unsigned char a, vector bool char b)
538{
539 return __builtin_altivec_vaddubs(a, (vector unsigned char)b);
540}
541
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000542/* vec_vaddshs */
543
Anton Yartsev05e35552010-08-16 16:22:12 +0000544static vector short __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000545vec_vaddshs(vector short a, vector short b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000546{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000547 return __builtin_altivec_vaddshs(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +0000548}
549
Anton Yartsev05e35552010-08-16 16:22:12 +0000550static vector short __ATTRS_o_ai
551vec_vaddshs(vector bool short a, vector short b)
552{
553 return __builtin_altivec_vaddshs((vector short)a, b);
554}
555
556static vector short __ATTRS_o_ai
557vec_vaddshs(vector short a, vector bool short b)
558{
559 return __builtin_altivec_vaddshs(a, (vector short)b);
560}
561
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000562/* vec_vadduhs */
563
Anton Yartsev05e35552010-08-16 16:22:12 +0000564static vector unsigned short __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000565vec_vadduhs(vector unsigned short a, vector unsigned short b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000566{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000567 return __builtin_altivec_vadduhs(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +0000568}
569
Anton Yartsev05e35552010-08-16 16:22:12 +0000570static vector unsigned short __ATTRS_o_ai
571vec_vadduhs(vector bool short a, vector unsigned short b)
572{
573 return __builtin_altivec_vadduhs((vector unsigned short)a, b);
574}
575
576static vector unsigned short __ATTRS_o_ai
577vec_vadduhs(vector unsigned short a, vector bool short b)
578{
579 return __builtin_altivec_vadduhs(a, (vector unsigned short)b);
580}
581
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000582/* vec_vaddsws */
583
Anton Yartsev05e35552010-08-16 16:22:12 +0000584static vector int __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000585vec_vaddsws(vector int a, vector int b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000586{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000587 return __builtin_altivec_vaddsws(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +0000588}
589
Anton Yartsev05e35552010-08-16 16:22:12 +0000590static vector int __ATTRS_o_ai
591vec_vaddsws(vector bool int a, vector int b)
592{
593 return __builtin_altivec_vaddsws((vector int)a, b);
594}
595
596static vector int __ATTRS_o_ai
597vec_vaddsws(vector int a, vector bool int b)
598{
599 return __builtin_altivec_vaddsws(a, (vector int)b);
600}
601
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000602/* vec_vadduws */
603
Anton Yartsev05e35552010-08-16 16:22:12 +0000604static vector unsigned int __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000605vec_vadduws(vector unsigned int a, vector unsigned int b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000606{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000607 return __builtin_altivec_vadduws(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +0000608}
609
Anton Yartsev05e35552010-08-16 16:22:12 +0000610static vector unsigned int __ATTRS_o_ai
611vec_vadduws(vector bool int a, vector unsigned int b)
612{
613 return __builtin_altivec_vadduws((vector unsigned int)a, b);
614}
615
616static vector unsigned int __ATTRS_o_ai
617vec_vadduws(vector unsigned int a, vector bool int b)
618{
619 return __builtin_altivec_vadduws(a, (vector unsigned int)b);
620}
621
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000622/* vec_and */
623
624#define __builtin_altivec_vand vec_and
625
626static vector signed char __ATTRS_o_ai
627vec_and(vector signed char a, vector signed char b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000628{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000629 return a & b;
Chris Lattnerdd173942010-04-14 03:54:58 +0000630}
631
Anton Yartsev05e35552010-08-16 16:22:12 +0000632static vector signed char __ATTRS_o_ai
633vec_and(vector bool char a, vector signed char b)
634{
635 return (vector signed char)a & b;
636}
637
638static vector signed char __ATTRS_o_ai
639vec_and(vector signed char a, vector bool char b)
640{
641 return a & (vector signed char)b;
642}
643
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000644static vector unsigned char __ATTRS_o_ai
645vec_and(vector unsigned char a, vector unsigned char b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000646{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000647 return a & b;
Chris Lattnerdd173942010-04-14 03:54:58 +0000648}
649
Anton Yartsev05e35552010-08-16 16:22:12 +0000650static vector unsigned char __ATTRS_o_ai
651vec_and(vector bool char a, vector unsigned char b)
652{
653 return (vector unsigned char)a & b;
654}
655
656static vector unsigned char __ATTRS_o_ai
657vec_and(vector unsigned char a, vector bool char b)
658{
659 return a & (vector unsigned char)b;
660}
661
662static vector bool char __ATTRS_o_ai
663vec_and(vector bool char a, vector bool char b)
664{
665 return a & b;
666}
667
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000668static vector short __ATTRS_o_ai
669vec_and(vector short a, vector short b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000670{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000671 return a & b;
Chris Lattnerdd173942010-04-14 03:54:58 +0000672}
673
Anton Yartsev05e35552010-08-16 16:22:12 +0000674static vector short __ATTRS_o_ai
675vec_and(vector bool short a, vector short b)
676{
677 return (vector short)a & b;
678}
679
680static vector short __ATTRS_o_ai
681vec_and(vector short a, vector bool short b)
682{
683 return a & (vector short)b;
684}
685
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000686static vector unsigned short __ATTRS_o_ai
687vec_and(vector unsigned short a, vector unsigned short b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000688{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000689 return a & b;
Chris Lattnerdd173942010-04-14 03:54:58 +0000690}
691
Anton Yartsev05e35552010-08-16 16:22:12 +0000692static vector unsigned short __ATTRS_o_ai
693vec_and(vector bool short a, vector unsigned short b)
694{
695 return (vector unsigned short)a & b;
696}
697
698static vector unsigned short __ATTRS_o_ai
699vec_and(vector unsigned short a, vector bool short b)
700{
701 return a & (vector unsigned short)b;
702}
703
704static vector bool short __ATTRS_o_ai
705vec_and(vector bool short a, vector bool short b)
706{
707 return a & b;
708}
709
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000710static vector int __ATTRS_o_ai
711vec_and(vector int a, vector int b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000712{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000713 return a & b;
Chris Lattnerdd173942010-04-14 03:54:58 +0000714}
715
Anton Yartsev05e35552010-08-16 16:22:12 +0000716static vector int __ATTRS_o_ai
717vec_and(vector bool int a, vector int b)
718{
719 return (vector int)a & b;
720}
721
722static vector int __ATTRS_o_ai
723vec_and(vector int a, vector bool int b)
724{
725 return a & (vector int)b;
726}
727
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000728static vector unsigned int __ATTRS_o_ai
729vec_and(vector unsigned int a, vector unsigned int b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000730{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000731 return a & b;
Chris Lattnerdd173942010-04-14 03:54:58 +0000732}
733
Anton Yartsev05e35552010-08-16 16:22:12 +0000734static vector unsigned int __ATTRS_o_ai
735vec_and(vector bool int a, vector unsigned int b)
736{
737 return (vector unsigned int)a & b;
738}
739
740static vector unsigned int __ATTRS_o_ai
741vec_and(vector unsigned int a, vector bool int b)
742{
743 return a & (vector unsigned int)b;
744}
745
746static vector bool int __ATTRS_o_ai
747vec_and(vector bool int a, vector bool int b)
748{
749 return a & b;
750}
751
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000752static vector float __ATTRS_o_ai
753vec_and(vector float a, vector float b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000754{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000755 vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b;
756 return (vector float)res;
757}
758
Anton Yartsev05e35552010-08-16 16:22:12 +0000759static vector float __ATTRS_o_ai
760vec_and(vector bool int a, vector float b)
761{
762 vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b;
763 return (vector float)res;
764}
765
766static vector float __ATTRS_o_ai
767vec_and(vector float a, vector bool int b)
768{
769 vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b;
770 return (vector float)res;
771}
772
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000773/* vec_vand */
774
775static vector signed char __ATTRS_o_ai
776vec_vand(vector signed char a, vector signed char b)
777{
778 return a & b;
779}
780
Anton Yartsev05e35552010-08-16 16:22:12 +0000781static vector signed char __ATTRS_o_ai
782vec_vand(vector bool char a, vector signed char b)
783{
784 return (vector signed char)a & b;
785}
786
787static vector signed char __ATTRS_o_ai
788vec_vand(vector signed char a, vector bool char b)
789{
790 return a & (vector signed char)b;
791}
792
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000793static vector unsigned char __ATTRS_o_ai
794vec_vand(vector unsigned char a, vector unsigned char b)
795{
796 return a & b;
797}
798
Anton Yartsev05e35552010-08-16 16:22:12 +0000799static vector unsigned char __ATTRS_o_ai
800vec_vand(vector bool char a, vector unsigned char b)
801{
802 return (vector unsigned char)a & b;
803}
804
805static vector unsigned char __ATTRS_o_ai
806vec_vand(vector unsigned char a, vector bool char b)
807{
808 return a & (vector unsigned char)b;
809}
810
811static vector bool char __ATTRS_o_ai
812vec_vand(vector bool char a, vector bool char b)
813{
814 return a & b;
815}
816
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000817static vector short __ATTRS_o_ai
818vec_vand(vector short a, vector short b)
819{
820 return a & b;
821}
822
Anton Yartsev05e35552010-08-16 16:22:12 +0000823static vector short __ATTRS_o_ai
824vec_vand(vector bool short a, vector short b)
825{
826 return (vector short)a & b;
827}
828
829static vector short __ATTRS_o_ai
830vec_vand(vector short a, vector bool short b)
831{
832 return a & (vector short)b;
833}
834
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000835static vector unsigned short __ATTRS_o_ai
836vec_vand(vector unsigned short a, vector unsigned short b)
837{
838 return a & b;
839}
840
Anton Yartsev05e35552010-08-16 16:22:12 +0000841static vector unsigned short __ATTRS_o_ai
842vec_vand(vector bool short a, vector unsigned short b)
843{
844 return (vector unsigned short)a & b;
845}
846
847static vector unsigned short __ATTRS_o_ai
848vec_vand(vector unsigned short a, vector bool short b)
849{
850 return a & (vector unsigned short)b;
851}
852
853static vector bool short __ATTRS_o_ai
854vec_vand(vector bool short a, vector bool short b)
855{
856 return a & b;
857}
858
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000859static vector int __ATTRS_o_ai
860vec_vand(vector int a, vector int b)
861{
862 return a & b;
863}
864
Anton Yartsev05e35552010-08-16 16:22:12 +0000865static vector int __ATTRS_o_ai
866vec_vand(vector bool int a, vector int b)
867{
868 return (vector int)a & b;
869}
870
871static vector int __ATTRS_o_ai
872vec_vand(vector int a, vector bool int b)
873{
874 return a & (vector int)b;
875}
876
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000877static vector unsigned int __ATTRS_o_ai
878vec_vand(vector unsigned int a, vector unsigned int b)
879{
880 return a & b;
881}
882
Anton Yartsev05e35552010-08-16 16:22:12 +0000883static vector unsigned int __ATTRS_o_ai
884vec_vand(vector bool int a, vector unsigned int b)
885{
886 return (vector unsigned int)a & b;
887}
888
889static vector unsigned int __ATTRS_o_ai
890vec_vand(vector unsigned int a, vector bool int b)
891{
892 return a & (vector unsigned int)b;
893}
894
895static vector bool int __ATTRS_o_ai
896vec_vand(vector bool int a, vector bool int b)
897{
898 return a & b;
899}
900
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000901static vector float __ATTRS_o_ai
902vec_vand(vector float a, vector float b)
903{
904 vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b;
905 return (vector float)res;
906}
907
Anton Yartsev05e35552010-08-16 16:22:12 +0000908static vector float __ATTRS_o_ai
909vec_vand(vector bool int a, vector float b)
910{
911 vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b;
912 return (vector float)res;
913}
914
915static vector float __ATTRS_o_ai
916vec_vand(vector float a, vector bool int b)
917{
918 vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b;
919 return (vector float)res;
920}
921
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000922/* vec_andc */
923
924#define __builtin_altivec_vandc vec_andc
925
926static vector signed char __ATTRS_o_ai
927vec_andc(vector signed char a, vector signed char b)
928{
929 return a & ~b;
930}
931
Anton Yartsev05e35552010-08-16 16:22:12 +0000932static vector signed char __ATTRS_o_ai
933vec_andc(vector bool char a, vector signed char b)
934{
935 return (vector signed char)a & ~b;
936}
937
938static vector signed char __ATTRS_o_ai
939vec_andc(vector signed char a, vector bool char b)
940{
941 return a & ~(vector signed char)b;
942}
943
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000944static vector unsigned char __ATTRS_o_ai
945vec_andc(vector unsigned char a, vector unsigned char b)
946{
947 return a & ~b;
948}
949
Anton Yartsev05e35552010-08-16 16:22:12 +0000950static vector unsigned char __ATTRS_o_ai
951vec_andc(vector bool char a, vector unsigned char b)
952{
953 return (vector unsigned char)a & ~b;
954}
955
956static vector unsigned char __ATTRS_o_ai
957vec_andc(vector unsigned char a, vector bool char b)
958{
959 return a & ~(vector unsigned char)b;
960}
961
962static vector bool char __ATTRS_o_ai
963vec_andc(vector bool char a, vector bool char b)
964{
965 return a & ~b;
966}
967
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000968static vector short __ATTRS_o_ai
969vec_andc(vector short a, vector short b)
970{
971 return a & ~b;
972}
973
Anton Yartsev05e35552010-08-16 16:22:12 +0000974static vector short __ATTRS_o_ai
975vec_andc(vector bool short a, vector short b)
976{
977 return (vector short)a & ~b;
978}
979
980static vector short __ATTRS_o_ai
981vec_andc(vector short a, vector bool short b)
982{
983 return a & ~(vector short)b;
984}
985
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000986static vector unsigned short __ATTRS_o_ai
987vec_andc(vector unsigned short a, vector unsigned short b)
988{
989 return a & ~b;
990}
991
Anton Yartsev05e35552010-08-16 16:22:12 +0000992static vector unsigned short __ATTRS_o_ai
993vec_andc(vector bool short a, vector unsigned short b)
994{
995 return (vector unsigned short)a & ~b;
996}
997
998static vector unsigned short __ATTRS_o_ai
999vec_andc(vector unsigned short a, vector bool short b)
1000{
1001 return a & ~(vector unsigned short)b;
1002}
1003
1004static vector bool short __ATTRS_o_ai
1005vec_andc(vector bool short a, vector bool short b)
1006{
1007 return a & ~b;
1008}
1009
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001010static vector int __ATTRS_o_ai
1011vec_andc(vector int a, vector int b)
1012{
1013 return a & ~b;
1014}
1015
Anton Yartsev05e35552010-08-16 16:22:12 +00001016static vector int __ATTRS_o_ai
1017vec_andc(vector bool int a, vector int b)
1018{
1019 return (vector int)a & ~b;
1020}
1021
1022static vector int __ATTRS_o_ai
1023vec_andc(vector int a, vector bool int b)
1024{
1025 return a & ~(vector int)b;
1026}
1027
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001028static vector unsigned int __ATTRS_o_ai
1029vec_andc(vector unsigned int a, vector unsigned int b)
1030{
1031 return a & ~b;
1032}
1033
Anton Yartsev05e35552010-08-16 16:22:12 +00001034static vector unsigned int __ATTRS_o_ai
1035vec_andc(vector bool int a, vector unsigned int b)
1036{
1037 return (vector unsigned int)a & ~b;
1038}
1039
1040static vector unsigned int __ATTRS_o_ai
1041vec_andc(vector unsigned int a, vector bool int b)
1042{
1043 return a & ~(vector unsigned int)b;
1044}
1045
1046static vector bool int __ATTRS_o_ai
1047vec_andc(vector bool int a, vector bool int b)
1048{
1049 return a & ~b;
1050}
1051
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001052static vector float __ATTRS_o_ai
1053vec_andc(vector float a, vector float b)
1054{
1055 vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b;
1056 return (vector float)res;
1057}
1058
Anton Yartsev05e35552010-08-16 16:22:12 +00001059static vector float __ATTRS_o_ai
1060vec_andc(vector bool int a, vector float b)
1061{
1062 vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b;
1063 return (vector float)res;
1064}
1065
1066static vector float __ATTRS_o_ai
1067vec_andc(vector float a, vector bool int b)
1068{
1069 vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b;
1070 return (vector float)res;
1071}
1072
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001073/* vec_vandc */
1074
1075static vector signed char __ATTRS_o_ai
1076vec_vandc(vector signed char a, vector signed char b)
1077{
1078 return a & ~b;
1079}
1080
Anton Yartsev05e35552010-08-16 16:22:12 +00001081static vector signed char __ATTRS_o_ai
1082vec_vandc(vector bool char a, vector signed char b)
1083{
1084 return (vector signed char)a & ~b;
1085}
1086
1087static vector signed char __ATTRS_o_ai
1088vec_vandc(vector signed char a, vector bool char b)
1089{
1090 return a & ~(vector signed char)b;
1091}
1092
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001093static vector unsigned char __ATTRS_o_ai
1094vec_vandc(vector unsigned char a, vector unsigned char b)
1095{
1096 return a & ~b;
1097}
1098
Anton Yartsev05e35552010-08-16 16:22:12 +00001099static vector unsigned char __ATTRS_o_ai
1100vec_vandc(vector bool char a, vector unsigned char b)
1101{
1102 return (vector unsigned char)a & ~b;
1103}
1104
1105static vector unsigned char __ATTRS_o_ai
1106vec_vandc(vector unsigned char a, vector bool char b)
1107{
1108 return a & ~(vector unsigned char)b;
1109}
1110
1111static vector bool char __ATTRS_o_ai
1112vec_vandc(vector bool char a, vector bool char b)
1113{
1114 return a & ~b;
1115}
1116
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001117static vector short __ATTRS_o_ai
1118vec_vandc(vector short a, vector short b)
1119{
1120 return a & ~b;
1121}
1122
Anton Yartsev05e35552010-08-16 16:22:12 +00001123static vector short __ATTRS_o_ai
1124vec_vandc(vector bool short a, vector short b)
1125{
1126 return (vector short)a & ~b;
1127}
1128
1129static vector short __ATTRS_o_ai
1130vec_vandc(vector short a, vector bool short b)
1131{
1132 return a & ~(vector short)b;
1133}
1134
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001135static vector unsigned short __ATTRS_o_ai
1136vec_vandc(vector unsigned short a, vector unsigned short b)
1137{
1138 return a & ~b;
1139}
1140
Anton Yartsev05e35552010-08-16 16:22:12 +00001141static vector unsigned short __ATTRS_o_ai
1142vec_vandc(vector bool short a, vector unsigned short b)
1143{
1144 return (vector unsigned short)a & ~b;
1145}
1146
1147static vector unsigned short __ATTRS_o_ai
1148vec_vandc(vector unsigned short a, vector bool short b)
1149{
1150 return a & ~(vector unsigned short)b;
1151}
1152
1153static vector bool short __ATTRS_o_ai
1154vec_vandc(vector bool short a, vector bool short b)
1155{
1156 return a & ~b;
1157}
1158
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001159static vector int __ATTRS_o_ai
1160vec_vandc(vector int a, vector int b)
1161{
1162 return a & ~b;
1163}
1164
Anton Yartsev05e35552010-08-16 16:22:12 +00001165static vector int __ATTRS_o_ai
1166vec_vandc(vector bool int a, vector int b)
1167{
1168 return (vector int)a & ~b;
1169}
1170
1171static vector int __ATTRS_o_ai
1172vec_vandc(vector int a, vector bool int b)
1173{
1174 return a & ~(vector int)b;
1175}
1176
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001177static vector unsigned int __ATTRS_o_ai
1178vec_vandc(vector unsigned int a, vector unsigned int b)
1179{
1180 return a & ~b;
1181}
1182
Anton Yartsev05e35552010-08-16 16:22:12 +00001183static vector unsigned int __ATTRS_o_ai
1184vec_vandc(vector bool int a, vector unsigned int b)
1185{
1186 return (vector unsigned int)a & ~b;
1187}
1188
1189static vector unsigned int __ATTRS_o_ai
1190vec_vandc(vector unsigned int a, vector bool int b)
1191{
1192 return a & ~(vector unsigned int)b;
1193}
1194
1195static vector bool int __ATTRS_o_ai
1196vec_vandc(vector bool int a, vector bool int b)
1197{
1198 return a & ~b;
1199}
1200
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001201static vector float __ATTRS_o_ai
1202vec_vandc(vector float a, vector float b)
1203{
1204 vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b;
1205 return (vector float)res;
Chris Lattnerdd173942010-04-14 03:54:58 +00001206}
1207
Anton Yartsev05e35552010-08-16 16:22:12 +00001208static vector float __ATTRS_o_ai
1209vec_vandc(vector bool int a, vector float b)
1210{
1211 vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b;
1212 return (vector float)res;
1213}
1214
1215static vector float __ATTRS_o_ai
1216vec_vandc(vector float a, vector bool int b)
1217{
1218 vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b;
1219 return (vector float)res;
1220}
1221
Chris Lattnerdd173942010-04-14 03:54:58 +00001222/* vec_avg */
1223
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001224static vector signed char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001225vec_avg(vector signed char a, vector signed char b)
1226{
1227 return __builtin_altivec_vavgsb(a, b);
1228}
1229
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001230static vector unsigned char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001231vec_avg(vector unsigned char a, vector unsigned char b)
1232{
1233 return __builtin_altivec_vavgub(a, b);
1234}
1235
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001236static vector short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001237vec_avg(vector short a, vector short b)
1238{
1239 return __builtin_altivec_vavgsh(a, b);
1240}
1241
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001242static vector unsigned short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001243vec_avg(vector unsigned short a, vector unsigned short b)
1244{
1245 return __builtin_altivec_vavguh(a, b);
1246}
1247
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001248static vector int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001249vec_avg(vector int a, vector int b)
1250{
1251 return __builtin_altivec_vavgsw(a, b);
1252}
1253
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001254static vector unsigned int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001255vec_avg(vector unsigned int a, vector unsigned int b)
1256{
1257 return __builtin_altivec_vavguw(a, b);
1258}
1259
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001260/* vec_vavgsb */
Chris Lattnerdd173942010-04-14 03:54:58 +00001261
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001262static vector signed char __attribute__((__always_inline__))
1263vec_vavgsb(vector signed char a, vector signed char b)
Chris Lattnerdd173942010-04-14 03:54:58 +00001264{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001265 return __builtin_altivec_vavgsb(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001266}
1267
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001268/* vec_vavgub */
1269
1270static vector unsigned char __attribute__((__always_inline__))
1271vec_vavgub(vector unsigned char a, vector unsigned char b)
Chris Lattnerdd173942010-04-14 03:54:58 +00001272{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001273 return __builtin_altivec_vavgub(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001274}
1275
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001276/* vec_vavgsh */
1277
1278static vector short __attribute__((__always_inline__))
1279vec_vavgsh(vector short a, vector short b)
Chris Lattnerdd173942010-04-14 03:54:58 +00001280{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001281 return __builtin_altivec_vavgsh(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001282}
1283
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001284/* vec_vavguh */
1285
1286static vector unsigned short __attribute__((__always_inline__))
1287vec_vavguh(vector unsigned short a, vector unsigned short b)
Chris Lattnerdd173942010-04-14 03:54:58 +00001288{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001289 return __builtin_altivec_vavguh(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001290}
1291
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001292/* vec_vavgsw */
1293
1294static vector int __attribute__((__always_inline__))
1295vec_vavgsw(vector int a, vector int b)
Chris Lattnerdd173942010-04-14 03:54:58 +00001296{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001297 return __builtin_altivec_vavgsw(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001298}
1299
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001300/* vec_vavguw */
1301
1302static vector unsigned int __attribute__((__always_inline__))
1303vec_vavguw(vector unsigned int a, vector unsigned int b)
Chris Lattnerdd173942010-04-14 03:54:58 +00001304{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001305 return __builtin_altivec_vavguw(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001306}
1307
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001308/* vec_ceil */
1309
1310static vector float __attribute__((__always_inline__))
1311vec_ceil(vector float a)
Chris Lattnerdd173942010-04-14 03:54:58 +00001312{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001313 return __builtin_altivec_vrfip(a);
Chris Lattnerdd173942010-04-14 03:54:58 +00001314}
1315
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001316/* vec_vrfip */
Chris Lattnerdd173942010-04-14 03:54:58 +00001317
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001318static vector float __attribute__((__always_inline__))
1319vec_vrfip(vector float a)
Chris Lattnerdd173942010-04-14 03:54:58 +00001320{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001321 return __builtin_altivec_vrfip(a);
Chris Lattnerdd173942010-04-14 03:54:58 +00001322}
1323
1324/* vec_cmpb */
1325
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001326static vector int __attribute__((__always_inline__))
1327vec_cmpb(vector float a, vector float b)
1328{
1329 return __builtin_altivec_vcmpbfp(a, b);
1330}
1331
1332/* vec_vcmpbfp */
1333
1334static vector int __attribute__((__always_inline__))
1335vec_vcmpbfp(vector float a, vector float b)
1336{
1337 return __builtin_altivec_vcmpbfp(a, b);
1338}
Chris Lattnerdd173942010-04-14 03:54:58 +00001339
1340/* vec_cmpeq */
1341
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001342static vector bool char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001343vec_cmpeq(vector signed char a, vector signed char b)
1344{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001345 return (vector bool char)
1346 __builtin_altivec_vcmpequb((vector char)a, (vector char)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001347}
1348
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001349static vector bool char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001350vec_cmpeq(vector unsigned char a, vector unsigned char b)
1351{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001352 return (vector bool char)
1353 __builtin_altivec_vcmpequb((vector char)a, (vector char)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001354}
1355
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001356static vector bool short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001357vec_cmpeq(vector short a, vector short b)
1358{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001359 return (vector bool short)__builtin_altivec_vcmpequh(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001360}
1361
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001362static vector bool short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001363vec_cmpeq(vector unsigned short a, vector unsigned short b)
1364{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001365 return (vector bool short)
1366 __builtin_altivec_vcmpequh((vector short)a, (vector short)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001367}
1368
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001369static vector bool int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001370vec_cmpeq(vector int a, vector int b)
1371{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001372 return (vector bool int)__builtin_altivec_vcmpequw(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001373}
1374
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001375static vector bool int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001376vec_cmpeq(vector unsigned int a, vector unsigned int b)
1377{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001378 return (vector bool int)
1379 __builtin_altivec_vcmpequw((vector int)a, (vector int)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001380}
1381
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001382static vector bool int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001383vec_cmpeq(vector float a, vector float b)
1384{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001385 return (vector bool int)__builtin_altivec_vcmpeqfp(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001386}
1387
1388/* vec_cmpge */
1389
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001390static vector bool int __attribute__((__always_inline__))
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001391vec_cmpge(vector float a, vector float b)
1392{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001393 return (vector bool int)__builtin_altivec_vcmpgefp(a, b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001394}
1395
1396/* vec_vcmpgefp */
1397
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001398static vector bool int __attribute__((__always_inline__))
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001399vec_vcmpgefp(vector float a, vector float b)
1400{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001401 return (vector bool int)__builtin_altivec_vcmpgefp(a, b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001402}
Chris Lattnerdd173942010-04-14 03:54:58 +00001403
1404/* vec_cmpgt */
1405
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001406static vector bool char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001407vec_cmpgt(vector signed char a, vector signed char b)
1408{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001409 return (vector bool char)__builtin_altivec_vcmpgtsb(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001410}
1411
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001412static vector bool char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001413vec_cmpgt(vector unsigned char a, vector unsigned char b)
1414{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001415 return (vector bool char)__builtin_altivec_vcmpgtub(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001416}
1417
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001418static vector bool short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001419vec_cmpgt(vector short a, vector short b)
1420{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001421 return (vector bool short)__builtin_altivec_vcmpgtsh(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001422}
1423
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001424static vector bool short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001425vec_cmpgt(vector unsigned short a, vector unsigned short b)
1426{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001427 return (vector bool short)__builtin_altivec_vcmpgtuh(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001428}
1429
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001430static vector bool int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001431vec_cmpgt(vector int a, vector int b)
1432{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001433 return (vector bool int)__builtin_altivec_vcmpgtsw(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001434}
1435
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001436static vector bool int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001437vec_cmpgt(vector unsigned int a, vector unsigned int b)
1438{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001439 return (vector bool int)__builtin_altivec_vcmpgtuw(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001440}
1441
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001442static vector bool int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001443vec_cmpgt(vector float a, vector float b)
1444{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001445 return (vector bool int)__builtin_altivec_vcmpgtfp(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001446}
1447
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001448/* vec_vcmpgtsb */
Chris Lattnerdd173942010-04-14 03:54:58 +00001449
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001450static vector bool char __attribute__((__always_inline__))
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001451vec_vcmpgtsb(vector signed char a, vector signed char b)
1452{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001453 return (vector bool char)__builtin_altivec_vcmpgtsb(a, b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001454}
1455
1456/* vec_vcmpgtub */
1457
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001458static vector bool char __attribute__((__always_inline__))
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001459vec_vcmpgtub(vector unsigned char a, vector unsigned char b)
1460{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001461 return (vector bool char)__builtin_altivec_vcmpgtub(a, b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001462}
1463
1464/* vec_vcmpgtsh */
1465
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001466static vector bool short __attribute__((__always_inline__))
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001467vec_vcmpgtsh(vector short a, vector short b)
1468{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001469 return (vector bool short)__builtin_altivec_vcmpgtsh(a, b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001470}
1471
1472/* vec_vcmpgtuh */
1473
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001474static vector bool short __attribute__((__always_inline__))
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001475vec_vcmpgtuh(vector unsigned short a, vector unsigned short b)
1476{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001477 return (vector bool short)__builtin_altivec_vcmpgtuh(a, b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001478}
1479
1480/* vec_vcmpgtsw */
1481
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001482static vector bool int __attribute__((__always_inline__))
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001483vec_vcmpgtsw(vector int a, vector int b)
1484{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001485 return (vector bool int)__builtin_altivec_vcmpgtsw(a, b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001486}
1487
1488/* vec_vcmpgtuw */
1489
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001490static vector bool int __attribute__((__always_inline__))
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001491vec_vcmpgtuw(vector unsigned int a, vector unsigned int b)
1492{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001493 return (vector bool int)__builtin_altivec_vcmpgtuw(a, b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001494}
1495
1496/* vec_vcmpgtfp */
1497
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001498static vector bool int __attribute__((__always_inline__))
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001499vec_vcmpgtfp(vector float a, vector float b)
1500{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001501 return (vector bool int)__builtin_altivec_vcmpgtfp(a, b);
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001502}
1503
1504/* vec_cmple */
Chris Lattnerdd173942010-04-14 03:54:58 +00001505
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001506static vector bool int __attribute__((__always_inline__))
Chris Lattnerdd173942010-04-14 03:54:58 +00001507vec_cmple(vector float a, vector float b)
1508{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001509 return (vector bool int)__builtin_altivec_vcmpgefp(b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00001510}
1511
1512/* vec_cmplt */
1513
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001514static vector bool char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001515vec_cmplt(vector signed char a, vector signed char b)
1516{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001517 return (vector bool char)__builtin_altivec_vcmpgtsb(b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00001518}
1519
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001520static vector bool char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001521vec_cmplt(vector unsigned char a, vector unsigned char b)
1522{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001523 return (vector bool char)__builtin_altivec_vcmpgtub(b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00001524}
1525
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001526static vector bool short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001527vec_cmplt(vector short a, vector short b)
1528{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001529 return (vector bool short)__builtin_altivec_vcmpgtsh(b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00001530}
1531
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001532static vector bool short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001533vec_cmplt(vector unsigned short a, vector unsigned short b)
1534{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001535 return (vector bool short)__builtin_altivec_vcmpgtuh(b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00001536}
1537
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001538static vector bool int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001539vec_cmplt(vector int a, vector int b)
1540{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001541 return (vector bool int)__builtin_altivec_vcmpgtsw(b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00001542}
1543
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001544static vector bool int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001545vec_cmplt(vector unsigned int a, vector unsigned int b)
1546{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001547 return (vector bool int)__builtin_altivec_vcmpgtuw(b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00001548}
1549
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001550static vector bool int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001551vec_cmplt(vector float a, vector float b)
1552{
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001553 return (vector bool int)__builtin_altivec_vcmpgtfp(b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00001554}
1555
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001556/* vec_ctf */
1557
1558static vector float __ATTRS_o_ai
1559vec_ctf(vector int a, int b)
1560{
1561 return __builtin_altivec_vcfsx(a, b);
1562}
1563
1564static vector float __ATTRS_o_ai
1565vec_ctf(vector unsigned int a, int b)
1566{
1567 return __builtin_altivec_vcfux((vector int)a, b);
1568}
1569
1570/* vec_vcfsx */
1571
1572static vector float __attribute__((__always_inline__))
1573vec_vcfsx(vector int a, int b)
1574{
1575 return __builtin_altivec_vcfsx(a, b);
1576}
1577
1578/* vec_vcfux */
1579
1580static vector float __attribute__((__always_inline__))
1581vec_vcfux(vector unsigned int a, int b)
1582{
1583 return __builtin_altivec_vcfux((vector int)a, b);
1584}
1585
1586/* vec_cts */
1587
1588static vector int __attribute__((__always_inline__))
1589vec_cts(vector float a, int b)
1590{
1591 return __builtin_altivec_vctsxs(a, b);
1592}
1593
1594/* vec_vctsxs */
1595
1596static vector int __attribute__((__always_inline__))
1597vec_vctsxs(vector float a, int b)
1598{
1599 return __builtin_altivec_vctsxs(a, b);
1600}
1601
1602/* vec_ctu */
1603
1604static vector unsigned int __attribute__((__always_inline__))
1605vec_ctu(vector float a, int b)
1606{
1607 return __builtin_altivec_vctuxs(a, b);
1608}
1609
1610/* vec_vctuxs */
1611
1612static vector unsigned int __attribute__((__always_inline__))
1613vec_vctuxs(vector float a, int b)
1614{
1615 return __builtin_altivec_vctuxs(a, b);
1616}
1617
1618/* vec_dss */
1619
1620static void __attribute__((__always_inline__))
1621vec_dss(int a)
1622{
1623 __builtin_altivec_dss(a);
1624}
1625
1626/* vec_dssall */
1627
1628static void __attribute__((__always_inline__))
1629vec_dssall(void)
1630{
1631 __builtin_altivec_dssall();
1632}
1633
1634/* vec_dst */
1635
1636static void __attribute__((__always_inline__))
1637vec_dst(void *a, int b, int c)
1638{
1639 __builtin_altivec_dst(a, b, c);
1640}
1641
1642/* vec_dstst */
1643
1644static void __attribute__((__always_inline__))
1645vec_dstst(void *a, int b, int c)
1646{
1647 __builtin_altivec_dstst(a, b, c);
1648}
1649
1650/* vec_dststt */
1651
1652static void __attribute__((__always_inline__))
1653vec_dststt(void *a, int b, int c)
1654{
1655 __builtin_altivec_dststt(a, b, c);
1656}
1657
1658/* vec_dstt */
1659
1660static void __attribute__((__always_inline__))
1661vec_dstt(void *a, int b, int c)
1662{
1663 __builtin_altivec_dstt(a, b, c);
1664}
1665
1666/* vec_expte */
1667
1668static vector float __attribute__((__always_inline__))
1669vec_expte(vector float a)
1670{
1671 return __builtin_altivec_vexptefp(a);
1672}
1673
1674/* vec_vexptefp */
1675
1676static vector float __attribute__((__always_inline__))
1677vec_vexptefp(vector float a)
1678{
1679 return __builtin_altivec_vexptefp(a);
1680}
1681
1682/* vec_floor */
1683
1684static vector float __attribute__((__always_inline__))
1685vec_floor(vector float a)
1686{
1687 return __builtin_altivec_vrfim(a);
1688}
1689
1690/* vec_vrfim */
1691
1692static vector float __attribute__((__always_inline__))
1693vec_vrfim(vector float a)
1694{
1695 return __builtin_altivec_vrfim(a);
1696}
1697
1698/* vec_ld */
1699
1700static vector signed char __ATTRS_o_ai
1701vec_ld(int a, vector signed char *b)
1702{
1703 return (vector signed char)__builtin_altivec_lvx(a, b);
1704}
1705
1706static vector signed char __ATTRS_o_ai
1707vec_ld(int a, signed char *b)
1708{
1709 return (vector signed char)__builtin_altivec_lvx(a, b);
1710}
1711
1712static vector unsigned char __ATTRS_o_ai
1713vec_ld(int a, vector unsigned char *b)
1714{
1715 return (vector unsigned char)__builtin_altivec_lvx(a, b);
1716}
1717
1718static vector unsigned char __ATTRS_o_ai
1719vec_ld(int a, unsigned char *b)
1720{
1721 return (vector unsigned char)__builtin_altivec_lvx(a, b);
1722}
1723
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001724static vector bool char __ATTRS_o_ai
1725vec_ld(int a, vector bool char *b)
1726{
1727 return (vector bool char)__builtin_altivec_lvx(a, b);
1728}
1729
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001730static vector short __ATTRS_o_ai
1731vec_ld(int a, vector short *b)
1732{
1733 return (vector short)__builtin_altivec_lvx(a, b);
1734}
1735
1736static vector short __ATTRS_o_ai
1737vec_ld(int a, short *b)
1738{
1739 return (vector short)__builtin_altivec_lvx(a, b);
1740}
1741
1742static vector unsigned short __ATTRS_o_ai
1743vec_ld(int a, vector unsigned short *b)
1744{
1745 return (vector unsigned short)__builtin_altivec_lvx(a, b);
1746}
1747
1748static vector unsigned short __ATTRS_o_ai
1749vec_ld(int a, unsigned short *b)
1750{
1751 return (vector unsigned short)__builtin_altivec_lvx(a, b);
1752}
1753
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001754static vector bool short __ATTRS_o_ai
1755vec_ld(int a, vector bool short *b)
1756{
1757 return (vector bool short)__builtin_altivec_lvx(a, b);
1758}
1759
1760static vector pixel __ATTRS_o_ai
1761vec_ld(int a, vector pixel *b)
1762{
1763 return (vector pixel)__builtin_altivec_lvx(a, b);
1764}
1765
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001766static vector int __ATTRS_o_ai
1767vec_ld(int a, vector int *b)
1768{
1769 return (vector int)__builtin_altivec_lvx(a, b);
1770}
1771
1772static vector int __ATTRS_o_ai
1773vec_ld(int a, int *b)
1774{
1775 return (vector int)__builtin_altivec_lvx(a, b);
1776}
1777
1778static vector unsigned int __ATTRS_o_ai
1779vec_ld(int a, vector unsigned int *b)
1780{
1781 return (vector unsigned int)__builtin_altivec_lvx(a, b);
1782}
1783
1784static vector unsigned int __ATTRS_o_ai
1785vec_ld(int a, unsigned int *b)
1786{
1787 return (vector unsigned int)__builtin_altivec_lvx(a, b);
1788}
1789
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001790static vector bool int __ATTRS_o_ai
1791vec_ld(int a, vector bool int *b)
1792{
1793 return (vector bool int)__builtin_altivec_lvx(a, b);
1794}
1795
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001796static vector float __ATTRS_o_ai
1797vec_ld(int a, vector float *b)
1798{
1799 return (vector float)__builtin_altivec_lvx(a, b);
1800}
1801
1802static vector float __ATTRS_o_ai
1803vec_ld(int a, float *b)
1804{
1805 return (vector float)__builtin_altivec_lvx(a, b);
1806}
1807
1808/* vec_lvx */
1809
1810static vector signed char __ATTRS_o_ai
1811vec_lvx(int a, vector signed char *b)
1812{
1813 return (vector signed char)__builtin_altivec_lvx(a, b);
1814}
1815
1816static vector signed char __ATTRS_o_ai
1817vec_lvx(int a, signed char *b)
1818{
1819 return (vector signed char)__builtin_altivec_lvx(a, b);
1820}
1821
1822static vector unsigned char __ATTRS_o_ai
1823vec_lvx(int a, vector unsigned char *b)
1824{
1825 return (vector unsigned char)__builtin_altivec_lvx(a, b);
1826}
1827
1828static vector unsigned char __ATTRS_o_ai
1829vec_lvx(int a, unsigned char *b)
1830{
1831 return (vector unsigned char)__builtin_altivec_lvx(a, b);
1832}
1833
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001834static vector bool char __ATTRS_o_ai
1835vec_lvx(int a, vector bool char *b)
1836{
1837 return (vector bool char)__builtin_altivec_lvx(a, b);
1838}
1839
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001840static vector short __ATTRS_o_ai
1841vec_lvx(int a, vector short *b)
1842{
1843 return (vector short)__builtin_altivec_lvx(a, b);
1844}
1845
1846static vector short __ATTRS_o_ai
1847vec_lvx(int a, short *b)
1848{
1849 return (vector short)__builtin_altivec_lvx(a, b);
1850}
1851
1852static vector unsigned short __ATTRS_o_ai
1853vec_lvx(int a, vector unsigned short *b)
1854{
1855 return (vector unsigned short)__builtin_altivec_lvx(a, b);
1856}
1857
1858static vector unsigned short __ATTRS_o_ai
1859vec_lvx(int a, unsigned short *b)
1860{
1861 return (vector unsigned short)__builtin_altivec_lvx(a, b);
1862}
1863
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001864static vector bool short __ATTRS_o_ai
1865vec_lvx(int a, vector bool short *b)
1866{
1867 return (vector bool short)__builtin_altivec_lvx(a, b);
1868}
1869
1870static vector pixel __ATTRS_o_ai
1871vec_lvx(int a, vector pixel *b)
1872{
1873 return (vector pixel)__builtin_altivec_lvx(a, b);
1874}
1875
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001876static vector int __ATTRS_o_ai
1877vec_lvx(int a, vector int *b)
1878{
1879 return (vector int)__builtin_altivec_lvx(a, b);
1880}
1881
1882static vector int __ATTRS_o_ai
1883vec_lvx(int a, int *b)
1884{
1885 return (vector int)__builtin_altivec_lvx(a, b);
1886}
1887
1888static vector unsigned int __ATTRS_o_ai
1889vec_lvx(int a, vector unsigned int *b)
1890{
1891 return (vector unsigned int)__builtin_altivec_lvx(a, b);
1892}
1893
1894static vector unsigned int __ATTRS_o_ai
1895vec_lvx(int a, unsigned int *b)
1896{
1897 return (vector unsigned int)__builtin_altivec_lvx(a, b);
1898}
1899
Anton Yartseva2fc0f52010-08-19 03:21:36 +00001900static vector bool int __ATTRS_o_ai
1901vec_lvx(int a, vector bool int *b)
1902{
1903 return (vector bool int)__builtin_altivec_lvx(a, b);
1904}
1905
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001906static vector float __ATTRS_o_ai
1907vec_lvx(int a, vector float *b)
1908{
1909 return (vector float)__builtin_altivec_lvx(a, b);
1910}
1911
1912static vector float __ATTRS_o_ai
1913vec_lvx(int a, float *b)
1914{
1915 return (vector float)__builtin_altivec_lvx(a, b);
1916}
1917
1918/* vec_lde */
1919
1920static vector signed char __ATTRS_o_ai
1921vec_lde(int a, vector signed char *b)
1922{
1923 return (vector signed char)__builtin_altivec_lvebx(a, b);
1924}
1925
1926static vector unsigned char __ATTRS_o_ai
1927vec_lde(int a, vector unsigned char *b)
1928{
1929 return (vector unsigned char)__builtin_altivec_lvebx(a, b);
1930}
1931
1932static vector short __ATTRS_o_ai
1933vec_lde(int a, vector short *b)
1934{
1935 return (vector short)__builtin_altivec_lvehx(a, b);
1936}
1937
1938static vector unsigned short __ATTRS_o_ai
1939vec_lde(int a, vector unsigned short *b)
1940{
1941 return (vector unsigned short)__builtin_altivec_lvehx(a, b);
1942}
1943
1944static vector int __ATTRS_o_ai
1945vec_lde(int a, vector int *b)
1946{
1947 return (vector int)__builtin_altivec_lvewx(a, b);
1948}
1949
1950static vector unsigned int __ATTRS_o_ai
1951vec_lde(int a, vector unsigned int *b)
1952{
1953 return (vector unsigned int)__builtin_altivec_lvewx(a, b);
1954}
1955
1956static vector float __ATTRS_o_ai
1957vec_lde(int a, vector float *b)
1958{
1959 return (vector float)__builtin_altivec_lvewx(a, b);
1960}
1961
1962/* vec_lvebx */
1963
1964static vector signed char __ATTRS_o_ai
1965vec_lvebx(int a, vector signed char *b)
1966{
1967 return (vector signed char)__builtin_altivec_lvebx(a, b);
1968}
1969
1970static vector unsigned char __ATTRS_o_ai
1971vec_lvebx(int a, vector unsigned char *b)
1972{
1973 return (vector unsigned char)__builtin_altivec_lvebx(a, b);
1974}
1975
1976/* vec_lvehx */
1977
1978static vector short __ATTRS_o_ai
1979vec_lvehx(int a, vector short *b)
1980{
1981 return (vector short)__builtin_altivec_lvehx(a, b);
1982}
1983
1984static vector unsigned short __ATTRS_o_ai
1985vec_lvehx(int a, vector unsigned short *b)
1986{
1987 return (vector unsigned short)__builtin_altivec_lvehx(a, b);
1988}
1989
1990/* vec_lvewx */
1991
1992static vector int __ATTRS_o_ai
1993vec_lvewx(int a, vector int *b)
1994{
1995 return (vector int)__builtin_altivec_lvewx(a, b);
1996}
1997
1998static vector unsigned int __ATTRS_o_ai
1999vec_lvewx(int a, vector unsigned int *b)
2000{
2001 return (vector unsigned int)__builtin_altivec_lvewx(a, b);
2002}
2003
2004static vector float __ATTRS_o_ai
2005vec_lvewx(int a, vector float *b)
2006{
2007 return (vector float)__builtin_altivec_lvewx(a, b);
2008}
2009
2010/* vec_ldl */
2011
2012static vector signed char __ATTRS_o_ai
2013vec_ldl(int a, vector signed char *b)
2014{
2015 return (vector signed char)__builtin_altivec_lvxl(a, b);
2016}
2017
2018static vector signed char __ATTRS_o_ai
2019vec_ldl(int a, signed char *b)
2020{
2021 return (vector signed char)__builtin_altivec_lvxl(a, b);
2022}
2023
2024static vector unsigned char __ATTRS_o_ai
2025vec_ldl(int a, vector unsigned char *b)
2026{
2027 return (vector unsigned char)__builtin_altivec_lvxl(a, b);
2028}
2029
2030static vector unsigned char __ATTRS_o_ai
2031vec_ldl(int a, unsigned char *b)
2032{
2033 return (vector unsigned char)__builtin_altivec_lvxl(a, b);
2034}
2035
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002036static vector bool char __ATTRS_o_ai
2037vec_ldl(int a, vector bool char *b)
2038{
2039 return (vector bool char)__builtin_altivec_lvxl(a, b);
2040}
2041
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002042static vector short __ATTRS_o_ai
2043vec_ldl(int a, vector short *b)
2044{
2045 return (vector short)__builtin_altivec_lvxl(a, b);
2046}
2047
2048static vector short __ATTRS_o_ai
2049vec_ldl(int a, short *b)
2050{
2051 return (vector short)__builtin_altivec_lvxl(a, b);
2052}
2053
2054static vector unsigned short __ATTRS_o_ai
2055vec_ldl(int a, vector unsigned short *b)
2056{
2057 return (vector unsigned short)__builtin_altivec_lvxl(a, b);
2058}
2059
2060static vector unsigned short __ATTRS_o_ai
2061vec_ldl(int a, unsigned short *b)
2062{
2063 return (vector unsigned short)__builtin_altivec_lvxl(a, b);
2064}
2065
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002066static vector bool short __ATTRS_o_ai
2067vec_ldl(int a, vector bool short *b)
2068{
2069 return (vector bool short)__builtin_altivec_lvxl(a, b);
2070}
2071
2072static vector pixel __ATTRS_o_ai
2073vec_ldl(int a, vector pixel *b)
2074{
2075 return (vector pixel short)__builtin_altivec_lvxl(a, b);
2076}
2077
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002078static vector int __ATTRS_o_ai
2079vec_ldl(int a, vector int *b)
2080{
2081 return (vector int)__builtin_altivec_lvxl(a, b);
2082}
2083
2084static vector int __ATTRS_o_ai
2085vec_ldl(int a, int *b)
2086{
2087 return (vector int)__builtin_altivec_lvxl(a, b);
2088}
2089
2090static vector unsigned int __ATTRS_o_ai
2091vec_ldl(int a, vector unsigned int *b)
2092{
2093 return (vector unsigned int)__builtin_altivec_lvxl(a, b);
2094}
2095
2096static vector unsigned int __ATTRS_o_ai
2097vec_ldl(int a, unsigned int *b)
2098{
2099 return (vector unsigned int)__builtin_altivec_lvxl(a, b);
2100}
2101
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002102static vector bool int __ATTRS_o_ai
2103vec_ldl(int a, vector bool int *b)
2104{
2105 return (vector bool int)__builtin_altivec_lvxl(a, b);
2106}
2107
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002108static vector float __ATTRS_o_ai
2109vec_ldl(int a, vector float *b)
2110{
2111 return (vector float)__builtin_altivec_lvxl(a, b);
2112}
2113
2114static vector float __ATTRS_o_ai
2115vec_ldl(int a, float *b)
2116{
2117 return (vector float)__builtin_altivec_lvxl(a, b);
2118}
2119
2120/* vec_lvxl */
2121
2122static vector signed char __ATTRS_o_ai
2123vec_lvxl(int a, vector signed char *b)
2124{
2125 return (vector signed char)__builtin_altivec_lvxl(a, b);
2126}
2127
2128static vector signed char __ATTRS_o_ai
2129vec_lvxl(int a, signed char *b)
2130{
2131 return (vector signed char)__builtin_altivec_lvxl(a, b);
2132}
2133
2134static vector unsigned char __ATTRS_o_ai
2135vec_lvxl(int a, vector unsigned char *b)
2136{
2137 return (vector unsigned char)__builtin_altivec_lvxl(a, b);
2138}
2139
2140static vector unsigned char __ATTRS_o_ai
2141vec_lvxl(int a, unsigned char *b)
2142{
2143 return (vector unsigned char)__builtin_altivec_lvxl(a, b);
2144}
2145
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002146static vector bool char __ATTRS_o_ai
2147vec_lvxl(int a, vector bool char *b)
2148{
2149 return (vector bool char)__builtin_altivec_lvxl(a, b);
2150}
2151
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002152static vector short __ATTRS_o_ai
2153vec_lvxl(int a, vector short *b)
2154{
2155 return (vector short)__builtin_altivec_lvxl(a, b);
2156}
2157
2158static vector short __ATTRS_o_ai
2159vec_lvxl(int a, short *b)
2160{
2161 return (vector short)__builtin_altivec_lvxl(a, b);
2162}
2163
2164static vector unsigned short __ATTRS_o_ai
2165vec_lvxl(int a, vector unsigned short *b)
2166{
2167 return (vector unsigned short)__builtin_altivec_lvxl(a, b);
2168}
2169
2170static vector unsigned short __ATTRS_o_ai
2171vec_lvxl(int a, unsigned short *b)
2172{
2173 return (vector unsigned short)__builtin_altivec_lvxl(a, b);
2174}
2175
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002176static vector bool short __ATTRS_o_ai
2177vec_lvxl(int a, vector bool short *b)
2178{
2179 return (vector bool short)__builtin_altivec_lvxl(a, b);
2180}
2181
2182static vector pixel __ATTRS_o_ai
2183vec_lvxl(int a, vector pixel *b)
2184{
2185 return (vector pixel)__builtin_altivec_lvxl(a, b);
2186}
2187
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002188static vector int __ATTRS_o_ai
2189vec_lvxl(int a, vector int *b)
2190{
2191 return (vector int)__builtin_altivec_lvxl(a, b);
2192}
2193
2194static vector int __ATTRS_o_ai
2195vec_lvxl(int a, int *b)
2196{
2197 return (vector int)__builtin_altivec_lvxl(a, b);
2198}
2199
2200static vector unsigned int __ATTRS_o_ai
2201vec_lvxl(int a, vector unsigned int *b)
2202{
2203 return (vector unsigned int)__builtin_altivec_lvxl(a, b);
2204}
2205
2206static vector unsigned int __ATTRS_o_ai
2207vec_lvxl(int a, unsigned int *b)
2208{
2209 return (vector unsigned int)__builtin_altivec_lvxl(a, b);
2210}
2211
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002212static vector bool int __ATTRS_o_ai
2213vec_lvxl(int a, vector bool int *b)
2214{
2215 return (vector bool int)__builtin_altivec_lvxl(a, b);
2216}
2217
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002218static vector float __ATTRS_o_ai
2219vec_lvxl(int a, vector float *b)
2220{
2221 return (vector float)__builtin_altivec_lvxl(a, b);
2222}
2223
2224static vector float __ATTRS_o_ai
2225vec_lvxl(int a, float *b)
2226{
2227 return (vector float)__builtin_altivec_lvxl(a, b);
2228}
2229
2230/* vec_loge */
2231
2232static vector float __attribute__((__always_inline__))
2233vec_loge(vector float a)
2234{
2235 return __builtin_altivec_vlogefp(a);
2236}
2237
2238/* vec_vlogefp */
2239
2240static vector float __attribute__((__always_inline__))
2241vec_vlogefp(vector float a)
2242{
2243 return __builtin_altivec_vlogefp(a);
2244}
2245
2246/* vec_lvsl */
2247
2248static vector unsigned char __ATTRS_o_ai
2249vec_lvsl(int a, signed char *b)
2250{
2251 return (vector unsigned char)__builtin_altivec_lvsl(a, b);
2252}
2253
2254static vector unsigned char __ATTRS_o_ai
2255vec_lvsl(int a, unsigned char *b)
2256{
2257 return (vector unsigned char)__builtin_altivec_lvsl(a, b);
2258}
2259
2260static vector unsigned char __ATTRS_o_ai
2261vec_lvsl(int a, short *b)
2262{
2263 return (vector unsigned char)__builtin_altivec_lvsl(a, b);
2264}
2265
2266static vector unsigned char __ATTRS_o_ai
2267vec_lvsl(int a, unsigned short *b)
2268{
2269 return (vector unsigned char)__builtin_altivec_lvsl(a, b);
2270}
2271
2272static vector unsigned char __ATTRS_o_ai
2273vec_lvsl(int a, int *b)
2274{
2275 return (vector unsigned char)__builtin_altivec_lvsl(a, b);
2276}
2277
2278static vector unsigned char __ATTRS_o_ai
2279vec_lvsl(int a, unsigned int *b)
2280{
2281 return (vector unsigned char)__builtin_altivec_lvsl(a, b);
2282}
2283
2284static vector unsigned char __ATTRS_o_ai
2285vec_lvsl(int a, float *b)
2286{
2287 return (vector unsigned char)__builtin_altivec_lvsl(a, b);
2288}
2289
2290/* vec_lvsr */
2291
2292static vector unsigned char __ATTRS_o_ai
2293vec_lvsr(int a, signed char *b)
2294{
2295 return (vector unsigned char)__builtin_altivec_lvsr(a, b);
2296}
2297
2298static vector unsigned char __ATTRS_o_ai
2299vec_lvsr(int a, unsigned char *b)
2300{
2301 return (vector unsigned char)__builtin_altivec_lvsr(a, b);
2302}
2303
2304static vector unsigned char __ATTRS_o_ai
2305vec_lvsr(int a, short *b)
2306{
2307 return (vector unsigned char)__builtin_altivec_lvsr(a, b);
2308}
2309
2310static vector unsigned char __ATTRS_o_ai
2311vec_lvsr(int a, unsigned short *b)
2312{
2313 return (vector unsigned char)__builtin_altivec_lvsr(a, b);
2314}
2315
2316static vector unsigned char __ATTRS_o_ai
2317vec_lvsr(int a, int *b)
2318{
2319 return (vector unsigned char)__builtin_altivec_lvsr(a, b);
2320}
2321
2322static vector unsigned char __ATTRS_o_ai
2323vec_lvsr(int a, unsigned int *b)
2324{
2325 return (vector unsigned char)__builtin_altivec_lvsr(a, b);
2326}
2327
2328static vector unsigned char __ATTRS_o_ai
2329vec_lvsr(int a, float *b)
2330{
2331 return (vector unsigned char)__builtin_altivec_lvsr(a, b);
2332}
2333
2334/* vec_madd */
2335
2336static vector float __attribute__((__always_inline__))
2337vec_madd(vector float a, vector float b, vector float c)
2338{
2339 return __builtin_altivec_vmaddfp(a, b, c);
2340}
2341
2342/* vec_vmaddfp */
2343
2344static vector float __attribute__((__always_inline__))
2345vec_vmaddfp(vector float a, vector float b, vector float c)
2346{
2347 return __builtin_altivec_vmaddfp(a, b, c);
2348}
2349
2350/* vec_madds */
2351
2352static vector signed short __attribute__((__always_inline__))
2353vec_madds(vector signed short a, vector signed short b, vector signed short c)
2354{
2355 return __builtin_altivec_vmhaddshs(a, b, c);
2356}
2357
2358/* vec_vmhaddshs */
2359static vector signed short __attribute__((__always_inline__))
2360vec_vmhaddshs(vector signed short a, vector signed short b, vector signed short c)
2361{
2362 return __builtin_altivec_vmhaddshs(a, b, c);
2363}
2364
Chris Lattnerdd173942010-04-14 03:54:58 +00002365/* vec_max */
2366
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002367static vector signed char __ATTRS_o_ai
Anton Yartseva816ec82010-08-12 18:51:55 +00002368vec_max(vector signed char a, vector signed char b)
Chris Lattnerdd173942010-04-14 03:54:58 +00002369{
2370 return __builtin_altivec_vmaxsb(a, b);
2371}
2372
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002373static vector signed char __ATTRS_o_ai
2374vec_max(vector bool char a, vector signed char b)
2375{
2376 return __builtin_altivec_vmaxsb((vector signed char)a, b);
2377}
2378
2379static vector signed char __ATTRS_o_ai
2380vec_max(vector signed char a, vector bool char b)
2381{
2382 return __builtin_altivec_vmaxsb(a, (vector signed char)b);
2383}
2384
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002385static vector unsigned char __ATTRS_o_ai
Anton Yartseva816ec82010-08-12 18:51:55 +00002386vec_max(vector unsigned char a, vector unsigned char b)
Chris Lattnerdd173942010-04-14 03:54:58 +00002387{
2388 return __builtin_altivec_vmaxub(a, b);
2389}
2390
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002391static vector unsigned char __ATTRS_o_ai
2392vec_max(vector bool char a, vector unsigned char b)
2393{
2394 return __builtin_altivec_vmaxub((vector unsigned char)a, b);
2395}
2396
2397static vector unsigned char __ATTRS_o_ai
2398vec_max(vector unsigned char a, vector bool char b)
2399{
2400 return __builtin_altivec_vmaxub(a, (vector unsigned char)b);
2401}
2402
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002403static vector short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00002404vec_max(vector short a, vector short b)
2405{
2406 return __builtin_altivec_vmaxsh(a, b);
2407}
2408
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002409static vector short __ATTRS_o_ai
2410vec_max(vector bool short a, vector short b)
2411{
2412 return __builtin_altivec_vmaxsh((vector short)a, b);
2413}
2414
2415static vector short __ATTRS_o_ai
2416vec_max(vector short a, vector bool short b)
2417{
2418 return __builtin_altivec_vmaxsh(a, (vector short)b);
2419}
2420
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002421static vector unsigned short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00002422vec_max(vector unsigned short a, vector unsigned short b)
2423{
2424 return __builtin_altivec_vmaxuh(a, b);
2425}
2426
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002427static vector unsigned short __ATTRS_o_ai
2428vec_max(vector bool short a, vector unsigned short b)
2429{
2430 return __builtin_altivec_vmaxuh((vector unsigned short)a, b);
2431}
2432
2433static vector unsigned short __ATTRS_o_ai
2434vec_max(vector unsigned short a, vector bool short b)
2435{
2436 return __builtin_altivec_vmaxuh(a, (vector unsigned short)b);
2437}
2438
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002439static vector int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00002440vec_max(vector int a, vector int b)
2441{
2442 return __builtin_altivec_vmaxsw(a, b);
2443}
2444
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002445static vector int __ATTRS_o_ai
2446vec_max(vector bool int a, vector int b)
2447{
2448 return __builtin_altivec_vmaxsw((vector int)a, b);
2449}
2450
2451static vector int __ATTRS_o_ai
2452vec_max(vector int a, vector bool int b)
2453{
2454 return __builtin_altivec_vmaxsw(a, (vector int)b);
2455}
2456
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002457static vector unsigned int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00002458vec_max(vector unsigned int a, vector unsigned int b)
2459{
2460 return __builtin_altivec_vmaxuw(a, b);
2461}
2462
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002463static vector unsigned int __ATTRS_o_ai
2464vec_max(vector bool int a, vector unsigned int b)
2465{
2466 return __builtin_altivec_vmaxuw((vector unsigned int)a, b);
2467}
2468
2469static vector unsigned int __ATTRS_o_ai
2470vec_max(vector unsigned int a, vector bool int b)
2471{
2472 return __builtin_altivec_vmaxuw(a, (vector unsigned int)b);
2473}
2474
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002475static vector float __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00002476vec_max(vector float a, vector float b)
2477{
2478 return __builtin_altivec_vmaxfp(a, b);
2479}
2480
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002481/* vec_vmaxsb */
2482
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002483static vector signed char __ATTRS_o_ai
Anton Yartseva816ec82010-08-12 18:51:55 +00002484vec_vmaxsb(vector signed char a, vector signed char b)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002485{
2486 return __builtin_altivec_vmaxsb(a, b);
2487}
2488
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002489static vector signed char __ATTRS_o_ai
2490vec_vmaxsb(vector bool char a, vector signed char b)
2491{
2492 return __builtin_altivec_vmaxsb((vector signed char)a, b);
2493}
2494
2495static vector signed char __ATTRS_o_ai
2496vec_vmaxsb(vector signed char a, vector bool char b)
2497{
2498 return __builtin_altivec_vmaxsb(a, (vector signed char)b);
2499}
2500
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002501/* vec_vmaxub */
2502
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002503static vector unsigned char __ATTRS_o_ai
Anton Yartseva816ec82010-08-12 18:51:55 +00002504vec_vmaxub(vector unsigned char a, vector unsigned char b)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002505{
2506 return __builtin_altivec_vmaxub(a, b);
2507}
2508
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002509static vector unsigned char __ATTRS_o_ai
2510vec_vmaxub(vector bool char a, vector unsigned char b)
2511{
2512 return __builtin_altivec_vmaxub((vector unsigned char)a, b);
2513}
2514
2515static vector unsigned char __ATTRS_o_ai
2516vec_vmaxub(vector unsigned char a, vector bool char b)
2517{
2518 return __builtin_altivec_vmaxub(a, (vector unsigned char)b);
2519}
2520
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002521/* vec_vmaxsh */
2522
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002523static vector short __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002524vec_vmaxsh(vector short a, vector short b)
2525{
2526 return __builtin_altivec_vmaxsh(a, b);
2527}
2528
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002529static vector short __ATTRS_o_ai
2530vec_vmaxsh(vector bool short a, vector short b)
2531{
2532 return __builtin_altivec_vmaxsh((vector short)a, b);
2533}
2534
2535static vector short __ATTRS_o_ai
2536vec_vmaxsh(vector short a, vector bool short b)
2537{
2538 return __builtin_altivec_vmaxsh(a, (vector short)b);
2539}
2540
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002541/* vec_vmaxuh */
2542
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002543static vector unsigned short __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002544vec_vmaxuh(vector unsigned short a, vector unsigned short b)
2545{
2546 return __builtin_altivec_vmaxuh(a, b);
2547}
2548
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002549static vector unsigned short __ATTRS_o_ai
2550vec_vmaxuh(vector bool short a, vector unsigned short b)
2551{
2552 return __builtin_altivec_vmaxuh((vector unsigned short)a, b);
2553}
2554
2555static vector unsigned short __ATTRS_o_ai
2556vec_vmaxuh(vector unsigned short a, vector bool short b)
2557{
2558 return __builtin_altivec_vmaxuh(a, (vector unsigned short)b);
2559}
2560
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002561/* vec_vmaxsw */
2562
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002563static vector int __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002564vec_vmaxsw(vector int a, vector int b)
2565{
2566 return __builtin_altivec_vmaxsw(a, b);
2567}
2568
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002569static vector int __ATTRS_o_ai
2570vec_vmaxsw(vector bool int a, vector int b)
2571{
2572 return __builtin_altivec_vmaxsw((vector int)a, b);
2573}
2574
2575static vector int __ATTRS_o_ai
2576vec_vmaxsw(vector int a, vector bool int b)
2577{
2578 return __builtin_altivec_vmaxsw(a, (vector int)b);
2579}
2580
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002581/* vec_vmaxuw */
2582
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002583static vector unsigned int __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002584vec_vmaxuw(vector unsigned int a, vector unsigned int b)
2585{
2586 return __builtin_altivec_vmaxuw(a, b);
2587}
2588
Anton Yartseva2fc0f52010-08-19 03:21:36 +00002589static vector unsigned int __ATTRS_o_ai
2590vec_vmaxuw(vector bool int a, vector unsigned int b)
2591{
2592 return __builtin_altivec_vmaxuw((vector unsigned int)a, b);
2593}
2594
2595static vector unsigned int __ATTRS_o_ai
2596vec_vmaxuw(vector unsigned int a, vector bool int b)
2597{
2598 return __builtin_altivec_vmaxuw(a, (vector unsigned int)b);
2599}
2600
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002601/* vec_vmaxfp */
2602
2603static vector float __attribute__((__always_inline__))
2604vec_vmaxfp(vector float a, vector float b)
2605{
2606 return __builtin_altivec_vmaxfp(a, b);
2607}
2608
2609/* vec_mergeh */
2610
2611static vector signed char __ATTRS_o_ai
2612vec_mergeh(vector signed char a, vector signed char b)
2613{
2614 return vec_perm(a, b, (vector unsigned char)
2615 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2616 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2617}
2618
2619static vector unsigned char __ATTRS_o_ai
2620vec_mergeh(vector unsigned char a, vector unsigned char b)
2621{
2622 return vec_perm(a, b, (vector unsigned char)
2623 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2624 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2625}
2626
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00002627static vector bool char __ATTRS_o_ai
2628vec_mergeh(vector bool char a, vector bool char b)
2629{
2630 return vec_perm(a, b, (vector unsigned char)
2631 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2632 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2633}
2634
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002635static vector short __ATTRS_o_ai
2636vec_mergeh(vector short a, vector short b)
2637{
2638 return vec_perm(a, b, (vector unsigned char)
2639 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2640 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2641}
2642
2643static vector unsigned short __ATTRS_o_ai
2644vec_mergeh(vector unsigned short a, vector unsigned short b)
2645{
2646 return vec_perm(a, b, (vector unsigned char)
2647 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2648 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2649}
2650
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00002651static vector bool short __ATTRS_o_ai
2652vec_mergeh(vector bool short a, vector bool short b)
2653{
2654 return vec_perm(a, b, (vector unsigned char)
2655 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2656 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2657}
2658
2659static vector pixel __ATTRS_o_ai
2660vec_mergeh(vector pixel a, vector pixel b)
2661{
2662 return vec_perm(a, b, (vector unsigned char)
2663 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2664 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2665}
2666
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002667static vector int __ATTRS_o_ai
2668vec_mergeh(vector int a, vector int b)
2669{
2670 return vec_perm(a, b, (vector unsigned char)
2671 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2672 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2673}
2674
2675static vector unsigned int __ATTRS_o_ai
2676vec_mergeh(vector unsigned int a, vector unsigned int b)
2677{
2678 return vec_perm(a, b, (vector unsigned char)
2679 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2680 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2681}
2682
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00002683static vector bool int __ATTRS_o_ai
2684vec_mergeh(vector bool int a, vector bool int b)
2685{
2686 return vec_perm(a, b, (vector unsigned char)
2687 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2688 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2689}
2690
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002691static vector float __ATTRS_o_ai
2692vec_mergeh(vector float a, vector float b)
2693{
2694 return vec_perm(a, b, (vector unsigned char)
2695 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2696 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2697}
2698
2699/* vec_vmrghb */
2700
2701#define __builtin_altivec_vmrghb vec_vmrghb
2702
2703static vector signed char __ATTRS_o_ai
2704vec_vmrghb(vector signed char a, vector signed char b)
2705{
2706 return vec_perm(a, b, (vector unsigned char)
2707 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2708 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2709}
2710
2711static vector unsigned char __ATTRS_o_ai
2712vec_vmrghb(vector unsigned char a, vector unsigned char b)
2713{
2714 return vec_perm(a, b, (vector unsigned char)
2715 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2716 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2717}
2718
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00002719static vector bool char __ATTRS_o_ai
2720vec_vmrghb(vector bool char a, vector bool char b)
2721{
2722 return vec_perm(a, b, (vector unsigned char)
2723 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2724 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2725}
2726
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002727/* vec_vmrghh */
2728
2729#define __builtin_altivec_vmrghh vec_vmrghh
2730
2731static vector short __ATTRS_o_ai
2732vec_vmrghh(vector short a, vector short b)
2733{
2734 return vec_perm(a, b, (vector unsigned char)
2735 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2736 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2737}
2738
2739static vector unsigned short __ATTRS_o_ai
2740vec_vmrghh(vector unsigned short a, vector unsigned short b)
2741{
2742 return vec_perm(a, b, (vector unsigned char)
2743 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2744 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2745}
2746
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00002747static vector bool short __ATTRS_o_ai
2748vec_vmrghh(vector bool short a, vector bool short b)
2749{
2750 return vec_perm(a, b, (vector unsigned char)
2751 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2752 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2753}
2754
2755static vector pixel __ATTRS_o_ai
2756vec_vmrghh(vector pixel a, vector pixel b)
2757{
2758 return vec_perm(a, b, (vector unsigned char)
2759 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2760 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2761}
2762
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002763/* vec_vmrghw */
2764
2765#define __builtin_altivec_vmrghw vec_vmrghw
2766
2767static vector int __ATTRS_o_ai
2768vec_vmrghw(vector int a, vector int b)
2769{
2770 return vec_perm(a, b, (vector unsigned char)
2771 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2772 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2773}
2774
2775static vector unsigned int __ATTRS_o_ai
2776vec_vmrghw(vector unsigned int a, vector unsigned int b)
2777{
2778 return vec_perm(a, b, (vector unsigned char)
2779 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2780 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2781}
2782
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00002783static vector bool int __ATTRS_o_ai
2784vec_vmrghw(vector bool int a, vector bool int b)
2785{
2786 return vec_perm(a, b, (vector unsigned char)
2787 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2788 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2789}
2790
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002791static vector float __ATTRS_o_ai
2792vec_vmrghw(vector float a, vector float b)
2793{
2794 return vec_perm(a, b, (vector unsigned char)
2795 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2796 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2797}
2798
2799/* vec_mergel */
2800
2801static vector signed char __ATTRS_o_ai
2802vec_mergel(vector signed char a, vector signed char b)
2803{
2804 return vec_perm(a, b, (vector unsigned char)
2805 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
2806 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
2807}
2808
2809static vector unsigned char __ATTRS_o_ai
2810vec_mergel(vector unsigned char a, vector unsigned char b)
2811{
2812 return vec_perm(a, b, (vector unsigned char)
2813 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
2814 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
2815}
2816
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00002817static vector bool char __ATTRS_o_ai
2818vec_mergel(vector bool char a, vector bool char b)
2819{
2820 return vec_perm(a, b, (vector unsigned char)
2821 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
2822 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
2823}
2824
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002825static vector short __ATTRS_o_ai
2826vec_mergel(vector short a, vector short b)
2827{
2828 return vec_perm(a, b, (vector unsigned char)
2829 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
2830 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
2831}
2832
2833static vector unsigned short __ATTRS_o_ai
2834vec_mergel(vector unsigned short a, vector unsigned short b)
2835{
2836 return vec_perm(a, b, (vector unsigned char)
2837 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
2838 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
2839}
2840
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00002841static vector bool short __ATTRS_o_ai
2842vec_mergel(vector bool short a, vector bool short b)
2843{
2844 return vec_perm(a, b, (vector unsigned char)
2845 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
2846 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
2847}
2848
2849static vector pixel __ATTRS_o_ai
2850vec_mergel(vector pixel a, vector pixel b)
2851{
2852 return vec_perm(a, b, (vector unsigned char)
2853 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
2854 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
2855}
2856
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002857static vector int __ATTRS_o_ai
2858vec_mergel(vector int a, vector int b)
2859{
2860 return vec_perm(a, b, (vector unsigned char)
2861 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
2862 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
2863}
2864
2865static vector unsigned int __ATTRS_o_ai
2866vec_mergel(vector unsigned int a, vector unsigned int b)
2867{
2868 return vec_perm(a, b, (vector unsigned char)
2869 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
2870 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
2871}
2872
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00002873static vector bool int __ATTRS_o_ai
2874vec_mergel(vector bool int a, vector bool int b)
2875{
2876 return vec_perm(a, b, (vector unsigned char)
2877 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
2878 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
2879}
2880
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002881static vector float __ATTRS_o_ai
2882vec_mergel(vector float a, vector float b)
2883{
2884 return vec_perm(a, b, (vector unsigned char)
2885 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
2886 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
2887}
2888
2889/* vec_vmrglb */
2890
2891#define __builtin_altivec_vmrglb vec_vmrglb
2892
2893static vector signed char __ATTRS_o_ai
2894vec_vmrglb(vector signed char a, vector signed char b)
2895{
2896 return vec_perm(a, b, (vector unsigned char)
2897 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
2898 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
2899}
2900
2901static vector unsigned char __ATTRS_o_ai
2902vec_vmrglb(vector unsigned char a, vector unsigned char b)
2903{
2904 return vec_perm(a, b, (vector unsigned char)
2905 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
2906 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
2907}
2908
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00002909static vector bool char __ATTRS_o_ai
2910vec_vmrglb(vector bool char a, vector bool char b)
2911{
2912 return vec_perm(a, b, (vector unsigned char)
2913 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
2914 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
2915}
2916
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002917/* vec_vmrglh */
2918
2919#define __builtin_altivec_vmrglh vec_vmrglh
2920
2921static vector short __ATTRS_o_ai
2922vec_vmrglh(vector short a, vector short b)
2923{
2924 return vec_perm(a, b, (vector unsigned char)
2925 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
2926 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
2927}
2928
2929static vector unsigned short __ATTRS_o_ai
2930vec_vmrglh(vector unsigned short a, vector unsigned short b)
2931{
2932 return vec_perm(a, b, (vector unsigned char)
2933 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
2934 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
2935}
2936
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00002937static vector bool short __ATTRS_o_ai
2938vec_vmrglh(vector bool short a, vector bool short b)
2939{
2940 return vec_perm(a, b, (vector unsigned char)
2941 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
2942 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
2943}
2944
2945static vector pixel __ATTRS_o_ai
2946vec_vmrglh(vector pixel a, vector pixel b)
2947{
2948 return vec_perm(a, b, (vector unsigned char)
2949 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
2950 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
2951}
2952
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002953/* vec_vmrglw */
2954
2955#define __builtin_altivec_vmrglw vec_vmrglw
2956
2957static vector int __ATTRS_o_ai
2958vec_vmrglw(vector int a, vector int b)
2959{
2960 return vec_perm(a, b, (vector unsigned char)
2961 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
2962 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
2963}
2964
2965static vector unsigned int __ATTRS_o_ai
2966vec_vmrglw(vector unsigned int a, vector unsigned int b)
2967{
2968 return vec_perm(a, b, (vector unsigned char)
2969 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
2970 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
2971}
2972
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00002973static vector bool int __ATTRS_o_ai
2974vec_vmrglw(vector bool int a, vector bool int b)
2975{
2976 return vec_perm(a, b, (vector unsigned char)
2977 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
2978 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
2979}
2980
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002981static vector float __ATTRS_o_ai
2982vec_vmrglw(vector float a, vector float b)
2983{
2984 return vec_perm(a, b, (vector unsigned char)
2985 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
2986 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
2987}
2988
Chris Lattnerdd173942010-04-14 03:54:58 +00002989/* vec_mfvscr */
2990
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002991static vector unsigned short __attribute__((__always_inline__))
2992vec_mfvscr(void)
2993{
2994 return __builtin_altivec_mfvscr();
2995}
Chris Lattnerdd173942010-04-14 03:54:58 +00002996
2997/* vec_min */
2998
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002999static vector signed char __ATTRS_o_ai
Anton Yartseva816ec82010-08-12 18:51:55 +00003000vec_min(vector signed char a, vector signed char b)
Chris Lattnerdd173942010-04-14 03:54:58 +00003001{
3002 return __builtin_altivec_vminsb(a, b);
3003}
3004
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003005static vector signed char __ATTRS_o_ai
3006vec_min(vector bool char a, vector signed char b)
3007{
3008 return __builtin_altivec_vminsb((vector signed char)a, b);
3009}
3010
3011static vector signed char __ATTRS_o_ai
3012vec_min(vector signed char a, vector bool char b)
3013{
3014 return __builtin_altivec_vminsb(a, (vector signed char)b);
3015}
3016
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003017static vector unsigned char __ATTRS_o_ai
Anton Yartseva816ec82010-08-12 18:51:55 +00003018vec_min(vector unsigned char a, vector unsigned char b)
Chris Lattnerdd173942010-04-14 03:54:58 +00003019{
3020 return __builtin_altivec_vminub(a, b);
3021}
3022
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003023static vector unsigned char __ATTRS_o_ai
3024vec_min(vector bool char a, vector unsigned char b)
3025{
3026 return __builtin_altivec_vminub((vector unsigned char)a, b);
3027}
3028
3029static vector unsigned char __ATTRS_o_ai
3030vec_min(vector unsigned char a, vector bool char b)
3031{
3032 return __builtin_altivec_vminub(a, (vector unsigned char)b);
3033}
3034
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003035static vector short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00003036vec_min(vector short a, vector short b)
3037{
3038 return __builtin_altivec_vminsh(a, b);
3039}
3040
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003041static vector short __ATTRS_o_ai
3042vec_min(vector bool short a, vector short b)
3043{
3044 return __builtin_altivec_vminsh((vector short)a, b);
3045}
3046
3047static vector short __ATTRS_o_ai
3048vec_min(vector short a, vector bool short b)
3049{
3050 return __builtin_altivec_vminsh(a, (vector short)b);
3051}
3052
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003053static vector unsigned short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00003054vec_min(vector unsigned short a, vector unsigned short b)
3055{
3056 return __builtin_altivec_vminuh(a, b);
3057}
3058
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003059static vector unsigned short __ATTRS_o_ai
3060vec_min(vector bool short a, vector unsigned short b)
3061{
3062 return __builtin_altivec_vminuh((vector unsigned short)a, b);
3063}
3064
3065static vector unsigned short __ATTRS_o_ai
3066vec_min(vector unsigned short a, vector bool short b)
3067{
3068 return __builtin_altivec_vminuh(a, (vector unsigned short)b);
3069}
3070
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003071static vector int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00003072vec_min(vector int a, vector int b)
3073{
3074 return __builtin_altivec_vminsw(a, b);
3075}
3076
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003077static vector int __ATTRS_o_ai
3078vec_min(vector bool int a, vector int b)
3079{
3080 return __builtin_altivec_vminsw((vector int)a, b);
3081}
3082
3083static vector int __ATTRS_o_ai
3084vec_min(vector int a, vector bool int b)
3085{
3086 return __builtin_altivec_vminsw(a, (vector int)b);
3087}
3088
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003089static vector unsigned int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00003090vec_min(vector unsigned int a, vector unsigned int b)
3091{
3092 return __builtin_altivec_vminuw(a, b);
3093}
3094
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003095static vector unsigned int __ATTRS_o_ai
3096vec_min(vector bool int a, vector unsigned int b)
3097{
3098 return __builtin_altivec_vminuw((vector unsigned int)a, b);
3099}
3100
3101static vector unsigned int __ATTRS_o_ai
3102vec_min(vector unsigned int a, vector bool int b)
3103{
3104 return __builtin_altivec_vminuw(a, (vector unsigned int)b);
3105}
3106
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003107static vector float __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00003108vec_min(vector float a, vector float b)
3109{
3110 return __builtin_altivec_vminfp(a, b);
3111}
3112
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003113/* vec_vminsb */
3114
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003115static vector signed char __ATTRS_o_ai
Anton Yartseva816ec82010-08-12 18:51:55 +00003116vec_vminsb(vector signed char a, vector signed char b)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003117{
3118 return __builtin_altivec_vminsb(a, b);
3119}
3120
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003121static vector signed char __ATTRS_o_ai
3122vec_vminsb(vector bool char a, vector signed char b)
3123{
3124 return __builtin_altivec_vminsb((vector signed char)a, b);
3125}
3126
3127static vector signed char __ATTRS_o_ai
3128vec_vminsb(vector signed char a, vector bool char b)
3129{
3130 return __builtin_altivec_vminsb(a, (vector signed char)b);
3131}
3132
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003133/* vec_vminub */
3134
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003135static vector unsigned char __ATTRS_o_ai
Anton Yartseva816ec82010-08-12 18:51:55 +00003136vec_vminub(vector unsigned char a, vector unsigned char b)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003137{
3138 return __builtin_altivec_vminub(a, b);
3139}
3140
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003141static vector unsigned char __ATTRS_o_ai
3142vec_vminub(vector bool char a, vector unsigned char b)
3143{
3144 return __builtin_altivec_vminub((vector unsigned char)a, b);
3145}
3146
3147static vector unsigned char __ATTRS_o_ai
3148vec_vminub(vector unsigned char a, vector bool char b)
3149{
3150 return __builtin_altivec_vminub(a, (vector unsigned char)b);
3151}
3152
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003153/* vec_vminsh */
3154
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003155static vector short __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003156vec_vminsh(vector short a, vector short b)
3157{
3158 return __builtin_altivec_vminsh(a, b);
3159}
3160
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003161static vector short __ATTRS_o_ai
3162vec_vminsh(vector bool short a, vector short b)
3163{
3164 return __builtin_altivec_vminsh((vector short)a, b);
3165}
3166
3167static vector short __ATTRS_o_ai
3168vec_vminsh(vector short a, vector bool short b)
3169{
3170 return __builtin_altivec_vminsh(a, (vector short)b);
3171}
3172
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003173/* vec_vminuh */
3174
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003175static vector unsigned short __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003176vec_vminuh(vector unsigned short a, vector unsigned short b)
3177{
3178 return __builtin_altivec_vminuh(a, b);
3179}
3180
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003181static vector unsigned short __ATTRS_o_ai
3182vec_vminuh(vector bool short a, vector unsigned short b)
3183{
3184 return __builtin_altivec_vminuh((vector unsigned short)a, b);
3185}
3186
3187static vector unsigned short __ATTRS_o_ai
3188vec_vminuh(vector unsigned short a, vector bool short b)
3189{
3190 return __builtin_altivec_vminuh(a, (vector unsigned short)b);
3191}
3192
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003193/* vec_vminsw */
3194
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003195static vector int __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003196vec_vminsw(vector int a, vector int b)
3197{
3198 return __builtin_altivec_vminsw(a, b);
3199}
3200
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003201static vector int __ATTRS_o_ai
3202vec_vminsw(vector bool int a, vector int b)
3203{
3204 return __builtin_altivec_vminsw((vector int)a, b);
3205}
3206
3207static vector int __ATTRS_o_ai
3208vec_vminsw(vector int a, vector bool int b)
3209{
3210 return __builtin_altivec_vminsw(a, (vector int)b);
3211}
3212
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003213/* vec_vminuw */
3214
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003215static vector unsigned int __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003216vec_vminuw(vector unsigned int a, vector unsigned int b)
3217{
3218 return __builtin_altivec_vminuw(a, b);
3219}
3220
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003221static vector unsigned int __ATTRS_o_ai
3222vec_vminuw(vector bool int a, vector unsigned int b)
3223{
3224 return __builtin_altivec_vminuw((vector unsigned int)a, b);
3225}
3226
3227static vector unsigned int __ATTRS_o_ai
3228vec_vminuw(vector unsigned int a, vector bool int b)
3229{
3230 return __builtin_altivec_vminuw(a, (vector unsigned int)b);
3231}
3232
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003233/* vec_vminfp */
3234
3235static vector float __attribute__((__always_inline__))
3236vec_vminfp(vector float a, vector float b)
3237{
3238 return __builtin_altivec_vminfp(a, b);
3239}
3240
3241/* vec_mladd */
3242
3243#define __builtin_altivec_vmladduhm vec_mladd
3244
3245static vector short __ATTRS_o_ai
3246vec_mladd(vector short a, vector short b, vector short c)
3247{
3248 return a * b + c;
3249}
3250
3251static vector short __ATTRS_o_ai
3252vec_mladd(vector short a, vector unsigned short b, vector unsigned short c)
3253{
3254 return a * (vector short)b + (vector short)c;
3255}
3256
3257static vector short __ATTRS_o_ai
3258vec_mladd(vector unsigned short a, vector short b, vector short c)
3259{
3260 return (vector short)a * b + c;
3261}
3262
3263static vector unsigned short __ATTRS_o_ai
3264vec_mladd(vector unsigned short a, vector unsigned short b, vector unsigned short c)
3265{
3266 return a * b + c;
3267}
3268
3269/* vec_vmladduhm */
3270
3271static vector short __ATTRS_o_ai
3272vec_vmladduhm(vector short a, vector short b, vector short c)
3273{
3274 return a * b + c;
3275}
3276
3277static vector short __ATTRS_o_ai
3278vec_vmladduhm(vector short a, vector unsigned short b, vector unsigned short c)
3279{
3280 return a * (vector short)b + (vector short)c;
3281}
3282
3283static vector short __ATTRS_o_ai
3284vec_vmladduhm(vector unsigned short a, vector short b, vector short c)
3285{
3286 return (vector short)a * b + c;
3287}
3288
3289static vector unsigned short __ATTRS_o_ai
3290vec_vmladduhm(vector unsigned short a, vector unsigned short b, vector unsigned short c)
3291{
3292 return a * b + c;
3293}
3294
3295/* vec_mradds */
3296
3297static vector short __attribute__((__always_inline__))
3298vec_mradds(vector short a, vector short b, vector short c)
3299{
3300 return __builtin_altivec_vmhraddshs(a, b, c);
3301}
3302
3303/* vec_vmhraddshs */
3304
3305static vector short __attribute__((__always_inline__))
3306vec_vmhraddshs(vector short a, vector short b, vector short c)
3307{
3308 return __builtin_altivec_vmhraddshs(a, b, c);
3309}
3310
3311/* vec_msum */
3312
3313static vector int __ATTRS_o_ai
3314vec_msum(vector signed char a, vector unsigned char b, vector int c)
3315{
3316 return __builtin_altivec_vmsummbm(a, b, c);
3317}
3318
3319static vector unsigned int __ATTRS_o_ai
3320vec_msum(vector unsigned char a, vector unsigned char b, vector unsigned int c)
3321{
3322 return __builtin_altivec_vmsumubm(a, b, c);
3323}
3324
3325static vector int __ATTRS_o_ai
3326vec_msum(vector short a, vector short b, vector int c)
3327{
3328 return __builtin_altivec_vmsumshm(a, b, c);
3329}
3330
3331static vector unsigned int __ATTRS_o_ai
3332vec_msum(vector unsigned short a, vector unsigned short b, vector unsigned int c)
3333{
3334 return __builtin_altivec_vmsumuhm(a, b, c);
3335}
3336
3337/* vec_vmsummbm */
3338
3339static vector int __attribute__((__always_inline__))
3340vec_vmsummbm(vector signed char a, vector unsigned char b, vector int c)
3341{
3342 return __builtin_altivec_vmsummbm(a, b, c);
3343}
3344
3345/* vec_vmsumubm */
3346
3347static vector unsigned int __attribute__((__always_inline__))
3348vec_vmsumubm(vector unsigned char a, vector unsigned char b, vector unsigned int c)
3349{
3350 return __builtin_altivec_vmsumubm(a, b, c);
3351}
3352
3353/* vec_vmsumshm */
3354
3355static vector int __attribute__((__always_inline__))
3356vec_vmsumshm(vector short a, vector short b, vector int c)
3357{
3358 return __builtin_altivec_vmsumshm(a, b, c);
3359}
3360
3361/* vec_vmsumuhm */
3362
3363static vector unsigned int __attribute__((__always_inline__))
3364vec_vmsumuhm(vector unsigned short a, vector unsigned short b, vector unsigned int c)
3365{
3366 return __builtin_altivec_vmsumuhm(a, b, c);
3367}
3368
3369/* vec_msums */
3370
3371static vector int __ATTRS_o_ai
3372vec_msums(vector short a, vector short b, vector int c)
3373{
3374 return __builtin_altivec_vmsumshs(a, b, c);
3375}
3376
3377static vector unsigned int __ATTRS_o_ai
3378vec_msums(vector unsigned short a, vector unsigned short b, vector unsigned int c)
3379{
3380 return __builtin_altivec_vmsumuhs(a, b, c);
3381}
3382
3383/* vec_vmsumshs */
3384
3385static vector int __attribute__((__always_inline__))
3386vec_vmsumshs(vector short a, vector short b, vector int c)
3387{
3388 return __builtin_altivec_vmsumshs(a, b, c);
3389}
3390
3391/* vec_vmsumuhs */
3392
3393static vector unsigned int __attribute__((__always_inline__))
3394vec_vmsumuhs(vector unsigned short a, vector unsigned short b, vector unsigned int c)
3395{
3396 return __builtin_altivec_vmsumuhs(a, b, c);
3397}
3398
Chris Lattnerdd173942010-04-14 03:54:58 +00003399/* vec_mtvscr */
3400
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003401static void __ATTRS_o_ai
3402vec_mtvscr(vector signed char a)
3403{
3404 __builtin_altivec_mtvscr((vector int)a);
3405}
3406
3407static void __ATTRS_o_ai
3408vec_mtvscr(vector unsigned char a)
3409{
3410 __builtin_altivec_mtvscr((vector int)a);
3411}
3412
3413static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003414vec_mtvscr(vector bool char a)
3415{
3416 __builtin_altivec_mtvscr((vector int)a);
3417}
3418
3419static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003420vec_mtvscr(vector short a)
3421{
3422 __builtin_altivec_mtvscr((vector int)a);
3423}
3424
3425static void __ATTRS_o_ai
3426vec_mtvscr(vector unsigned short a)
3427{
3428 __builtin_altivec_mtvscr((vector int)a);
3429}
3430
3431static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003432vec_mtvscr(vector bool short a)
3433{
3434 __builtin_altivec_mtvscr((vector int)a);
3435}
3436
3437static void __ATTRS_o_ai
3438vec_mtvscr(vector pixel a)
3439{
3440 __builtin_altivec_mtvscr((vector int)a);
3441}
3442
3443static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003444vec_mtvscr(vector int a)
3445{
3446 __builtin_altivec_mtvscr((vector int)a);
3447}
3448
3449static void __ATTRS_o_ai
3450vec_mtvscr(vector unsigned int a)
3451{
3452 __builtin_altivec_mtvscr((vector int)a);
3453}
3454
3455static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003456vec_mtvscr(vector bool int a)
3457{
3458 __builtin_altivec_mtvscr((vector int)a);
3459}
3460
3461static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003462vec_mtvscr(vector float a)
3463{
3464 __builtin_altivec_mtvscr((vector int)a);
3465}
3466
3467/* vec_mule */
3468
3469static vector short __ATTRS_o_ai
3470vec_mule(vector signed char a, vector signed char b)
3471{
3472 return __builtin_altivec_vmulesb(a, b);
3473}
3474
3475static vector unsigned short __ATTRS_o_ai
3476vec_mule(vector unsigned char a, vector unsigned char b)
3477{
3478 return __builtin_altivec_vmuleub(a, b);
3479}
3480
3481static vector int __ATTRS_o_ai
3482vec_mule(vector short a, vector short b)
3483{
3484 return __builtin_altivec_vmulesh(a, b);
3485}
3486
3487static vector unsigned int __ATTRS_o_ai
3488vec_mule(vector unsigned short a, vector unsigned short b)
3489{
3490 return __builtin_altivec_vmuleuh(a, b);
3491}
3492
3493/* vec_vmulesb */
3494
3495static vector short __attribute__((__always_inline__))
3496vec_vmulesb(vector signed char a, vector signed char b)
3497{
3498 return __builtin_altivec_vmulesb(a, b);
3499}
3500
3501/* vec_vmuleub */
3502
3503static vector unsigned short __attribute__((__always_inline__))
3504vec_vmuleub(vector unsigned char a, vector unsigned char b)
3505{
3506 return __builtin_altivec_vmuleub(a, b);
3507}
3508
3509/* vec_vmulesh */
3510
3511static vector int __attribute__((__always_inline__))
3512vec_vmulesh(vector short a, vector short b)
3513{
3514 return __builtin_altivec_vmulesh(a, b);
3515}
3516
3517/* vec_vmuleuh */
3518
3519static vector unsigned int __attribute__((__always_inline__))
3520vec_vmuleuh(vector unsigned short a, vector unsigned short b)
3521{
3522 return __builtin_altivec_vmuleuh(a, b);
3523}
3524
3525/* vec_mulo */
3526
3527static vector short __ATTRS_o_ai
3528vec_mulo(vector signed char a, vector signed char b)
3529{
3530 return __builtin_altivec_vmulosb(a, b);
3531}
3532
3533static vector unsigned short __ATTRS_o_ai
3534vec_mulo(vector unsigned char a, vector unsigned char b)
3535{
3536 return __builtin_altivec_vmuloub(a, b);
3537}
3538
3539static vector int __ATTRS_o_ai
3540vec_mulo(vector short a, vector short b)
3541{
3542 return __builtin_altivec_vmulosh(a, b);
3543}
3544
3545static vector unsigned int __ATTRS_o_ai
3546vec_mulo(vector unsigned short a, vector unsigned short b)
3547{
3548 return __builtin_altivec_vmulouh(a, b);
3549}
3550
3551/* vec_vmulosb */
3552
3553static vector short __attribute__((__always_inline__))
3554vec_vmulosb(vector signed char a, vector signed char b)
3555{
3556 return __builtin_altivec_vmulosb(a, b);
3557}
3558
3559/* vec_vmuloub */
3560
3561static vector unsigned short __attribute__((__always_inline__))
3562vec_vmuloub(vector unsigned char a, vector unsigned char b)
3563{
3564 return __builtin_altivec_vmuloub(a, b);
3565}
3566
3567/* vec_vmulosh */
3568
3569static vector int __attribute__((__always_inline__))
3570vec_vmulosh(vector short a, vector short b)
3571{
3572 return __builtin_altivec_vmulosh(a, b);
3573}
3574
3575/* vec_vmulouh */
3576
3577static vector unsigned int __attribute__((__always_inline__))
3578vec_vmulouh(vector unsigned short a, vector unsigned short b)
3579{
3580 return __builtin_altivec_vmulouh(a, b);
3581}
3582
3583/* vec_nmsub */
3584
3585static vector float __attribute__((__always_inline__))
3586vec_nmsub(vector float a, vector float b, vector float c)
3587{
3588 return __builtin_altivec_vnmsubfp(a, b, c);
3589}
3590
3591/* vec_vnmsubfp */
3592
3593static vector float __attribute__((__always_inline__))
3594vec_vnmsubfp(vector float a, vector float b, vector float c)
3595{
3596 return __builtin_altivec_vnmsubfp(a, b, c);
3597}
3598
3599/* vec_nor */
3600
3601#define __builtin_altivec_vnor vec_nor
3602
3603static vector signed char __ATTRS_o_ai
3604vec_nor(vector signed char a, vector signed char b)
3605{
3606 return ~(a | b);
3607}
3608
3609static vector unsigned char __ATTRS_o_ai
3610vec_nor(vector unsigned char a, vector unsigned char b)
3611{
3612 return ~(a | b);
3613}
3614
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003615static vector bool char __ATTRS_o_ai
3616vec_nor(vector bool char a, vector bool char b)
3617{
3618 return ~(a | b);
3619}
3620
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003621static vector short __ATTRS_o_ai
3622vec_nor(vector short a, vector short b)
3623{
3624 return ~(a | b);
3625}
3626
3627static vector unsigned short __ATTRS_o_ai
3628vec_nor(vector unsigned short a, vector unsigned short b)
3629{
3630 return ~(a | b);
3631}
3632
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003633static vector bool short __ATTRS_o_ai
3634vec_nor(vector bool short a, vector bool short b)
3635{
3636 return ~(a | b);
3637}
3638
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003639static vector int __ATTRS_o_ai
3640vec_nor(vector int a, vector int b)
3641{
3642 return ~(a | b);
3643}
3644
3645static vector unsigned int __ATTRS_o_ai
3646vec_nor(vector unsigned int a, vector unsigned int b)
3647{
3648 return ~(a | b);
3649}
3650
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003651static vector bool int __ATTRS_o_ai
3652vec_nor(vector bool int a, vector bool int b)
3653{
3654 return ~(a | b);
3655}
3656
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003657static vector float __ATTRS_o_ai
3658vec_nor(vector float a, vector float b)
3659{
3660 vector unsigned int res = ~((vector unsigned int)a | (vector unsigned int)b);
3661 return (vector float)res;
3662}
3663
3664/* vec_vnor */
3665
3666static vector signed char __ATTRS_o_ai
3667vec_vnor(vector signed char a, vector signed char b)
3668{
3669 return ~(a | b);
3670}
3671
3672static vector unsigned char __ATTRS_o_ai
3673vec_vnor(vector unsigned char a, vector unsigned char b)
3674{
3675 return ~(a | b);
3676}
3677
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003678static vector bool char __ATTRS_o_ai
3679vec_vnor(vector bool char a, vector bool char b)
3680{
3681 return ~(a | b);
3682}
3683
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003684static vector short __ATTRS_o_ai
3685vec_vnor(vector short a, vector short b)
3686{
3687 return ~(a | b);
3688}
3689
3690static vector unsigned short __ATTRS_o_ai
3691vec_vnor(vector unsigned short a, vector unsigned short b)
3692{
3693 return ~(a | b);
3694}
3695
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003696static vector bool short __ATTRS_o_ai
3697vec_vnor(vector bool short a, vector bool short b)
3698{
3699 return ~(a | b);
3700}
3701
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003702static vector int __ATTRS_o_ai
3703vec_vnor(vector int a, vector int b)
3704{
3705 return ~(a | b);
3706}
3707
3708static vector unsigned int __ATTRS_o_ai
3709vec_vnor(vector unsigned int a, vector unsigned int b)
3710{
3711 return ~(a | b);
3712}
3713
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003714static vector bool int __ATTRS_o_ai
3715vec_vnor(vector bool int a, vector bool int b)
3716{
3717 return ~(a | b);
3718}
3719
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003720static vector float __ATTRS_o_ai
3721vec_vnor(vector float a, vector float b)
3722{
3723 vector unsigned int res = ~((vector unsigned int)a | (vector unsigned int)b);
3724 return (vector float)res;
3725}
3726
3727/* vec_or */
3728
3729#define __builtin_altivec_vor vec_or
3730
3731static vector signed char __ATTRS_o_ai
3732vec_or(vector signed char a, vector signed char b)
3733{
3734 return a | b;
3735}
3736
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003737static vector signed char __ATTRS_o_ai
3738vec_or(vector bool char a, vector signed char b)
3739{
3740 return (vector signed char)a | b;
3741}
3742
3743static vector signed char __ATTRS_o_ai
3744vec_or(vector signed char a, vector bool char b)
3745{
3746 return a | (vector signed char)b;
3747}
3748
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003749static vector unsigned char __ATTRS_o_ai
3750vec_or(vector unsigned char a, vector unsigned char b)
3751{
3752 return a | b;
3753}
3754
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003755static vector unsigned char __ATTRS_o_ai
3756vec_or(vector bool char a, vector unsigned char b)
3757{
3758 return (vector unsigned char)a | b;
3759}
3760
3761static vector unsigned char __ATTRS_o_ai
3762vec_or(vector unsigned char a, vector bool char b)
3763{
3764 return a | (vector unsigned char)b;
3765}
3766
3767static vector bool char __ATTRS_o_ai
3768vec_or(vector bool char a, vector bool char b)
3769{
3770 return a | b;
3771}
3772
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003773static vector short __ATTRS_o_ai
3774vec_or(vector short a, vector short b)
3775{
3776 return a | b;
3777}
3778
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003779static vector short __ATTRS_o_ai
3780vec_or(vector bool short a, vector short b)
3781{
3782 return (vector short)a | b;
3783}
3784
3785static vector short __ATTRS_o_ai
3786vec_or(vector short a, vector bool short b)
3787{
3788 return a | (vector short)b;
3789}
3790
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003791static vector unsigned short __ATTRS_o_ai
3792vec_or(vector unsigned short a, vector unsigned short b)
3793{
3794 return a | b;
3795}
3796
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003797static vector unsigned short __ATTRS_o_ai
3798vec_or(vector bool short a, vector unsigned short b)
3799{
3800 return (vector unsigned short)a | b;
3801}
3802
3803static vector unsigned short __ATTRS_o_ai
3804vec_or(vector unsigned short a, vector bool short b)
3805{
3806 return a | (vector unsigned short)b;
3807}
3808
3809static vector bool short __ATTRS_o_ai
3810vec_or(vector bool short a, vector bool short b)
3811{
3812 return a | b;
3813}
3814
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003815static vector int __ATTRS_o_ai
3816vec_or(vector int a, vector int b)
3817{
3818 return a | b;
3819}
3820
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003821static vector int __ATTRS_o_ai
3822vec_or(vector bool int a, vector int b)
3823{
3824 return (vector int)a | b;
3825}
3826
3827static vector int __ATTRS_o_ai
3828vec_or(vector int a, vector bool int b)
3829{
3830 return a | (vector int)b;
3831}
3832
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003833static vector unsigned int __ATTRS_o_ai
3834vec_or(vector unsigned int a, vector unsigned int b)
3835{
3836 return a | b;
3837}
3838
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003839static vector unsigned int __ATTRS_o_ai
3840vec_or(vector bool int a, vector unsigned int b)
3841{
3842 return (vector unsigned int)a | b;
3843}
3844
3845static vector unsigned int __ATTRS_o_ai
3846vec_or(vector unsigned int a, vector bool int b)
3847{
3848 return a | (vector unsigned int)b;
3849}
3850
3851static vector bool int __ATTRS_o_ai
3852vec_or(vector bool int a, vector bool int b)
3853{
3854 return a | b;
3855}
3856
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003857static vector float __ATTRS_o_ai
3858vec_or(vector float a, vector float b)
3859{
3860 vector unsigned int res = (vector unsigned int)a | (vector unsigned int)b;
3861 return (vector float)res;
3862}
3863
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003864static vector float __ATTRS_o_ai
3865vec_or(vector bool int a, vector float b)
3866{
3867 vector unsigned int res = (vector unsigned int)a | (vector unsigned int)b;
3868 return (vector float)res;
3869}
3870
3871static vector float __ATTRS_o_ai
3872vec_or(vector float a, vector bool int b)
3873{
3874 vector unsigned int res = (vector unsigned int)a | (vector unsigned int)b;
3875 return (vector float)res;
3876}
3877
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003878/* vec_vor */
3879
3880static vector signed char __ATTRS_o_ai
3881vec_vor(vector signed char a, vector signed char b)
3882{
3883 return a | b;
3884}
3885
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003886static vector signed char __ATTRS_o_ai
3887vec_vor(vector bool char a, vector signed char b)
3888{
3889 return (vector signed char)a | b;
3890}
3891
3892static vector signed char __ATTRS_o_ai
3893vec_vor(vector signed char a, vector bool char b)
3894{
3895 return a | (vector signed char)b;
3896}
3897
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003898static vector unsigned char __ATTRS_o_ai
3899vec_vor(vector unsigned char a, vector unsigned char b)
3900{
3901 return a | b;
3902}
3903
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003904static vector unsigned char __ATTRS_o_ai
3905vec_vor(vector bool char a, vector unsigned char b)
3906{
3907 return (vector unsigned char)a | b;
3908}
3909
3910static vector unsigned char __ATTRS_o_ai
3911vec_vor(vector unsigned char a, vector bool char b)
3912{
3913 return a | (vector unsigned char)b;
3914}
3915
3916static vector bool char __ATTRS_o_ai
3917vec_vor(vector bool char a, vector bool char b)
3918{
3919 return a | b;
3920}
3921
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003922static vector short __ATTRS_o_ai
3923vec_vor(vector short a, vector short b)
3924{
3925 return a | b;
3926}
3927
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003928static vector short __ATTRS_o_ai
3929vec_vor(vector bool short a, vector short b)
3930{
3931 return (vector short)a | b;
3932}
3933
3934static vector short __ATTRS_o_ai
3935vec_vor(vector short a, vector bool short b)
3936{
3937 return a | (vector short)b;
3938}
3939
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003940static vector unsigned short __ATTRS_o_ai
3941vec_vor(vector unsigned short a, vector unsigned short b)
3942{
3943 return a | b;
3944}
3945
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003946static vector unsigned short __ATTRS_o_ai
3947vec_vor(vector bool short a, vector unsigned short b)
3948{
3949 return (vector unsigned short)a | b;
3950}
3951
3952static vector unsigned short __ATTRS_o_ai
3953vec_vor(vector unsigned short a, vector bool short b)
3954{
3955 return a | (vector unsigned short)b;
3956}
3957
3958static vector bool short __ATTRS_o_ai
3959vec_vor(vector bool short a, vector bool short b)
3960{
3961 return a | b;
3962}
3963
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003964static vector int __ATTRS_o_ai
3965vec_vor(vector int a, vector int b)
3966{
3967 return a | b;
3968}
3969
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003970static vector int __ATTRS_o_ai
3971vec_vor(vector bool int a, vector int b)
3972{
3973 return (vector int)a | b;
3974}
3975
3976static vector int __ATTRS_o_ai
3977vec_vor(vector int a, vector bool int b)
3978{
3979 return a | (vector int)b;
3980}
3981
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00003982static vector unsigned int __ATTRS_o_ai
3983vec_vor(vector unsigned int a, vector unsigned int b)
3984{
3985 return a | b;
3986}
3987
Anton Yartseva2fc0f52010-08-19 03:21:36 +00003988static vector unsigned int __ATTRS_o_ai
3989vec_vor(vector bool int a, vector unsigned int b)
3990{
3991 return (vector unsigned int)a | b;
3992}
3993
3994static vector unsigned int __ATTRS_o_ai
3995vec_vor(vector unsigned int a, vector bool int b)
3996{
3997 return a | (vector unsigned int)b;
3998}
3999
4000static vector bool int __ATTRS_o_ai
4001vec_vor(vector bool int a, vector bool int b)
4002{
4003 return a | b;
4004}
4005
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004006static vector float __ATTRS_o_ai
4007vec_vor(vector float a, vector float b)
4008{
4009 vector unsigned int res = (vector unsigned int)a | (vector unsigned int)b;
4010 return (vector float)res;
4011}
4012
Anton Yartseva2fc0f52010-08-19 03:21:36 +00004013static vector float __ATTRS_o_ai
4014vec_vor(vector bool int a, vector float b)
4015{
4016 vector unsigned int res = (vector unsigned int)a | (vector unsigned int)b;
4017 return (vector float)res;
4018}
4019
4020static vector float __ATTRS_o_ai
4021vec_vor(vector float a, vector bool int b)
4022{
4023 vector unsigned int res = (vector unsigned int)a | (vector unsigned int)b;
4024 return (vector float)res;
4025}
4026
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004027/* vec_pack */
4028
4029static vector signed char __ATTRS_o_ai
4030vec_pack(vector signed short a, vector signed short b)
4031{
4032 return (vector signed char)vec_perm(a, b, (vector unsigned char)
4033 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4034 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
4035}
4036
4037static vector unsigned char __ATTRS_o_ai
4038vec_pack(vector unsigned short a, vector unsigned short b)
4039{
4040 return (vector unsigned char)vec_perm(a, b, (vector unsigned char)
4041 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4042 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
4043}
4044
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004045static vector bool char __ATTRS_o_ai
4046vec_pack(vector bool short a, vector bool short b)
4047{
4048 return (vector bool char)vec_perm(a, b, (vector unsigned char)
4049 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4050 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
4051}
4052
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004053static vector short __ATTRS_o_ai
4054vec_pack(vector int a, vector int b)
4055{
4056 return (vector short)vec_perm(a, b, (vector unsigned char)
4057 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4058 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
4059}
4060
4061static vector unsigned short __ATTRS_o_ai
4062vec_pack(vector unsigned int a, vector unsigned int b)
4063{
4064 return (vector unsigned short)vec_perm(a, b, (vector unsigned char)
4065 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4066 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
4067}
4068
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004069static vector bool short __ATTRS_o_ai
4070vec_pack(vector bool int a, vector bool int b)
4071{
4072 return (vector bool short)vec_perm(a, b, (vector unsigned char)
4073 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4074 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
4075}
4076
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004077/* vec_vpkuhum */
4078
4079#define __builtin_altivec_vpkuhum vec_vpkuhum
4080
4081static vector signed char __ATTRS_o_ai
4082vec_vpkuhum(vector signed short a, vector signed short b)
4083{
4084 return (vector signed char)vec_perm(a, b, (vector unsigned char)
4085 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4086 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
4087}
4088
4089static vector unsigned char __ATTRS_o_ai
4090vec_vpkuhum(vector unsigned short a, vector unsigned short b)
4091{
4092 return (vector unsigned char)vec_perm(a, b, (vector unsigned char)
4093 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4094 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
4095}
4096
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004097static vector bool char __ATTRS_o_ai
4098vec_vpkuhum(vector bool short a, vector bool short b)
4099{
4100 return (vector bool char)vec_perm(a, b, (vector unsigned char)
4101 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4102 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
4103}
4104
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004105/* vec_vpkuwum */
4106
4107#define __builtin_altivec_vpkuwum vec_vpkuwum
4108
4109static vector short __ATTRS_o_ai
4110vec_vpkuwum(vector int a, vector int b)
4111{
4112 return (vector short)vec_perm(a, b, (vector unsigned char)
4113 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4114 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
4115}
4116
4117static vector unsigned short __ATTRS_o_ai
4118vec_vpkuwum(vector unsigned int a, vector unsigned int b)
4119{
4120 return (vector unsigned short)vec_perm(a, b, (vector unsigned char)
4121 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4122 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
4123}
4124
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004125static vector bool short __ATTRS_o_ai
4126vec_vpkuwum(vector bool int a, vector bool int b)
4127{
4128 return (vector bool short)vec_perm(a, b, (vector unsigned char)
4129 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4130 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
4131}
4132
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004133/* vec_packpx */
4134
4135static vector pixel __attribute__((__always_inline__))
4136vec_packpx(vector unsigned int a, vector unsigned int b)
4137{
4138 return (vector pixel)__builtin_altivec_vpkpx(a, b);
4139}
4140
4141/* vec_vpkpx */
4142
4143static vector pixel __attribute__((__always_inline__))
4144vec_vpkpx(vector unsigned int a, vector unsigned int b)
4145{
4146 return (vector pixel)__builtin_altivec_vpkpx(a, b);
4147}
4148
4149/* vec_packs */
4150
4151static vector signed char __ATTRS_o_ai
4152vec_packs(vector short a, vector short b)
4153{
4154 return __builtin_altivec_vpkshss(a, b);
4155}
4156
4157static vector unsigned char __ATTRS_o_ai
4158vec_packs(vector unsigned short a, vector unsigned short b)
4159{
4160 return __builtin_altivec_vpkuhus(a, b);
4161}
4162
4163static vector signed short __ATTRS_o_ai
4164vec_packs(vector int a, vector int b)
4165{
4166 return __builtin_altivec_vpkswss(a, b);
4167}
4168
4169static vector unsigned short __ATTRS_o_ai
4170vec_packs(vector unsigned int a, vector unsigned int b)
4171{
4172 return __builtin_altivec_vpkuwus(a, b);
4173}
4174
4175/* vec_vpkshss */
4176
4177static vector signed char __attribute__((__always_inline__))
4178vec_vpkshss(vector short a, vector short b)
4179{
4180 return __builtin_altivec_vpkshss(a, b);
4181}
4182
4183/* vec_vpkuhus */
4184
4185static vector unsigned char __attribute__((__always_inline__))
4186vec_vpkuhus(vector unsigned short a, vector unsigned short b)
4187{
4188 return __builtin_altivec_vpkuhus(a, b);
4189}
4190
4191/* vec_vpkswss */
4192
4193static vector signed short __attribute__((__always_inline__))
4194vec_vpkswss(vector int a, vector int b)
4195{
4196 return __builtin_altivec_vpkswss(a, b);
4197}
4198
4199/* vec_vpkuwus */
4200
4201static vector unsigned short __attribute__((__always_inline__))
4202vec_vpkuwus(vector unsigned int a, vector unsigned int b)
4203{
4204 return __builtin_altivec_vpkuwus(a, b);
4205}
4206
4207/* vec_packsu */
4208
4209static vector unsigned char __ATTRS_o_ai
4210vec_packsu(vector short a, vector short b)
4211{
4212 return __builtin_altivec_vpkshus(a, b);
4213}
4214
4215static vector unsigned char __ATTRS_o_ai
4216vec_packsu(vector unsigned short a, vector unsigned short b)
4217{
4218 return __builtin_altivec_vpkuhus(a, b);
4219}
4220
4221static vector unsigned short __ATTRS_o_ai
4222vec_packsu(vector int a, vector int b)
4223{
4224 return __builtin_altivec_vpkswus(a, b);
4225}
4226
4227static vector unsigned short __ATTRS_o_ai
4228vec_packsu(vector unsigned int a, vector unsigned int b)
4229{
4230 return __builtin_altivec_vpkuwus(a, b);
4231}
4232
4233/* vec_vpkshus */
4234
4235static vector unsigned char __ATTRS_o_ai
4236vec_vpkshus(vector short a, vector short b)
4237{
4238 return __builtin_altivec_vpkshus(a, b);
4239}
4240
4241static vector unsigned char __ATTRS_o_ai
4242vec_vpkshus(vector unsigned short a, vector unsigned short b)
4243{
4244 return __builtin_altivec_vpkuhus(a, b);
4245}
4246
4247/* vec_vpkswus */
4248
4249static vector unsigned short __ATTRS_o_ai
4250vec_vpkswus(vector int a, vector int b)
4251{
4252 return __builtin_altivec_vpkswus(a, b);
4253}
4254
4255static vector unsigned short __ATTRS_o_ai
4256vec_vpkswus(vector unsigned int a, vector unsigned int b)
4257{
4258 return __builtin_altivec_vpkuwus(a, b);
4259}
4260
4261/* vec_perm */
4262
4263vector signed char __ATTRS_o_ai
4264vec_perm(vector signed char a, vector signed char b, vector unsigned char c)
4265{
4266 return (vector signed char)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
4267}
4268
4269vector unsigned char __ATTRS_o_ai
4270vec_perm(vector unsigned char a, vector unsigned char b, vector unsigned char c)
4271{
4272 return (vector unsigned char)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
4273}
4274
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004275vector bool char __ATTRS_o_ai
4276vec_perm(vector bool char a, vector bool char b, vector unsigned char c)
4277{
4278 return (vector bool char)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
4279}
4280
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004281vector short __ATTRS_o_ai
4282vec_perm(vector short a, vector short b, vector unsigned char c)
4283{
4284 return (vector short)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
4285}
4286
4287vector unsigned short __ATTRS_o_ai
4288vec_perm(vector unsigned short a, vector unsigned short b, vector unsigned char c)
4289{
4290 return (vector unsigned short)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
4291}
4292
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004293vector bool short __ATTRS_o_ai
4294vec_perm(vector bool short a, vector bool short b, vector unsigned char c)
4295{
4296 return (vector bool short)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
4297}
4298
4299vector pixel __ATTRS_o_ai
4300vec_perm(vector pixel a, vector pixel b, vector unsigned char c)
4301{
4302 return (vector pixel)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
4303}
4304
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004305vector int __ATTRS_o_ai
4306vec_perm(vector int a, vector int b, vector unsigned char c)
4307{
4308 return (vector int)__builtin_altivec_vperm_4si(a, b, c);
4309}
4310
4311vector unsigned int __ATTRS_o_ai
4312vec_perm(vector unsigned int a, vector unsigned int b, vector unsigned char c)
4313{
4314 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
4315}
4316
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004317vector bool int __ATTRS_o_ai
4318vec_perm(vector bool int a, vector bool int b, vector unsigned char c)
4319{
4320 return (vector bool int)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
4321}
4322
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004323vector float __ATTRS_o_ai
4324vec_perm(vector float a, vector float b, vector unsigned char c)
4325{
4326 return (vector float)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
4327}
4328
4329/* vec_vperm */
4330
4331vector signed char __ATTRS_o_ai
4332vec_vperm(vector signed char a, vector signed char b, vector unsigned char c)
4333{
4334 return (vector signed char)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
4335}
4336
4337vector unsigned char __ATTRS_o_ai
4338vec_vperm(vector unsigned char a, vector unsigned char b, vector unsigned char c)
4339{
4340 return (vector unsigned char)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
4341}
4342
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004343vector bool char __ATTRS_o_ai
4344vec_vperm(vector bool char a, vector bool char b, vector unsigned char c)
4345{
4346 return (vector bool char)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
4347}
4348
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004349vector short __ATTRS_o_ai
4350vec_vperm(vector short a, vector short b, vector unsigned char c)
4351{
4352 return (vector short)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
4353}
4354
4355vector unsigned short __ATTRS_o_ai
4356vec_vperm(vector unsigned short a, vector unsigned short b, vector unsigned char c)
4357{
4358 return (vector unsigned short)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
4359}
4360
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004361vector bool short __ATTRS_o_ai
4362vec_vperm(vector bool short a, vector bool short b, vector unsigned char c)
4363{
4364 return (vector bool short)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
4365}
4366
4367vector pixel __ATTRS_o_ai
4368vec_vperm(vector pixel a, vector pixel b, vector unsigned char c)
4369{
4370 return (vector pixel)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
4371}
4372
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004373vector int __ATTRS_o_ai
4374vec_vperm(vector int a, vector int b, vector unsigned char c)
4375{
4376 return (vector int)__builtin_altivec_vperm_4si(a, b, c);
4377}
4378
4379vector unsigned int __ATTRS_o_ai
4380vec_vperm(vector unsigned int a, vector unsigned int b, vector unsigned char c)
4381{
4382 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
4383}
4384
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004385vector bool int __ATTRS_o_ai
4386vec_vperm(vector bool int a, vector bool int b, vector unsigned char c)
4387{
4388 return (vector bool int)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
4389}
4390
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004391vector float __ATTRS_o_ai
4392vec_vperm(vector float a, vector float b, vector unsigned char c)
4393{
4394 return (vector float)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
4395}
4396
4397/* vec_re */
4398
4399vector float __attribute__((__always_inline__))
4400vec_re(vector float a)
4401{
4402 return __builtin_altivec_vrefp(a);
4403}
4404
4405/* vec_vrefp */
4406
4407vector float __attribute__((__always_inline__))
4408vec_vrefp(vector float a)
4409{
4410 return __builtin_altivec_vrefp(a);
4411}
4412
4413/* vec_rl */
4414
4415static vector signed char __ATTRS_o_ai
4416vec_rl(vector signed char a, vector unsigned char b)
4417{
4418 return (vector signed char)__builtin_altivec_vrlb((vector char)a, b);
4419}
4420
4421static vector unsigned char __ATTRS_o_ai
4422vec_rl(vector unsigned char a, vector unsigned char b)
4423{
4424 return (vector unsigned char)__builtin_altivec_vrlb((vector char)a, b);
4425}
4426
4427static vector short __ATTRS_o_ai
4428vec_rl(vector short a, vector unsigned short b)
4429{
4430 return __builtin_altivec_vrlh(a, b);
4431}
4432
4433static vector unsigned short __ATTRS_o_ai
4434vec_rl(vector unsigned short a, vector unsigned short b)
4435{
4436 return (vector unsigned short)__builtin_altivec_vrlh((vector short)a, b);
4437}
4438
4439static vector int __ATTRS_o_ai
4440vec_rl(vector int a, vector unsigned int b)
4441{
4442 return __builtin_altivec_vrlw(a, b);
4443}
4444
4445static vector unsigned int __ATTRS_o_ai
4446vec_rl(vector unsigned int a, vector unsigned int b)
4447{
4448 return (vector unsigned int)__builtin_altivec_vrlw((vector int)a, b);
4449}
4450
4451/* vec_vrlb */
4452
4453static vector signed char __ATTRS_o_ai
4454vec_vrlb(vector signed char a, vector unsigned char b)
4455{
4456 return (vector signed char)__builtin_altivec_vrlb((vector char)a, b);
4457}
4458
4459static vector unsigned char __ATTRS_o_ai
4460vec_vrlb(vector unsigned char a, vector unsigned char b)
4461{
4462 return (vector unsigned char)__builtin_altivec_vrlb((vector char)a, b);
4463}
4464
4465/* vec_vrlh */
4466
4467static vector short __ATTRS_o_ai
4468vec_vrlh(vector short a, vector unsigned short b)
4469{
4470 return __builtin_altivec_vrlh(a, b);
4471}
4472
4473static vector unsigned short __ATTRS_o_ai
4474vec_vrlh(vector unsigned short a, vector unsigned short b)
4475{
4476 return (vector unsigned short)__builtin_altivec_vrlh((vector short)a, b);
4477}
4478
4479/* vec_vrlw */
4480
4481static vector int __ATTRS_o_ai
4482vec_vrlw(vector int a, vector unsigned int b)
4483{
4484 return __builtin_altivec_vrlw(a, b);
4485}
4486
4487static vector unsigned int __ATTRS_o_ai
4488vec_vrlw(vector unsigned int a, vector unsigned int b)
4489{
4490 return (vector unsigned int)__builtin_altivec_vrlw((vector int)a, b);
4491}
4492
4493/* vec_round */
4494
4495static vector float __attribute__((__always_inline__))
4496vec_round(vector float a)
4497{
4498 return __builtin_altivec_vrfin(a);
4499}
4500
4501/* vec_vrfin */
4502
4503static vector float __attribute__((__always_inline__))
4504vec_vrfin(vector float a)
4505{
4506 return __builtin_altivec_vrfin(a);
4507}
4508
4509/* vec_rsqrte */
4510
4511static __vector float __attribute__((__always_inline__))
4512vec_rsqrte(vector float a)
4513{
4514 return __builtin_altivec_vrsqrtefp(a);
4515}
4516
4517/* vec_vrsqrtefp */
4518
4519static __vector float __attribute__((__always_inline__))
4520vec_vrsqrtefp(vector float a)
4521{
4522 return __builtin_altivec_vrsqrtefp(a);
4523}
4524
4525/* vec_sel */
4526
4527#define __builtin_altivec_vsel_4si vec_sel
4528
4529static vector signed char __ATTRS_o_ai
4530vec_sel(vector signed char a, vector signed char b, vector unsigned char c)
4531{
4532 return (a & ~(vector signed char)c) | (b & (vector signed char)c);
4533}
4534
Anton Yartseva2fc0f52010-08-19 03:21:36 +00004535static vector signed char __ATTRS_o_ai
4536vec_sel(vector signed char a, vector signed char b, vector bool char c)
4537{
4538 return (a & ~(vector signed char)c) | (b & (vector signed char)c);
4539}
4540
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004541static vector unsigned char __ATTRS_o_ai
4542vec_sel(vector unsigned char a, vector unsigned char b, vector unsigned char c)
4543{
4544 return (a & ~c) | (b & c);
4545}
4546
Anton Yartseva2fc0f52010-08-19 03:21:36 +00004547static vector unsigned char __ATTRS_o_ai
4548vec_sel(vector unsigned char a, vector unsigned char b, vector bool char c)
4549{
4550 return (a & ~(vector unsigned char)c) | (b & (vector unsigned char)c);
4551}
4552
4553static vector bool char __ATTRS_o_ai
4554vec_sel(vector bool char a, vector bool char b, vector unsigned char c)
4555{
4556 return (a & ~(vector bool char)c) | (b & (vector bool char)c);
4557}
4558
4559static vector bool char __ATTRS_o_ai
4560vec_sel(vector bool char a, vector bool char b, vector bool char c)
4561{
4562 return (a & ~c) | (b & c);
4563}
4564
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004565static vector short __ATTRS_o_ai
4566vec_sel(vector short a, vector short b, vector unsigned short c)
4567{
4568 return (a & ~(vector short)c) | (b & (vector short)c);
4569}
4570
Anton Yartseva2fc0f52010-08-19 03:21:36 +00004571static vector short __ATTRS_o_ai
4572vec_sel(vector short a, vector short b, vector bool short c)
4573{
4574 return (a & ~(vector short)c) | (b & (vector short)c);
4575}
4576
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004577static vector unsigned short __ATTRS_o_ai
4578vec_sel(vector unsigned short a, vector unsigned short b, vector unsigned short c)
4579{
4580 return (a & ~c) | (b & c);
4581}
4582
Anton Yartseva2fc0f52010-08-19 03:21:36 +00004583static vector unsigned short __ATTRS_o_ai
4584vec_sel(vector unsigned short a, vector unsigned short b, vector bool short c)
4585{
4586 return (a & ~(vector unsigned short)c) | (b & (vector unsigned short)c);
4587}
4588
4589static vector bool short __ATTRS_o_ai
4590vec_sel(vector bool short a, vector bool short b, vector unsigned short c)
4591{
4592 return (a & ~(vector bool short)c) | (b & (vector bool short)c);
4593}
4594
4595static vector bool short __ATTRS_o_ai
4596vec_sel(vector bool short a, vector bool short b, vector bool short c)
4597{
4598 return (a & ~c) | (b & c);
4599}
4600
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004601static vector int __ATTRS_o_ai
4602vec_sel(vector int a, vector int b, vector unsigned int c)
4603{
4604 return (a & ~(vector int)c) | (b & (vector int)c);
4605}
4606
Anton Yartseva2fc0f52010-08-19 03:21:36 +00004607static vector int __ATTRS_o_ai
4608vec_sel(vector int a, vector int b, vector bool int c)
4609{
4610 return (a & ~(vector int)c) | (b & (vector int)c);
4611}
4612
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004613static vector unsigned int __ATTRS_o_ai
4614vec_sel(vector unsigned int a, vector unsigned int b, vector unsigned int c)
4615{
4616 return (a & ~c) | (b & c);
4617}
4618
Anton Yartseva2fc0f52010-08-19 03:21:36 +00004619static vector unsigned int __ATTRS_o_ai
4620vec_sel(vector unsigned int a, vector unsigned int b, vector bool int c)
4621{
4622 return (a & ~(vector unsigned int)c) | (b & (vector unsigned int)c);
4623}
4624
4625static vector bool int __ATTRS_o_ai
4626vec_sel(vector bool int a, vector bool int b, vector unsigned int c)
4627{
4628 return (a & ~(vector bool int)c) | (b & (vector bool int)c);
4629}
4630
4631static vector bool int __ATTRS_o_ai
4632vec_sel(vector bool int a, vector bool int b, vector bool int c)
4633{
4634 return (a & ~c) | (b & c);
4635}
4636
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004637static vector float __ATTRS_o_ai
4638vec_sel(vector float a, vector float b, vector unsigned int c)
4639{
4640 vector int res = ((vector int)a & ~(vector int)c) | ((vector int)b & (vector int)c);
4641 return (vector float)res;
4642}
4643
Anton Yartseva2fc0f52010-08-19 03:21:36 +00004644static vector float __ATTRS_o_ai
4645vec_sel(vector float a, vector float b, vector bool int c)
4646{
4647 vector int res = ((vector int)a & ~(vector int)c) | ((vector int)b & (vector int)c);
4648 return (vector float)res;
4649}
4650
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004651/* vec_vsel */
4652
4653static vector signed char __ATTRS_o_ai
4654vec_vsel(vector signed char a, vector signed char b, vector unsigned char c)
4655{
4656 return (a & ~(vector signed char)c) | (b & (vector signed char)c);
4657}
4658
Anton Yartseva2fc0f52010-08-19 03:21:36 +00004659static vector signed char __ATTRS_o_ai
4660vec_vsel(vector signed char a, vector signed char b, vector bool char c)
4661{
4662 return (a & ~(vector signed char)c) | (b & (vector signed char)c);
4663}
4664
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004665static vector unsigned char __ATTRS_o_ai
4666vec_vsel(vector unsigned char a, vector unsigned char b, vector unsigned char c)
4667{
4668 return (a & ~c) | (b & c);
4669}
4670
Anton Yartseva2fc0f52010-08-19 03:21:36 +00004671static vector unsigned char __ATTRS_o_ai
4672vec_vsel(vector unsigned char a, vector unsigned char b, vector bool char c)
4673{
4674 return (a & ~(vector unsigned char)c) | (b & (vector unsigned char)c);
4675}
4676
4677static vector bool char __ATTRS_o_ai
4678vec_vsel(vector bool char a, vector bool char b, vector unsigned char c)
4679{
4680 return (a & ~(vector bool char)c) | (b & (vector bool char)c);
4681}
4682
4683static vector bool char __ATTRS_o_ai
4684vec_vsel(vector bool char a, vector bool char b, vector bool char c)
4685{
4686 return (a & ~c) | (b & c);
4687}
4688
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004689static vector short __ATTRS_o_ai
4690vec_vsel(vector short a, vector short b, vector unsigned short c)
4691{
4692 return (a & ~(vector short)c) | (b & (vector short)c);
4693}
4694
Anton Yartseva2fc0f52010-08-19 03:21:36 +00004695static vector short __ATTRS_o_ai
4696vec_vsel(vector short a, vector short b, vector bool short c)
4697{
4698 return (a & ~(vector short)c) | (b & (vector short)c);
4699}
4700
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004701static vector unsigned short __ATTRS_o_ai
4702vec_vsel(vector unsigned short a, vector unsigned short b, vector unsigned short c)
4703{
4704 return (a & ~c) | (b & c);
4705}
4706
Anton Yartseva2fc0f52010-08-19 03:21:36 +00004707static vector unsigned short __ATTRS_o_ai
4708vec_vsel(vector unsigned short a, vector unsigned short b, vector bool short c)
4709{
4710 return (a & ~(vector unsigned short)c) | (b & (vector unsigned short)c);
4711}
4712
4713static vector bool short __ATTRS_o_ai
4714vec_vsel(vector bool short a, vector bool short b, vector unsigned short c)
4715{
4716 return (a & ~(vector bool short)c) | (b & (vector bool short)c);
4717}
4718
4719static vector bool short __ATTRS_o_ai
4720vec_vsel(vector bool short a, vector bool short b, vector bool short c)
4721{
4722 return (a & ~c) | (b & c);
4723}
4724
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004725static vector int __ATTRS_o_ai
4726vec_vsel(vector int a, vector int b, vector unsigned int c)
4727{
4728 return (a & ~(vector int)c) | (b & (vector int)c);
4729}
4730
Anton Yartseva2fc0f52010-08-19 03:21:36 +00004731static vector int __ATTRS_o_ai
4732vec_vsel(vector int a, vector int b, vector bool int c)
4733{
4734 return (a & ~(vector int)c) | (b & (vector int)c);
4735}
4736
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004737static vector unsigned int __ATTRS_o_ai
4738vec_vsel(vector unsigned int a, vector unsigned int b, vector unsigned int c)
4739{
4740 return (a & ~c) | (b & c);
4741}
4742
Anton Yartseva2fc0f52010-08-19 03:21:36 +00004743static vector unsigned int __ATTRS_o_ai
4744vec_vsel(vector unsigned int a, vector unsigned int b, vector bool int c)
4745{
4746 return (a & ~(vector unsigned int)c) | (b & (vector unsigned int)c);
4747}
4748
4749static vector bool int __ATTRS_o_ai
4750vec_vsel(vector bool int a, vector bool int b, vector unsigned int c)
4751{
4752 return (a & ~(vector bool int)c) | (b & (vector bool int)c);
4753}
4754
4755static vector bool int __ATTRS_o_ai
4756vec_vsel(vector bool int a, vector bool int b, vector bool int c)
4757{
4758 return (a & ~c) | (b & c);
4759}
4760
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004761static vector float __ATTRS_o_ai
4762vec_vsel(vector float a, vector float b, vector unsigned int c)
4763{
4764 vector int res = ((vector int)a & ~(vector int)c) | ((vector int)b & (vector int)c);
4765 return (vector float)res;
4766}
4767
Anton Yartseva2fc0f52010-08-19 03:21:36 +00004768static vector float __ATTRS_o_ai
4769vec_vsel(vector float a, vector float b, vector bool int c)
4770{
4771 vector int res = ((vector int)a & ~(vector int)c) | ((vector int)b & (vector int)c);
4772 return (vector float)res;
4773}
4774
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004775/* vec_sl */
4776
4777static vector signed char __ATTRS_o_ai
4778vec_sl(vector signed char a, vector unsigned char b)
4779{
4780 return a << (vector signed char)b;
4781}
4782
4783static vector unsigned char __ATTRS_o_ai
4784vec_sl(vector unsigned char a, vector unsigned char b)
4785{
4786 return a << b;
4787}
4788
4789static vector short __ATTRS_o_ai
4790vec_sl(vector short a, vector unsigned short b)
4791{
4792 return a << (vector short)b;
4793}
4794
4795static vector unsigned short __ATTRS_o_ai
4796vec_sl(vector unsigned short a, vector unsigned short b)
4797{
4798 return a << b;
4799}
4800
4801static vector int __ATTRS_o_ai
4802vec_sl(vector int a, vector unsigned int b)
4803{
4804 return a << (vector int)b;
4805}
4806
4807static vector unsigned int __ATTRS_o_ai
4808vec_sl(vector unsigned int a, vector unsigned int b)
4809{
4810 return a << b;
4811}
4812
4813/* vec_vslb */
4814
4815#define __builtin_altivec_vslb vec_vslb
4816
4817static vector signed char __ATTRS_o_ai
4818vec_vslb(vector signed char a, vector unsigned char b)
4819{
4820 return vec_sl(a, b);
4821}
4822
4823static vector unsigned char __ATTRS_o_ai
4824vec_vslb(vector unsigned char a, vector unsigned char b)
4825{
4826 return vec_sl(a, b);
4827}
4828
4829/* vec_vslh */
4830
4831#define __builtin_altivec_vslh vec_vslh
4832
4833static vector short __ATTRS_o_ai
4834vec_vslh(vector short a, vector unsigned short b)
4835{
4836 return vec_sl(a, b);
4837}
4838
4839static vector unsigned short __ATTRS_o_ai
4840vec_vslh(vector unsigned short a, vector unsigned short b)
4841{
4842 return vec_sl(a, b);
4843}
4844
4845/* vec_vslw */
4846
4847#define __builtin_altivec_vslw vec_vslw
4848
4849static vector int __ATTRS_o_ai
4850vec_vslw(vector int a, vector unsigned int b)
4851{
4852 return vec_sl(a, b);
4853}
4854
4855static vector unsigned int __ATTRS_o_ai
4856vec_vslw(vector unsigned int a, vector unsigned int b)
4857{
4858 return vec_sl(a, b);
4859}
4860
4861/* vec_sld */
4862
4863#define __builtin_altivec_vsldoi_4si vec_sld
4864
4865static vector signed char __ATTRS_o_ai
4866vec_sld(vector signed char a, vector signed char b, unsigned char c)
4867{
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004868 return vec_perm(a, b, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004869 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
4870 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
4871}
4872
4873static vector unsigned char __ATTRS_o_ai
4874vec_sld(vector unsigned char a, vector unsigned char b, unsigned char c)
4875{
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004876 return vec_perm(a, b, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004877 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
4878 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
4879}
4880
4881static vector short __ATTRS_o_ai
4882vec_sld(vector short a, vector short b, unsigned char c)
4883{
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004884 return vec_perm(a, b, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004885 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
4886 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
4887}
4888
4889static vector unsigned short __ATTRS_o_ai
4890vec_sld(vector unsigned short a, vector unsigned short b, unsigned char c)
4891{
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004892 return vec_perm(a, b, (vector unsigned char)
4893 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
4894 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
4895}
4896
4897static vector pixel __ATTRS_o_ai
4898vec_sld(vector pixel a, vector pixel b, unsigned char c)
4899{
4900 return vec_perm(a, b, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004901 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
4902 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
4903}
4904
4905static vector int __ATTRS_o_ai
4906vec_sld(vector int a, vector int b, unsigned char c)
4907{
4908 return vec_perm(a, b, (vector unsigned char)
4909 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
4910 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
4911}
4912
4913static vector unsigned int __ATTRS_o_ai
4914vec_sld(vector unsigned int a, vector unsigned int b, unsigned char c)
4915{
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004916 return vec_perm(a, b, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004917 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
4918 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
4919}
4920
4921static vector float __ATTRS_o_ai
4922vec_sld(vector float a, vector float b, unsigned char c)
4923{
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004924 return vec_perm(a, b, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004925 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
4926 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
4927}
4928
4929/* vec_vsldoi */
4930
4931static vector signed char __ATTRS_o_ai
4932vec_vsldoi(vector signed char a, vector signed char b, unsigned char c)
4933{
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004934 return vec_perm(a, b, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004935 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
4936 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
4937}
4938
4939static vector unsigned char __ATTRS_o_ai
4940vec_vsldoi(vector unsigned char a, vector unsigned char b, unsigned char c)
4941{
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004942 return vec_perm(a, b, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004943 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
4944 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
4945}
4946
4947static vector short __ATTRS_o_ai
4948vec_vsldoi(vector short a, vector short b, unsigned char c)
4949{
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004950 return vec_perm(a, b, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004951 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
4952 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
4953}
4954
4955static vector unsigned short __ATTRS_o_ai
4956vec_vsldoi(vector unsigned short a, vector unsigned short b, unsigned char c)
4957{
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004958 return vec_perm(a, b, (vector unsigned char)
4959 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
4960 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
4961}
4962
4963static vector pixel __ATTRS_o_ai
4964vec_vsldoi(vector pixel a, vector pixel b, unsigned char c)
4965{
4966 return vec_perm(a, b, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004967 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
4968 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
4969}
4970
4971static vector int __ATTRS_o_ai
4972vec_vsldoi(vector int a, vector int b, unsigned char c)
4973{
4974 return vec_perm(a, b, (vector unsigned char)
4975 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
4976 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
4977}
4978
4979static vector unsigned int __ATTRS_o_ai
4980vec_vsldoi(vector unsigned int a, vector unsigned int b, unsigned char c)
4981{
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004982 return vec_perm(a, b, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004983 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
4984 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
4985}
4986
4987static vector float __ATTRS_o_ai
4988vec_vsldoi(vector float a, vector float b, unsigned char c)
4989{
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00004990 return vec_perm(a, b, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00004991 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
4992 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
4993}
4994
4995/* vec_sll */
4996
4997static vector signed char __ATTRS_o_ai
4998vec_sll(vector signed char a, vector unsigned char b)
4999{
5000 return (vector signed char)__builtin_altivec_vsl((vector int)a, (vector int)b);
5001}
5002
5003static vector signed char __ATTRS_o_ai
5004vec_sll(vector signed char a, vector unsigned short b)
5005{
5006 return (vector signed char)__builtin_altivec_vsl((vector int)a, (vector int)b);
5007}
5008
5009static vector signed char __ATTRS_o_ai
5010vec_sll(vector signed char a, vector unsigned int b)
5011{
5012 return (vector signed char)__builtin_altivec_vsl((vector int)a, (vector int)b);
5013}
5014
5015static vector unsigned char __ATTRS_o_ai
5016vec_sll(vector unsigned char a, vector unsigned char b)
5017{
5018 return (vector unsigned char)__builtin_altivec_vsl((vector int)a, (vector int)b);
5019}
5020
5021static vector unsigned char __ATTRS_o_ai
5022vec_sll(vector unsigned char a, vector unsigned short b)
5023{
5024 return (vector unsigned char)__builtin_altivec_vsl((vector int)a, (vector int)b);
5025}
5026
5027static vector unsigned char __ATTRS_o_ai
5028vec_sll(vector unsigned char a, vector unsigned int b)
5029{
5030 return (vector unsigned char)__builtin_altivec_vsl((vector int)a, (vector int)b);
5031}
5032
Anton Yartseva2fc0f52010-08-19 03:21:36 +00005033static vector bool char __ATTRS_o_ai
5034vec_sll(vector bool char a, vector unsigned char b)
5035{
5036 return (vector bool char)__builtin_altivec_vsl((vector int)a, (vector int)b);
5037}
5038
5039static vector bool char __ATTRS_o_ai
5040vec_sll(vector bool char a, vector unsigned short b)
5041{
5042 return (vector bool char)__builtin_altivec_vsl((vector int)a, (vector int)b);
5043}
5044
5045static vector bool char __ATTRS_o_ai
5046vec_sll(vector bool char a, vector unsigned int b)
5047{
5048 return (vector bool char)__builtin_altivec_vsl((vector int)a, (vector int)b);
5049}
5050
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005051static vector short __ATTRS_o_ai
5052vec_sll(vector short a, vector unsigned char b)
5053{
5054 return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b);
5055}
5056
5057static vector short __ATTRS_o_ai
5058vec_sll(vector short a, vector unsigned short b)
5059{
5060 return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b);
5061}
5062
5063static vector short __ATTRS_o_ai
5064vec_sll(vector short a, vector unsigned int b)
5065{
5066 return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b);
5067}
5068
5069static vector unsigned short __ATTRS_o_ai
5070vec_sll(vector unsigned short a, vector unsigned char b)
5071{
5072 return (vector unsigned short)__builtin_altivec_vsl((vector int)a, (vector int)b);
5073}
5074
5075static vector unsigned short __ATTRS_o_ai
5076vec_sll(vector unsigned short a, vector unsigned short b)
5077{
5078 return (vector unsigned short)__builtin_altivec_vsl((vector int)a, (vector int)b);
5079}
5080
5081static vector unsigned short __ATTRS_o_ai
5082vec_sll(vector unsigned short a, vector unsigned int b)
5083{
5084 return (vector unsigned short)__builtin_altivec_vsl((vector int)a, (vector int)b);
5085}
5086
Anton Yartseva2fc0f52010-08-19 03:21:36 +00005087static vector bool short __ATTRS_o_ai
5088vec_sll(vector bool short a, vector unsigned char b)
5089{
5090 return (vector bool short)__builtin_altivec_vsl((vector int)a, (vector int)b);
5091}
5092
5093static vector bool short __ATTRS_o_ai
5094vec_sll(vector bool short a, vector unsigned short b)
5095{
5096 return (vector bool short)__builtin_altivec_vsl((vector int)a, (vector int)b);
5097}
5098
5099static vector bool short __ATTRS_o_ai
5100vec_sll(vector bool short a, vector unsigned int b)
5101{
5102 return (vector bool short)__builtin_altivec_vsl((vector int)a, (vector int)b);
5103}
5104
5105static vector pixel __ATTRS_o_ai
5106vec_sll(vector pixel a, vector unsigned char b)
5107{
5108 return (vector pixel)__builtin_altivec_vsl((vector int)a, (vector int)b);
5109}
5110
5111static vector pixel __ATTRS_o_ai
5112vec_sll(vector pixel a, vector unsigned short b)
5113{
5114 return (vector pixel)__builtin_altivec_vsl((vector int)a, (vector int)b);
5115}
5116
5117static vector pixel __ATTRS_o_ai
5118vec_sll(vector pixel a, vector unsigned int b)
5119{
5120 return (vector pixel)__builtin_altivec_vsl((vector int)a, (vector int)b);
5121}
5122
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005123static vector int __ATTRS_o_ai
5124vec_sll(vector int a, vector unsigned char b)
5125{
5126 return (vector int)__builtin_altivec_vsl(a, (vector int)b);
5127}
5128
5129static vector int __ATTRS_o_ai
5130vec_sll(vector int a, vector unsigned short b)
5131{
5132 return (vector int)__builtin_altivec_vsl(a, (vector int)b);
5133}
5134
5135static vector int __ATTRS_o_ai
5136vec_sll(vector int a, vector unsigned int b)
5137{
5138 return (vector int)__builtin_altivec_vsl(a, (vector int)b);
5139}
5140
5141static vector unsigned int __ATTRS_o_ai
5142vec_sll(vector unsigned int a, vector unsigned char b)
5143{
5144 return (vector unsigned int)__builtin_altivec_vsl((vector int)a, (vector int)b);
5145}
5146
5147static vector unsigned int __ATTRS_o_ai
5148vec_sll(vector unsigned int a, vector unsigned short b)
5149{
5150 return (vector unsigned int)__builtin_altivec_vsl((vector int)a, (vector int)b);
5151}
5152
5153static vector unsigned int __ATTRS_o_ai
5154vec_sll(vector unsigned int a, vector unsigned int b)
5155{
5156 return (vector unsigned int)__builtin_altivec_vsl((vector int)a, (vector int)b);
5157}
5158
Anton Yartseva2fc0f52010-08-19 03:21:36 +00005159static vector bool int __ATTRS_o_ai
5160vec_sll(vector bool int a, vector unsigned char b)
5161{
5162 return (vector bool int)__builtin_altivec_vsl((vector int)a, (vector int)b);
5163}
5164
5165static vector bool int __ATTRS_o_ai
5166vec_sll(vector bool int a, vector unsigned short b)
5167{
5168 return (vector bool int)__builtin_altivec_vsl((vector int)a, (vector int)b);
5169}
5170
5171static vector bool int __ATTRS_o_ai
5172vec_sll(vector bool int a, vector unsigned int b)
5173{
5174 return (vector bool int)__builtin_altivec_vsl((vector int)a, (vector int)b);
5175}
5176
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005177/* vec_vsl */
5178
5179static vector signed char __ATTRS_o_ai
5180vec_vsl(vector signed char a, vector unsigned char b)
5181{
5182 return (vector signed char)__builtin_altivec_vsl((vector int)a, (vector int)b);
5183}
5184
5185static vector signed char __ATTRS_o_ai
5186vec_vsl(vector signed char a, vector unsigned short b)
5187{
5188 return (vector signed char)__builtin_altivec_vsl((vector int)a, (vector int)b);
5189}
5190
5191static vector signed char __ATTRS_o_ai
5192vec_vsl(vector signed char a, vector unsigned int b)
5193{
5194 return (vector signed char)__builtin_altivec_vsl((vector int)a, (vector int)b);
5195}
5196
5197static vector unsigned char __ATTRS_o_ai
5198vec_vsl(vector unsigned char a, vector unsigned char b)
5199{
5200 return (vector unsigned char)__builtin_altivec_vsl((vector int)a, (vector int)b);
5201}
5202
5203static vector unsigned char __ATTRS_o_ai
5204vec_vsl(vector unsigned char a, vector unsigned short b)
5205{
5206 return (vector unsigned char)__builtin_altivec_vsl((vector int)a, (vector int)b);
5207}
5208
5209static vector unsigned char __ATTRS_o_ai
5210vec_vsl(vector unsigned char a, vector unsigned int b)
5211{
5212 return (vector unsigned char)__builtin_altivec_vsl((vector int)a, (vector int)b);
5213}
5214
Anton Yartseva2fc0f52010-08-19 03:21:36 +00005215static vector bool char __ATTRS_o_ai
5216vec_vsl(vector bool char a, vector unsigned char b)
5217{
5218 return (vector bool char)__builtin_altivec_vsl((vector int)a, (vector int)b);
5219}
5220
5221static vector bool char __ATTRS_o_ai
5222vec_vsl(vector bool char a, vector unsigned short b)
5223{
5224 return (vector bool char)__builtin_altivec_vsl((vector int)a, (vector int)b);
5225}
5226
5227static vector bool char __ATTRS_o_ai
5228vec_vsl(vector bool char a, vector unsigned int b)
5229{
5230 return (vector bool char)__builtin_altivec_vsl((vector int)a, (vector int)b);
5231}
5232
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005233static vector short __ATTRS_o_ai
5234vec_vsl(vector short a, vector unsigned char b)
5235{
5236 return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b);
5237}
5238
5239static vector short __ATTRS_o_ai
5240vec_vsl(vector short a, vector unsigned short b)
5241{
5242 return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b);
5243}
5244
5245static vector short __ATTRS_o_ai
5246vec_vsl(vector short a, vector unsigned int b)
5247{
5248 return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b);
5249}
5250
5251static vector unsigned short __ATTRS_o_ai
5252vec_vsl(vector unsigned short a, vector unsigned char b)
5253{
5254 return (vector unsigned short)__builtin_altivec_vsl((vector int)a, (vector int)b);
5255}
5256
5257static vector unsigned short __ATTRS_o_ai
5258vec_vsl(vector unsigned short a, vector unsigned short b)
5259{
5260 return (vector unsigned short)__builtin_altivec_vsl((vector int)a, (vector int)b);
5261}
5262
5263static vector unsigned short __ATTRS_o_ai
5264vec_vsl(vector unsigned short a, vector unsigned int b)
5265{
5266 return (vector unsigned short)__builtin_altivec_vsl((vector int)a, (vector int)b);
5267}
5268
Anton Yartseva2fc0f52010-08-19 03:21:36 +00005269static vector bool short __ATTRS_o_ai
5270vec_vsl(vector bool short a, vector unsigned char b)
5271{
5272 return (vector bool short)__builtin_altivec_vsl((vector int)a, (vector int)b);
5273}
5274
5275static vector bool short __ATTRS_o_ai
5276vec_vsl(vector bool short a, vector unsigned short b)
5277{
5278 return (vector bool short)__builtin_altivec_vsl((vector int)a, (vector int)b);
5279}
5280
5281static vector bool short __ATTRS_o_ai
5282vec_vsl(vector bool short a, vector unsigned int b)
5283{
5284 return (vector bool short)__builtin_altivec_vsl((vector int)a, (vector int)b);
5285}
5286
5287static vector pixel __ATTRS_o_ai
5288vec_vsl(vector pixel a, vector unsigned char b)
5289{
5290 return (vector pixel)__builtin_altivec_vsl((vector int)a, (vector int)b);
5291}
5292
5293static vector pixel __ATTRS_o_ai
5294vec_vsl(vector pixel a, vector unsigned short b)
5295{
5296 return (vector pixel)__builtin_altivec_vsl((vector int)a, (vector int)b);
5297}
5298
5299static vector pixel __ATTRS_o_ai
5300vec_vsl(vector pixel a, vector unsigned int b)
5301{
5302 return (vector pixel)__builtin_altivec_vsl((vector int)a, (vector int)b);
5303}
5304
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005305static vector int __ATTRS_o_ai
5306vec_vsl(vector int a, vector unsigned char b)
5307{
5308 return (vector int)__builtin_altivec_vsl(a, (vector int)b);
5309}
5310
5311static vector int __ATTRS_o_ai
5312vec_vsl(vector int a, vector unsigned short b)
5313{
5314 return (vector int)__builtin_altivec_vsl(a, (vector int)b);
5315}
5316
5317static vector int __ATTRS_o_ai
5318vec_vsl(vector int a, vector unsigned int b)
5319{
5320 return (vector int)__builtin_altivec_vsl(a, (vector int)b);
5321}
5322
5323static vector unsigned int __ATTRS_o_ai
5324vec_vsl(vector unsigned int a, vector unsigned char b)
5325{
5326 return (vector unsigned int)__builtin_altivec_vsl((vector int)a, (vector int)b);
5327}
5328
5329static vector unsigned int __ATTRS_o_ai
5330vec_vsl(vector unsigned int a, vector unsigned short b)
5331{
5332 return (vector unsigned int)__builtin_altivec_vsl((vector int)a, (vector int)b);
5333}
5334
5335static vector unsigned int __ATTRS_o_ai
5336vec_vsl(vector unsigned int a, vector unsigned int b)
5337{
5338 return (vector unsigned int)__builtin_altivec_vsl((vector int)a, (vector int)b);
5339}
5340
Anton Yartseva2fc0f52010-08-19 03:21:36 +00005341static vector bool int __ATTRS_o_ai
5342vec_vsl(vector bool int a, vector unsigned char b)
5343{
5344 return (vector bool int)__builtin_altivec_vsl((vector int)a, (vector int)b);
5345}
5346
5347static vector bool int __ATTRS_o_ai
5348vec_vsl(vector bool int a, vector unsigned short b)
5349{
5350 return (vector bool int)__builtin_altivec_vsl((vector int)a, (vector int)b);
5351}
5352
5353static vector bool int __ATTRS_o_ai
5354vec_vsl(vector bool int a, vector unsigned int b)
5355{
5356 return (vector bool int)__builtin_altivec_vsl((vector int)a, (vector int)b);
5357}
5358
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005359/* vec_slo */
5360
5361static vector signed char __ATTRS_o_ai
5362vec_slo(vector signed char a, vector signed char b)
5363{
5364 return (vector signed char)__builtin_altivec_vslo((vector int)a, (vector int)b);
5365}
5366
5367static vector signed char __ATTRS_o_ai
5368vec_slo(vector signed char a, vector unsigned char b)
5369{
5370 return (vector signed char)__builtin_altivec_vslo((vector int)a, (vector int)b);
5371}
5372
5373static vector unsigned char __ATTRS_o_ai
5374vec_slo(vector unsigned char a, vector signed char b)
5375{
5376 return (vector unsigned char)__builtin_altivec_vslo((vector int)a, (vector int)b);
5377}
5378
5379static vector unsigned char __ATTRS_o_ai
5380vec_slo(vector unsigned char a, vector unsigned char b)
5381{
5382 return (vector unsigned char)__builtin_altivec_vslo((vector int)a, (vector int)b);
5383}
5384
5385static vector short __ATTRS_o_ai
5386vec_slo(vector short a, vector signed char b)
5387{
5388 return (vector short)__builtin_altivec_vslo((vector int)a, (vector int)b);
5389}
5390
5391static vector short __ATTRS_o_ai
5392vec_slo(vector short a, vector unsigned char b)
5393{
5394 return (vector short)__builtin_altivec_vslo((vector int)a, (vector int)b);
5395}
5396
5397static vector unsigned short __ATTRS_o_ai
5398vec_slo(vector unsigned short a, vector signed char b)
5399{
5400 return (vector unsigned short)__builtin_altivec_vslo((vector int)a, (vector int)b);
5401}
5402
5403static vector unsigned short __ATTRS_o_ai
5404vec_slo(vector unsigned short a, vector unsigned char b)
5405{
5406 return (vector unsigned short)__builtin_altivec_vslo((vector int)a, (vector int)b);
5407}
5408
Anton Yartseva2fc0f52010-08-19 03:21:36 +00005409static vector pixel __ATTRS_o_ai
5410vec_slo(vector pixel a, vector signed char b)
5411{
5412 return (vector pixel)__builtin_altivec_vslo((vector int)a, (vector int)b);
5413}
5414
5415static vector pixel __ATTRS_o_ai
5416vec_slo(vector pixel a, vector unsigned char b)
5417{
5418 return (vector pixel)__builtin_altivec_vslo((vector int)a, (vector int)b);
5419}
5420
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005421static vector int __ATTRS_o_ai
5422vec_slo(vector int a, vector signed char b)
5423{
5424 return (vector int)__builtin_altivec_vslo(a, (vector int)b);
5425}
5426
5427static vector int __ATTRS_o_ai
5428vec_slo(vector int a, vector unsigned char b)
5429{
5430 return (vector int)__builtin_altivec_vslo(a, (vector int)b);
5431}
5432
5433static vector unsigned int __ATTRS_o_ai
5434vec_slo(vector unsigned int a, vector signed char b)
5435{
5436 return (vector unsigned int)__builtin_altivec_vslo((vector int)a, (vector int)b);
5437}
5438
5439static vector unsigned int __ATTRS_o_ai
5440vec_slo(vector unsigned int a, vector unsigned char b)
5441{
5442 return (vector unsigned int)__builtin_altivec_vslo((vector int)a, (vector int)b);
5443}
5444
5445static vector float __ATTRS_o_ai
5446vec_slo(vector float a, vector signed char b)
5447{
5448 return (vector float)__builtin_altivec_vslo((vector int)a, (vector int)b);
5449}
5450
5451static vector float __ATTRS_o_ai
5452vec_slo(vector float a, vector unsigned char b)
5453{
5454 return (vector float)__builtin_altivec_vslo((vector int)a, (vector int)b);
5455}
5456
5457/* vec_vslo */
5458
5459static vector signed char __ATTRS_o_ai
5460vec_vslo(vector signed char a, vector signed char b)
5461{
5462 return (vector signed char)__builtin_altivec_vslo((vector int)a, (vector int)b);
5463}
5464
5465static vector signed char __ATTRS_o_ai
5466vec_vslo(vector signed char a, vector unsigned char b)
5467{
5468 return (vector signed char)__builtin_altivec_vslo((vector int)a, (vector int)b);
5469}
5470
5471static vector unsigned char __ATTRS_o_ai
5472vec_vslo(vector unsigned char a, vector signed char b)
5473{
5474 return (vector unsigned char)__builtin_altivec_vslo((vector int)a, (vector int)b);
5475}
5476
5477static vector unsigned char __ATTRS_o_ai
5478vec_vslo(vector unsigned char a, vector unsigned char b)
5479{
5480 return (vector unsigned char)__builtin_altivec_vslo((vector int)a, (vector int)b);
5481}
5482
5483static vector short __ATTRS_o_ai
5484vec_vslo(vector short a, vector signed char b)
5485{
5486 return (vector short)__builtin_altivec_vslo((vector int)a, (vector int)b);
5487}
5488
5489static vector short __ATTRS_o_ai
5490vec_vslo(vector short a, vector unsigned char b)
5491{
5492 return (vector short)__builtin_altivec_vslo((vector int)a, (vector int)b);
5493}
5494
5495static vector unsigned short __ATTRS_o_ai
5496vec_vslo(vector unsigned short a, vector signed char b)
5497{
5498 return (vector unsigned short)__builtin_altivec_vslo((vector int)a, (vector int)b);
5499}
5500
5501static vector unsigned short __ATTRS_o_ai
5502vec_vslo(vector unsigned short a, vector unsigned char b)
5503{
5504 return (vector unsigned short)__builtin_altivec_vslo((vector int)a, (vector int)b);
5505}
5506
Anton Yartseva2fc0f52010-08-19 03:21:36 +00005507static vector pixel __ATTRS_o_ai
5508vec_vslo(vector pixel a, vector signed char b)
5509{
5510 return (vector pixel)__builtin_altivec_vslo((vector int)a, (vector int)b);
5511}
5512
5513static vector pixel __ATTRS_o_ai
5514vec_vslo(vector pixel a, vector unsigned char b)
5515{
5516 return (vector pixel)__builtin_altivec_vslo((vector int)a, (vector int)b);
5517}
5518
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005519static vector int __ATTRS_o_ai
5520vec_vslo(vector int a, vector signed char b)
5521{
5522 return (vector int)__builtin_altivec_vslo(a, (vector int)b);
5523}
5524
5525static vector int __ATTRS_o_ai
5526vec_vslo(vector int a, vector unsigned char b)
5527{
5528 return (vector int)__builtin_altivec_vslo(a, (vector int)b);
5529}
5530
5531static vector unsigned int __ATTRS_o_ai
5532vec_vslo(vector unsigned int a, vector signed char b)
5533{
5534 return (vector unsigned int)__builtin_altivec_vslo((vector int)a, (vector int)b);
5535}
5536
5537static vector unsigned int __ATTRS_o_ai
5538vec_vslo(vector unsigned int a, vector unsigned char b)
5539{
5540 return (vector unsigned int)__builtin_altivec_vslo((vector int)a, (vector int)b);
5541}
5542
5543static vector float __ATTRS_o_ai
5544vec_vslo(vector float a, vector signed char b)
5545{
5546 return (vector float)__builtin_altivec_vslo((vector int)a, (vector int)b);
5547}
5548
5549static vector float __ATTRS_o_ai
5550vec_vslo(vector float a, vector unsigned char b)
5551{
5552 return (vector float)__builtin_altivec_vslo((vector int)a, (vector int)b);
5553}
5554
5555/* vec_splat */
5556
5557static vector signed char __ATTRS_o_ai
5558vec_splat(vector signed char a, unsigned char b)
5559{
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00005560 return vec_perm(a, a, (vector unsigned char)(b));
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005561}
5562
5563static vector unsigned char __ATTRS_o_ai
5564vec_splat(vector unsigned char a, unsigned char b)
5565{
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00005566 return vec_perm(a, a, (vector unsigned char)(b));
5567}
5568
5569static vector bool char __ATTRS_o_ai
5570vec_splat(vector bool char a, unsigned char b)
5571{
5572 return vec_perm(a, a, (vector unsigned char)(b));
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005573}
5574
5575static vector short __ATTRS_o_ai
5576vec_splat(vector short a, unsigned char b)
5577{
5578 b *= 2;
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00005579 return vec_perm(a, a, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005580 (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1));
5581}
5582
5583static vector unsigned short __ATTRS_o_ai
5584vec_splat(vector unsigned short a, unsigned char b)
5585{
5586 b *= 2;
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00005587 return vec_perm(a, a, (vector unsigned char)
5588 (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1));
5589}
5590
5591static vector bool short __ATTRS_o_ai
5592vec_splat(vector bool short a, unsigned char b)
5593{
5594 b *= 2;
5595 return vec_perm(a, a, (vector unsigned char)
5596 (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1));
5597}
5598
5599static vector pixel __ATTRS_o_ai
5600vec_splat(vector pixel a, unsigned char b)
5601{
5602 b *= 2;
5603 return vec_perm(a, a, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005604 (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1));
5605}
5606
5607static vector int __ATTRS_o_ai
5608vec_splat(vector int a, unsigned char b)
5609{
5610 b *= 4;
5611 return vec_perm(a, a, (vector unsigned char)
5612 (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));
5613}
5614
5615static vector unsigned int __ATTRS_o_ai
5616vec_splat(vector unsigned int a, unsigned char b)
5617{
5618 b *= 4;
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00005619 return vec_perm(a, a, (vector unsigned char)
5620 (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));
5621}
5622
5623static vector bool int __ATTRS_o_ai
5624vec_splat(vector bool int a, unsigned char b)
5625{
5626 b *= 4;
5627 return vec_perm(a, a, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005628 (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));
5629}
5630
5631static vector float __ATTRS_o_ai
5632vec_splat(vector float a, unsigned char b)
5633{
5634 b *= 4;
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00005635 return vec_perm(a, a, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005636 (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));
5637}
5638
5639/* vec_vspltb */
5640
5641#define __builtin_altivec_vspltb vec_vspltb
5642
5643static vector signed char __ATTRS_o_ai
5644vec_vspltb(vector signed char a, unsigned char b)
5645{
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00005646 return vec_perm(a, a, (vector unsigned char)(b));
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005647}
5648
5649static vector unsigned char __ATTRS_o_ai
5650vec_vspltb(vector unsigned char a, unsigned char b)
5651{
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00005652 return vec_perm(a, a, (vector unsigned char)(b));
5653}
5654
5655static vector bool char __ATTRS_o_ai
5656vec_vspltb(vector bool char a, unsigned char b)
5657{
5658 return vec_perm(a, a, (vector unsigned char)(b));
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005659}
5660
5661/* vec_vsplth */
5662
5663#define __builtin_altivec_vsplth vec_vsplth
5664
5665static vector short __ATTRS_o_ai
5666vec_vsplth(vector short a, unsigned char b)
5667{
5668 b *= 2;
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00005669 return vec_perm(a, a, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005670 (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1));
5671}
5672
5673static vector unsigned short __ATTRS_o_ai
5674vec_vsplth(vector unsigned short a, unsigned char b)
5675{
5676 b *= 2;
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00005677 return vec_perm(a, a, (vector unsigned char)
5678 (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1));
5679}
5680
5681static vector bool short __ATTRS_o_ai
5682vec_vsplth(vector bool short a, unsigned char b)
5683{
5684 b *= 2;
5685 return vec_perm(a, a, (vector unsigned char)
5686 (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1));
5687}
5688
5689static vector pixel __ATTRS_o_ai
5690vec_vsplth(vector pixel a, unsigned char b)
5691{
5692 b *= 2;
5693 return vec_perm(a, a, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005694 (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1));
5695}
5696
5697/* vec_vspltw */
5698
5699#define __builtin_altivec_vspltw vec_vspltw
5700
5701static vector int __ATTRS_o_ai
5702vec_vspltw(vector int a, unsigned char b)
5703{
5704 b *= 4;
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00005705 return vec_perm(a, a, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005706 (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));
5707}
5708
5709static vector unsigned int __ATTRS_o_ai
5710vec_vspltw(vector unsigned int a, unsigned char b)
5711{
5712 b *= 4;
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00005713 return vec_perm(a, a, (vector unsigned char)
5714 (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));
5715}
5716
5717static vector bool int __ATTRS_o_ai
5718vec_vspltw(vector bool int a, unsigned char b)
5719{
5720 b *= 4;
5721 return vec_perm(a, a, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005722 (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));
5723}
5724
5725static vector float __ATTRS_o_ai
5726vec_vspltw(vector float a, unsigned char b)
5727{
5728 b *= 4;
Anton Yartsevf54dbfd2010-08-19 03:00:09 +00005729 return vec_perm(a, a, (vector unsigned char)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005730 (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));
5731}
5732
5733/* vec_splat_s8 */
5734
5735#define __builtin_altivec_vspltisb vec_splat_s8
5736
5737// FIXME: parameter should be treated as 5-bit signed literal
5738static vector signed char __ATTRS_o_ai
5739vec_splat_s8(signed char a)
5740{
5741 return (vector signed char)(a);
5742}
5743
5744/* vec_vspltisb */
5745
5746// FIXME: parameter should be treated as 5-bit signed literal
5747static vector signed char __ATTRS_o_ai
5748vec_vspltisb(signed char a)
5749{
5750 return (vector signed char)(a);
5751}
5752
5753/* vec_splat_s16 */
5754
5755#define __builtin_altivec_vspltish vec_splat_s16
5756
5757// FIXME: parameter should be treated as 5-bit signed literal
5758static vector short __ATTRS_o_ai
5759vec_splat_s16(signed char a)
5760{
5761 return (vector short)(a);
5762}
5763
5764/* vec_vspltish */
5765
5766// FIXME: parameter should be treated as 5-bit signed literal
5767static vector short __ATTRS_o_ai
5768vec_vspltish(signed char a)
5769{
5770 return (vector short)(a);
5771}
5772
5773/* vec_splat_s32 */
5774
5775#define __builtin_altivec_vspltisw vec_splat_s32
5776
5777// FIXME: parameter should be treated as 5-bit signed literal
5778static vector int __ATTRS_o_ai
5779vec_splat_s32(signed char a)
5780{
5781 return (vector int)(a);
5782}
5783
5784/* vec_vspltisw */
5785
5786// FIXME: parameter should be treated as 5-bit signed literal
5787static vector int __ATTRS_o_ai
5788vec_vspltisw(signed char a)
5789{
5790 return (vector int)(a);
5791}
5792
5793/* vec_splat_u8 */
5794
5795// FIXME: parameter should be treated as 5-bit signed literal
5796static vector unsigned char __ATTRS_o_ai
5797vec_splat_u8(unsigned char a)
5798{
5799 return (vector unsigned char)(a);
5800}
5801
5802/* vec_splat_u16 */
5803
5804// FIXME: parameter should be treated as 5-bit signed literal
5805static vector unsigned short __ATTRS_o_ai
5806vec_splat_u16(signed char a)
5807{
5808 return (vector unsigned short)(a);
5809}
5810
5811/* vec_splat_u32 */
5812
5813// FIXME: parameter should be treated as 5-bit signed literal
5814static vector unsigned int __ATTRS_o_ai
5815vec_splat_u32(signed char a)
5816{
5817 return (vector unsigned int)(a);
5818}
5819
5820/* vec_sr */
5821
5822static vector signed char __ATTRS_o_ai
5823vec_sr(vector signed char a, vector unsigned char b)
5824{
5825 return a >> (vector signed char)b;
5826}
5827
5828static vector unsigned char __ATTRS_o_ai
5829vec_sr(vector unsigned char a, vector unsigned char b)
5830{
5831 return a >> b;
5832}
5833
5834static vector short __ATTRS_o_ai
5835vec_sr(vector short a, vector unsigned short b)
5836{
5837 return a >> (vector short)b;
5838}
5839
5840static vector unsigned short __ATTRS_o_ai
5841vec_sr(vector unsigned short a, vector unsigned short b)
5842{
5843 return a >> b;
5844}
5845
5846static vector int __ATTRS_o_ai
5847vec_sr(vector int a, vector unsigned int b)
5848{
5849 return a >> (vector int)b;
5850}
5851
5852static vector unsigned int __ATTRS_o_ai
5853vec_sr(vector unsigned int a, vector unsigned int b)
5854{
5855 return a >> b;
5856}
5857
5858/* vec_vsrb */
5859
5860#define __builtin_altivec_vsrb vec_vsrb
5861
5862static vector signed char __ATTRS_o_ai
5863vec_vsrb(vector signed char a, vector unsigned char b)
5864{
5865 return a >> (vector signed char)b;
5866}
5867
5868static vector unsigned char __ATTRS_o_ai
5869vec_vsrb(vector unsigned char a, vector unsigned char b)
5870{
5871 return a >> b;
5872}
5873
5874/* vec_vsrh */
5875
5876#define __builtin_altivec_vsrh vec_vsrh
5877
5878static vector short __ATTRS_o_ai
5879vec_vsrh(vector short a, vector unsigned short b)
5880{
5881 return a >> (vector short)b;
5882}
5883
5884static vector unsigned short __ATTRS_o_ai
5885vec_vsrh(vector unsigned short a, vector unsigned short b)
5886{
5887 return a >> b;
5888}
5889
5890/* vec_vsrw */
5891
5892#define __builtin_altivec_vsrw vec_vsrw
5893
5894static vector int __ATTRS_o_ai
5895vec_vsrw(vector int a, vector unsigned int b)
5896{
5897 return a >> (vector int)b;
5898}
5899
5900static vector unsigned int __ATTRS_o_ai
5901vec_vsrw(vector unsigned int a, vector unsigned int b)
5902{
5903 return a >> b;
5904}
5905
5906/* vec_sra */
5907
5908static vector signed char __ATTRS_o_ai
5909vec_sra(vector signed char a, vector unsigned char b)
5910{
5911 return (vector signed char)__builtin_altivec_vsrab((vector char)a, b);
5912}
5913
5914static vector unsigned char __ATTRS_o_ai
5915vec_sra(vector unsigned char a, vector unsigned char b)
5916{
5917 return (vector unsigned char)__builtin_altivec_vsrab((vector char)a, b);
5918}
5919
5920static vector short __ATTRS_o_ai
5921vec_sra(vector short a, vector unsigned short b)
5922{
5923 return __builtin_altivec_vsrah(a, (vector unsigned short)b);
5924}
5925
5926static vector unsigned short __ATTRS_o_ai
5927vec_sra(vector unsigned short a, vector unsigned short b)
5928{
5929 return (vector unsigned short)__builtin_altivec_vsrah((vector short)a, b);
5930}
5931
5932static vector int __ATTRS_o_ai
5933vec_sra(vector int a, vector unsigned int b)
5934{
5935 return __builtin_altivec_vsraw(a, b);
5936}
5937
5938static vector unsigned int __ATTRS_o_ai
5939vec_sra(vector unsigned int a, vector unsigned int b)
5940{
5941 return (vector unsigned int)__builtin_altivec_vsraw((vector int)a, b);
5942}
5943
5944/* vec_vsrab */
5945
5946static vector signed char __ATTRS_o_ai
5947vec_vsrab(vector signed char a, vector unsigned char b)
5948{
5949 return (vector signed char)__builtin_altivec_vsrab((vector char)a, b);
5950}
5951
5952static vector unsigned char __ATTRS_o_ai
5953vec_vsrab(vector unsigned char a, vector unsigned char b)
5954{
5955 return (vector unsigned char)__builtin_altivec_vsrab((vector char)a, b);
5956}
5957
5958/* vec_vsrah */
5959
5960static vector short __ATTRS_o_ai
5961vec_vsrah(vector short a, vector unsigned short b)
5962{
5963 return __builtin_altivec_vsrah(a, (vector unsigned short)b);
5964}
5965
5966static vector unsigned short __ATTRS_o_ai
5967vec_vsrah(vector unsigned short a, vector unsigned short b)
5968{
5969 return (vector unsigned short)__builtin_altivec_vsrah((vector short)a, b);
5970}
5971
5972/* vec_vsraw */
5973
5974static vector int __ATTRS_o_ai
5975vec_vsraw(vector int a, vector unsigned int b)
5976{
5977 return __builtin_altivec_vsraw(a, b);
5978}
5979
5980static vector unsigned int __ATTRS_o_ai
5981vec_vsraw(vector unsigned int a, vector unsigned int b)
5982{
5983 return (vector unsigned int)__builtin_altivec_vsraw((vector int)a, b);
5984}
5985
5986/* vec_srl */
5987
5988static vector signed char __ATTRS_o_ai
5989vec_srl(vector signed char a, vector unsigned char b)
5990{
5991 return (vector signed char)__builtin_altivec_vsr((vector int)a, (vector int)b);
5992}
5993
5994static vector signed char __ATTRS_o_ai
5995vec_srl(vector signed char a, vector unsigned short b)
5996{
5997 return (vector signed char)__builtin_altivec_vsr((vector int)a, (vector int)b);
5998}
5999
6000static vector signed char __ATTRS_o_ai
6001vec_srl(vector signed char a, vector unsigned int b)
6002{
6003 return (vector signed char)__builtin_altivec_vsr((vector int)a, (vector int)b);
6004}
6005
6006static vector unsigned char __ATTRS_o_ai
6007vec_srl(vector unsigned char a, vector unsigned char b)
6008{
6009 return (vector unsigned char)__builtin_altivec_vsr((vector int)a, (vector int)b);
6010}
6011
6012static vector unsigned char __ATTRS_o_ai
6013vec_srl(vector unsigned char a, vector unsigned short b)
6014{
6015 return (vector unsigned char)__builtin_altivec_vsr((vector int)a, (vector int)b);
6016}
6017
6018static vector unsigned char __ATTRS_o_ai
6019vec_srl(vector unsigned char a, vector unsigned int b)
6020{
6021 return (vector unsigned char)__builtin_altivec_vsr((vector int)a, (vector int)b);
6022}
6023
Anton Yartseva2fc0f52010-08-19 03:21:36 +00006024static vector bool char __ATTRS_o_ai
6025vec_srl(vector bool char a, vector unsigned char b)
6026{
6027 return (vector bool char)__builtin_altivec_vsr((vector int)a, (vector int)b);
6028}
6029
6030static vector bool char __ATTRS_o_ai
6031vec_srl(vector bool char a, vector unsigned short b)
6032{
6033 return (vector bool char)__builtin_altivec_vsr((vector int)a, (vector int)b);
6034}
6035
6036static vector bool char __ATTRS_o_ai
6037vec_srl(vector bool char a, vector unsigned int b)
6038{
6039 return (vector bool char)__builtin_altivec_vsr((vector int)a, (vector int)b);
6040}
6041
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006042static vector short __ATTRS_o_ai
6043vec_srl(vector short a, vector unsigned char b)
6044{
6045 return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b);
6046}
6047
6048static vector short __ATTRS_o_ai
6049vec_srl(vector short a, vector unsigned short b)
6050{
6051 return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b);
6052}
6053
6054static vector short __ATTRS_o_ai
6055vec_srl(vector short a, vector unsigned int b)
6056{
6057 return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b);
6058}
6059
6060static vector unsigned short __ATTRS_o_ai
6061vec_srl(vector unsigned short a, vector unsigned char b)
6062{
6063 return (vector unsigned short)__builtin_altivec_vsr((vector int)a, (vector int)b);
6064}
6065
6066static vector unsigned short __ATTRS_o_ai
6067vec_srl(vector unsigned short a, vector unsigned short b)
6068{
6069 return (vector unsigned short)__builtin_altivec_vsr((vector int)a, (vector int)b);
6070}
6071
6072static vector unsigned short __ATTRS_o_ai
6073vec_srl(vector unsigned short a, vector unsigned int b)
6074{
6075 return (vector unsigned short)__builtin_altivec_vsr((vector int)a, (vector int)b);
6076}
6077
Anton Yartseva2fc0f52010-08-19 03:21:36 +00006078static vector bool short __ATTRS_o_ai
6079vec_srl(vector bool short a, vector unsigned char b)
6080{
6081 return (vector bool short)__builtin_altivec_vsr((vector int)a, (vector int)b);
6082}
6083
6084static vector bool short __ATTRS_o_ai
6085vec_srl(vector bool short a, vector unsigned short b)
6086{
6087 return (vector bool short)__builtin_altivec_vsr((vector int)a, (vector int)b);
6088}
6089
6090static vector bool short __ATTRS_o_ai
6091vec_srl(vector bool short a, vector unsigned int b)
6092{
6093 return (vector bool short)__builtin_altivec_vsr((vector int)a, (vector int)b);
6094}
6095
6096static vector pixel __ATTRS_o_ai
6097vec_srl(vector pixel a, vector unsigned char b)
6098{
6099 return (vector pixel)__builtin_altivec_vsr((vector int)a, (vector int)b);
6100}
6101
6102static vector pixel __ATTRS_o_ai
6103vec_srl(vector pixel a, vector unsigned short b)
6104{
6105 return (vector pixel)__builtin_altivec_vsr((vector int)a, (vector int)b);
6106}
6107
6108static vector pixel __ATTRS_o_ai
6109vec_srl(vector pixel a, vector unsigned int b)
6110{
6111 return (vector pixel)__builtin_altivec_vsr((vector int)a, (vector int)b);
6112}
6113
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006114static vector int __ATTRS_o_ai
6115vec_srl(vector int a, vector unsigned char b)
6116{
6117 return (vector int)__builtin_altivec_vsr(a, (vector int)b);
6118}
6119
6120static vector int __ATTRS_o_ai
6121vec_srl(vector int a, vector unsigned short b)
6122{
6123 return (vector int)__builtin_altivec_vsr(a, (vector int)b);
6124}
6125
6126static vector int __ATTRS_o_ai
6127vec_srl(vector int a, vector unsigned int b)
6128{
6129 return (vector int)__builtin_altivec_vsr(a, (vector int)b);
6130}
6131
6132static vector unsigned int __ATTRS_o_ai
6133vec_srl(vector unsigned int a, vector unsigned char b)
6134{
6135 return (vector unsigned int)__builtin_altivec_vsr((vector int)a, (vector int)b);
6136}
6137
6138static vector unsigned int __ATTRS_o_ai
6139vec_srl(vector unsigned int a, vector unsigned short b)
6140{
6141 return (vector unsigned int)__builtin_altivec_vsr((vector int)a, (vector int)b);
6142}
6143
6144static vector unsigned int __ATTRS_o_ai
6145vec_srl(vector unsigned int a, vector unsigned int b)
6146{
6147 return (vector unsigned int)__builtin_altivec_vsr((vector int)a, (vector int)b);
6148}
6149
Anton Yartseva2fc0f52010-08-19 03:21:36 +00006150static vector bool int __ATTRS_o_ai
6151vec_srl(vector bool int a, vector unsigned char b)
6152{
6153 return (vector bool int)__builtin_altivec_vsr((vector int)a, (vector int)b);
6154}
6155
6156static vector bool int __ATTRS_o_ai
6157vec_srl(vector bool int a, vector unsigned short b)
6158{
6159 return (vector bool int)__builtin_altivec_vsr((vector int)a, (vector int)b);
6160}
6161
6162static vector bool int __ATTRS_o_ai
6163vec_srl(vector bool int a, vector unsigned int b)
6164{
6165 return (vector bool int)__builtin_altivec_vsr((vector int)a, (vector int)b);
6166}
6167
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006168/* vec_vsr */
6169
6170static vector signed char __ATTRS_o_ai
6171vec_vsr(vector signed char a, vector unsigned char b)
6172{
6173 return (vector signed char)__builtin_altivec_vsr((vector int)a, (vector int)b);
6174}
6175
6176static vector signed char __ATTRS_o_ai
6177vec_vsr(vector signed char a, vector unsigned short b)
6178{
6179 return (vector signed char)__builtin_altivec_vsr((vector int)a, (vector int)b);
6180}
6181
6182static vector signed char __ATTRS_o_ai
6183vec_vsr(vector signed char a, vector unsigned int b)
6184{
6185 return (vector signed char)__builtin_altivec_vsr((vector int)a, (vector int)b);
6186}
6187
6188static vector unsigned char __ATTRS_o_ai
6189vec_vsr(vector unsigned char a, vector unsigned char b)
6190{
6191 return (vector unsigned char)__builtin_altivec_vsr((vector int)a, (vector int)b);
6192}
6193
6194static vector unsigned char __ATTRS_o_ai
6195vec_vsr(vector unsigned char a, vector unsigned short b)
6196{
6197 return (vector unsigned char)__builtin_altivec_vsr((vector int)a, (vector int)b);
6198}
6199
6200static vector unsigned char __ATTRS_o_ai
6201vec_vsr(vector unsigned char a, vector unsigned int b)
6202{
6203 return (vector unsigned char)__builtin_altivec_vsr((vector int)a, (vector int)b);
6204}
6205
Anton Yartseva2fc0f52010-08-19 03:21:36 +00006206static vector bool char __ATTRS_o_ai
6207vec_vsr(vector bool char a, vector unsigned char b)
6208{
6209 return (vector bool char)__builtin_altivec_vsr((vector int)a, (vector int)b);
6210}
6211
6212static vector bool char __ATTRS_o_ai
6213vec_vsr(vector bool char a, vector unsigned short b)
6214{
6215 return (vector bool char)__builtin_altivec_vsr((vector int)a, (vector int)b);
6216}
6217
6218static vector bool char __ATTRS_o_ai
6219vec_vsr(vector bool char a, vector unsigned int b)
6220{
6221 return (vector bool char)__builtin_altivec_vsr((vector int)a, (vector int)b);
6222}
6223
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006224static vector short __ATTRS_o_ai
6225vec_vsr(vector short a, vector unsigned char b)
6226{
6227 return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b);
6228}
6229
6230static vector short __ATTRS_o_ai
6231vec_vsr(vector short a, vector unsigned short b)
6232{
6233 return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b);
6234}
6235
6236static vector short __ATTRS_o_ai
6237vec_vsr(vector short a, vector unsigned int b)
6238{
6239 return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b);
6240}
6241
6242static vector unsigned short __ATTRS_o_ai
6243vec_vsr(vector unsigned short a, vector unsigned char b)
6244{
6245 return (vector unsigned short)__builtin_altivec_vsr((vector int)a, (vector int)b);
6246}
6247
6248static vector unsigned short __ATTRS_o_ai
6249vec_vsr(vector unsigned short a, vector unsigned short b)
6250{
6251 return (vector unsigned short)__builtin_altivec_vsr((vector int)a, (vector int)b);
6252}
6253
6254static vector unsigned short __ATTRS_o_ai
6255vec_vsr(vector unsigned short a, vector unsigned int b)
6256{
6257 return (vector unsigned short)__builtin_altivec_vsr((vector int)a, (vector int)b);
6258}
6259
Anton Yartseva2fc0f52010-08-19 03:21:36 +00006260static vector bool short __ATTRS_o_ai
6261vec_vsr(vector bool short a, vector unsigned char b)
6262{
6263 return (vector bool short)__builtin_altivec_vsr((vector int)a, (vector int)b);
6264}
6265
6266static vector bool short __ATTRS_o_ai
6267vec_vsr(vector bool short a, vector unsigned short b)
6268{
6269 return (vector bool short)__builtin_altivec_vsr((vector int)a, (vector int)b);
6270}
6271
6272static vector bool short __ATTRS_o_ai
6273vec_vsr(vector bool short a, vector unsigned int b)
6274{
6275 return (vector bool short)__builtin_altivec_vsr((vector int)a, (vector int)b);
6276}
6277
6278static vector pixel __ATTRS_o_ai
6279vec_vsr(vector pixel a, vector unsigned char b)
6280{
6281 return (vector pixel)__builtin_altivec_vsr((vector int)a, (vector int)b);
6282}
6283
6284static vector pixel __ATTRS_o_ai
6285vec_vsr(vector pixel a, vector unsigned short b)
6286{
6287 return (vector pixel)__builtin_altivec_vsr((vector int)a, (vector int)b);
6288}
6289
6290static vector pixel __ATTRS_o_ai
6291vec_vsr(vector pixel a, vector unsigned int b)
6292{
6293 return (vector pixel)__builtin_altivec_vsr((vector int)a, (vector int)b);
6294}
6295
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006296static vector int __ATTRS_o_ai
6297vec_vsr(vector int a, vector unsigned char b)
6298{
6299 return (vector int)__builtin_altivec_vsr(a, (vector int)b);
6300}
6301
6302static vector int __ATTRS_o_ai
6303vec_vsr(vector int a, vector unsigned short b)
6304{
6305 return (vector int)__builtin_altivec_vsr(a, (vector int)b);
6306}
6307
6308static vector int __ATTRS_o_ai
6309vec_vsr(vector int a, vector unsigned int b)
6310{
6311 return (vector int)__builtin_altivec_vsr(a, (vector int)b);
6312}
6313
6314static vector unsigned int __ATTRS_o_ai
6315vec_vsr(vector unsigned int a, vector unsigned char b)
6316{
6317 return (vector unsigned int)__builtin_altivec_vsr((vector int)a, (vector int)b);
6318}
6319
6320static vector unsigned int __ATTRS_o_ai
6321vec_vsr(vector unsigned int a, vector unsigned short b)
6322{
6323 return (vector unsigned int)__builtin_altivec_vsr((vector int)a, (vector int)b);
6324}
6325
6326static vector unsigned int __ATTRS_o_ai
6327vec_vsr(vector unsigned int a, vector unsigned int b)
6328{
6329 return (vector unsigned int)__builtin_altivec_vsr((vector int)a, (vector int)b);
6330}
6331
Anton Yartseva2fc0f52010-08-19 03:21:36 +00006332static vector bool int __ATTRS_o_ai
6333vec_vsr(vector bool int a, vector unsigned char b)
6334{
6335 return (vector bool int)__builtin_altivec_vsr((vector int)a, (vector int)b);
6336}
6337
6338static vector bool int __ATTRS_o_ai
6339vec_vsr(vector bool int a, vector unsigned short b)
6340{
6341 return (vector bool int)__builtin_altivec_vsr((vector int)a, (vector int)b);
6342}
6343
6344static vector bool int __ATTRS_o_ai
6345vec_vsr(vector bool int a, vector unsigned int b)
6346{
6347 return (vector bool int)__builtin_altivec_vsr((vector int)a, (vector int)b);
6348}
6349
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006350/* vec_sro */
6351
6352static vector signed char __ATTRS_o_ai
6353vec_sro(vector signed char a, vector signed char b)
6354{
6355 return (vector signed char)__builtin_altivec_vsro((vector int)a, (vector int)b);
6356}
6357
6358static vector signed char __ATTRS_o_ai
6359vec_sro(vector signed char a, vector unsigned char b)
6360{
6361 return (vector signed char)__builtin_altivec_vsro((vector int)a, (vector int)b);
6362}
6363
6364static vector unsigned char __ATTRS_o_ai
6365vec_sro(vector unsigned char a, vector signed char b)
6366{
6367 return (vector unsigned char)__builtin_altivec_vsro((vector int)a, (vector int)b);
6368}
6369
6370static vector unsigned char __ATTRS_o_ai
6371vec_sro(vector unsigned char a, vector unsigned char b)
6372{
6373 return (vector unsigned char)__builtin_altivec_vsro((vector int)a, (vector int)b);
6374}
6375
6376static vector short __ATTRS_o_ai
6377vec_sro(vector short a, vector signed char b)
6378{
6379 return (vector short)__builtin_altivec_vsro((vector int)a, (vector int)b);
6380}
6381
6382static vector short __ATTRS_o_ai
6383vec_sro(vector short a, vector unsigned char b)
6384{
6385 return (vector short)__builtin_altivec_vsro((vector int)a, (vector int)b);
6386}
6387
6388static vector unsigned short __ATTRS_o_ai
6389vec_sro(vector unsigned short a, vector signed char b)
6390{
6391 return (vector unsigned short)__builtin_altivec_vsro((vector int)a, (vector int)b);
6392}
6393
6394static vector unsigned short __ATTRS_o_ai
6395vec_sro(vector unsigned short a, vector unsigned char b)
6396{
6397 return (vector unsigned short)__builtin_altivec_vsro((vector int)a, (vector int)b);
6398}
6399
Anton Yartseva2fc0f52010-08-19 03:21:36 +00006400static vector pixel __ATTRS_o_ai
6401vec_sro(vector pixel a, vector signed char b)
6402{
6403 return (vector pixel)__builtin_altivec_vsro((vector int)a, (vector int)b);
6404}
6405
6406static vector pixel __ATTRS_o_ai
6407vec_sro(vector pixel a, vector unsigned char b)
6408{
6409 return (vector pixel)__builtin_altivec_vsro((vector int)a, (vector int)b);
6410}
6411
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006412static vector int __ATTRS_o_ai
6413vec_sro(vector int a, vector signed char b)
6414{
6415 return (vector int)__builtin_altivec_vsro(a, (vector int)b);
6416}
6417
6418static vector int __ATTRS_o_ai
6419vec_sro(vector int a, vector unsigned char b)
6420{
6421 return (vector int)__builtin_altivec_vsro(a, (vector int)b);
6422}
6423
6424static vector unsigned int __ATTRS_o_ai
6425vec_sro(vector unsigned int a, vector signed char b)
6426{
6427 return (vector unsigned int)__builtin_altivec_vsro((vector int)a, (vector int)b);
6428}
6429
6430static vector unsigned int __ATTRS_o_ai
6431vec_sro(vector unsigned int a, vector unsigned char b)
6432{
6433 return (vector unsigned int)__builtin_altivec_vsro((vector int)a, (vector int)b);
6434}
6435
6436static vector float __ATTRS_o_ai
6437vec_sro(vector float a, vector signed char b)
6438{
6439 return (vector float)__builtin_altivec_vsro((vector int)a, (vector int)b);
6440}
6441
6442static vector float __ATTRS_o_ai
6443vec_sro(vector float a, vector unsigned char b)
6444{
6445 return (vector float)__builtin_altivec_vsro((vector int)a, (vector int)b);
6446}
6447
6448/* vec_vsro */
6449
6450static vector signed char __ATTRS_o_ai
6451vec_vsro(vector signed char a, vector signed char b)
6452{
6453 return (vector signed char)__builtin_altivec_vsro((vector int)a, (vector int)b);
6454}
6455
6456static vector signed char __ATTRS_o_ai
6457vec_vsro(vector signed char a, vector unsigned char b)
6458{
6459 return (vector signed char)__builtin_altivec_vsro((vector int)a, (vector int)b);
6460}
6461
6462static vector unsigned char __ATTRS_o_ai
6463vec_vsro(vector unsigned char a, vector signed char b)
6464{
6465 return (vector unsigned char)__builtin_altivec_vsro((vector int)a, (vector int)b);
6466}
6467
6468static vector unsigned char __ATTRS_o_ai
6469vec_vsro(vector unsigned char a, vector unsigned char b)
6470{
6471 return (vector unsigned char)__builtin_altivec_vsro((vector int)a, (vector int)b);
6472}
6473
6474static vector short __ATTRS_o_ai
6475vec_vsro(vector short a, vector signed char b)
6476{
6477 return (vector short)__builtin_altivec_vsro((vector int)a, (vector int)b);
6478}
6479
6480static vector short __ATTRS_o_ai
6481vec_vsro(vector short a, vector unsigned char b)
6482{
6483 return (vector short)__builtin_altivec_vsro((vector int)a, (vector int)b);
6484}
6485
6486static vector unsigned short __ATTRS_o_ai
6487vec_vsro(vector unsigned short a, vector signed char b)
6488{
6489 return (vector unsigned short)__builtin_altivec_vsro((vector int)a, (vector int)b);
6490}
6491
6492static vector unsigned short __ATTRS_o_ai
6493vec_vsro(vector unsigned short a, vector unsigned char b)
6494{
6495 return (vector unsigned short)__builtin_altivec_vsro((vector int)a, (vector int)b);
6496}
6497
Anton Yartseva2fc0f52010-08-19 03:21:36 +00006498static vector pixel __ATTRS_o_ai
6499vec_vsro(vector pixel a, vector signed char b)
6500{
6501 return (vector pixel)__builtin_altivec_vsro((vector int)a, (vector int)b);
6502}
6503
6504static vector pixel __ATTRS_o_ai
6505vec_vsro(vector pixel a, vector unsigned char b)
6506{
6507 return (vector pixel)__builtin_altivec_vsro((vector int)a, (vector int)b);
6508}
6509
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006510static vector int __ATTRS_o_ai
6511vec_vsro(vector int a, vector signed char b)
6512{
6513 return (vector int)__builtin_altivec_vsro(a, (vector int)b);
6514}
6515
6516static vector int __ATTRS_o_ai
6517vec_vsro(vector int a, vector unsigned char b)
6518{
6519 return (vector int)__builtin_altivec_vsro(a, (vector int)b);
6520}
6521
6522static vector unsigned int __ATTRS_o_ai
6523vec_vsro(vector unsigned int a, vector signed char b)
6524{
6525 return (vector unsigned int)__builtin_altivec_vsro((vector int)a, (vector int)b);
6526}
6527
6528static vector unsigned int __ATTRS_o_ai
6529vec_vsro(vector unsigned int a, vector unsigned char b)
6530{
6531 return (vector unsigned int)__builtin_altivec_vsro((vector int)a, (vector int)b);
6532}
6533
6534static vector float __ATTRS_o_ai
6535vec_vsro(vector float a, vector signed char b)
6536{
6537 return (vector float)__builtin_altivec_vsro((vector int)a, (vector int)b);
6538}
6539
6540static vector float __ATTRS_o_ai
6541vec_vsro(vector float a, vector unsigned char b)
6542{
6543 return (vector float)__builtin_altivec_vsro((vector int)a, (vector int)b);
6544}
6545
6546/* vec_st */
6547
6548static void __ATTRS_o_ai
6549vec_st(vector signed char a, int b, vector signed char *c)
6550{
6551 __builtin_altivec_stvx((vector int)a, b, c);
6552}
6553
6554static void __ATTRS_o_ai
6555vec_st(vector signed char a, int b, signed char *c)
6556{
6557 __builtin_altivec_stvx((vector int)a, b, c);
6558}
6559
6560static void __ATTRS_o_ai
6561vec_st(vector unsigned char a, int b, vector unsigned char *c)
6562{
6563 __builtin_altivec_stvx((vector int)a, b, c);
6564}
6565
6566static void __ATTRS_o_ai
6567vec_st(vector unsigned char a, int b, unsigned char *c)
6568{
6569 __builtin_altivec_stvx((vector int)a, b, c);
6570}
6571
6572static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00006573vec_st(vector bool char a, int b, signed char *c)
6574{
6575 __builtin_altivec_stvx((vector int)a, b, c);
6576}
6577
6578static void __ATTRS_o_ai
6579vec_st(vector bool char a, int b, unsigned char *c)
6580{
6581 __builtin_altivec_stvx((vector int)a, b, c);
6582}
6583
6584static void __ATTRS_o_ai
6585vec_st(vector bool char a, int b, vector bool char *c)
6586{
6587 __builtin_altivec_stvx((vector int)a, b, c);
6588}
6589
6590static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006591vec_st(vector short a, int b, vector short *c)
6592{
6593 __builtin_altivec_stvx((vector int)a, b, c);
6594}
6595
6596static void __ATTRS_o_ai
6597vec_st(vector short a, int b, short *c)
6598{
6599 __builtin_altivec_stvx((vector int)a, b, c);
6600}
6601
6602static void __ATTRS_o_ai
6603vec_st(vector unsigned short a, int b, vector unsigned short *c)
6604{
6605 __builtin_altivec_stvx((vector int)a, b, c);
6606}
6607
6608static void __ATTRS_o_ai
6609vec_st(vector unsigned short a, int b, unsigned short *c)
6610{
6611 __builtin_altivec_stvx((vector int)a, b, c);
6612}
6613
6614static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00006615vec_st(vector bool short a, int b, short *c)
6616{
6617 __builtin_altivec_stvx((vector int)a, b, c);
6618}
6619
6620static void __ATTRS_o_ai
6621vec_st(vector bool short a, int b, unsigned short *c)
6622{
6623 __builtin_altivec_stvx((vector int)a, b, c);
6624}
6625
6626static void __ATTRS_o_ai
6627vec_st(vector bool short a, int b, vector bool short *c)
6628{
6629 __builtin_altivec_stvx((vector int)a, b, c);
6630}
6631
6632static void __ATTRS_o_ai
6633vec_st(vector pixel a, int b, short *c)
6634{
6635 __builtin_altivec_stvx((vector int)a, b, c);
6636}
6637
6638static void __ATTRS_o_ai
6639vec_st(vector pixel a, int b, unsigned short *c)
6640{
6641 __builtin_altivec_stvx((vector int)a, b, c);
6642}
6643
6644static void __ATTRS_o_ai
6645vec_st(vector pixel a, int b, vector pixel *c)
6646{
6647 __builtin_altivec_stvx((vector int)a, b, c);
6648}
6649
6650static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006651vec_st(vector int a, int b, vector int *c)
6652{
6653 __builtin_altivec_stvx(a, b, c);
6654}
6655
6656static void __ATTRS_o_ai
6657vec_st(vector int a, int b, int *c)
6658{
6659 __builtin_altivec_stvx(a, b, c);
6660}
6661
6662static void __ATTRS_o_ai
6663vec_st(vector unsigned int a, int b, vector unsigned int *c)
6664{
6665 __builtin_altivec_stvx((vector int)a, b, c);
6666}
6667
6668static void __ATTRS_o_ai
6669vec_st(vector unsigned int a, int b, unsigned int *c)
6670{
6671 __builtin_altivec_stvx((vector int)a, b, c);
6672}
6673
6674static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00006675vec_st(vector bool int a, int b, int *c)
6676{
6677 __builtin_altivec_stvx((vector int)a, b, c);
6678}
6679
6680static void __ATTRS_o_ai
6681vec_st(vector bool int a, int b, unsigned int *c)
6682{
6683 __builtin_altivec_stvx((vector int)a, b, c);
6684}
6685
6686static void __ATTRS_o_ai
6687vec_st(vector bool int a, int b, vector bool int *c)
6688{
6689 __builtin_altivec_stvx((vector int)a, b, c);
6690}
6691
6692static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006693vec_st(vector float a, int b, vector float *c)
6694{
6695 __builtin_altivec_stvx((vector int)a, b, c);
6696}
6697
6698static void __ATTRS_o_ai
6699vec_st(vector float a, int b, float *c)
6700{
6701 __builtin_altivec_stvx((vector int)a, b, c);
6702}
6703
6704/* vec_stvx */
6705
6706static void __ATTRS_o_ai
6707vec_stvx(vector signed char a, int b, vector signed char *c)
6708{
6709 __builtin_altivec_stvx((vector int)a, b, c);
6710}
6711
6712static void __ATTRS_o_ai
6713vec_stvx(vector signed char a, int b, signed char *c)
6714{
6715 __builtin_altivec_stvx((vector int)a, b, c);
6716}
6717
6718static void __ATTRS_o_ai
6719vec_stvx(vector unsigned char a, int b, vector unsigned char *c)
6720{
6721 __builtin_altivec_stvx((vector int)a, b, c);
6722}
6723
6724static void __ATTRS_o_ai
6725vec_stvx(vector unsigned char a, int b, unsigned char *c)
6726{
6727 __builtin_altivec_stvx((vector int)a, b, c);
6728}
6729
6730static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00006731vec_stvx(vector bool char a, int b, signed char *c)
6732{
6733 __builtin_altivec_stvx((vector int)a, b, c);
6734}
6735
6736static void __ATTRS_o_ai
6737vec_stvx(vector bool char a, int b, unsigned char *c)
6738{
6739 __builtin_altivec_stvx((vector int)a, b, c);
6740}
6741
6742static void __ATTRS_o_ai
6743vec_stvx(vector bool char a, int b, vector bool char *c)
6744{
6745 __builtin_altivec_stvx((vector int)a, b, c);
6746}
6747
6748static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006749vec_stvx(vector short a, int b, vector short *c)
6750{
6751 __builtin_altivec_stvx((vector int)a, b, c);
6752}
6753
6754static void __ATTRS_o_ai
6755vec_stvx(vector short a, int b, short *c)
6756{
6757 __builtin_altivec_stvx((vector int)a, b, c);
6758}
6759
6760static void __ATTRS_o_ai
6761vec_stvx(vector unsigned short a, int b, vector unsigned short *c)
6762{
6763 __builtin_altivec_stvx((vector int)a, b, c);
6764}
6765
6766static void __ATTRS_o_ai
6767vec_stvx(vector unsigned short a, int b, unsigned short *c)
6768{
6769 __builtin_altivec_stvx((vector int)a, b, c);
6770}
6771
6772static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00006773vec_stvx(vector bool short a, int b, short *c)
6774{
6775 __builtin_altivec_stvx((vector int)a, b, c);
6776}
6777
6778static void __ATTRS_o_ai
6779vec_stvx(vector bool short a, int b, unsigned short *c)
6780{
6781 __builtin_altivec_stvx((vector int)a, b, c);
6782}
6783
6784static void __ATTRS_o_ai
6785vec_stvx(vector bool short a, int b, vector bool short *c)
6786{
6787 __builtin_altivec_stvx((vector int)a, b, c);
6788}
6789
6790static void __ATTRS_o_ai
6791vec_stvx(vector pixel a, int b, short *c)
6792{
6793 __builtin_altivec_stvx((vector int)a, b, c);
6794}
6795
6796static void __ATTRS_o_ai
6797vec_stvx(vector pixel a, int b, unsigned short *c)
6798{
6799 __builtin_altivec_stvx((vector int)a, b, c);
6800}
6801
6802static void __ATTRS_o_ai
6803vec_stvx(vector pixel a, int b, vector pixel *c)
6804{
6805 __builtin_altivec_stvx((vector int)a, b, c);
6806}
6807
6808static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006809vec_stvx(vector int a, int b, vector int *c)
6810{
6811 __builtin_altivec_stvx(a, b, c);
6812}
6813
6814static void __ATTRS_o_ai
6815vec_stvx(vector int a, int b, int *c)
6816{
6817 __builtin_altivec_stvx(a, b, c);
6818}
6819
6820static void __ATTRS_o_ai
6821vec_stvx(vector unsigned int a, int b, vector unsigned int *c)
6822{
6823 __builtin_altivec_stvx((vector int)a, b, c);
6824}
6825
6826static void __ATTRS_o_ai
6827vec_stvx(vector unsigned int a, int b, unsigned int *c)
6828{
6829 __builtin_altivec_stvx((vector int)a, b, c);
6830}
6831
6832static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00006833vec_stvx(vector bool int a, int b, int *c)
6834{
6835 __builtin_altivec_stvx((vector int)a, b, c);
6836}
6837
6838static void __ATTRS_o_ai
6839vec_stvx(vector bool int a, int b, unsigned int *c)
6840{
6841 __builtin_altivec_stvx((vector int)a, b, c);
6842}
6843
6844static void __ATTRS_o_ai
6845vec_stvx(vector bool int a, int b, vector bool int *c)
6846{
6847 __builtin_altivec_stvx((vector int)a, b, c);
6848}
6849
6850static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006851vec_stvx(vector float a, int b, vector float *c)
6852{
6853 __builtin_altivec_stvx((vector int)a, b, c);
6854}
6855
6856static void __ATTRS_o_ai
6857vec_stvx(vector float a, int b, float *c)
6858{
6859 __builtin_altivec_stvx((vector int)a, b, c);
6860}
6861
6862/* vec_ste */
6863
6864static void __ATTRS_o_ai
6865vec_ste(vector signed char a, int b, signed char *c)
6866{
6867 __builtin_altivec_stvebx((vector char)a, b, c);
6868}
6869
6870static void __ATTRS_o_ai
6871vec_ste(vector unsigned char a, int b, unsigned char *c)
6872{
6873 __builtin_altivec_stvebx((vector char)a, b, c);
6874}
6875
6876static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00006877vec_ste(vector bool char a, int b, signed char *c)
6878{
6879 __builtin_altivec_stvebx((vector char)a, b, c);
6880}
6881
6882static void __ATTRS_o_ai
6883vec_ste(vector bool char a, int b, unsigned char *c)
6884{
6885 __builtin_altivec_stvebx((vector char)a, b, c);
6886}
6887
6888static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006889vec_ste(vector short a, int b, short *c)
6890{
6891 __builtin_altivec_stvehx(a, b, c);
6892}
6893
6894static void __ATTRS_o_ai
6895vec_ste(vector unsigned short a, int b, unsigned short *c)
6896{
6897 __builtin_altivec_stvehx((vector short)a, b, c);
6898}
6899
6900static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00006901vec_ste(vector bool short a, int b, short *c)
6902{
6903 __builtin_altivec_stvehx((vector short)a, b, c);
6904}
6905
6906static void __ATTRS_o_ai
6907vec_ste(vector bool short a, int b, unsigned short *c)
6908{
6909 __builtin_altivec_stvehx((vector short)a, b, c);
6910}
6911
6912static void __ATTRS_o_ai
6913vec_ste(vector pixel a, int b, short *c)
6914{
6915 __builtin_altivec_stvehx((vector short)a, b, c);
6916}
6917
6918static void __ATTRS_o_ai
6919vec_ste(vector pixel a, int b, unsigned short *c)
6920{
6921 __builtin_altivec_stvehx((vector short)a, b, c);
6922}
6923
6924static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006925vec_ste(vector int a, int b, int *c)
6926{
6927 __builtin_altivec_stvewx(a, b, c);
6928}
6929
6930static void __ATTRS_o_ai
6931vec_ste(vector unsigned int a, int b, unsigned int *c)
6932{
6933 __builtin_altivec_stvewx((vector int)a, b, c);
6934}
6935
6936static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00006937vec_ste(vector bool int a, int b, int *c)
6938{
6939 __builtin_altivec_stvewx((vector int)a, b, c);
6940}
6941
6942static void __ATTRS_o_ai
6943vec_ste(vector bool int a, int b, unsigned int *c)
6944{
6945 __builtin_altivec_stvewx((vector int)a, b, c);
6946}
6947
6948static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006949vec_ste(vector float a, int b, float *c)
6950{
6951 __builtin_altivec_stvewx((vector int)a, b, c);
6952}
6953
6954/* vec_stvebx */
6955
6956static void __ATTRS_o_ai
6957vec_stvebx(vector signed char a, int b, signed char *c)
6958{
6959 __builtin_altivec_stvebx((vector char)a, b, c);
6960}
6961
6962static void __ATTRS_o_ai
6963vec_stvebx(vector unsigned char a, int b, unsigned char *c)
6964{
6965 __builtin_altivec_stvebx((vector char)a, b, c);
6966}
6967
Anton Yartseva2fc0f52010-08-19 03:21:36 +00006968static void __ATTRS_o_ai
6969vec_stvebx(vector bool char a, int b, signed char *c)
6970{
6971 __builtin_altivec_stvebx((vector char)a, b, c);
6972}
6973
6974static void __ATTRS_o_ai
6975vec_stvebx(vector bool char a, int b, unsigned char *c)
6976{
6977 __builtin_altivec_stvebx((vector char)a, b, c);
6978}
6979
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006980/* vec_stvehx */
6981
6982static void __ATTRS_o_ai
6983vec_stvehx(vector short a, int b, short *c)
6984{
6985 __builtin_altivec_stvehx(a, b, c);
6986}
6987
6988static void __ATTRS_o_ai
6989vec_stvehx(vector unsigned short a, int b, unsigned short *c)
6990{
6991 __builtin_altivec_stvehx((vector short)a, b, c);
6992}
6993
Anton Yartseva2fc0f52010-08-19 03:21:36 +00006994static void __ATTRS_o_ai
6995vec_stvehx(vector bool short a, int b, short *c)
6996{
6997 __builtin_altivec_stvehx((vector short)a, b, c);
6998}
6999
7000static void __ATTRS_o_ai
7001vec_stvehx(vector bool short a, int b, unsigned short *c)
7002{
7003 __builtin_altivec_stvehx((vector short)a, b, c);
7004}
7005
7006static void __ATTRS_o_ai
7007vec_stvehx(vector pixel a, int b, short *c)
7008{
7009 __builtin_altivec_stvehx((vector short)a, b, c);
7010}
7011
7012static void __ATTRS_o_ai
7013vec_stvehx(vector pixel a, int b, unsigned short *c)
7014{
7015 __builtin_altivec_stvehx((vector short)a, b, c);
7016}
7017
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007018/* vec_stvewx */
7019
7020static void __ATTRS_o_ai
7021vec_stvewx(vector int a, int b, int *c)
7022{
7023 __builtin_altivec_stvewx(a, b, c);
7024}
7025
7026static void __ATTRS_o_ai
7027vec_stvewx(vector unsigned int a, int b, unsigned int *c)
7028{
7029 __builtin_altivec_stvewx((vector int)a, b, c);
7030}
7031
7032static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007033vec_stvewx(vector bool int a, int b, int *c)
7034{
7035 __builtin_altivec_stvewx((vector int)a, b, c);
7036}
7037
7038static void __ATTRS_o_ai
7039vec_stvewx(vector bool int a, int b, unsigned int *c)
7040{
7041 __builtin_altivec_stvewx((vector int)a, b, c);
7042}
7043
7044static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007045vec_stvewx(vector float a, int b, float *c)
7046{
7047 __builtin_altivec_stvewx((vector int)a, b, c);
7048}
7049
7050/* vec_stl */
7051
7052static void __ATTRS_o_ai
7053vec_stl(vector signed char a, int b, vector signed char *c)
7054{
7055 __builtin_altivec_stvxl((vector int)a, b, c);
7056}
7057
7058static void __ATTRS_o_ai
7059vec_stl(vector signed char a, int b, signed char *c)
7060{
7061 __builtin_altivec_stvxl((vector int)a, b, c);
7062}
7063
7064static void __ATTRS_o_ai
7065vec_stl(vector unsigned char a, int b, vector unsigned char *c)
7066{
7067 __builtin_altivec_stvxl((vector int)a, b, c);
7068}
7069
7070static void __ATTRS_o_ai
7071vec_stl(vector unsigned char a, int b, unsigned char *c)
7072{
7073 __builtin_altivec_stvxl((vector int)a, b, c);
7074}
7075
7076static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007077vec_stl(vector bool char a, int b, signed char *c)
7078{
7079 __builtin_altivec_stvxl((vector int)a, b, c);
7080}
7081
7082static void __ATTRS_o_ai
7083vec_stl(vector bool char a, int b, unsigned char *c)
7084{
7085 __builtin_altivec_stvxl((vector int)a, b, c);
7086}
7087
7088static void __ATTRS_o_ai
7089vec_stl(vector bool char a, int b, vector bool char *c)
7090{
7091 __builtin_altivec_stvxl((vector int)a, b, c);
7092}
7093
7094static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007095vec_stl(vector short a, int b, vector short *c)
7096{
7097 __builtin_altivec_stvxl((vector int)a, b, c);
7098}
7099
7100static void __ATTRS_o_ai
7101vec_stl(vector short a, int b, short *c)
7102{
7103 __builtin_altivec_stvxl((vector int)a, b, c);
7104}
7105
7106static void __ATTRS_o_ai
7107vec_stl(vector unsigned short a, int b, vector unsigned short *c)
7108{
7109 __builtin_altivec_stvxl((vector int)a, b, c);
7110}
7111
7112static void __ATTRS_o_ai
7113vec_stl(vector unsigned short a, int b, unsigned short *c)
7114{
7115 __builtin_altivec_stvxl((vector int)a, b, c);
7116}
7117
7118static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007119vec_stl(vector bool short a, int b, short *c)
7120{
7121 __builtin_altivec_stvxl((vector int)a, b, c);
7122}
7123
7124static void __ATTRS_o_ai
7125vec_stl(vector bool short a, int b, unsigned short *c)
7126{
7127 __builtin_altivec_stvxl((vector int)a, b, c);
7128}
7129
7130static void __ATTRS_o_ai
7131vec_stl(vector bool short a, int b, vector bool short *c)
7132{
7133 __builtin_altivec_stvxl((vector int)a, b, c);
7134}
7135
7136static void __ATTRS_o_ai
7137vec_stl(vector pixel a, int b, short *c)
7138{
7139 __builtin_altivec_stvxl((vector int)a, b, c);
7140}
7141
7142static void __ATTRS_o_ai
7143vec_stl(vector pixel a, int b, unsigned short *c)
7144{
7145 __builtin_altivec_stvxl((vector int)a, b, c);
7146}
7147
7148static void __ATTRS_o_ai
7149vec_stl(vector pixel a, int b, vector pixel *c)
7150{
7151 __builtin_altivec_stvxl((vector int)a, b, c);
7152}
7153
7154static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007155vec_stl(vector int a, int b, vector int *c)
7156{
7157 __builtin_altivec_stvxl(a, b, c);
7158}
7159
7160static void __ATTRS_o_ai
7161vec_stl(vector int a, int b, int *c)
7162{
7163 __builtin_altivec_stvxl(a, b, c);
7164}
7165
7166static void __ATTRS_o_ai
7167vec_stl(vector unsigned int a, int b, vector unsigned int *c)
7168{
7169 __builtin_altivec_stvxl((vector int)a, b, c);
7170}
7171
7172static void __ATTRS_o_ai
7173vec_stl(vector unsigned int a, int b, unsigned int *c)
7174{
7175 __builtin_altivec_stvxl((vector int)a, b, c);
7176}
7177
7178static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007179vec_stl(vector bool int a, int b, int *c)
7180{
7181 __builtin_altivec_stvxl((vector int)a, b, c);
7182}
7183
7184static void __ATTRS_o_ai
7185vec_stl(vector bool int a, int b, unsigned int *c)
7186{
7187 __builtin_altivec_stvxl((vector int)a, b, c);
7188}
7189
7190static void __ATTRS_o_ai
7191vec_stl(vector bool int a, int b, vector bool int *c)
7192{
7193 __builtin_altivec_stvxl((vector int)a, b, c);
7194}
7195
7196static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007197vec_stl(vector float a, int b, vector float *c)
7198{
7199 __builtin_altivec_stvxl((vector int)a, b, c);
7200}
7201
7202static void __ATTRS_o_ai
7203vec_stl(vector float a, int b, float *c)
7204{
7205 __builtin_altivec_stvxl((vector int)a, b, c);
7206}
7207
7208/* vec_stvxl */
7209
7210static void __ATTRS_o_ai
7211vec_stvxl(vector signed char a, int b, vector signed char *c)
7212{
7213 __builtin_altivec_stvxl((vector int)a, b, c);
7214}
7215
7216static void __ATTRS_o_ai
7217vec_stvxl(vector signed char a, int b, signed char *c)
7218{
7219 __builtin_altivec_stvxl((vector int)a, b, c);
7220}
7221
7222static void __ATTRS_o_ai
7223vec_stvxl(vector unsigned char a, int b, vector unsigned char *c)
7224{
7225 __builtin_altivec_stvxl((vector int)a, b, c);
7226}
7227
7228static void __ATTRS_o_ai
7229vec_stvxl(vector unsigned char a, int b, unsigned char *c)
7230{
7231 __builtin_altivec_stvxl((vector int)a, b, c);
7232}
7233
7234static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007235vec_stvxl(vector bool char a, int b, signed char *c)
7236{
7237 __builtin_altivec_stvxl((vector int)a, b, c);
7238}
7239
7240static void __ATTRS_o_ai
7241vec_stvxl(vector bool char a, int b, unsigned char *c)
7242{
7243 __builtin_altivec_stvxl((vector int)a, b, c);
7244}
7245
7246static void __ATTRS_o_ai
7247vec_stvxl(vector bool char a, int b, vector bool char *c)
7248{
7249 __builtin_altivec_stvxl((vector int)a, b, c);
7250}
7251
7252static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007253vec_stvxl(vector short a, int b, vector short *c)
7254{
7255 __builtin_altivec_stvxl((vector int)a, b, c);
7256}
7257
7258static void __ATTRS_o_ai
7259vec_stvxl(vector short a, int b, short *c)
7260{
7261 __builtin_altivec_stvxl((vector int)a, b, c);
7262}
7263
7264static void __ATTRS_o_ai
7265vec_stvxl(vector unsigned short a, int b, vector unsigned short *c)
7266{
7267 __builtin_altivec_stvxl((vector int)a, b, c);
7268}
7269
7270static void __ATTRS_o_ai
7271vec_stvxl(vector unsigned short a, int b, unsigned short *c)
7272{
7273 __builtin_altivec_stvxl((vector int)a, b, c);
7274}
7275
7276static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007277vec_stvxl(vector bool short a, int b, short *c)
7278{
7279 __builtin_altivec_stvxl((vector int)a, b, c);
7280}
7281
7282static void __ATTRS_o_ai
7283vec_stvxl(vector bool short a, int b, unsigned short *c)
7284{
7285 __builtin_altivec_stvxl((vector int)a, b, c);
7286}
7287
7288static void __ATTRS_o_ai
7289vec_stvxl(vector bool short a, int b, vector bool short *c)
7290{
7291 __builtin_altivec_stvxl((vector int)a, b, c);
7292}
7293
7294static void __ATTRS_o_ai
7295vec_stvxl(vector pixel a, int b, short *c)
7296{
7297 __builtin_altivec_stvxl((vector int)a, b, c);
7298}
7299
7300static void __ATTRS_o_ai
7301vec_stvxl(vector pixel a, int b, unsigned short *c)
7302{
7303 __builtin_altivec_stvxl((vector int)a, b, c);
7304}
7305
7306static void __ATTRS_o_ai
7307vec_stvxl(vector pixel a, int b, vector pixel *c)
7308{
7309 __builtin_altivec_stvxl((vector int)a, b, c);
7310}
7311
7312static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007313vec_stvxl(vector int a, int b, vector int *c)
7314{
7315 __builtin_altivec_stvxl(a, b, c);
7316}
7317
7318static void __ATTRS_o_ai
7319vec_stvxl(vector int a, int b, int *c)
7320{
7321 __builtin_altivec_stvxl(a, b, c);
7322}
7323
7324static void __ATTRS_o_ai
7325vec_stvxl(vector unsigned int a, int b, vector unsigned int *c)
7326{
7327 __builtin_altivec_stvxl((vector int)a, b, c);
7328}
7329
7330static void __ATTRS_o_ai
7331vec_stvxl(vector unsigned int a, int b, unsigned int *c)
7332{
7333 __builtin_altivec_stvxl((vector int)a, b, c);
7334}
7335
7336static void __ATTRS_o_ai
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007337vec_stvxl(vector bool int a, int b, int *c)
7338{
7339 __builtin_altivec_stvxl((vector int)a, b, c);
7340}
7341
7342static void __ATTRS_o_ai
7343vec_stvxl(vector bool int a, int b, unsigned int *c)
7344{
7345 __builtin_altivec_stvxl((vector int)a, b, c);
7346}
7347
7348static void __ATTRS_o_ai
7349vec_stvxl(vector bool int a, int b, vector bool int *c)
7350{
7351 __builtin_altivec_stvxl((vector int)a, b, c);
7352}
7353
7354static void __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007355vec_stvxl(vector float a, int b, vector float *c)
7356{
7357 __builtin_altivec_stvxl((vector int)a, b, c);
7358}
7359
7360static void __ATTRS_o_ai
7361vec_stvxl(vector float a, int b, float *c)
7362{
7363 __builtin_altivec_stvxl((vector int)a, b, c);
7364}
7365
7366/* vec_sub */
7367
7368static vector signed char __ATTRS_o_ai
7369vec_sub(vector signed char a, vector signed char b)
7370{
7371 return a - b;
7372}
7373
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007374static vector signed char __ATTRS_o_ai
7375vec_sub(vector bool char a, vector signed char b)
7376{
7377 return (vector signed char)a - b;
7378}
7379
7380static vector signed char __ATTRS_o_ai
7381vec_sub(vector signed char a, vector bool char b)
7382{
7383 return a - (vector signed char)b;
7384}
7385
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007386static vector unsigned char __ATTRS_o_ai
7387vec_sub(vector unsigned char a, vector unsigned char b)
7388{
7389 return a - b;
7390}
7391
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007392static vector unsigned char __ATTRS_o_ai
7393vec_sub(vector bool char a, vector unsigned char b)
7394{
7395 return (vector unsigned char)a - b;
7396}
7397
7398static vector unsigned char __ATTRS_o_ai
7399vec_sub(vector unsigned char a, vector bool char b)
7400{
7401 return a - (vector unsigned char)b;
7402}
7403
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007404static vector short __ATTRS_o_ai
7405vec_sub(vector short a, vector short b)
7406{
7407 return a - b;
7408}
7409
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007410static vector short __ATTRS_o_ai
7411vec_sub(vector bool short a, vector short b)
7412{
7413 return (vector short)a - b;
7414}
7415
7416static vector short __ATTRS_o_ai
7417vec_sub(vector short a, vector bool short b)
7418{
7419 return a - (vector short)b;
7420}
7421
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007422static vector unsigned short __ATTRS_o_ai
7423vec_sub(vector unsigned short a, vector unsigned short b)
7424{
7425 return a - b;
7426}
7427
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007428static vector unsigned short __ATTRS_o_ai
7429vec_sub(vector bool short a, vector unsigned short b)
7430{
7431 return (vector unsigned short)a - b;
7432}
7433
7434static vector unsigned short __ATTRS_o_ai
7435vec_sub(vector unsigned short a, vector bool short b)
7436{
7437 return a - (vector unsigned short)b;
7438}
7439
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007440static vector int __ATTRS_o_ai
7441vec_sub(vector int a, vector int b)
7442{
7443 return a - b;
7444}
7445
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007446static vector int __ATTRS_o_ai
7447vec_sub(vector bool int a, vector int b)
7448{
7449 return (vector int)a - b;
7450}
7451
7452static vector int __ATTRS_o_ai
7453vec_sub(vector int a, vector bool int b)
7454{
7455 return a - (vector int)b;
7456}
7457
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007458static vector unsigned int __ATTRS_o_ai
7459vec_sub(vector unsigned int a, vector unsigned int b)
7460{
7461 return a - b;
7462}
7463
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007464static vector unsigned int __ATTRS_o_ai
7465vec_sub(vector bool int a, vector unsigned int b)
7466{
7467 return (vector unsigned int)a - b;
7468}
7469
7470static vector unsigned int __ATTRS_o_ai
7471vec_sub(vector unsigned int a, vector bool int b)
7472{
7473 return a - (vector unsigned int)b;
7474}
7475
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007476static vector float __ATTRS_o_ai
7477vec_sub(vector float a, vector float b)
7478{
7479 return a - b;
7480}
7481
7482/* vec_vsububm */
7483
7484#define __builtin_altivec_vsububm vec_vsububm
7485
7486static vector signed char __ATTRS_o_ai
7487vec_vsububm(vector signed char a, vector signed char b)
7488{
7489 return a - b;
7490}
7491
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007492static vector signed char __ATTRS_o_ai
7493vec_vsububm(vector bool char a, vector signed char b)
7494{
7495 return (vector signed char)a - b;
7496}
7497
7498static vector signed char __ATTRS_o_ai
7499vec_vsububm(vector signed char a, vector bool char b)
7500{
7501 return a - (vector signed char)b;
7502}
7503
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007504static vector unsigned char __ATTRS_o_ai
7505vec_vsububm(vector unsigned char a, vector unsigned char b)
7506{
7507 return a - b;
7508}
7509
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007510static vector unsigned char __ATTRS_o_ai
7511vec_vsububm(vector bool char a, vector unsigned char b)
7512{
7513 return (vector unsigned char)a - b;
7514}
7515
7516static vector unsigned char __ATTRS_o_ai
7517vec_vsububm(vector unsigned char a, vector bool char b)
7518{
7519 return a - (vector unsigned char)b;
7520}
7521
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007522/* vec_vsubuhm */
7523
7524#define __builtin_altivec_vsubuhm vec_vsubuhm
7525
7526static vector short __ATTRS_o_ai
7527vec_vsubuhm(vector short a, vector short b)
7528{
7529 return a - b;
7530}
7531
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007532static vector short __ATTRS_o_ai
7533vec_vsubuhm(vector bool short a, vector short b)
7534{
7535 return (vector short)a - b;
7536}
7537
7538static vector short __ATTRS_o_ai
7539vec_vsubuhm(vector short a, vector bool short b)
7540{
7541 return a - (vector short)b;
7542}
7543
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007544static vector unsigned short __ATTRS_o_ai
7545vec_vsubuhm(vector unsigned short a, vector unsigned short b)
7546{
7547 return a - b;
7548}
7549
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007550static vector unsigned short __ATTRS_o_ai
7551vec_vsubuhm(vector bool short a, vector unsigned short b)
7552{
7553 return (vector unsigned short)a - b;
7554}
7555
7556static vector unsigned short __ATTRS_o_ai
7557vec_vsubuhm(vector unsigned short a, vector bool short b)
7558{
7559 return a - (vector unsigned short)b;
7560}
7561
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007562/* vec_vsubuwm */
7563
7564#define __builtin_altivec_vsubuwm vec_vsubuwm
7565
7566static vector int __ATTRS_o_ai
7567vec_vsubuwm(vector int a, vector int b)
7568{
7569 return a - b;
7570}
7571
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007572static vector int __ATTRS_o_ai
7573vec_vsubuwm(vector bool int a, vector int b)
7574{
7575 return (vector int)a - b;
7576}
7577
7578static vector int __ATTRS_o_ai
7579vec_vsubuwm(vector int a, vector bool int b)
7580{
7581 return a - (vector int)b;
7582}
7583
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007584static vector unsigned int __ATTRS_o_ai
7585vec_vsubuwm(vector unsigned int a, vector unsigned int b)
7586{
7587 return a - b;
7588}
7589
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007590static vector unsigned int __ATTRS_o_ai
7591vec_vsubuwm(vector bool int a, vector unsigned int b)
7592{
7593 return (vector unsigned int)a - b;
7594}
7595
7596static vector unsigned int __ATTRS_o_ai
7597vec_vsubuwm(vector unsigned int a, vector bool int b)
7598{
7599 return a - (vector unsigned int)b;
7600}
7601
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007602/* vec_vsubfp */
7603
7604#define __builtin_altivec_vsubfp vec_vsubfp
7605
7606static vector float __attribute__((__always_inline__))
7607vec_vsubfp(vector float a, vector float b)
7608{
7609 return a - b;
7610}
7611
7612/* vec_subc */
7613
7614static vector unsigned int __attribute__((__always_inline__))
7615vec_subc(vector unsigned int a, vector unsigned int b)
7616{
7617 return __builtin_altivec_vsubcuw(a, b);
7618}
7619
7620/* vec_vsubcuw */
7621
7622static vector unsigned int __attribute__((__always_inline__))
7623vec_vsubcuw(vector unsigned int a, vector unsigned int b)
7624{
7625 return __builtin_altivec_vsubcuw(a, b);
7626}
7627
7628/* vec_subs */
7629
7630static vector signed char __ATTRS_o_ai
7631vec_subs(vector signed char a, vector signed char b)
7632{
7633 return __builtin_altivec_vsubsbs(a, b);
7634}
7635
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007636static vector signed char __ATTRS_o_ai
7637vec_subs(vector bool char a, vector signed char b)
7638{
7639 return __builtin_altivec_vsubsbs((vector signed char)a, b);
7640}
7641
7642static vector signed char __ATTRS_o_ai
7643vec_subs(vector signed char a, vector bool char b)
7644{
7645 return __builtin_altivec_vsubsbs(a, (vector signed char)b);
7646}
7647
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007648static vector unsigned char __ATTRS_o_ai
7649vec_subs(vector unsigned char a, vector unsigned char b)
7650{
7651 return __builtin_altivec_vsububs(a, b);
7652}
7653
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007654static vector unsigned char __ATTRS_o_ai
7655vec_subs(vector bool char a, vector unsigned char b)
7656{
7657 return __builtin_altivec_vsububs((vector unsigned char)a, b);
7658}
7659
7660static vector unsigned char __ATTRS_o_ai
7661vec_subs(vector unsigned char a, vector bool char b)
7662{
7663 return __builtin_altivec_vsububs(a, (vector unsigned char)b);
7664}
7665
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007666static vector short __ATTRS_o_ai
7667vec_subs(vector short a, vector short b)
7668{
7669 return __builtin_altivec_vsubshs(a, b);
7670}
7671
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007672static vector short __ATTRS_o_ai
7673vec_subs(vector bool short a, vector short b)
7674{
7675 return __builtin_altivec_vsubshs((vector short)a, b);
7676}
7677
7678static vector short __ATTRS_o_ai
7679vec_subs(vector short a, vector bool short b)
7680{
7681 return __builtin_altivec_vsubshs(a, (vector short)b);
7682}
7683
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007684static vector unsigned short __ATTRS_o_ai
7685vec_subs(vector unsigned short a, vector unsigned short b)
7686{
7687 return __builtin_altivec_vsubuhs(a, b);
7688}
7689
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007690static vector unsigned short __ATTRS_o_ai
7691vec_subs(vector bool short a, vector unsigned short b)
7692{
7693 return __builtin_altivec_vsubuhs((vector unsigned short)a, b);
7694}
7695
7696static vector unsigned short __ATTRS_o_ai
7697vec_subs(vector unsigned short a, vector bool short b)
7698{
7699 return __builtin_altivec_vsubuhs(a, (vector unsigned short)b);
7700}
7701
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007702static vector int __ATTRS_o_ai
7703vec_subs(vector int a, vector int b)
7704{
7705 return __builtin_altivec_vsubsws(a, b);
7706}
7707
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007708static vector int __ATTRS_o_ai
7709vec_subs(vector bool int a, vector int b)
7710{
7711 return __builtin_altivec_vsubsws((vector int)a, b);
7712}
7713
7714static vector int __ATTRS_o_ai
7715vec_subs(vector int a, vector bool int b)
7716{
7717 return __builtin_altivec_vsubsws(a, (vector int)b);
7718}
7719
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007720static vector unsigned int __ATTRS_o_ai
7721vec_subs(vector unsigned int a, vector unsigned int b)
7722{
7723 return __builtin_altivec_vsubuws(a, b);
7724}
7725
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007726static vector unsigned int __ATTRS_o_ai
7727vec_subs(vector bool int a, vector unsigned int b)
7728{
7729 return __builtin_altivec_vsubuws((vector unsigned int)a, b);
7730}
7731
7732static vector unsigned int __ATTRS_o_ai
7733vec_subs(vector unsigned int a, vector bool int b)
7734{
7735 return __builtin_altivec_vsubuws(a, (vector unsigned int)b);
7736}
7737
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007738/* vec_vsubsbs */
7739
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007740static vector signed char __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007741vec_vsubsbs(vector signed char a, vector signed char b)
7742{
7743 return __builtin_altivec_vsubsbs(a, b);
7744}
7745
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007746static vector signed char __ATTRS_o_ai
7747vec_vsubsbs(vector bool char a, vector signed char b)
7748{
7749 return __builtin_altivec_vsubsbs((vector signed char)a, b);
7750}
7751
7752static vector signed char __ATTRS_o_ai
7753vec_vsubsbs(vector signed char a, vector bool char b)
7754{
7755 return __builtin_altivec_vsubsbs(a, (vector signed char)b);
7756}
7757
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007758/* vec_vsububs */
7759
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007760static vector unsigned char __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007761vec_vsububs(vector unsigned char a, vector unsigned char b)
7762{
7763 return __builtin_altivec_vsububs(a, b);
7764}
7765
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007766static vector unsigned char __ATTRS_o_ai
7767vec_vsububs(vector bool char a, vector unsigned char b)
7768{
7769 return __builtin_altivec_vsububs((vector unsigned char)a, b);
7770}
7771
7772static vector unsigned char __ATTRS_o_ai
7773vec_vsububs(vector unsigned char a, vector bool char b)
7774{
7775 return __builtin_altivec_vsububs(a, (vector unsigned char)b);
7776}
7777
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007778/* vec_vsubshs */
7779
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007780static vector short __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007781vec_vsubshs(vector short a, vector short b)
7782{
7783 return __builtin_altivec_vsubshs(a, b);
7784}
7785
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007786static vector short __ATTRS_o_ai
7787vec_vsubshs(vector bool short a, vector short b)
7788{
7789 return __builtin_altivec_vsubshs((vector short)a, b);
7790}
7791
7792static vector short __ATTRS_o_ai
7793vec_vsubshs(vector short a, vector bool short b)
7794{
7795 return __builtin_altivec_vsubshs(a, (vector short)b);
7796}
7797
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007798/* vec_vsubuhs */
7799
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007800static vector unsigned short __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007801vec_vsubuhs(vector unsigned short a, vector unsigned short b)
7802{
7803 return __builtin_altivec_vsubuhs(a, b);
7804}
7805
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007806static vector unsigned short __ATTRS_o_ai
7807vec_vsubuhs(vector bool short a, vector unsigned short b)
7808{
7809 return __builtin_altivec_vsubuhs((vector unsigned short)a, b);
7810}
7811
7812static vector unsigned short __ATTRS_o_ai
7813vec_vsubuhs(vector unsigned short a, vector bool short b)
7814{
7815 return __builtin_altivec_vsubuhs(a, (vector unsigned short)b);
7816}
7817
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007818/* vec_vsubsws */
7819
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007820static vector int __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007821vec_vsubsws(vector int a, vector int b)
7822{
7823 return __builtin_altivec_vsubsws(a, b);
7824}
7825
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007826static vector int __ATTRS_o_ai
7827vec_vsubsws(vector bool int a, vector int b)
7828{
7829 return __builtin_altivec_vsubsws((vector int)a, b);
7830}
7831
7832static vector int __ATTRS_o_ai
7833vec_vsubsws(vector int a, vector bool int b)
7834{
7835 return __builtin_altivec_vsubsws(a, (vector int)b);
7836}
7837
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007838/* vec_vsubuws */
7839
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007840static vector unsigned int __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007841vec_vsubuws(vector unsigned int a, vector unsigned int b)
7842{
7843 return __builtin_altivec_vsubuws(a, b);
7844}
7845
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007846static vector unsigned int __ATTRS_o_ai
7847vec_vsubuws(vector bool int a, vector unsigned int b)
7848{
7849 return __builtin_altivec_vsubuws((vector unsigned int)a, b);
7850}
7851
7852static vector unsigned int __ATTRS_o_ai
7853vec_vsubuws(vector unsigned int a, vector bool int b)
7854{
7855 return __builtin_altivec_vsubuws(a, (vector unsigned int)b);
7856}
7857
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007858/* vec_sum4s */
7859
7860static vector int __ATTRS_o_ai
7861vec_sum4s(vector signed char a, vector int b)
7862{
7863 return __builtin_altivec_vsum4sbs(a, b);
7864}
7865
7866static vector unsigned int __ATTRS_o_ai
7867vec_sum4s(vector unsigned char a, vector unsigned int b)
7868{
7869 return __builtin_altivec_vsum4ubs(a, b);
7870}
7871
7872static vector int __ATTRS_o_ai
7873vec_sum4s(vector signed short a, vector int b)
7874{
7875 return __builtin_altivec_vsum4shs(a, b);
7876}
7877
7878/* vec_vsum4sbs */
7879
7880static vector int __attribute__((__always_inline__))
7881vec_vsum4sbs(vector signed char a, vector int b)
7882{
7883 return __builtin_altivec_vsum4sbs(a, b);
7884}
7885
7886/* vec_vsum4ubs */
7887
7888static vector unsigned int __attribute__((__always_inline__))
7889vec_vsum4ubs(vector unsigned char a, vector unsigned int b)
7890{
7891 return __builtin_altivec_vsum4ubs(a, b);
7892}
7893
7894/* vec_vsum4shs */
7895
7896static vector int __attribute__((__always_inline__))
7897vec_vsum4shs(vector signed short a, vector int b)
7898{
7899 return __builtin_altivec_vsum4shs(a, b);
7900}
7901
7902/* vec_sum2s */
7903
7904static vector signed int __attribute__((__always_inline__))
7905vec_sum2s(vector int a, vector int b)
7906{
7907 return __builtin_altivec_vsum2sws(a, b);
7908}
7909
7910/* vec_vsum2sws */
7911
7912static vector signed int __attribute__((__always_inline__))
7913vec_vsum2sws(vector int a, vector int b)
7914{
7915 return __builtin_altivec_vsum2sws(a, b);
7916}
7917
7918/* vec_sums */
7919
7920static vector signed int __attribute__((__always_inline__))
7921vec_sums(vector signed int a, vector signed int b)
7922{
7923 return __builtin_altivec_vsumsws(a, b);
7924}
7925
7926/* vec_vsumsws */
7927
7928static vector signed int __attribute__((__always_inline__))
7929vec_vsumsws(vector signed int a, vector signed int b)
7930{
7931 return __builtin_altivec_vsumsws(a, b);
7932}
7933
7934/* vec_trunc */
7935
7936static vector float __attribute__((__always_inline__))
7937vec_trunc(vector float a)
7938{
7939 return __builtin_altivec_vrfiz(a);
7940}
7941
7942/* vec_vrfiz */
7943
7944static vector float __attribute__((__always_inline__))
7945vec_vrfiz(vector float a)
7946{
7947 return __builtin_altivec_vrfiz(a);
7948}
7949
7950/* vec_unpackh */
7951
7952static vector short __ATTRS_o_ai
7953vec_unpackh(vector signed char a)
7954{
7955 return __builtin_altivec_vupkhsb((vector char)a);
7956}
7957
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007958static vector bool short __ATTRS_o_ai
7959vec_unpackh(vector bool char a)
7960{
7961 return (vector bool short)__builtin_altivec_vupkhsb((vector char)a);
7962}
7963
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007964static vector int __ATTRS_o_ai
7965vec_unpackh(vector short a)
7966{
7967 return __builtin_altivec_vupkhsh(a);
7968}
7969
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007970static vector bool int __ATTRS_o_ai
7971vec_unpackh(vector bool short a)
7972{
7973 return (vector bool int)__builtin_altivec_vupkhsh((vector short)a);
7974}
7975
7976static vector unsigned int __ATTRS_o_ai
7977vec_unpackh(vector pixel a)
7978{
7979 return (vector unsigned int)__builtin_altivec_vupkhsh((vector short)a);
7980}
7981
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007982/* vec_vupkhsb */
7983
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007984static vector short __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007985vec_vupkhsb(vector signed char a)
7986{
7987 return __builtin_altivec_vupkhsb((vector char)a);
7988}
7989
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007990static vector bool short __ATTRS_o_ai
7991vec_vupkhsb(vector bool char a)
7992{
7993 return (vector bool short)__builtin_altivec_vupkhsb((vector char)a);
7994}
7995
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007996/* vec_vupkhsh */
7997
Anton Yartseva2fc0f52010-08-19 03:21:36 +00007998static vector int __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00007999vec_vupkhsh(vector short a)
8000{
8001 return __builtin_altivec_vupkhsh(a);
8002}
8003
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008004static vector bool int __ATTRS_o_ai
8005vec_vupkhsh(vector bool short a)
8006{
8007 return (vector bool int)__builtin_altivec_vupkhsh((vector short)a);
8008}
8009
8010static vector unsigned int __ATTRS_o_ai
8011vec_vupkhsh(vector pixel a)
8012{
8013 return (vector unsigned int)__builtin_altivec_vupkhsh((vector short)a);
8014}
8015
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008016/* vec_unpackl */
8017
8018static vector short __ATTRS_o_ai
8019vec_unpackl(vector signed char a)
8020{
8021 return __builtin_altivec_vupklsb((vector char)a);
8022}
8023
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008024static vector bool short __ATTRS_o_ai
8025vec_unpackl(vector bool char a)
8026{
8027 return (vector bool short)__builtin_altivec_vupklsb((vector char)a);
8028}
8029
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008030static vector int __ATTRS_o_ai
8031vec_unpackl(vector short a)
8032{
8033 return __builtin_altivec_vupklsh(a);
8034}
8035
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008036static vector bool int __ATTRS_o_ai
8037vec_unpackl(vector bool short a)
8038{
8039 return (vector bool int)__builtin_altivec_vupklsh((vector short)a);
8040}
8041
8042static vector unsigned int __ATTRS_o_ai
8043vec_unpackl(vector pixel a)
8044{
8045 return (vector unsigned int)__builtin_altivec_vupklsh((vector short)a);
8046}
8047
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008048/* vec_vupklsb */
8049
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008050static vector short __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008051vec_vupklsb(vector signed char a)
8052{
8053 return __builtin_altivec_vupklsb((vector char)a);
8054}
8055
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008056static vector bool short __ATTRS_o_ai
8057vec_vupklsb(vector bool char a)
8058{
8059 return (vector bool short)__builtin_altivec_vupklsb((vector char)a);
8060}
8061
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008062/* vec_vupklsh */
8063
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008064static vector int __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008065vec_vupklsh(vector short a)
8066{
8067 return __builtin_altivec_vupklsh(a);
8068}
8069
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008070static vector bool int __ATTRS_o_ai
8071vec_vupklsh(vector bool short a)
8072{
8073 return (vector bool int)__builtin_altivec_vupklsh((vector short)a);
8074}
8075
8076static vector unsigned int __ATTRS_o_ai
8077vec_vupklsh(vector pixel a)
8078{
8079 return (vector unsigned int)__builtin_altivec_vupklsh((vector short)a);
8080}
8081
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008082/* vec_xor */
8083
8084#define __builtin_altivec_vxor vec_xor
8085
8086static vector signed char __ATTRS_o_ai
8087vec_xor(vector signed char a, vector signed char b)
8088{
8089 return a ^ b;
8090}
8091
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008092static vector signed char __ATTRS_o_ai
8093vec_xor(vector bool char a, vector signed char b)
8094{
8095 return (vector signed char)a ^ b;
8096}
8097
8098static vector signed char __ATTRS_o_ai
8099vec_xor(vector signed char a, vector bool char b)
8100{
8101 return a ^ (vector signed char)b;
8102}
8103
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008104static vector unsigned char __ATTRS_o_ai
8105vec_xor(vector unsigned char a, vector unsigned char b)
8106{
8107 return a ^ b;
8108}
8109
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008110static vector unsigned char __ATTRS_o_ai
8111vec_xor(vector bool char a, vector unsigned char b)
8112{
8113 return (vector unsigned char)a ^ b;
8114}
8115
8116static vector unsigned char __ATTRS_o_ai
8117vec_xor(vector unsigned char a, vector bool char b)
8118{
8119 return a ^ (vector unsigned char)b;
8120}
8121
8122static vector bool char __ATTRS_o_ai
8123vec_xor(vector bool char a, vector bool char b)
8124{
8125 return a ^ b;
8126}
8127
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008128static vector short __ATTRS_o_ai
8129vec_xor(vector short a, vector short b)
8130{
8131 return a ^ b;
8132}
8133
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008134static vector short __ATTRS_o_ai
8135vec_xor(vector bool short a, vector short b)
8136{
8137 return (vector short)a ^ b;
8138}
8139
8140static vector short __ATTRS_o_ai
8141vec_xor(vector short a, vector bool short b)
8142{
8143 return a ^ (vector short)b;
8144}
8145
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008146static vector unsigned short __ATTRS_o_ai
8147vec_xor(vector unsigned short a, vector unsigned short b)
8148{
8149 return a ^ b;
8150}
8151
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008152static vector unsigned short __ATTRS_o_ai
8153vec_xor(vector bool short a, vector unsigned short b)
8154{
8155 return (vector unsigned short)a ^ b;
8156}
8157
8158static vector unsigned short __ATTRS_o_ai
8159vec_xor(vector unsigned short a, vector bool short b)
8160{
8161 return a ^ (vector unsigned short)b;
8162}
8163
8164static vector bool short __ATTRS_o_ai
8165vec_xor(vector bool short a, vector bool short b)
8166{
8167 return a ^ b;
8168}
8169
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008170static vector int __ATTRS_o_ai
8171vec_xor(vector int a, vector int b)
8172{
8173 return a ^ b;
8174}
8175
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008176static vector int __ATTRS_o_ai
8177vec_xor(vector bool int a, vector int b)
8178{
8179 return (vector int)a ^ b;
8180}
8181
8182static vector int __ATTRS_o_ai
8183vec_xor(vector int a, vector bool int b)
8184{
8185 return a ^ (vector int)b;
8186}
8187
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008188static vector unsigned int __ATTRS_o_ai
8189vec_xor(vector unsigned int a, vector unsigned int b)
8190{
8191 return a ^ b;
8192}
8193
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008194static vector unsigned int __ATTRS_o_ai
8195vec_xor(vector bool int a, vector unsigned int b)
8196{
8197 return (vector unsigned int)a ^ b;
8198}
8199
8200static vector unsigned int __ATTRS_o_ai
8201vec_xor(vector unsigned int a, vector bool int b)
8202{
8203 return a ^ (vector unsigned int)b;
8204}
8205
8206static vector bool int __ATTRS_o_ai
8207vec_xor(vector bool int a, vector bool int b)
8208{
8209 return a ^ b;
8210}
8211
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008212static vector float __ATTRS_o_ai
8213vec_xor(vector float a, vector float b)
8214{
8215 vector unsigned int res = (vector unsigned int)a ^ (vector unsigned int)b;
8216 return (vector float)res;
8217}
8218
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008219static vector float __ATTRS_o_ai
8220vec_xor(vector bool int a, vector float b)
8221{
8222 vector unsigned int res = (vector unsigned int)a ^ (vector unsigned int)b;
8223 return (vector float)res;
8224}
8225
8226static vector float __ATTRS_o_ai
8227vec_xor(vector float a, vector bool int b)
8228{
8229 vector unsigned int res = (vector unsigned int)a ^ (vector unsigned int)b;
8230 return (vector float)res;
8231}
8232
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008233/* vec_vxor */
8234
8235static vector signed char __ATTRS_o_ai
8236vec_vxor(vector signed char a, vector signed char b)
8237{
8238 return a ^ b;
8239}
8240
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008241static vector signed char __ATTRS_o_ai
8242vec_vxor(vector bool char a, vector signed char b)
8243{
8244 return (vector signed char)a ^ b;
8245}
8246
8247static vector signed char __ATTRS_o_ai
8248vec_vxor(vector signed char a, vector bool char b)
8249{
8250 return a ^ (vector signed char)b;
8251}
8252
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008253static vector unsigned char __ATTRS_o_ai
8254vec_vxor(vector unsigned char a, vector unsigned char b)
8255{
8256 return a ^ b;
8257}
8258
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008259static vector unsigned char __ATTRS_o_ai
8260vec_vxor(vector bool char a, vector unsigned char b)
8261{
8262 return (vector unsigned char)a ^ b;
8263}
8264
8265static vector unsigned char __ATTRS_o_ai
8266vec_vxor(vector unsigned char a, vector bool char b)
8267{
8268 return a ^ (vector unsigned char)b;
8269}
8270
8271static vector bool char __ATTRS_o_ai
8272vec_vxor(vector bool char a, vector bool char b)
8273{
8274 return a ^ b;
8275}
8276
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008277static vector short __ATTRS_o_ai
8278vec_vxor(vector short a, vector short b)
8279{
8280 return a ^ b;
8281}
8282
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008283static vector short __ATTRS_o_ai
8284vec_vxor(vector bool short a, vector short b)
8285{
8286 return (vector short)a ^ b;
8287}
8288
8289static vector short __ATTRS_o_ai
8290vec_vxor(vector short a, vector bool short b)
8291{
8292 return a ^ (vector short)b;
8293}
8294
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008295static vector unsigned short __ATTRS_o_ai
8296vec_vxor(vector unsigned short a, vector unsigned short b)
8297{
8298 return a ^ b;
8299}
8300
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008301static vector unsigned short __ATTRS_o_ai
8302vec_vxor(vector bool short a, vector unsigned short b)
8303{
8304 return (vector unsigned short)a ^ b;
8305}
8306
8307static vector unsigned short __ATTRS_o_ai
8308vec_vxor(vector unsigned short a, vector bool short b)
8309{
8310 return a ^ (vector unsigned short)b;
8311}
8312
8313static vector bool short __ATTRS_o_ai
8314vec_vxor(vector bool short a, vector bool short b)
8315{
8316 return a ^ b;
8317}
8318
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008319static vector int __ATTRS_o_ai
8320vec_vxor(vector int a, vector int b)
8321{
8322 return a ^ b;
8323}
8324
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008325static vector int __ATTRS_o_ai
8326vec_vxor(vector bool int a, vector int b)
8327{
8328 return (vector int)a ^ b;
8329}
8330
8331static vector int __ATTRS_o_ai
8332vec_vxor(vector int a, vector bool int b)
8333{
8334 return a ^ (vector int)b;
8335}
8336
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008337static vector unsigned int __ATTRS_o_ai
8338vec_vxor(vector unsigned int a, vector unsigned int b)
8339{
8340 return a ^ b;
8341}
8342
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008343static vector unsigned int __ATTRS_o_ai
8344vec_vxor(vector bool int a, vector unsigned int b)
8345{
8346 return (vector unsigned int)a ^ b;
8347}
8348
8349static vector unsigned int __ATTRS_o_ai
8350vec_vxor(vector unsigned int a, vector bool int b)
8351{
8352 return a ^ (vector unsigned int)b;
8353}
8354
8355static vector bool int __ATTRS_o_ai
8356vec_vxor(vector bool int a, vector bool int b)
8357{
8358 return a ^ b;
8359}
8360
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008361static vector float __ATTRS_o_ai
8362vec_vxor(vector float a, vector float b)
8363{
8364 vector unsigned int res = (vector unsigned int)a ^ (vector unsigned int)b;
8365 return (vector float)res;
8366}
Chris Lattnerdd173942010-04-14 03:54:58 +00008367
Anton Yartseva2fc0f52010-08-19 03:21:36 +00008368static vector float __ATTRS_o_ai
8369vec_vxor(vector bool int a, vector float b)
8370{
8371 vector unsigned int res = (vector unsigned int)a ^ (vector unsigned int)b;
8372 return (vector float)res;
8373}
8374
8375static vector float __ATTRS_o_ai
8376vec_vxor(vector float a, vector bool int b)
8377{
8378 vector unsigned int res = (vector unsigned int)a ^ (vector unsigned int)b;
8379 return (vector float)res;
8380}
8381
Chris Lattnerdd173942010-04-14 03:54:58 +00008382/* ------------------------------ predicates ------------------------------------ */
8383
Chris Lattnerdd173942010-04-14 03:54:58 +00008384/* vec_all_eq */
8385
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008386static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008387vec_all_eq(vector signed char a, vector signed char b)
8388{
Chris Lattnerab866b42010-04-14 20:35:39 +00008389 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)a, (vector char)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00008390}
8391
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008392static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008393vec_all_eq(vector unsigned char a, vector unsigned char b)
8394{
Chris Lattnerab866b42010-04-14 20:35:39 +00008395 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)a, (vector char)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00008396}
8397
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008398static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008399vec_all_eq(vector short a, vector short b)
8400{
8401 return __builtin_altivec_vcmpequh_p(__CR6_LT, a, b);
8402}
8403
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008404static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008405vec_all_eq(vector unsigned short a, vector unsigned short b)
8406{
Chris Lattnerab866b42010-04-14 20:35:39 +00008407 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)a, (vector short)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00008408}
8409
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008410static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008411vec_all_eq(vector int a, vector int b)
8412{
8413 return __builtin_altivec_vcmpequw_p(__CR6_LT, a, b);
8414}
8415
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008416static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008417vec_all_eq(vector unsigned int a, vector unsigned int b)
8418{
Chris Lattnerab866b42010-04-14 20:35:39 +00008419 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)a, (vector int)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00008420}
8421
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008422static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008423vec_all_eq(vector float a, vector float b)
8424{
8425 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, a, b);
8426}
8427
8428/* vec_all_ge */
8429
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008430static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008431vec_all_ge(vector signed char a, vector signed char b)
8432{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008433 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00008434}
8435
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008436static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008437vec_all_ge(vector unsigned char a, vector unsigned char b)
8438{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008439 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00008440}
8441
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008442static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008443vec_all_ge(vector short a, vector short b)
8444{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008445 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00008446}
8447
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008448static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008449vec_all_ge(vector unsigned short a, vector unsigned short b)
8450{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008451 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00008452}
8453
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008454static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008455vec_all_ge(vector int a, vector int b)
8456{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008457 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00008458}
8459
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008460static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008461vec_all_ge(vector unsigned int a, vector unsigned int b)
8462{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008463 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00008464}
8465
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008466static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008467vec_all_ge(vector float a, vector float b)
8468{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008469 return __builtin_altivec_vcmpgefp_p(__CR6_LT, a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00008470}
8471
8472/* vec_all_gt */
8473
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008474static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008475vec_all_gt(vector signed char a, vector signed char b)
8476{
8477 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, a, b);
8478}
8479
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008480static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008481vec_all_gt(vector unsigned char a, vector unsigned char b)
8482{
8483 return __builtin_altivec_vcmpgtub_p(__CR6_LT, a, b);
8484}
8485
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008486static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008487vec_all_gt(vector short a, vector short b)
8488{
8489 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, a, b);
8490}
8491
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008492static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008493vec_all_gt(vector unsigned short a, vector unsigned short b)
8494{
8495 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, a, b);
8496}
8497
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008498static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008499vec_all_gt(vector int a, vector int b)
8500{
8501 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, a, b);
8502}
8503
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008504static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008505vec_all_gt(vector unsigned int a, vector unsigned int b)
8506{
8507 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, a, b);
8508}
8509
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008510static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008511vec_all_gt(vector float a, vector float b)
8512{
8513 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, a, b);
8514}
8515
8516/* vec_all_in */
8517
8518static int __attribute__((__always_inline__))
8519vec_all_in(vector float a, vector float b)
8520{
8521 return __builtin_altivec_vcmpbfp_p(__CR6_EQ, a, b);
8522}
8523
8524/* vec_all_le */
8525
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008526static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008527vec_all_le(vector signed char a, vector signed char b)
8528{
8529 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, a, b);
8530}
8531
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008532static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008533vec_all_le(vector unsigned char a, vector unsigned char b)
8534{
8535 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, a, b);
8536}
8537
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008538static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008539vec_all_le(vector short a, vector short b)
8540{
8541 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, a, b);
8542}
8543
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008544static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008545vec_all_le(vector unsigned short a, vector unsigned short b)
8546{
8547 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, a, b);
8548}
8549
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008550static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008551vec_all_le(vector int a, vector int b)
8552{
8553 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, a, b);
8554}
8555
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008556static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008557vec_all_le(vector unsigned int a, vector unsigned int b)
8558{
8559 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, a, b);
8560}
8561
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008562static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008563vec_all_le(vector float a, vector float b)
8564{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008565 return __builtin_altivec_vcmpgefp_p(__CR6_LT, b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00008566}
8567
8568/* vec_all_lt */
8569
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008570static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008571vec_all_lt(vector signed char a, vector signed char b)
8572{
8573 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, b, a);
8574}
8575
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008576static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008577vec_all_lt(vector unsigned char a, vector unsigned char b)
8578{
8579 return __builtin_altivec_vcmpgtub_p(__CR6_LT, b, a);
8580}
8581
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008582static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008583vec_all_lt(vector short a, vector short b)
8584{
8585 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, b, a);
8586}
8587
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008588static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008589vec_all_lt(vector unsigned short a, vector unsigned short b)
8590{
8591 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, b, a);
8592}
8593
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008594static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008595vec_all_lt(vector int a, vector int b)
8596{
8597 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, b, a);
8598}
8599
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008600static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008601vec_all_lt(vector unsigned int a, vector unsigned int b)
8602{
8603 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, b, a);
8604}
8605
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008606static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008607vec_all_lt(vector float a, vector float b)
8608{
8609 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, b, a);
8610}
8611
8612/* vec_all_nan */
8613
8614static int __attribute__((__always_inline__))
8615vec_all_nan(vector float a)
8616{
8617 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, a, a);
8618}
8619
8620/* vec_all_ne */
8621
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008622static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008623vec_all_ne(vector signed char a, vector signed char b)
8624{
Chris Lattnerab866b42010-04-14 20:35:39 +00008625 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)a, (vector char)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00008626}
8627
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008628static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008629vec_all_ne(vector unsigned char a, vector unsigned char b)
8630{
Chris Lattnerab866b42010-04-14 20:35:39 +00008631 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)a, (vector char)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00008632}
8633
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008634static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008635vec_all_ne(vector short a, vector short b)
8636{
8637 return __builtin_altivec_vcmpequh_p(__CR6_EQ, a, b);
8638}
8639
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008640static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008641vec_all_ne(vector unsigned short a, vector unsigned short b)
8642{
Chris Lattnerab866b42010-04-14 20:35:39 +00008643 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)a, (vector short)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00008644}
8645
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008646static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008647vec_all_ne(vector int a, vector int b)
8648{
8649 return __builtin_altivec_vcmpequw_p(__CR6_EQ, a, b);
8650}
8651
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008652static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008653vec_all_ne(vector unsigned int a, vector unsigned int b)
8654{
Chris Lattnerab866b42010-04-14 20:35:39 +00008655 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)a, (vector int)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00008656}
8657
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008658static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008659vec_all_ne(vector float a, vector float b)
8660{
8661 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, a, b);
8662}
8663
8664/* vec_all_nge */
8665
8666static int __attribute__((__always_inline__))
8667vec_all_nge(vector float a, vector float b)
8668{
8669 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, a, b);
8670}
8671
8672/* vec_all_ngt */
8673
8674static int __attribute__((__always_inline__))
8675vec_all_ngt(vector float a, vector float b)
8676{
8677 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, a, b);
8678}
8679
8680/* vec_all_nle */
8681
8682static int __attribute__((__always_inline__))
8683vec_all_nle(vector float a, vector float b)
8684{
8685 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, b, a);
8686}
8687
8688/* vec_all_nlt */
8689
8690static int __attribute__((__always_inline__))
8691vec_all_nlt(vector float a, vector float b)
8692{
8693 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, b, a);
8694}
8695
8696/* vec_all_numeric */
8697
8698static int __attribute__((__always_inline__))
8699vec_all_numeric(vector float a)
8700{
8701 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, a, a);
8702}
8703
8704/* vec_any_eq */
8705
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008706static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008707vec_any_eq(vector signed char a, vector signed char b)
8708{
Chris Lattnerab866b42010-04-14 20:35:39 +00008709 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)a, (vector char)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00008710}
8711
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008712static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008713vec_any_eq(vector unsigned char a, vector unsigned char b)
8714{
Chris Lattnerab866b42010-04-14 20:35:39 +00008715 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)a, (vector char)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00008716}
8717
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008718static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008719vec_any_eq(vector short a, vector short b)
8720{
8721 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, a, b);
8722}
8723
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008724static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008725vec_any_eq(vector unsigned short a, vector unsigned short b)
8726{
Chris Lattnerab866b42010-04-14 20:35:39 +00008727 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)a, (vector short)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00008728}
8729
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008730static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008731vec_any_eq(vector int a, vector int b)
8732{
8733 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, a, b);
8734}
8735
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008736static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008737vec_any_eq(vector unsigned int a, vector unsigned int b)
8738{
Chris Lattnerab866b42010-04-14 20:35:39 +00008739 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)a, (vector int)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00008740}
8741
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008742static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008743vec_any_eq(vector float a, vector float b)
8744{
8745 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, a, b);
8746}
8747
8748/* vec_any_ge */
8749
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008750static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008751vec_any_ge(vector signed char a, vector signed char b)
8752{
8753 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, b, a);
8754}
8755
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008756static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008757vec_any_ge(vector unsigned char a, vector unsigned char b)
8758{
8759 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, b, a);
8760}
8761
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008762static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008763vec_any_ge(vector short a, vector short b)
8764{
8765 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, b, a);
8766}
8767
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008768static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008769vec_any_ge(vector unsigned short a, vector unsigned short b)
8770{
8771 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, b, a);
8772}
8773
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008774static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008775vec_any_ge(vector int a, vector int b)
8776{
8777 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, b, a);
8778}
8779
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008780static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008781vec_any_ge(vector unsigned int a, vector unsigned int b)
8782{
8783 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, b, a);
8784}
8785
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008786static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008787vec_any_ge(vector float a, vector float b)
8788{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008789 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00008790}
8791
8792/* vec_any_gt */
8793
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008794static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008795vec_any_gt(vector signed char a, vector signed char b)
8796{
8797 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, a, b);
8798}
8799
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008800static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008801vec_any_gt(vector unsigned char a, vector unsigned char b)
8802{
8803 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, a, b);
8804}
8805
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008806static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008807vec_any_gt(vector short a, vector short b)
8808{
8809 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, a, b);
8810}
8811
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008812static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008813vec_any_gt(vector unsigned short a, vector unsigned short b)
8814{
8815 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, a, b);
8816}
8817
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008818static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008819vec_any_gt(vector int a, vector int b)
8820{
8821 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, a, b);
8822}
8823
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008824static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008825vec_any_gt(vector unsigned int a, vector unsigned int b)
8826{
8827 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, a, b);
8828}
8829
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008830static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008831vec_any_gt(vector float a, vector float b)
8832{
8833 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, a, b);
8834}
8835
8836/* vec_any_le */
8837
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008838static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008839vec_any_le(vector signed char a, vector signed char b)
8840{
8841 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, a, b);
8842}
8843
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008844static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008845vec_any_le(vector unsigned char a, vector unsigned char b)
8846{
8847 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, a, b);
8848}
8849
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008850static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008851vec_any_le(vector short a, vector short b)
8852{
8853 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, a, b);
8854}
8855
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008856static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008857vec_any_le(vector unsigned short a, vector unsigned short b)
8858{
8859 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, a, b);
8860}
8861
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008862static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008863vec_any_le(vector int a, vector int b)
8864{
8865 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, a, b);
8866}
8867
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008868static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008869vec_any_le(vector unsigned int a, vector unsigned int b)
8870{
8871 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, a, b);
8872}
8873
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008874static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008875vec_any_le(vector float a, vector float b)
8876{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008877 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00008878}
8879
8880/* vec_any_lt */
8881
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008882static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008883vec_any_lt(vector signed char a, vector signed char b)
8884{
8885 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, b, a);
8886}
8887
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008888static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008889vec_any_lt(vector unsigned char a, vector unsigned char b)
8890{
8891 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, b, a);
8892}
8893
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008894static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008895vec_any_lt(vector short a, vector short b)
8896{
8897 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, b, a);
8898}
8899
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008900static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008901vec_any_lt(vector unsigned short a, vector unsigned short b)
8902{
8903 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, b, a);
8904}
8905
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008906static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008907vec_any_lt(vector int a, vector int b)
8908{
8909 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, b, a);
8910}
8911
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008912static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008913vec_any_lt(vector unsigned int a, vector unsigned int b)
8914{
8915 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, b, a);
8916}
8917
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008918static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008919vec_any_lt(vector float a, vector float b)
8920{
8921 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, b, a);
8922}
8923
8924/* vec_any_nan */
8925
8926static int __attribute__((__always_inline__))
8927vec_any_nan(vector float a)
8928{
8929 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, a, a);
8930}
8931
8932/* vec_any_ne */
8933
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008934static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008935vec_any_ne(vector signed char a, vector signed char b)
8936{
Chris Lattnerab866b42010-04-14 20:35:39 +00008937 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)a, (vector char)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00008938}
8939
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008940static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008941vec_any_ne(vector unsigned char a, vector unsigned char b)
8942{
Chris Lattnerab866b42010-04-14 20:35:39 +00008943 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)a, (vector char)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00008944}
8945
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008946static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008947vec_any_ne(vector short a, vector short b)
8948{
8949 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, a, b);
8950}
8951
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008952static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008953vec_any_ne(vector unsigned short a, vector unsigned short b)
8954{
Chris Lattnerab866b42010-04-14 20:35:39 +00008955 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)a, (vector short)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00008956}
8957
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008958static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008959vec_any_ne(vector int a, vector int b)
8960{
8961 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, a, b);
8962}
8963
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008964static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008965vec_any_ne(vector unsigned int a, vector unsigned int b)
8966{
Chris Lattnerab866b42010-04-14 20:35:39 +00008967 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)a, (vector int)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00008968}
8969
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00008970static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00008971vec_any_ne(vector float a, vector float b)
8972{
8973 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, a, b);
8974}
8975
8976/* vec_any_nge */
8977
8978static int __attribute__((__always_inline__))
8979vec_any_nge(vector float a, vector float b)
8980{
8981 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, a, b);
8982}
8983
8984/* vec_any_ngt */
8985
8986static int __attribute__((__always_inline__))
8987vec_any_ngt(vector float a, vector float b)
8988{
8989 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, a, b);
8990}
8991
8992/* vec_any_nle */
8993
8994static int __attribute__((__always_inline__))
8995vec_any_nle(vector float a, vector float b)
8996{
8997 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, b, a);
8998}
8999
9000/* vec_any_nlt */
9001
9002static int __attribute__((__always_inline__))
9003vec_any_nlt(vector float a, vector float b)
9004{
9005 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, b, a);
9006}
9007
9008/* vec_any_numeric */
9009
9010static int __attribute__((__always_inline__))
9011vec_any_numeric(vector float a)
9012{
9013 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, a, a);
9014}
9015
9016/* vec_any_out */
9017
9018static int __attribute__((__always_inline__))
9019vec_any_out(vector float a, vector float b)
9020{
9021 return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, a, b);
9022}
9023
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00009024#undef __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00009025
9026#endif /* __ALTIVEC_H */