blob: d7e514aad64e71515fff1c15826c139fa8461c89 [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
48static vector short __ATTRS_o_ai
49vec_perm(vector short a, vector short b, vector unsigned char c);
50
51static vector unsigned short __ATTRS_o_ai
52vec_perm(vector unsigned short a, vector unsigned short b, vector unsigned char c);
53
54static vector int __ATTRS_o_ai
55vec_perm(vector int a, vector int b, vector unsigned char c);
56
57static vector unsigned int __ATTRS_o_ai
58vec_perm(vector unsigned int a, vector unsigned int b, vector unsigned char c);
59
60static vector float __ATTRS_o_ai
61vec_perm(vector float a, vector float b, vector unsigned char c);
Chris Lattnerdd173942010-04-14 03:54:58 +000062
63/* vec_abs */
64
Chris Lattnerdd173942010-04-14 03:54:58 +000065#define __builtin_altivec_abs_v16qi vec_abs
66#define __builtin_altivec_abs_v8hi vec_abs
67#define __builtin_altivec_abs_v4si vec_abs
68
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000069static vector signed char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +000070vec_abs(vector signed char a)
71{
72 return __builtin_altivec_vmaxsb(a, -a);
73}
74
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000075static vector signed short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +000076vec_abs(vector signed short a)
77{
78 return __builtin_altivec_vmaxsh(a, -a);
79}
80
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000081static vector signed int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +000082vec_abs(vector signed int a)
83{
84 return __builtin_altivec_vmaxsw(a, -a);
85}
86
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000087static vector float __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +000088vec_abs(vector float a)
89{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +000090 vector unsigned int res = (vector unsigned int)a & (vector unsigned int)(0x7FFFFFFF);
Chris Lattnerab866b42010-04-14 20:35:39 +000091 return (vector float)res;
Chris Lattnerdd173942010-04-14 03:54:58 +000092}
93
94/* vec_abss */
95
Chris Lattnerdd173942010-04-14 03:54:58 +000096#define __builtin_altivec_abss_v16qi vec_abss
97#define __builtin_altivec_abss_v8hi vec_abss
98#define __builtin_altivec_abss_v4si vec_abss
99
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000100static vector signed char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000101vec_abss(vector signed char a)
102{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000103 return __builtin_altivec_vmaxsb(a, __builtin_altivec_vsubsbs((vector signed char)(0), a));
Chris Lattnerdd173942010-04-14 03:54:58 +0000104}
105
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000106static vector signed short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000107vec_abss(vector signed short a)
108{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000109 return __builtin_altivec_vmaxsh(a, __builtin_altivec_vsubshs((vector signed short)(0), a));
Chris Lattnerdd173942010-04-14 03:54:58 +0000110}
111
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000112static vector signed int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000113vec_abss(vector signed int a)
114{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000115 return __builtin_altivec_vmaxsw(a, __builtin_altivec_vsubsws((vector signed int)(0), a));
Chris Lattnerdd173942010-04-14 03:54:58 +0000116}
117
118/* vec_add */
119
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000120static vector signed char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000121vec_add(vector signed char a, vector signed char b)
122{
123 return a + b;
124}
125
Anton Yartsev05e35552010-08-16 16:22:12 +0000126static vector signed char __ATTRS_o_ai
127vec_add(vector bool char a, vector signed char b)
128{
129 return (vector signed char)a + b;
130}
131
132static vector signed char __ATTRS_o_ai
133vec_add(vector signed char a, vector bool char b)
134{
135 return a + (vector signed char)b;
136}
137
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000138static vector unsigned char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000139vec_add(vector unsigned char a, vector unsigned char b)
140{
141 return a + b;
142}
143
Anton Yartsev05e35552010-08-16 16:22:12 +0000144static vector unsigned char __ATTRS_o_ai
145vec_add(vector bool char a, vector unsigned char b)
146{
147 return (vector unsigned char)a + b;
148}
149
150static vector unsigned char __ATTRS_o_ai
151vec_add(vector unsigned char a, vector bool char b)
152{
153 return a + (vector unsigned char)b;
154}
155
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000156static vector short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000157vec_add(vector short a, vector short b)
158{
159 return a + b;
160}
161
Anton Yartsev05e35552010-08-16 16:22:12 +0000162static vector short __ATTRS_o_ai
163vec_add(vector bool short a, vector short b)
164{
165 return (vector short)a + b;
166}
167
168static vector short __ATTRS_o_ai
169vec_add(vector short a, vector bool short b)
170{
171 return a + (vector short)b;
172}
173
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000174static vector unsigned short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000175vec_add(vector unsigned short a, vector unsigned short b)
176{
177 return a + b;
178}
179
Anton Yartsev05e35552010-08-16 16:22:12 +0000180static vector unsigned short __ATTRS_o_ai
181vec_add(vector bool short a, vector unsigned short b)
182{
183 return (vector unsigned short)a + b;
184}
185
186static vector unsigned short __ATTRS_o_ai
187vec_add(vector unsigned short a, vector bool short b)
188{
189 return a + (vector unsigned short)b;
190}
191
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000192static vector int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000193vec_add(vector int a, vector int b)
194{
195 return a + b;
196}
197
Anton Yartsev05e35552010-08-16 16:22:12 +0000198static vector int __ATTRS_o_ai
199vec_add(vector bool int a, vector int b)
200{
201 return (vector int)a + b;
202}
203
204static vector int __ATTRS_o_ai
205vec_add(vector int a, vector bool int b)
206{
207 return a + (vector int)b;
208}
209
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000210static vector unsigned int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000211vec_add(vector unsigned int a, vector unsigned int b)
212{
213 return a + b;
214}
215
Anton Yartsev05e35552010-08-16 16:22:12 +0000216static vector unsigned int __ATTRS_o_ai
217vec_add(vector bool int a, vector unsigned int b)
218{
219 return (vector unsigned int)a + b;
220}
221
222static vector unsigned int __ATTRS_o_ai
223vec_add(vector unsigned int a, vector bool int b)
224{
225 return a + (vector unsigned int)b;
226}
227
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000228static vector float __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000229vec_add(vector float a, vector float b)
230{
231 return a + b;
232}
233
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000234/* vec_vaddubm */
235
236#define __builtin_altivec_vaddubm vec_vaddubm
237
238static vector signed char __ATTRS_o_ai
239vec_vaddubm(vector signed char a, vector signed char b)
240{
241 return a + b;
242}
243
Anton Yartsev05e35552010-08-16 16:22:12 +0000244static vector signed char __ATTRS_o_ai
245vec_vaddubm(vector bool char a, vector signed char b)
246{
247 return (vector signed char)a + b;
248}
249
250static vector signed char __ATTRS_o_ai
251vec_vaddubm(vector signed char a, vector bool char b)
252{
253 return a + (vector signed char)b;
254}
255
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000256static vector unsigned char __ATTRS_o_ai
257vec_vaddubm(vector unsigned char a, vector unsigned char b)
258{
259 return a + b;
260}
261
Anton Yartsev05e35552010-08-16 16:22:12 +0000262static vector unsigned char __ATTRS_o_ai
263vec_vaddubm(vector bool char a, vector unsigned char b)
264{
265 return (vector unsigned char)a + b;
266}
267
268static vector unsigned char __ATTRS_o_ai
269vec_vaddubm(vector unsigned char a, vector bool char b)
270{
271 return a + (vector unsigned char)b;
272}
273
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000274/* vec_vadduhm */
275
276#define __builtin_altivec_vadduhm vec_vadduhm
277
278static vector short __ATTRS_o_ai
279vec_vadduhm(vector short a, vector short b)
280{
281 return a + b;
282}
283
Anton Yartsev05e35552010-08-16 16:22:12 +0000284static vector short __ATTRS_o_ai
285vec_vadduhm(vector bool short a, vector short b)
286{
287 return (vector short)a + b;
288}
289
290static vector short __ATTRS_o_ai
291vec_vadduhm(vector short a, vector bool short b)
292{
293 return a + (vector short)b;
294}
295
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000296static vector unsigned short __ATTRS_o_ai
297vec_vadduhm(vector unsigned short a, vector unsigned short b)
298{
299 return a + b;
300}
301
Anton Yartsev05e35552010-08-16 16:22:12 +0000302static vector unsigned short __ATTRS_o_ai
303vec_vadduhm(vector bool short a, vector unsigned short b)
304{
305 return (vector unsigned short)a + b;
306}
307
308static vector unsigned short __ATTRS_o_ai
309vec_vadduhm(vector unsigned short a, vector bool short b)
310{
311 return a + (vector unsigned short)b;
312}
313
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000314/* vec_vadduwm */
315
316#define __builtin_altivec_vadduwm vec_vadduwm
317
318static vector int __ATTRS_o_ai
319vec_vadduwm(vector int a, vector int b)
320{
321 return a + b;
322}
323
Anton Yartsev05e35552010-08-16 16:22:12 +0000324static vector int __ATTRS_o_ai
325vec_vadduwm(vector bool int a, vector int b)
326{
327 return (vector int)a + b;
328}
329
330static vector int __ATTRS_o_ai
331vec_vadduwm(vector int a, vector bool int b)
332{
333 return a + (vector int)b;
334}
335
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000336static vector unsigned int __ATTRS_o_ai
337vec_vadduwm(vector unsigned int a, vector unsigned int b)
338{
339 return a + b;
340}
341
Anton Yartsev05e35552010-08-16 16:22:12 +0000342static vector unsigned int __ATTRS_o_ai
343vec_vadduwm(vector bool int a, vector unsigned int b)
344{
345 return (vector unsigned int)a + b;
346}
347
348static vector unsigned int __ATTRS_o_ai
349vec_vadduwm(vector unsigned int a, vector bool int b)
350{
351 return a + (vector unsigned int)b;
352}
353
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000354/* vec_vaddfp */
355
356#define __builtin_altivec_vaddfp vec_vaddfp
357
358static vector float __attribute__((__always_inline__))
359vec_vaddfp(vector float a, vector float b)
360{
361 return a + b;
362}
363
Chris Lattnerdd173942010-04-14 03:54:58 +0000364/* vec_addc */
365
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000366static vector unsigned int __attribute__((__always_inline__))
367vec_addc(vector unsigned int a, vector unsigned int b)
368{
369 return __builtin_altivec_vaddcuw(a, b);
370}
371
372/* vec_vaddcuw */
373
374static vector unsigned int __attribute__((__always_inline__))
375vec_vaddcuw(vector unsigned int a, vector unsigned int b)
376{
377 return __builtin_altivec_vaddcuw(a, b);
378}
Chris Lattnerdd173942010-04-14 03:54:58 +0000379
380/* vec_adds */
381
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000382static vector signed char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000383vec_adds(vector signed char a, vector signed char b)
384{
385 return __builtin_altivec_vaddsbs(a, b);
386}
387
Anton Yartsev05e35552010-08-16 16:22:12 +0000388static vector signed char __ATTRS_o_ai
389vec_adds(vector bool char a, vector signed char b)
390{
391 return __builtin_altivec_vaddsbs((vector signed char)a, b);
392}
393
394static vector signed char __ATTRS_o_ai
395vec_adds(vector signed char a, vector bool char b)
396{
397 return __builtin_altivec_vaddsbs(a, (vector signed char)b);
398}
399
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000400static vector unsigned char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000401vec_adds(vector unsigned char a, vector unsigned char b)
402{
403 return __builtin_altivec_vaddubs(a, b);
404}
405
Anton Yartsev05e35552010-08-16 16:22:12 +0000406static vector unsigned char __ATTRS_o_ai
407vec_adds(vector bool char a, vector unsigned char b)
408{
409 return __builtin_altivec_vaddubs((vector unsigned char)a, b);
410}
411
412static vector unsigned char __ATTRS_o_ai
413vec_adds(vector unsigned char a, vector bool char b)
414{
415 return __builtin_altivec_vaddubs(a, (vector unsigned char)b);
416}
417
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000418static vector short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000419vec_adds(vector short a, vector short b)
420{
421 return __builtin_altivec_vaddshs(a, b);
422}
423
Anton Yartsev05e35552010-08-16 16:22:12 +0000424static vector short __ATTRS_o_ai
425vec_adds(vector bool short a, vector short b)
426{
427 return __builtin_altivec_vaddshs((vector short)a, b);
428}
429
430static vector short __ATTRS_o_ai
431vec_adds(vector short a, vector bool short b)
432{
433 return __builtin_altivec_vaddshs(a, (vector short)b);
434}
435
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000436static vector unsigned short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000437vec_adds(vector unsigned short a, vector unsigned short b)
438{
439 return __builtin_altivec_vadduhs(a, b);
440}
441
Anton Yartsev05e35552010-08-16 16:22:12 +0000442static vector unsigned short __ATTRS_o_ai
443vec_adds(vector bool short a, vector unsigned short b)
444{
445 return __builtin_altivec_vadduhs((vector unsigned short)a, b);
446}
447
448static vector unsigned short __ATTRS_o_ai
449vec_adds(vector unsigned short a, vector bool short b)
450{
451 return __builtin_altivec_vadduhs(a, (vector unsigned short)b);
452}
453
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000454static vector int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000455vec_adds(vector int a, vector int b)
456{
457 return __builtin_altivec_vaddsws(a, b);
458}
459
Anton Yartsev05e35552010-08-16 16:22:12 +0000460static vector int __ATTRS_o_ai
461vec_adds(vector bool int a, vector int b)
462{
463 return __builtin_altivec_vaddsws((vector int)a, b);
464}
465
466static vector int __ATTRS_o_ai
467vec_adds(vector int a, vector bool int b)
468{
469 return __builtin_altivec_vaddsws(a, (vector int)b);
470}
471
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000472static vector unsigned int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +0000473vec_adds(vector unsigned int a, vector unsigned int b)
474{
475 return __builtin_altivec_vadduws(a, b);
476}
477
Anton Yartsev05e35552010-08-16 16:22:12 +0000478static vector unsigned int __ATTRS_o_ai
479vec_adds(vector bool int a, vector unsigned int b)
480{
481 return __builtin_altivec_vadduws((vector unsigned int)a, b);
482}
483
484static vector unsigned int __ATTRS_o_ai
485vec_adds(vector unsigned int a, vector bool int b)
486{
487 return __builtin_altivec_vadduws(a, (vector unsigned int)b);
488}
489
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000490/* vec_vaddsbs */
Chris Lattnerdd173942010-04-14 03:54:58 +0000491
Anton Yartsev05e35552010-08-16 16:22:12 +0000492static vector signed char __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000493vec_vaddsbs(vector signed char a, vector signed char b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000494{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000495 return __builtin_altivec_vaddsbs(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +0000496}
497
Anton Yartsev05e35552010-08-16 16:22:12 +0000498static vector signed char __ATTRS_o_ai
499vec_vaddsbs(vector bool char a, vector signed char b)
500{
501 return __builtin_altivec_vaddsbs((vector signed char)a, b);
502}
503
504static vector signed char __ATTRS_o_ai
505vec_vaddsbs(vector signed char a, vector bool char b)
506{
507 return __builtin_altivec_vaddsbs(a, (vector signed char)b);
508}
509
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000510/* vec_vaddubs */
511
Anton Yartsev05e35552010-08-16 16:22:12 +0000512static vector unsigned char __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000513vec_vaddubs(vector unsigned char a, vector unsigned char b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000514{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000515 return __builtin_altivec_vaddubs(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +0000516}
517
Anton Yartsev05e35552010-08-16 16:22:12 +0000518static vector unsigned char __ATTRS_o_ai
519vec_vaddubs(vector bool char a, vector unsigned char b)
520{
521 return __builtin_altivec_vaddubs((vector unsigned char)a, b);
522}
523
524static vector unsigned char __ATTRS_o_ai
525vec_vaddubs(vector unsigned char a, vector bool char b)
526{
527 return __builtin_altivec_vaddubs(a, (vector unsigned char)b);
528}
529
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000530/* vec_vaddshs */
531
Anton Yartsev05e35552010-08-16 16:22:12 +0000532static vector short __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000533vec_vaddshs(vector short a, vector short b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000534{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000535 return __builtin_altivec_vaddshs(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +0000536}
537
Anton Yartsev05e35552010-08-16 16:22:12 +0000538static vector short __ATTRS_o_ai
539vec_vaddshs(vector bool short a, vector short b)
540{
541 return __builtin_altivec_vaddshs((vector short)a, b);
542}
543
544static vector short __ATTRS_o_ai
545vec_vaddshs(vector short a, vector bool short b)
546{
547 return __builtin_altivec_vaddshs(a, (vector short)b);
548}
549
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000550/* vec_vadduhs */
551
Anton Yartsev05e35552010-08-16 16:22:12 +0000552static vector unsigned short __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000553vec_vadduhs(vector unsigned short a, vector unsigned short b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000554{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000555 return __builtin_altivec_vadduhs(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +0000556}
557
Anton Yartsev05e35552010-08-16 16:22:12 +0000558static vector unsigned short __ATTRS_o_ai
559vec_vadduhs(vector bool short a, vector unsigned short b)
560{
561 return __builtin_altivec_vadduhs((vector unsigned short)a, b);
562}
563
564static vector unsigned short __ATTRS_o_ai
565vec_vadduhs(vector unsigned short a, vector bool short b)
566{
567 return __builtin_altivec_vadduhs(a, (vector unsigned short)b);
568}
569
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000570/* vec_vaddsws */
571
Anton Yartsev05e35552010-08-16 16:22:12 +0000572static vector int __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000573vec_vaddsws(vector int a, vector int b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000574{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000575 return __builtin_altivec_vaddsws(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +0000576}
577
Anton Yartsev05e35552010-08-16 16:22:12 +0000578static vector int __ATTRS_o_ai
579vec_vaddsws(vector bool int a, vector int b)
580{
581 return __builtin_altivec_vaddsws((vector int)a, b);
582}
583
584static vector int __ATTRS_o_ai
585vec_vaddsws(vector int a, vector bool int b)
586{
587 return __builtin_altivec_vaddsws(a, (vector int)b);
588}
589
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000590/* vec_vadduws */
591
Anton Yartsev05e35552010-08-16 16:22:12 +0000592static vector unsigned int __ATTRS_o_ai
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000593vec_vadduws(vector unsigned int a, vector unsigned int b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000594{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000595 return __builtin_altivec_vadduws(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +0000596}
597
Anton Yartsev05e35552010-08-16 16:22:12 +0000598static vector unsigned int __ATTRS_o_ai
599vec_vadduws(vector bool int a, vector unsigned int b)
600{
601 return __builtin_altivec_vadduws((vector unsigned int)a, b);
602}
603
604static vector unsigned int __ATTRS_o_ai
605vec_vadduws(vector unsigned int a, vector bool int b)
606{
607 return __builtin_altivec_vadduws(a, (vector unsigned int)b);
608}
609
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000610/* vec_and */
611
612#define __builtin_altivec_vand vec_and
613
614static vector signed char __ATTRS_o_ai
615vec_and(vector signed char a, vector signed char b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000616{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000617 return a & b;
Chris Lattnerdd173942010-04-14 03:54:58 +0000618}
619
Anton Yartsev05e35552010-08-16 16:22:12 +0000620static vector signed char __ATTRS_o_ai
621vec_and(vector bool char a, vector signed char b)
622{
623 return (vector signed char)a & b;
624}
625
626static vector signed char __ATTRS_o_ai
627vec_and(vector signed char a, vector bool char b)
628{
629 return a & (vector signed char)b;
630}
631
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000632static vector unsigned char __ATTRS_o_ai
633vec_and(vector unsigned char a, vector unsigned char b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000634{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000635 return a & b;
Chris Lattnerdd173942010-04-14 03:54:58 +0000636}
637
Anton Yartsev05e35552010-08-16 16:22:12 +0000638static vector unsigned char __ATTRS_o_ai
639vec_and(vector bool char a, vector unsigned char b)
640{
641 return (vector unsigned char)a & b;
642}
643
644static vector unsigned char __ATTRS_o_ai
645vec_and(vector unsigned char a, vector bool char b)
646{
647 return a & (vector unsigned char)b;
648}
649
650static vector bool char __ATTRS_o_ai
651vec_and(vector bool char a, vector bool char b)
652{
653 return a & b;
654}
655
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000656static vector short __ATTRS_o_ai
657vec_and(vector short a, vector short b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000658{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000659 return a & b;
Chris Lattnerdd173942010-04-14 03:54:58 +0000660}
661
Anton Yartsev05e35552010-08-16 16:22:12 +0000662static vector short __ATTRS_o_ai
663vec_and(vector bool short a, vector short b)
664{
665 return (vector short)a & b;
666}
667
668static vector short __ATTRS_o_ai
669vec_and(vector short a, vector bool short b)
670{
671 return a & (vector short)b;
672}
673
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000674static vector unsigned short __ATTRS_o_ai
675vec_and(vector unsigned short a, vector unsigned short b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000676{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000677 return a & b;
Chris Lattnerdd173942010-04-14 03:54:58 +0000678}
679
Anton Yartsev05e35552010-08-16 16:22:12 +0000680static vector unsigned short __ATTRS_o_ai
681vec_and(vector bool short a, vector unsigned short b)
682{
683 return (vector unsigned short)a & b;
684}
685
686static vector unsigned short __ATTRS_o_ai
687vec_and(vector unsigned short a, vector bool short b)
688{
689 return a & (vector unsigned short)b;
690}
691
692static vector bool short __ATTRS_o_ai
693vec_and(vector bool short a, vector bool short b)
694{
695 return a & b;
696}
697
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000698static vector int __ATTRS_o_ai
699vec_and(vector int a, vector int b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000700{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000701 return a & b;
Chris Lattnerdd173942010-04-14 03:54:58 +0000702}
703
Anton Yartsev05e35552010-08-16 16:22:12 +0000704static vector int __ATTRS_o_ai
705vec_and(vector bool int a, vector int b)
706{
707 return (vector int)a & b;
708}
709
710static vector int __ATTRS_o_ai
711vec_and(vector int a, vector bool int b)
712{
713 return a & (vector int)b;
714}
715
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000716static vector unsigned int __ATTRS_o_ai
717vec_and(vector unsigned int a, vector unsigned int b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000718{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000719 return a & b;
Chris Lattnerdd173942010-04-14 03:54:58 +0000720}
721
Anton Yartsev05e35552010-08-16 16:22:12 +0000722static vector unsigned int __ATTRS_o_ai
723vec_and(vector bool int a, vector unsigned int b)
724{
725 return (vector unsigned int)a & b;
726}
727
728static vector unsigned int __ATTRS_o_ai
729vec_and(vector unsigned int a, vector bool int b)
730{
731 return a & (vector unsigned int)b;
732}
733
734static vector bool int __ATTRS_o_ai
735vec_and(vector bool int a, vector bool int b)
736{
737 return a & b;
738}
739
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000740static vector float __ATTRS_o_ai
741vec_and(vector float a, vector float b)
Chris Lattnerdd173942010-04-14 03:54:58 +0000742{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000743 vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b;
744 return (vector float)res;
745}
746
Anton Yartsev05e35552010-08-16 16:22:12 +0000747static vector float __ATTRS_o_ai
748vec_and(vector bool int a, vector float b)
749{
750 vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b;
751 return (vector float)res;
752}
753
754static vector float __ATTRS_o_ai
755vec_and(vector float a, vector bool int b)
756{
757 vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b;
758 return (vector float)res;
759}
760
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000761/* vec_vand */
762
763static vector signed char __ATTRS_o_ai
764vec_vand(vector signed char a, vector signed char b)
765{
766 return a & b;
767}
768
Anton Yartsev05e35552010-08-16 16:22:12 +0000769static vector signed char __ATTRS_o_ai
770vec_vand(vector bool char a, vector signed char b)
771{
772 return (vector signed char)a & b;
773}
774
775static vector signed char __ATTRS_o_ai
776vec_vand(vector signed char a, vector bool char b)
777{
778 return a & (vector signed char)b;
779}
780
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000781static vector unsigned char __ATTRS_o_ai
782vec_vand(vector unsigned char a, vector unsigned char b)
783{
784 return a & b;
785}
786
Anton Yartsev05e35552010-08-16 16:22:12 +0000787static vector unsigned char __ATTRS_o_ai
788vec_vand(vector bool char a, vector unsigned char b)
789{
790 return (vector unsigned char)a & b;
791}
792
793static vector unsigned char __ATTRS_o_ai
794vec_vand(vector unsigned char a, vector bool char b)
795{
796 return a & (vector unsigned char)b;
797}
798
799static vector bool char __ATTRS_o_ai
800vec_vand(vector bool char a, vector bool char b)
801{
802 return a & b;
803}
804
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000805static vector short __ATTRS_o_ai
806vec_vand(vector short a, vector short b)
807{
808 return a & b;
809}
810
Anton Yartsev05e35552010-08-16 16:22:12 +0000811static vector short __ATTRS_o_ai
812vec_vand(vector bool short a, vector short b)
813{
814 return (vector short)a & b;
815}
816
817static vector short __ATTRS_o_ai
818vec_vand(vector short a, vector bool short b)
819{
820 return a & (vector short)b;
821}
822
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000823static vector unsigned short __ATTRS_o_ai
824vec_vand(vector unsigned short a, vector unsigned short b)
825{
826 return a & b;
827}
828
Anton Yartsev05e35552010-08-16 16:22:12 +0000829static vector unsigned short __ATTRS_o_ai
830vec_vand(vector bool short a, vector unsigned short b)
831{
832 return (vector unsigned short)a & b;
833}
834
835static vector unsigned short __ATTRS_o_ai
836vec_vand(vector unsigned short a, vector bool short b)
837{
838 return a & (vector unsigned short)b;
839}
840
841static vector bool short __ATTRS_o_ai
842vec_vand(vector bool short a, vector bool short b)
843{
844 return a & b;
845}
846
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000847static vector int __ATTRS_o_ai
848vec_vand(vector int a, vector int b)
849{
850 return a & b;
851}
852
Anton Yartsev05e35552010-08-16 16:22:12 +0000853static vector int __ATTRS_o_ai
854vec_vand(vector bool int a, vector int b)
855{
856 return (vector int)a & b;
857}
858
859static vector int __ATTRS_o_ai
860vec_vand(vector int a, vector bool int b)
861{
862 return a & (vector int)b;
863}
864
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000865static vector unsigned int __ATTRS_o_ai
866vec_vand(vector unsigned int a, vector unsigned int b)
867{
868 return a & b;
869}
870
Anton Yartsev05e35552010-08-16 16:22:12 +0000871static vector unsigned int __ATTRS_o_ai
872vec_vand(vector bool int a, vector unsigned int b)
873{
874 return (vector unsigned int)a & b;
875}
876
877static vector unsigned int __ATTRS_o_ai
878vec_vand(vector unsigned int a, vector bool int b)
879{
880 return a & (vector unsigned int)b;
881}
882
883static vector bool int __ATTRS_o_ai
884vec_vand(vector bool int a, vector bool int b)
885{
886 return a & b;
887}
888
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000889static vector float __ATTRS_o_ai
890vec_vand(vector float a, vector float b)
891{
892 vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b;
893 return (vector float)res;
894}
895
Anton Yartsev05e35552010-08-16 16:22:12 +0000896static vector float __ATTRS_o_ai
897vec_vand(vector bool int a, vector float b)
898{
899 vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b;
900 return (vector float)res;
901}
902
903static vector float __ATTRS_o_ai
904vec_vand(vector float a, vector bool int b)
905{
906 vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b;
907 return (vector float)res;
908}
909
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000910/* vec_andc */
911
912#define __builtin_altivec_vandc vec_andc
913
914static vector signed char __ATTRS_o_ai
915vec_andc(vector signed char a, vector signed char b)
916{
917 return a & ~b;
918}
919
Anton Yartsev05e35552010-08-16 16:22:12 +0000920static vector signed char __ATTRS_o_ai
921vec_andc(vector bool char a, vector signed char b)
922{
923 return (vector signed char)a & ~b;
924}
925
926static vector signed char __ATTRS_o_ai
927vec_andc(vector signed char a, vector bool char b)
928{
929 return a & ~(vector signed char)b;
930}
931
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000932static vector unsigned char __ATTRS_o_ai
933vec_andc(vector unsigned char a, vector unsigned char b)
934{
935 return a & ~b;
936}
937
Anton Yartsev05e35552010-08-16 16:22:12 +0000938static vector unsigned char __ATTRS_o_ai
939vec_andc(vector bool char a, vector unsigned char b)
940{
941 return (vector unsigned char)a & ~b;
942}
943
944static vector unsigned char __ATTRS_o_ai
945vec_andc(vector unsigned char a, vector bool char b)
946{
947 return a & ~(vector unsigned char)b;
948}
949
950static vector bool char __ATTRS_o_ai
951vec_andc(vector bool char a, vector bool char b)
952{
953 return a & ~b;
954}
955
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000956static vector short __ATTRS_o_ai
957vec_andc(vector short a, vector short b)
958{
959 return a & ~b;
960}
961
Anton Yartsev05e35552010-08-16 16:22:12 +0000962static vector short __ATTRS_o_ai
963vec_andc(vector bool short a, vector short b)
964{
965 return (vector short)a & ~b;
966}
967
968static vector short __ATTRS_o_ai
969vec_andc(vector short a, vector bool short b)
970{
971 return a & ~(vector short)b;
972}
973
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000974static vector unsigned short __ATTRS_o_ai
975vec_andc(vector unsigned short a, vector unsigned short b)
976{
977 return a & ~b;
978}
979
Anton Yartsev05e35552010-08-16 16:22:12 +0000980static vector unsigned short __ATTRS_o_ai
981vec_andc(vector bool short a, vector unsigned short b)
982{
983 return (vector unsigned short)a & ~b;
984}
985
986static vector unsigned short __ATTRS_o_ai
987vec_andc(vector unsigned short a, vector bool short b)
988{
989 return a & ~(vector unsigned short)b;
990}
991
992static vector bool short __ATTRS_o_ai
993vec_andc(vector bool short a, vector bool short b)
994{
995 return a & ~b;
996}
997
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +0000998static vector int __ATTRS_o_ai
999vec_andc(vector int a, vector int b)
1000{
1001 return a & ~b;
1002}
1003
Anton Yartsev05e35552010-08-16 16:22:12 +00001004static vector int __ATTRS_o_ai
1005vec_andc(vector bool int a, vector int b)
1006{
1007 return (vector int)a & ~b;
1008}
1009
1010static vector int __ATTRS_o_ai
1011vec_andc(vector int a, vector bool int b)
1012{
1013 return a & ~(vector int)b;
1014}
1015
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001016static vector unsigned int __ATTRS_o_ai
1017vec_andc(vector unsigned int a, vector unsigned int b)
1018{
1019 return a & ~b;
1020}
1021
Anton Yartsev05e35552010-08-16 16:22:12 +00001022static vector unsigned int __ATTRS_o_ai
1023vec_andc(vector bool int a, vector unsigned int b)
1024{
1025 return (vector unsigned int)a & ~b;
1026}
1027
1028static vector unsigned int __ATTRS_o_ai
1029vec_andc(vector unsigned int a, vector bool int b)
1030{
1031 return a & ~(vector unsigned int)b;
1032}
1033
1034static vector bool int __ATTRS_o_ai
1035vec_andc(vector bool int a, vector bool int b)
1036{
1037 return a & ~b;
1038}
1039
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001040static vector float __ATTRS_o_ai
1041vec_andc(vector float a, vector float b)
1042{
1043 vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b;
1044 return (vector float)res;
1045}
1046
Anton Yartsev05e35552010-08-16 16:22:12 +00001047static vector float __ATTRS_o_ai
1048vec_andc(vector bool int a, vector float b)
1049{
1050 vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b;
1051 return (vector float)res;
1052}
1053
1054static vector float __ATTRS_o_ai
1055vec_andc(vector float a, vector bool int b)
1056{
1057 vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b;
1058 return (vector float)res;
1059}
1060
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001061/* vec_vandc */
1062
1063static vector signed char __ATTRS_o_ai
1064vec_vandc(vector signed char a, vector signed char b)
1065{
1066 return a & ~b;
1067}
1068
Anton Yartsev05e35552010-08-16 16:22:12 +00001069static vector signed char __ATTRS_o_ai
1070vec_vandc(vector bool char a, vector signed char b)
1071{
1072 return (vector signed char)a & ~b;
1073}
1074
1075static vector signed char __ATTRS_o_ai
1076vec_vandc(vector signed char a, vector bool char b)
1077{
1078 return a & ~(vector signed char)b;
1079}
1080
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001081static vector unsigned char __ATTRS_o_ai
1082vec_vandc(vector unsigned char a, vector unsigned char b)
1083{
1084 return a & ~b;
1085}
1086
Anton Yartsev05e35552010-08-16 16:22:12 +00001087static vector unsigned char __ATTRS_o_ai
1088vec_vandc(vector bool char a, vector unsigned char b)
1089{
1090 return (vector unsigned char)a & ~b;
1091}
1092
1093static vector unsigned char __ATTRS_o_ai
1094vec_vandc(vector unsigned char a, vector bool char b)
1095{
1096 return a & ~(vector unsigned char)b;
1097}
1098
1099static vector bool char __ATTRS_o_ai
1100vec_vandc(vector bool char a, vector bool char b)
1101{
1102 return a & ~b;
1103}
1104
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001105static vector short __ATTRS_o_ai
1106vec_vandc(vector short a, vector short b)
1107{
1108 return a & ~b;
1109}
1110
Anton Yartsev05e35552010-08-16 16:22:12 +00001111static vector short __ATTRS_o_ai
1112vec_vandc(vector bool short a, vector short b)
1113{
1114 return (vector short)a & ~b;
1115}
1116
1117static vector short __ATTRS_o_ai
1118vec_vandc(vector short a, vector bool short b)
1119{
1120 return a & ~(vector short)b;
1121}
1122
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001123static vector unsigned short __ATTRS_o_ai
1124vec_vandc(vector unsigned short a, vector unsigned short b)
1125{
1126 return a & ~b;
1127}
1128
Anton Yartsev05e35552010-08-16 16:22:12 +00001129static vector unsigned short __ATTRS_o_ai
1130vec_vandc(vector bool short a, vector unsigned short b)
1131{
1132 return (vector unsigned short)a & ~b;
1133}
1134
1135static vector unsigned short __ATTRS_o_ai
1136vec_vandc(vector unsigned short a, vector bool short b)
1137{
1138 return a & ~(vector unsigned short)b;
1139}
1140
1141static vector bool short __ATTRS_o_ai
1142vec_vandc(vector bool short a, vector bool short b)
1143{
1144 return a & ~b;
1145}
1146
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001147static vector int __ATTRS_o_ai
1148vec_vandc(vector int a, vector int b)
1149{
1150 return a & ~b;
1151}
1152
Anton Yartsev05e35552010-08-16 16:22:12 +00001153static vector int __ATTRS_o_ai
1154vec_vandc(vector bool int a, vector int b)
1155{
1156 return (vector int)a & ~b;
1157}
1158
1159static vector int __ATTRS_o_ai
1160vec_vandc(vector int a, vector bool int b)
1161{
1162 return a & ~(vector int)b;
1163}
1164
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001165static vector unsigned int __ATTRS_o_ai
1166vec_vandc(vector unsigned int a, vector unsigned int b)
1167{
1168 return a & ~b;
1169}
1170
Anton Yartsev05e35552010-08-16 16:22:12 +00001171static vector unsigned int __ATTRS_o_ai
1172vec_vandc(vector bool int a, vector unsigned int b)
1173{
1174 return (vector unsigned int)a & ~b;
1175}
1176
1177static vector unsigned int __ATTRS_o_ai
1178vec_vandc(vector unsigned int a, vector bool int b)
1179{
1180 return a & ~(vector unsigned int)b;
1181}
1182
1183static vector bool int __ATTRS_o_ai
1184vec_vandc(vector bool int a, vector bool int b)
1185{
1186 return a & ~b;
1187}
1188
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001189static vector float __ATTRS_o_ai
1190vec_vandc(vector float a, vector float b)
1191{
1192 vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b;
1193 return (vector float)res;
Chris Lattnerdd173942010-04-14 03:54:58 +00001194}
1195
Anton Yartsev05e35552010-08-16 16:22:12 +00001196static vector float __ATTRS_o_ai
1197vec_vandc(vector bool int a, vector float b)
1198{
1199 vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b;
1200 return (vector float)res;
1201}
1202
1203static vector float __ATTRS_o_ai
1204vec_vandc(vector float a, vector bool int b)
1205{
1206 vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b;
1207 return (vector float)res;
1208}
1209
Chris Lattnerdd173942010-04-14 03:54:58 +00001210/* vec_avg */
1211
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001212static vector signed char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001213vec_avg(vector signed char a, vector signed char b)
1214{
1215 return __builtin_altivec_vavgsb(a, b);
1216}
1217
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001218static vector unsigned char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001219vec_avg(vector unsigned char a, vector unsigned char b)
1220{
1221 return __builtin_altivec_vavgub(a, b);
1222}
1223
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001224static vector short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001225vec_avg(vector short a, vector short b)
1226{
1227 return __builtin_altivec_vavgsh(a, b);
1228}
1229
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001230static vector unsigned short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001231vec_avg(vector unsigned short a, vector unsigned short b)
1232{
1233 return __builtin_altivec_vavguh(a, b);
1234}
1235
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001236static vector int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001237vec_avg(vector int a, vector int b)
1238{
1239 return __builtin_altivec_vavgsw(a, b);
1240}
1241
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001242static vector unsigned int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001243vec_avg(vector unsigned int a, vector unsigned int b)
1244{
1245 return __builtin_altivec_vavguw(a, b);
1246}
1247
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001248/* vec_vavgsb */
Chris Lattnerdd173942010-04-14 03:54:58 +00001249
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001250static vector signed char __attribute__((__always_inline__))
1251vec_vavgsb(vector signed char a, vector signed char b)
Chris Lattnerdd173942010-04-14 03:54:58 +00001252{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001253 return __builtin_altivec_vavgsb(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001254}
1255
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001256/* vec_vavgub */
1257
1258static vector unsigned char __attribute__((__always_inline__))
1259vec_vavgub(vector unsigned char a, vector unsigned char b)
Chris Lattnerdd173942010-04-14 03:54:58 +00001260{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001261 return __builtin_altivec_vavgub(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001262}
1263
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001264/* vec_vavgsh */
1265
1266static vector short __attribute__((__always_inline__))
1267vec_vavgsh(vector short a, vector short b)
Chris Lattnerdd173942010-04-14 03:54:58 +00001268{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001269 return __builtin_altivec_vavgsh(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001270}
1271
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001272/* vec_vavguh */
1273
1274static vector unsigned short __attribute__((__always_inline__))
1275vec_vavguh(vector unsigned short a, vector unsigned short b)
Chris Lattnerdd173942010-04-14 03:54:58 +00001276{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001277 return __builtin_altivec_vavguh(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001278}
1279
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001280/* vec_vavgsw */
1281
1282static vector int __attribute__((__always_inline__))
1283vec_vavgsw(vector int a, vector int b)
Chris Lattnerdd173942010-04-14 03:54:58 +00001284{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001285 return __builtin_altivec_vavgsw(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001286}
1287
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001288/* vec_vavguw */
1289
1290static vector unsigned int __attribute__((__always_inline__))
1291vec_vavguw(vector unsigned int a, vector unsigned int b)
Chris Lattnerdd173942010-04-14 03:54:58 +00001292{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001293 return __builtin_altivec_vavguw(a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001294}
1295
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001296/* vec_ceil */
1297
1298static vector float __attribute__((__always_inline__))
1299vec_ceil(vector float a)
Chris Lattnerdd173942010-04-14 03:54:58 +00001300{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001301 return __builtin_altivec_vrfip(a);
Chris Lattnerdd173942010-04-14 03:54:58 +00001302}
1303
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001304/* vec_vrfip */
Chris Lattnerdd173942010-04-14 03:54:58 +00001305
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001306static vector float __attribute__((__always_inline__))
1307vec_vrfip(vector float a)
Chris Lattnerdd173942010-04-14 03:54:58 +00001308{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001309 return __builtin_altivec_vrfip(a);
Chris Lattnerdd173942010-04-14 03:54:58 +00001310}
1311
1312/* vec_cmpb */
1313
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001314static vector int __attribute__((__always_inline__))
1315vec_cmpb(vector float a, vector float b)
1316{
1317 return __builtin_altivec_vcmpbfp(a, b);
1318}
1319
1320/* vec_vcmpbfp */
1321
1322static vector int __attribute__((__always_inline__))
1323vec_vcmpbfp(vector float a, vector float b)
1324{
1325 return __builtin_altivec_vcmpbfp(a, b);
1326}
Chris Lattnerdd173942010-04-14 03:54:58 +00001327
1328/* vec_cmpeq */
1329
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001330static vector /*bool*/ char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001331vec_cmpeq(vector signed char a, vector signed char b)
1332{
Chris Lattnerab866b42010-04-14 20:35:39 +00001333 return __builtin_altivec_vcmpequb((vector char)a, (vector char)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001334}
1335
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001336static vector /*bool*/ char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001337vec_cmpeq(vector unsigned char a, vector unsigned char b)
1338{
Chris Lattnerab866b42010-04-14 20:35:39 +00001339 return __builtin_altivec_vcmpequb((vector char)a, (vector char)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001340}
1341
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001342static vector /*bool*/ short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001343vec_cmpeq(vector short a, vector short b)
1344{
1345 return __builtin_altivec_vcmpequh(a, b);
1346}
1347
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001348static vector /*bool*/ short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001349vec_cmpeq(vector unsigned short a, vector unsigned short b)
1350{
Chris Lattnerab866b42010-04-14 20:35:39 +00001351 return __builtin_altivec_vcmpequh((vector short)a, (vector short)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001352}
1353
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001354static vector /*bool*/ int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001355vec_cmpeq(vector int a, vector int b)
1356{
1357 return __builtin_altivec_vcmpequw(a, b);
1358}
1359
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001360static vector /*bool*/ int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001361vec_cmpeq(vector unsigned int a, vector unsigned int b)
1362{
Chris Lattnerab866b42010-04-14 20:35:39 +00001363 return __builtin_altivec_vcmpequw((vector int)a, (vector int)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00001364}
1365
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001366static vector /*bool*/ int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001367vec_cmpeq(vector float a, vector float b)
1368{
1369 return __builtin_altivec_vcmpeqfp(a, b);
1370}
1371
1372/* vec_cmpge */
1373
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001374static vector /*bool*/ int __attribute__((__always_inline__))
1375vec_cmpge(vector float a, vector float b)
1376{
1377 return __builtin_altivec_vcmpgefp(a, b);
1378}
1379
1380/* vec_vcmpgefp */
1381
1382static vector /*bool*/ int __attribute__((__always_inline__))
1383vec_vcmpgefp(vector float a, vector float b)
1384{
1385 return __builtin_altivec_vcmpgefp(a, b);
1386}
Chris Lattnerdd173942010-04-14 03:54:58 +00001387
1388/* vec_cmpgt */
1389
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001390static vector /*bool*/ char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001391vec_cmpgt(vector signed char a, vector signed char b)
1392{
1393 return __builtin_altivec_vcmpgtsb(a, b);
1394}
1395
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001396static vector /*bool*/ char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001397vec_cmpgt(vector unsigned char a, vector unsigned char b)
1398{
1399 return __builtin_altivec_vcmpgtub(a, b);
1400}
1401
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001402static vector /*bool*/ short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001403vec_cmpgt(vector short a, vector short b)
1404{
1405 return __builtin_altivec_vcmpgtsh(a, b);
1406}
1407
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001408static vector /*bool*/ short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001409vec_cmpgt(vector unsigned short a, vector unsigned short b)
1410{
1411 return __builtin_altivec_vcmpgtuh(a, b);
1412}
1413
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001414static vector /*bool*/ int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001415vec_cmpgt(vector int a, vector int b)
1416{
1417 return __builtin_altivec_vcmpgtsw(a, b);
1418}
1419
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001420static vector /*bool*/ int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001421vec_cmpgt(vector unsigned int a, vector unsigned int b)
1422{
1423 return __builtin_altivec_vcmpgtuw(a, b);
1424}
1425
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001426static vector /*bool*/ int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001427vec_cmpgt(vector float a, vector float b)
1428{
1429 return __builtin_altivec_vcmpgtfp(a, b);
1430}
1431
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001432/* vec_vcmpgtsb */
Chris Lattnerdd173942010-04-14 03:54:58 +00001433
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001434static vector /*bool*/ char __attribute__((__always_inline__))
1435vec_vcmpgtsb(vector signed char a, vector signed char b)
1436{
1437 return __builtin_altivec_vcmpgtsb(a, b);
1438}
1439
1440/* vec_vcmpgtub */
1441
1442static vector /*bool*/ char __attribute__((__always_inline__))
1443vec_vcmpgtub(vector unsigned char a, vector unsigned char b)
1444{
1445 return __builtin_altivec_vcmpgtub(a, b);
1446}
1447
1448/* vec_vcmpgtsh */
1449
1450static vector /*bool*/ short __attribute__((__always_inline__))
1451vec_vcmpgtsh(vector short a, vector short b)
1452{
1453 return __builtin_altivec_vcmpgtsh(a, b);
1454}
1455
1456/* vec_vcmpgtuh */
1457
1458static vector /*bool*/ short __attribute__((__always_inline__))
1459vec_vcmpgtuh(vector unsigned short a, vector unsigned short b)
1460{
1461 return __builtin_altivec_vcmpgtuh(a, b);
1462}
1463
1464/* vec_vcmpgtsw */
1465
1466static vector /*bool*/ int __attribute__((__always_inline__))
1467vec_vcmpgtsw(vector int a, vector int b)
1468{
1469 return __builtin_altivec_vcmpgtsw(a, b);
1470}
1471
1472/* vec_vcmpgtuw */
1473
1474static vector /*bool*/ int __attribute__((__always_inline__))
1475vec_vcmpgtuw(vector unsigned int a, vector unsigned int b)
1476{
1477 return __builtin_altivec_vcmpgtuw(a, b);
1478}
1479
1480/* vec_vcmpgtfp */
1481
1482static vector /*bool*/ int __attribute__((__always_inline__))
1483vec_vcmpgtfp(vector float a, vector float b)
1484{
1485 return __builtin_altivec_vcmpgtfp(a, b);
1486}
1487
1488/* vec_cmple */
Chris Lattnerdd173942010-04-14 03:54:58 +00001489
Chris Lattnerab866b42010-04-14 20:35:39 +00001490static vector /*bool*/ int __attribute__((__always_inline__))
Chris Lattnerdd173942010-04-14 03:54:58 +00001491vec_cmple(vector float a, vector float b)
1492{
1493 return __builtin_altivec_vcmpgefp(b, a);
1494}
1495
1496/* vec_cmplt */
1497
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001498static vector /*bool*/ char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001499vec_cmplt(vector signed char a, vector signed char b)
1500{
1501 return __builtin_altivec_vcmpgtsb(b, a);
1502}
1503
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001504static vector /*bool*/ char __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001505vec_cmplt(vector unsigned char a, vector unsigned char b)
1506{
1507 return __builtin_altivec_vcmpgtub(b, a);
1508}
1509
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001510static vector /*bool*/ short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001511vec_cmplt(vector short a, vector short b)
1512{
1513 return __builtin_altivec_vcmpgtsh(b, a);
1514}
1515
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001516static vector /*bool*/ short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001517vec_cmplt(vector unsigned short a, vector unsigned short b)
1518{
1519 return __builtin_altivec_vcmpgtuh(b, a);
1520}
1521
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001522static vector /*bool*/ int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001523vec_cmplt(vector int a, vector int b)
1524{
1525 return __builtin_altivec_vcmpgtsw(b, a);
1526}
1527
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001528static vector /*bool*/ int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001529vec_cmplt(vector unsigned int a, vector unsigned int b)
1530{
1531 return __builtin_altivec_vcmpgtuw(b, a);
1532}
1533
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001534static vector /*bool*/ int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00001535vec_cmplt(vector float a, vector float b)
1536{
1537 return __builtin_altivec_vcmpgtfp(b, a);
1538}
1539
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00001540/* vec_ctf */
1541
1542static vector float __ATTRS_o_ai
1543vec_ctf(vector int a, int b)
1544{
1545 return __builtin_altivec_vcfsx(a, b);
1546}
1547
1548static vector float __ATTRS_o_ai
1549vec_ctf(vector unsigned int a, int b)
1550{
1551 return __builtin_altivec_vcfux((vector int)a, b);
1552}
1553
1554/* vec_vcfsx */
1555
1556static vector float __attribute__((__always_inline__))
1557vec_vcfsx(vector int a, int b)
1558{
1559 return __builtin_altivec_vcfsx(a, b);
1560}
1561
1562/* vec_vcfux */
1563
1564static vector float __attribute__((__always_inline__))
1565vec_vcfux(vector unsigned int a, int b)
1566{
1567 return __builtin_altivec_vcfux((vector int)a, b);
1568}
1569
1570/* vec_cts */
1571
1572static vector int __attribute__((__always_inline__))
1573vec_cts(vector float a, int b)
1574{
1575 return __builtin_altivec_vctsxs(a, b);
1576}
1577
1578/* vec_vctsxs */
1579
1580static vector int __attribute__((__always_inline__))
1581vec_vctsxs(vector float a, int b)
1582{
1583 return __builtin_altivec_vctsxs(a, b);
1584}
1585
1586/* vec_ctu */
1587
1588static vector unsigned int __attribute__((__always_inline__))
1589vec_ctu(vector float a, int b)
1590{
1591 return __builtin_altivec_vctuxs(a, b);
1592}
1593
1594/* vec_vctuxs */
1595
1596static vector unsigned int __attribute__((__always_inline__))
1597vec_vctuxs(vector float a, int b)
1598{
1599 return __builtin_altivec_vctuxs(a, b);
1600}
1601
1602/* vec_dss */
1603
1604static void __attribute__((__always_inline__))
1605vec_dss(int a)
1606{
1607 __builtin_altivec_dss(a);
1608}
1609
1610/* vec_dssall */
1611
1612static void __attribute__((__always_inline__))
1613vec_dssall(void)
1614{
1615 __builtin_altivec_dssall();
1616}
1617
1618/* vec_dst */
1619
1620static void __attribute__((__always_inline__))
1621vec_dst(void *a, int b, int c)
1622{
1623 __builtin_altivec_dst(a, b, c);
1624}
1625
1626/* vec_dstst */
1627
1628static void __attribute__((__always_inline__))
1629vec_dstst(void *a, int b, int c)
1630{
1631 __builtin_altivec_dstst(a, b, c);
1632}
1633
1634/* vec_dststt */
1635
1636static void __attribute__((__always_inline__))
1637vec_dststt(void *a, int b, int c)
1638{
1639 __builtin_altivec_dststt(a, b, c);
1640}
1641
1642/* vec_dstt */
1643
1644static void __attribute__((__always_inline__))
1645vec_dstt(void *a, int b, int c)
1646{
1647 __builtin_altivec_dstt(a, b, c);
1648}
1649
1650/* vec_expte */
1651
1652static vector float __attribute__((__always_inline__))
1653vec_expte(vector float a)
1654{
1655 return __builtin_altivec_vexptefp(a);
1656}
1657
1658/* vec_vexptefp */
1659
1660static vector float __attribute__((__always_inline__))
1661vec_vexptefp(vector float a)
1662{
1663 return __builtin_altivec_vexptefp(a);
1664}
1665
1666/* vec_floor */
1667
1668static vector float __attribute__((__always_inline__))
1669vec_floor(vector float a)
1670{
1671 return __builtin_altivec_vrfim(a);
1672}
1673
1674/* vec_vrfim */
1675
1676static vector float __attribute__((__always_inline__))
1677vec_vrfim(vector float a)
1678{
1679 return __builtin_altivec_vrfim(a);
1680}
1681
1682/* vec_ld */
1683
1684static vector signed char __ATTRS_o_ai
1685vec_ld(int a, vector signed char *b)
1686{
1687 return (vector signed char)__builtin_altivec_lvx(a, b);
1688}
1689
1690static vector signed char __ATTRS_o_ai
1691vec_ld(int a, signed char *b)
1692{
1693 return (vector signed char)__builtin_altivec_lvx(a, b);
1694}
1695
1696static vector unsigned char __ATTRS_o_ai
1697vec_ld(int a, vector unsigned char *b)
1698{
1699 return (vector unsigned char)__builtin_altivec_lvx(a, b);
1700}
1701
1702static vector unsigned char __ATTRS_o_ai
1703vec_ld(int a, unsigned char *b)
1704{
1705 return (vector unsigned char)__builtin_altivec_lvx(a, b);
1706}
1707
1708static vector short __ATTRS_o_ai
1709vec_ld(int a, vector short *b)
1710{
1711 return (vector short)__builtin_altivec_lvx(a, b);
1712}
1713
1714static vector short __ATTRS_o_ai
1715vec_ld(int a, short *b)
1716{
1717 return (vector short)__builtin_altivec_lvx(a, b);
1718}
1719
1720static vector unsigned short __ATTRS_o_ai
1721vec_ld(int a, vector unsigned short *b)
1722{
1723 return (vector unsigned short)__builtin_altivec_lvx(a, b);
1724}
1725
1726static vector unsigned short __ATTRS_o_ai
1727vec_ld(int a, unsigned short *b)
1728{
1729 return (vector unsigned short)__builtin_altivec_lvx(a, b);
1730}
1731
1732static vector int __ATTRS_o_ai
1733vec_ld(int a, vector int *b)
1734{
1735 return (vector int)__builtin_altivec_lvx(a, b);
1736}
1737
1738static vector int __ATTRS_o_ai
1739vec_ld(int a, int *b)
1740{
1741 return (vector int)__builtin_altivec_lvx(a, b);
1742}
1743
1744static vector unsigned int __ATTRS_o_ai
1745vec_ld(int a, vector unsigned int *b)
1746{
1747 return (vector unsigned int)__builtin_altivec_lvx(a, b);
1748}
1749
1750static vector unsigned int __ATTRS_o_ai
1751vec_ld(int a, unsigned int *b)
1752{
1753 return (vector unsigned int)__builtin_altivec_lvx(a, b);
1754}
1755
1756static vector float __ATTRS_o_ai
1757vec_ld(int a, vector float *b)
1758{
1759 return (vector float)__builtin_altivec_lvx(a, b);
1760}
1761
1762static vector float __ATTRS_o_ai
1763vec_ld(int a, float *b)
1764{
1765 return (vector float)__builtin_altivec_lvx(a, b);
1766}
1767
1768/* vec_lvx */
1769
1770static vector signed char __ATTRS_o_ai
1771vec_lvx(int a, vector signed char *b)
1772{
1773 return (vector signed char)__builtin_altivec_lvx(a, b);
1774}
1775
1776static vector signed char __ATTRS_o_ai
1777vec_lvx(int a, signed char *b)
1778{
1779 return (vector signed char)__builtin_altivec_lvx(a, b);
1780}
1781
1782static vector unsigned char __ATTRS_o_ai
1783vec_lvx(int a, vector unsigned char *b)
1784{
1785 return (vector unsigned char)__builtin_altivec_lvx(a, b);
1786}
1787
1788static vector unsigned char __ATTRS_o_ai
1789vec_lvx(int a, unsigned char *b)
1790{
1791 return (vector unsigned char)__builtin_altivec_lvx(a, b);
1792}
1793
1794static vector short __ATTRS_o_ai
1795vec_lvx(int a, vector short *b)
1796{
1797 return (vector short)__builtin_altivec_lvx(a, b);
1798}
1799
1800static vector short __ATTRS_o_ai
1801vec_lvx(int a, short *b)
1802{
1803 return (vector short)__builtin_altivec_lvx(a, b);
1804}
1805
1806static vector unsigned short __ATTRS_o_ai
1807vec_lvx(int a, vector unsigned short *b)
1808{
1809 return (vector unsigned short)__builtin_altivec_lvx(a, b);
1810}
1811
1812static vector unsigned short __ATTRS_o_ai
1813vec_lvx(int a, unsigned short *b)
1814{
1815 return (vector unsigned short)__builtin_altivec_lvx(a, b);
1816}
1817
1818static vector int __ATTRS_o_ai
1819vec_lvx(int a, vector int *b)
1820{
1821 return (vector int)__builtin_altivec_lvx(a, b);
1822}
1823
1824static vector int __ATTRS_o_ai
1825vec_lvx(int a, int *b)
1826{
1827 return (vector int)__builtin_altivec_lvx(a, b);
1828}
1829
1830static vector unsigned int __ATTRS_o_ai
1831vec_lvx(int a, vector unsigned int *b)
1832{
1833 return (vector unsigned int)__builtin_altivec_lvx(a, b);
1834}
1835
1836static vector unsigned int __ATTRS_o_ai
1837vec_lvx(int a, unsigned int *b)
1838{
1839 return (vector unsigned int)__builtin_altivec_lvx(a, b);
1840}
1841
1842static vector float __ATTRS_o_ai
1843vec_lvx(int a, vector float *b)
1844{
1845 return (vector float)__builtin_altivec_lvx(a, b);
1846}
1847
1848static vector float __ATTRS_o_ai
1849vec_lvx(int a, float *b)
1850{
1851 return (vector float)__builtin_altivec_lvx(a, b);
1852}
1853
1854/* vec_lde */
1855
1856static vector signed char __ATTRS_o_ai
1857vec_lde(int a, vector signed char *b)
1858{
1859 return (vector signed char)__builtin_altivec_lvebx(a, b);
1860}
1861
1862static vector unsigned char __ATTRS_o_ai
1863vec_lde(int a, vector unsigned char *b)
1864{
1865 return (vector unsigned char)__builtin_altivec_lvebx(a, b);
1866}
1867
1868static vector short __ATTRS_o_ai
1869vec_lde(int a, vector short *b)
1870{
1871 return (vector short)__builtin_altivec_lvehx(a, b);
1872}
1873
1874static vector unsigned short __ATTRS_o_ai
1875vec_lde(int a, vector unsigned short *b)
1876{
1877 return (vector unsigned short)__builtin_altivec_lvehx(a, b);
1878}
1879
1880static vector int __ATTRS_o_ai
1881vec_lde(int a, vector int *b)
1882{
1883 return (vector int)__builtin_altivec_lvewx(a, b);
1884}
1885
1886static vector unsigned int __ATTRS_o_ai
1887vec_lde(int a, vector unsigned int *b)
1888{
1889 return (vector unsigned int)__builtin_altivec_lvewx(a, b);
1890}
1891
1892static vector float __ATTRS_o_ai
1893vec_lde(int a, vector float *b)
1894{
1895 return (vector float)__builtin_altivec_lvewx(a, b);
1896}
1897
1898/* vec_lvebx */
1899
1900static vector signed char __ATTRS_o_ai
1901vec_lvebx(int a, vector signed char *b)
1902{
1903 return (vector signed char)__builtin_altivec_lvebx(a, b);
1904}
1905
1906static vector unsigned char __ATTRS_o_ai
1907vec_lvebx(int a, vector unsigned char *b)
1908{
1909 return (vector unsigned char)__builtin_altivec_lvebx(a, b);
1910}
1911
1912/* vec_lvehx */
1913
1914static vector short __ATTRS_o_ai
1915vec_lvehx(int a, vector short *b)
1916{
1917 return (vector short)__builtin_altivec_lvehx(a, b);
1918}
1919
1920static vector unsigned short __ATTRS_o_ai
1921vec_lvehx(int a, vector unsigned short *b)
1922{
1923 return (vector unsigned short)__builtin_altivec_lvehx(a, b);
1924}
1925
1926/* vec_lvewx */
1927
1928static vector int __ATTRS_o_ai
1929vec_lvewx(int a, vector int *b)
1930{
1931 return (vector int)__builtin_altivec_lvewx(a, b);
1932}
1933
1934static vector unsigned int __ATTRS_o_ai
1935vec_lvewx(int a, vector unsigned int *b)
1936{
1937 return (vector unsigned int)__builtin_altivec_lvewx(a, b);
1938}
1939
1940static vector float __ATTRS_o_ai
1941vec_lvewx(int a, vector float *b)
1942{
1943 return (vector float)__builtin_altivec_lvewx(a, b);
1944}
1945
1946/* vec_ldl */
1947
1948static vector signed char __ATTRS_o_ai
1949vec_ldl(int a, vector signed char *b)
1950{
1951 return (vector signed char)__builtin_altivec_lvxl(a, b);
1952}
1953
1954static vector signed char __ATTRS_o_ai
1955vec_ldl(int a, signed char *b)
1956{
1957 return (vector signed char)__builtin_altivec_lvxl(a, b);
1958}
1959
1960static vector unsigned char __ATTRS_o_ai
1961vec_ldl(int a, vector unsigned char *b)
1962{
1963 return (vector unsigned char)__builtin_altivec_lvxl(a, b);
1964}
1965
1966static vector unsigned char __ATTRS_o_ai
1967vec_ldl(int a, unsigned char *b)
1968{
1969 return (vector unsigned char)__builtin_altivec_lvxl(a, b);
1970}
1971
1972static vector short __ATTRS_o_ai
1973vec_ldl(int a, vector short *b)
1974{
1975 return (vector short)__builtin_altivec_lvxl(a, b);
1976}
1977
1978static vector short __ATTRS_o_ai
1979vec_ldl(int a, short *b)
1980{
1981 return (vector short)__builtin_altivec_lvxl(a, b);
1982}
1983
1984static vector unsigned short __ATTRS_o_ai
1985vec_ldl(int a, vector unsigned short *b)
1986{
1987 return (vector unsigned short)__builtin_altivec_lvxl(a, b);
1988}
1989
1990static vector unsigned short __ATTRS_o_ai
1991vec_ldl(int a, unsigned short *b)
1992{
1993 return (vector unsigned short)__builtin_altivec_lvxl(a, b);
1994}
1995
1996static vector int __ATTRS_o_ai
1997vec_ldl(int a, vector int *b)
1998{
1999 return (vector int)__builtin_altivec_lvxl(a, b);
2000}
2001
2002static vector int __ATTRS_o_ai
2003vec_ldl(int a, int *b)
2004{
2005 return (vector int)__builtin_altivec_lvxl(a, b);
2006}
2007
2008static vector unsigned int __ATTRS_o_ai
2009vec_ldl(int a, vector unsigned int *b)
2010{
2011 return (vector unsigned int)__builtin_altivec_lvxl(a, b);
2012}
2013
2014static vector unsigned int __ATTRS_o_ai
2015vec_ldl(int a, unsigned int *b)
2016{
2017 return (vector unsigned int)__builtin_altivec_lvxl(a, b);
2018}
2019
2020static vector float __ATTRS_o_ai
2021vec_ldl(int a, vector float *b)
2022{
2023 return (vector float)__builtin_altivec_lvxl(a, b);
2024}
2025
2026static vector float __ATTRS_o_ai
2027vec_ldl(int a, float *b)
2028{
2029 return (vector float)__builtin_altivec_lvxl(a, b);
2030}
2031
2032/* vec_lvxl */
2033
2034static vector signed char __ATTRS_o_ai
2035vec_lvxl(int a, vector signed char *b)
2036{
2037 return (vector signed char)__builtin_altivec_lvxl(a, b);
2038}
2039
2040static vector signed char __ATTRS_o_ai
2041vec_lvxl(int a, signed char *b)
2042{
2043 return (vector signed char)__builtin_altivec_lvxl(a, b);
2044}
2045
2046static vector unsigned char __ATTRS_o_ai
2047vec_lvxl(int a, vector unsigned char *b)
2048{
2049 return (vector unsigned char)__builtin_altivec_lvxl(a, b);
2050}
2051
2052static vector unsigned char __ATTRS_o_ai
2053vec_lvxl(int a, unsigned char *b)
2054{
2055 return (vector unsigned char)__builtin_altivec_lvxl(a, b);
2056}
2057
2058static vector short __ATTRS_o_ai
2059vec_lvxl(int a, vector short *b)
2060{
2061 return (vector short)__builtin_altivec_lvxl(a, b);
2062}
2063
2064static vector short __ATTRS_o_ai
2065vec_lvxl(int a, short *b)
2066{
2067 return (vector short)__builtin_altivec_lvxl(a, b);
2068}
2069
2070static vector unsigned short __ATTRS_o_ai
2071vec_lvxl(int a, vector unsigned short *b)
2072{
2073 return (vector unsigned short)__builtin_altivec_lvxl(a, b);
2074}
2075
2076static vector unsigned short __ATTRS_o_ai
2077vec_lvxl(int a, unsigned short *b)
2078{
2079 return (vector unsigned short)__builtin_altivec_lvxl(a, b);
2080}
2081
2082static vector int __ATTRS_o_ai
2083vec_lvxl(int a, vector int *b)
2084{
2085 return (vector int)__builtin_altivec_lvxl(a, b);
2086}
2087
2088static vector int __ATTRS_o_ai
2089vec_lvxl(int a, int *b)
2090{
2091 return (vector int)__builtin_altivec_lvxl(a, b);
2092}
2093
2094static vector unsigned int __ATTRS_o_ai
2095vec_lvxl(int a, vector unsigned int *b)
2096{
2097 return (vector unsigned int)__builtin_altivec_lvxl(a, b);
2098}
2099
2100static vector unsigned int __ATTRS_o_ai
2101vec_lvxl(int a, unsigned int *b)
2102{
2103 return (vector unsigned int)__builtin_altivec_lvxl(a, b);
2104}
2105
2106static vector float __ATTRS_o_ai
2107vec_lvxl(int a, vector float *b)
2108{
2109 return (vector float)__builtin_altivec_lvxl(a, b);
2110}
2111
2112static vector float __ATTRS_o_ai
2113vec_lvxl(int a, float *b)
2114{
2115 return (vector float)__builtin_altivec_lvxl(a, b);
2116}
2117
2118/* vec_loge */
2119
2120static vector float __attribute__((__always_inline__))
2121vec_loge(vector float a)
2122{
2123 return __builtin_altivec_vlogefp(a);
2124}
2125
2126/* vec_vlogefp */
2127
2128static vector float __attribute__((__always_inline__))
2129vec_vlogefp(vector float a)
2130{
2131 return __builtin_altivec_vlogefp(a);
2132}
2133
2134/* vec_lvsl */
2135
2136static vector unsigned char __ATTRS_o_ai
2137vec_lvsl(int a, signed char *b)
2138{
2139 return (vector unsigned char)__builtin_altivec_lvsl(a, b);
2140}
2141
2142static vector unsigned char __ATTRS_o_ai
2143vec_lvsl(int a, unsigned char *b)
2144{
2145 return (vector unsigned char)__builtin_altivec_lvsl(a, b);
2146}
2147
2148static vector unsigned char __ATTRS_o_ai
2149vec_lvsl(int a, short *b)
2150{
2151 return (vector unsigned char)__builtin_altivec_lvsl(a, b);
2152}
2153
2154static vector unsigned char __ATTRS_o_ai
2155vec_lvsl(int a, unsigned short *b)
2156{
2157 return (vector unsigned char)__builtin_altivec_lvsl(a, b);
2158}
2159
2160static vector unsigned char __ATTRS_o_ai
2161vec_lvsl(int a, int *b)
2162{
2163 return (vector unsigned char)__builtin_altivec_lvsl(a, b);
2164}
2165
2166static vector unsigned char __ATTRS_o_ai
2167vec_lvsl(int a, unsigned int *b)
2168{
2169 return (vector unsigned char)__builtin_altivec_lvsl(a, b);
2170}
2171
2172static vector unsigned char __ATTRS_o_ai
2173vec_lvsl(int a, float *b)
2174{
2175 return (vector unsigned char)__builtin_altivec_lvsl(a, b);
2176}
2177
2178/* vec_lvsr */
2179
2180static vector unsigned char __ATTRS_o_ai
2181vec_lvsr(int a, signed char *b)
2182{
2183 return (vector unsigned char)__builtin_altivec_lvsr(a, b);
2184}
2185
2186static vector unsigned char __ATTRS_o_ai
2187vec_lvsr(int a, unsigned char *b)
2188{
2189 return (vector unsigned char)__builtin_altivec_lvsr(a, b);
2190}
2191
2192static vector unsigned char __ATTRS_o_ai
2193vec_lvsr(int a, short *b)
2194{
2195 return (vector unsigned char)__builtin_altivec_lvsr(a, b);
2196}
2197
2198static vector unsigned char __ATTRS_o_ai
2199vec_lvsr(int a, unsigned short *b)
2200{
2201 return (vector unsigned char)__builtin_altivec_lvsr(a, b);
2202}
2203
2204static vector unsigned char __ATTRS_o_ai
2205vec_lvsr(int a, int *b)
2206{
2207 return (vector unsigned char)__builtin_altivec_lvsr(a, b);
2208}
2209
2210static vector unsigned char __ATTRS_o_ai
2211vec_lvsr(int a, unsigned int *b)
2212{
2213 return (vector unsigned char)__builtin_altivec_lvsr(a, b);
2214}
2215
2216static vector unsigned char __ATTRS_o_ai
2217vec_lvsr(int a, float *b)
2218{
2219 return (vector unsigned char)__builtin_altivec_lvsr(a, b);
2220}
2221
2222/* vec_madd */
2223
2224static vector float __attribute__((__always_inline__))
2225vec_madd(vector float a, vector float b, vector float c)
2226{
2227 return __builtin_altivec_vmaddfp(a, b, c);
2228}
2229
2230/* vec_vmaddfp */
2231
2232static vector float __attribute__((__always_inline__))
2233vec_vmaddfp(vector float a, vector float b, vector float c)
2234{
2235 return __builtin_altivec_vmaddfp(a, b, c);
2236}
2237
2238/* vec_madds */
2239
2240static vector signed short __attribute__((__always_inline__))
2241vec_madds(vector signed short a, vector signed short b, vector signed short c)
2242{
2243 return __builtin_altivec_vmhaddshs(a, b, c);
2244}
2245
2246/* vec_vmhaddshs */
2247static vector signed short __attribute__((__always_inline__))
2248vec_vmhaddshs(vector signed short a, vector signed short b, vector signed short c)
2249{
2250 return __builtin_altivec_vmhaddshs(a, b, c);
2251}
2252
Chris Lattnerdd173942010-04-14 03:54:58 +00002253/* vec_max */
2254
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002255static vector signed char __ATTRS_o_ai
Anton Yartseva816ec82010-08-12 18:51:55 +00002256vec_max(vector signed char a, vector signed char b)
Chris Lattnerdd173942010-04-14 03:54:58 +00002257{
2258 return __builtin_altivec_vmaxsb(a, b);
2259}
2260
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002261static vector unsigned char __ATTRS_o_ai
Anton Yartseva816ec82010-08-12 18:51:55 +00002262vec_max(vector unsigned char a, vector unsigned char b)
Chris Lattnerdd173942010-04-14 03:54:58 +00002263{
2264 return __builtin_altivec_vmaxub(a, b);
2265}
2266
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002267static vector short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00002268vec_max(vector short a, vector short b)
2269{
2270 return __builtin_altivec_vmaxsh(a, b);
2271}
2272
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002273static vector unsigned short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00002274vec_max(vector unsigned short a, vector unsigned short b)
2275{
2276 return __builtin_altivec_vmaxuh(a, b);
2277}
2278
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002279static vector int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00002280vec_max(vector int a, vector int b)
2281{
2282 return __builtin_altivec_vmaxsw(a, b);
2283}
2284
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002285static vector unsigned int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00002286vec_max(vector unsigned int a, vector unsigned int b)
2287{
2288 return __builtin_altivec_vmaxuw(a, b);
2289}
2290
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002291static vector float __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00002292vec_max(vector float a, vector float b)
2293{
2294 return __builtin_altivec_vmaxfp(a, b);
2295}
2296
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002297/* vec_vmaxsb */
2298
2299static vector signed char __attribute__((__always_inline__))
Anton Yartseva816ec82010-08-12 18:51:55 +00002300vec_vmaxsb(vector signed char a, vector signed char b)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002301{
2302 return __builtin_altivec_vmaxsb(a, b);
2303}
2304
2305/* vec_vmaxub */
2306
2307static vector unsigned char __attribute__((__always_inline__))
Anton Yartseva816ec82010-08-12 18:51:55 +00002308vec_vmaxub(vector unsigned char a, vector unsigned char b)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002309{
2310 return __builtin_altivec_vmaxub(a, b);
2311}
2312
2313/* vec_vmaxsh */
2314
2315static vector short __attribute__((__always_inline__))
2316vec_vmaxsh(vector short a, vector short b)
2317{
2318 return __builtin_altivec_vmaxsh(a, b);
2319}
2320
2321/* vec_vmaxuh */
2322
2323static vector unsigned short __attribute__((__always_inline__))
2324vec_vmaxuh(vector unsigned short a, vector unsigned short b)
2325{
2326 return __builtin_altivec_vmaxuh(a, b);
2327}
2328
2329/* vec_vmaxsw */
2330
2331static vector int __attribute__((__always_inline__))
2332vec_vmaxsw(vector int a, vector int b)
2333{
2334 return __builtin_altivec_vmaxsw(a, b);
2335}
2336
2337/* vec_vmaxuw */
2338
2339static vector unsigned int __attribute__((__always_inline__))
2340vec_vmaxuw(vector unsigned int a, vector unsigned int b)
2341{
2342 return __builtin_altivec_vmaxuw(a, b);
2343}
2344
2345/* vec_vmaxfp */
2346
2347static vector float __attribute__((__always_inline__))
2348vec_vmaxfp(vector float a, vector float b)
2349{
2350 return __builtin_altivec_vmaxfp(a, b);
2351}
2352
2353/* vec_mergeh */
2354
2355static vector signed char __ATTRS_o_ai
2356vec_mergeh(vector signed char a, vector signed char b)
2357{
2358 return vec_perm(a, b, (vector unsigned char)
2359 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2360 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2361}
2362
2363static vector unsigned char __ATTRS_o_ai
2364vec_mergeh(vector unsigned char a, vector unsigned char b)
2365{
2366 return vec_perm(a, b, (vector unsigned char)
2367 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2368 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2369}
2370
2371static vector short __ATTRS_o_ai
2372vec_mergeh(vector short a, vector short b)
2373{
2374 return vec_perm(a, b, (vector unsigned char)
2375 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2376 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2377}
2378
2379static vector unsigned short __ATTRS_o_ai
2380vec_mergeh(vector unsigned short a, vector unsigned short b)
2381{
2382 return vec_perm(a, b, (vector unsigned char)
2383 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2384 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2385}
2386
2387static vector int __ATTRS_o_ai
2388vec_mergeh(vector int a, vector int b)
2389{
2390 return vec_perm(a, b, (vector unsigned char)
2391 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2392 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2393}
2394
2395static vector unsigned int __ATTRS_o_ai
2396vec_mergeh(vector unsigned int a, vector unsigned int b)
2397{
2398 return vec_perm(a, b, (vector unsigned char)
2399 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2400 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2401}
2402
2403static vector float __ATTRS_o_ai
2404vec_mergeh(vector float a, vector float b)
2405{
2406 return vec_perm(a, b, (vector unsigned char)
2407 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2408 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2409}
2410
2411/* vec_vmrghb */
2412
2413#define __builtin_altivec_vmrghb vec_vmrghb
2414
2415static vector signed char __ATTRS_o_ai
2416vec_vmrghb(vector signed char a, vector signed char b)
2417{
2418 return vec_perm(a, b, (vector unsigned char)
2419 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2420 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2421}
2422
2423static vector unsigned char __ATTRS_o_ai
2424vec_vmrghb(vector unsigned char a, vector unsigned char b)
2425{
2426 return vec_perm(a, b, (vector unsigned char)
2427 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2428 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2429}
2430
2431/* vec_vmrghh */
2432
2433#define __builtin_altivec_vmrghh vec_vmrghh
2434
2435static vector short __ATTRS_o_ai
2436vec_vmrghh(vector short a, vector short b)
2437{
2438 return vec_perm(a, b, (vector unsigned char)
2439 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2440 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2441}
2442
2443static vector unsigned short __ATTRS_o_ai
2444vec_vmrghh(vector unsigned short a, vector unsigned short b)
2445{
2446 return vec_perm(a, b, (vector unsigned char)
2447 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2448 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2449}
2450
2451/* vec_vmrghw */
2452
2453#define __builtin_altivec_vmrghw vec_vmrghw
2454
2455static vector int __ATTRS_o_ai
2456vec_vmrghw(vector int a, vector int b)
2457{
2458 return vec_perm(a, b, (vector unsigned char)
2459 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2460 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2461}
2462
2463static vector unsigned int __ATTRS_o_ai
2464vec_vmrghw(vector unsigned int a, vector unsigned int b)
2465{
2466 return vec_perm(a, b, (vector unsigned char)
2467 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2468 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2469}
2470
2471static vector float __ATTRS_o_ai
2472vec_vmrghw(vector float a, vector float b)
2473{
2474 return vec_perm(a, b, (vector unsigned char)
2475 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2476 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2477}
2478
2479/* vec_mergel */
2480
2481static vector signed char __ATTRS_o_ai
2482vec_mergel(vector signed char a, vector signed char b)
2483{
2484 return vec_perm(a, b, (vector unsigned char)
2485 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
2486 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
2487}
2488
2489static vector unsigned char __ATTRS_o_ai
2490vec_mergel(vector unsigned char a, vector unsigned char b)
2491{
2492 return vec_perm(a, b, (vector unsigned char)
2493 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
2494 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
2495}
2496
2497static vector short __ATTRS_o_ai
2498vec_mergel(vector short a, vector short b)
2499{
2500 return vec_perm(a, b, (vector unsigned char)
2501 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
2502 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
2503}
2504
2505static vector unsigned short __ATTRS_o_ai
2506vec_mergel(vector unsigned short a, vector unsigned short b)
2507{
2508 return vec_perm(a, b, (vector unsigned char)
2509 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
2510 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
2511}
2512
2513static vector int __ATTRS_o_ai
2514vec_mergel(vector int a, vector int b)
2515{
2516 return vec_perm(a, b, (vector unsigned char)
2517 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
2518 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
2519}
2520
2521static vector unsigned int __ATTRS_o_ai
2522vec_mergel(vector unsigned int a, vector unsigned int b)
2523{
2524 return vec_perm(a, b, (vector unsigned char)
2525 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
2526 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
2527}
2528
2529static vector float __ATTRS_o_ai
2530vec_mergel(vector float a, vector float b)
2531{
2532 return vec_perm(a, b, (vector unsigned char)
2533 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
2534 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
2535}
2536
2537/* vec_vmrglb */
2538
2539#define __builtin_altivec_vmrglb vec_vmrglb
2540
2541static vector signed char __ATTRS_o_ai
2542vec_vmrglb(vector signed char a, vector signed char b)
2543{
2544 return vec_perm(a, b, (vector unsigned char)
2545 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
2546 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
2547}
2548
2549static vector unsigned char __ATTRS_o_ai
2550vec_vmrglb(vector unsigned char a, vector unsigned char b)
2551{
2552 return vec_perm(a, b, (vector unsigned char)
2553 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
2554 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
2555}
2556
2557/* vec_vmrglh */
2558
2559#define __builtin_altivec_vmrglh vec_vmrglh
2560
2561static vector short __ATTRS_o_ai
2562vec_vmrglh(vector short a, vector short b)
2563{
2564 return vec_perm(a, b, (vector unsigned char)
2565 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
2566 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
2567}
2568
2569static vector unsigned short __ATTRS_o_ai
2570vec_vmrglh(vector unsigned short a, vector unsigned short b)
2571{
2572 return vec_perm(a, b, (vector unsigned char)
2573 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
2574 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
2575}
2576
2577/* vec_vmrglw */
2578
2579#define __builtin_altivec_vmrglw vec_vmrglw
2580
2581static vector int __ATTRS_o_ai
2582vec_vmrglw(vector int a, vector int b)
2583{
2584 return vec_perm(a, b, (vector unsigned char)
2585 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
2586 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
2587}
2588
2589static vector unsigned int __ATTRS_o_ai
2590vec_vmrglw(vector unsigned int a, vector unsigned int b)
2591{
2592 return vec_perm(a, b, (vector unsigned char)
2593 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
2594 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
2595}
2596
2597static vector float __ATTRS_o_ai
2598vec_vmrglw(vector float a, vector float b)
2599{
2600 return vec_perm(a, b, (vector unsigned char)
2601 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
2602 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
2603}
2604
Chris Lattnerdd173942010-04-14 03:54:58 +00002605/* vec_mfvscr */
2606
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002607static vector unsigned short __attribute__((__always_inline__))
2608vec_mfvscr(void)
2609{
2610 return __builtin_altivec_mfvscr();
2611}
Chris Lattnerdd173942010-04-14 03:54:58 +00002612
2613/* vec_min */
2614
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002615static vector signed char __ATTRS_o_ai
Anton Yartseva816ec82010-08-12 18:51:55 +00002616vec_min(vector signed char a, vector signed char b)
Chris Lattnerdd173942010-04-14 03:54:58 +00002617{
2618 return __builtin_altivec_vminsb(a, b);
2619}
2620
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002621static vector unsigned char __ATTRS_o_ai
Anton Yartseva816ec82010-08-12 18:51:55 +00002622vec_min(vector unsigned char a, vector unsigned char b)
Chris Lattnerdd173942010-04-14 03:54:58 +00002623{
2624 return __builtin_altivec_vminub(a, b);
2625}
2626
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002627static vector short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00002628vec_min(vector short a, vector short b)
2629{
2630 return __builtin_altivec_vminsh(a, b);
2631}
2632
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002633static vector unsigned short __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00002634vec_min(vector unsigned short a, vector unsigned short b)
2635{
2636 return __builtin_altivec_vminuh(a, b);
2637}
2638
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002639static vector int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00002640vec_min(vector int a, vector int b)
2641{
2642 return __builtin_altivec_vminsw(a, b);
2643}
2644
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002645static vector unsigned int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00002646vec_min(vector unsigned int a, vector unsigned int b)
2647{
2648 return __builtin_altivec_vminuw(a, b);
2649}
2650
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002651static vector float __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00002652vec_min(vector float a, vector float b)
2653{
2654 return __builtin_altivec_vminfp(a, b);
2655}
2656
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002657/* vec_vminsb */
2658
2659static vector signed char __attribute__((__always_inline__))
Anton Yartseva816ec82010-08-12 18:51:55 +00002660vec_vminsb(vector signed char a, vector signed char b)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002661{
2662 return __builtin_altivec_vminsb(a, b);
2663}
2664
2665/* vec_vminub */
2666
2667static vector unsigned char __attribute__((__always_inline__))
Anton Yartseva816ec82010-08-12 18:51:55 +00002668vec_vminub(vector unsigned char a, vector unsigned char b)
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002669{
2670 return __builtin_altivec_vminub(a, b);
2671}
2672
2673/* vec_vminsh */
2674
2675static vector short __attribute__((__always_inline__))
2676vec_vminsh(vector short a, vector short b)
2677{
2678 return __builtin_altivec_vminsh(a, b);
2679}
2680
2681/* vec_vminuh */
2682
2683static vector unsigned short __attribute__((__always_inline__))
2684vec_vminuh(vector unsigned short a, vector unsigned short b)
2685{
2686 return __builtin_altivec_vminuh(a, b);
2687}
2688
2689/* vec_vminsw */
2690
2691static vector int __attribute__((__always_inline__))
2692vec_vminsw(vector int a, vector int b)
2693{
2694 return __builtin_altivec_vminsw(a, b);
2695}
2696
2697/* vec_vminuw */
2698
2699static vector unsigned int __attribute__((__always_inline__))
2700vec_vminuw(vector unsigned int a, vector unsigned int b)
2701{
2702 return __builtin_altivec_vminuw(a, b);
2703}
2704
2705/* vec_vminfp */
2706
2707static vector float __attribute__((__always_inline__))
2708vec_vminfp(vector float a, vector float b)
2709{
2710 return __builtin_altivec_vminfp(a, b);
2711}
2712
2713/* vec_mladd */
2714
2715#define __builtin_altivec_vmladduhm vec_mladd
2716
2717static vector short __ATTRS_o_ai
2718vec_mladd(vector short a, vector short b, vector short c)
2719{
2720 return a * b + c;
2721}
2722
2723static vector short __ATTRS_o_ai
2724vec_mladd(vector short a, vector unsigned short b, vector unsigned short c)
2725{
2726 return a * (vector short)b + (vector short)c;
2727}
2728
2729static vector short __ATTRS_o_ai
2730vec_mladd(vector unsigned short a, vector short b, vector short c)
2731{
2732 return (vector short)a * b + c;
2733}
2734
2735static vector unsigned short __ATTRS_o_ai
2736vec_mladd(vector unsigned short a, vector unsigned short b, vector unsigned short c)
2737{
2738 return a * b + c;
2739}
2740
2741/* vec_vmladduhm */
2742
2743static vector short __ATTRS_o_ai
2744vec_vmladduhm(vector short a, vector short b, vector short c)
2745{
2746 return a * b + c;
2747}
2748
2749static vector short __ATTRS_o_ai
2750vec_vmladduhm(vector short a, vector unsigned short b, vector unsigned short c)
2751{
2752 return a * (vector short)b + (vector short)c;
2753}
2754
2755static vector short __ATTRS_o_ai
2756vec_vmladduhm(vector unsigned short a, vector short b, vector short c)
2757{
2758 return (vector short)a * b + c;
2759}
2760
2761static vector unsigned short __ATTRS_o_ai
2762vec_vmladduhm(vector unsigned short a, vector unsigned short b, vector unsigned short c)
2763{
2764 return a * b + c;
2765}
2766
2767/* vec_mradds */
2768
2769static vector short __attribute__((__always_inline__))
2770vec_mradds(vector short a, vector short b, vector short c)
2771{
2772 return __builtin_altivec_vmhraddshs(a, b, c);
2773}
2774
2775/* vec_vmhraddshs */
2776
2777static vector short __attribute__((__always_inline__))
2778vec_vmhraddshs(vector short a, vector short b, vector short c)
2779{
2780 return __builtin_altivec_vmhraddshs(a, b, c);
2781}
2782
2783/* vec_msum */
2784
2785static vector int __ATTRS_o_ai
2786vec_msum(vector signed char a, vector unsigned char b, vector int c)
2787{
2788 return __builtin_altivec_vmsummbm(a, b, c);
2789}
2790
2791static vector unsigned int __ATTRS_o_ai
2792vec_msum(vector unsigned char a, vector unsigned char b, vector unsigned int c)
2793{
2794 return __builtin_altivec_vmsumubm(a, b, c);
2795}
2796
2797static vector int __ATTRS_o_ai
2798vec_msum(vector short a, vector short b, vector int c)
2799{
2800 return __builtin_altivec_vmsumshm(a, b, c);
2801}
2802
2803static vector unsigned int __ATTRS_o_ai
2804vec_msum(vector unsigned short a, vector unsigned short b, vector unsigned int c)
2805{
2806 return __builtin_altivec_vmsumuhm(a, b, c);
2807}
2808
2809/* vec_vmsummbm */
2810
2811static vector int __attribute__((__always_inline__))
2812vec_vmsummbm(vector signed char a, vector unsigned char b, vector int c)
2813{
2814 return __builtin_altivec_vmsummbm(a, b, c);
2815}
2816
2817/* vec_vmsumubm */
2818
2819static vector unsigned int __attribute__((__always_inline__))
2820vec_vmsumubm(vector unsigned char a, vector unsigned char b, vector unsigned int c)
2821{
2822 return __builtin_altivec_vmsumubm(a, b, c);
2823}
2824
2825/* vec_vmsumshm */
2826
2827static vector int __attribute__((__always_inline__))
2828vec_vmsumshm(vector short a, vector short b, vector int c)
2829{
2830 return __builtin_altivec_vmsumshm(a, b, c);
2831}
2832
2833/* vec_vmsumuhm */
2834
2835static vector unsigned int __attribute__((__always_inline__))
2836vec_vmsumuhm(vector unsigned short a, vector unsigned short b, vector unsigned int c)
2837{
2838 return __builtin_altivec_vmsumuhm(a, b, c);
2839}
2840
2841/* vec_msums */
2842
2843static vector int __ATTRS_o_ai
2844vec_msums(vector short a, vector short b, vector int c)
2845{
2846 return __builtin_altivec_vmsumshs(a, b, c);
2847}
2848
2849static vector unsigned int __ATTRS_o_ai
2850vec_msums(vector unsigned short a, vector unsigned short b, vector unsigned int c)
2851{
2852 return __builtin_altivec_vmsumuhs(a, b, c);
2853}
2854
2855/* vec_vmsumshs */
2856
2857static vector int __attribute__((__always_inline__))
2858vec_vmsumshs(vector short a, vector short b, vector int c)
2859{
2860 return __builtin_altivec_vmsumshs(a, b, c);
2861}
2862
2863/* vec_vmsumuhs */
2864
2865static vector unsigned int __attribute__((__always_inline__))
2866vec_vmsumuhs(vector unsigned short a, vector unsigned short b, vector unsigned int c)
2867{
2868 return __builtin_altivec_vmsumuhs(a, b, c);
2869}
2870
Chris Lattnerdd173942010-04-14 03:54:58 +00002871/* vec_mtvscr */
2872
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00002873static void __ATTRS_o_ai
2874vec_mtvscr(vector signed char a)
2875{
2876 __builtin_altivec_mtvscr((vector int)a);
2877}
2878
2879static void __ATTRS_o_ai
2880vec_mtvscr(vector unsigned char a)
2881{
2882 __builtin_altivec_mtvscr((vector int)a);
2883}
2884
2885static void __ATTRS_o_ai
2886vec_mtvscr(vector short a)
2887{
2888 __builtin_altivec_mtvscr((vector int)a);
2889}
2890
2891static void __ATTRS_o_ai
2892vec_mtvscr(vector unsigned short a)
2893{
2894 __builtin_altivec_mtvscr((vector int)a);
2895}
2896
2897static void __ATTRS_o_ai
2898vec_mtvscr(vector int a)
2899{
2900 __builtin_altivec_mtvscr((vector int)a);
2901}
2902
2903static void __ATTRS_o_ai
2904vec_mtvscr(vector unsigned int a)
2905{
2906 __builtin_altivec_mtvscr((vector int)a);
2907}
2908
2909static void __ATTRS_o_ai
2910vec_mtvscr(vector float a)
2911{
2912 __builtin_altivec_mtvscr((vector int)a);
2913}
2914
2915/* vec_mule */
2916
2917static vector short __ATTRS_o_ai
2918vec_mule(vector signed char a, vector signed char b)
2919{
2920 return __builtin_altivec_vmulesb(a, b);
2921}
2922
2923static vector unsigned short __ATTRS_o_ai
2924vec_mule(vector unsigned char a, vector unsigned char b)
2925{
2926 return __builtin_altivec_vmuleub(a, b);
2927}
2928
2929static vector int __ATTRS_o_ai
2930vec_mule(vector short a, vector short b)
2931{
2932 return __builtin_altivec_vmulesh(a, b);
2933}
2934
2935static vector unsigned int __ATTRS_o_ai
2936vec_mule(vector unsigned short a, vector unsigned short b)
2937{
2938 return __builtin_altivec_vmuleuh(a, b);
2939}
2940
2941/* vec_vmulesb */
2942
2943static vector short __attribute__((__always_inline__))
2944vec_vmulesb(vector signed char a, vector signed char b)
2945{
2946 return __builtin_altivec_vmulesb(a, b);
2947}
2948
2949/* vec_vmuleub */
2950
2951static vector unsigned short __attribute__((__always_inline__))
2952vec_vmuleub(vector unsigned char a, vector unsigned char b)
2953{
2954 return __builtin_altivec_vmuleub(a, b);
2955}
2956
2957/* vec_vmulesh */
2958
2959static vector int __attribute__((__always_inline__))
2960vec_vmulesh(vector short a, vector short b)
2961{
2962 return __builtin_altivec_vmulesh(a, b);
2963}
2964
2965/* vec_vmuleuh */
2966
2967static vector unsigned int __attribute__((__always_inline__))
2968vec_vmuleuh(vector unsigned short a, vector unsigned short b)
2969{
2970 return __builtin_altivec_vmuleuh(a, b);
2971}
2972
2973/* vec_mulo */
2974
2975static vector short __ATTRS_o_ai
2976vec_mulo(vector signed char a, vector signed char b)
2977{
2978 return __builtin_altivec_vmulosb(a, b);
2979}
2980
2981static vector unsigned short __ATTRS_o_ai
2982vec_mulo(vector unsigned char a, vector unsigned char b)
2983{
2984 return __builtin_altivec_vmuloub(a, b);
2985}
2986
2987static vector int __ATTRS_o_ai
2988vec_mulo(vector short a, vector short b)
2989{
2990 return __builtin_altivec_vmulosh(a, b);
2991}
2992
2993static vector unsigned int __ATTRS_o_ai
2994vec_mulo(vector unsigned short a, vector unsigned short b)
2995{
2996 return __builtin_altivec_vmulouh(a, b);
2997}
2998
2999/* vec_vmulosb */
3000
3001static vector short __attribute__((__always_inline__))
3002vec_vmulosb(vector signed char a, vector signed char b)
3003{
3004 return __builtin_altivec_vmulosb(a, b);
3005}
3006
3007/* vec_vmuloub */
3008
3009static vector unsigned short __attribute__((__always_inline__))
3010vec_vmuloub(vector unsigned char a, vector unsigned char b)
3011{
3012 return __builtin_altivec_vmuloub(a, b);
3013}
3014
3015/* vec_vmulosh */
3016
3017static vector int __attribute__((__always_inline__))
3018vec_vmulosh(vector short a, vector short b)
3019{
3020 return __builtin_altivec_vmulosh(a, b);
3021}
3022
3023/* vec_vmulouh */
3024
3025static vector unsigned int __attribute__((__always_inline__))
3026vec_vmulouh(vector unsigned short a, vector unsigned short b)
3027{
3028 return __builtin_altivec_vmulouh(a, b);
3029}
3030
3031/* vec_nmsub */
3032
3033static vector float __attribute__((__always_inline__))
3034vec_nmsub(vector float a, vector float b, vector float c)
3035{
3036 return __builtin_altivec_vnmsubfp(a, b, c);
3037}
3038
3039/* vec_vnmsubfp */
3040
3041static vector float __attribute__((__always_inline__))
3042vec_vnmsubfp(vector float a, vector float b, vector float c)
3043{
3044 return __builtin_altivec_vnmsubfp(a, b, c);
3045}
3046
3047/* vec_nor */
3048
3049#define __builtin_altivec_vnor vec_nor
3050
3051static vector signed char __ATTRS_o_ai
3052vec_nor(vector signed char a, vector signed char b)
3053{
3054 return ~(a | b);
3055}
3056
3057static vector unsigned char __ATTRS_o_ai
3058vec_nor(vector unsigned char a, vector unsigned char b)
3059{
3060 return ~(a | b);
3061}
3062
3063static vector short __ATTRS_o_ai
3064vec_nor(vector short a, vector short b)
3065{
3066 return ~(a | b);
3067}
3068
3069static vector unsigned short __ATTRS_o_ai
3070vec_nor(vector unsigned short a, vector unsigned short b)
3071{
3072 return ~(a | b);
3073}
3074
3075static vector int __ATTRS_o_ai
3076vec_nor(vector int a, vector int b)
3077{
3078 return ~(a | b);
3079}
3080
3081static vector unsigned int __ATTRS_o_ai
3082vec_nor(vector unsigned int a, vector unsigned int b)
3083{
3084 return ~(a | b);
3085}
3086
3087static vector float __ATTRS_o_ai
3088vec_nor(vector float a, vector float b)
3089{
3090 vector unsigned int res = ~((vector unsigned int)a | (vector unsigned int)b);
3091 return (vector float)res;
3092}
3093
3094/* vec_vnor */
3095
3096static vector signed char __ATTRS_o_ai
3097vec_vnor(vector signed char a, vector signed char b)
3098{
3099 return ~(a | b);
3100}
3101
3102static vector unsigned char __ATTRS_o_ai
3103vec_vnor(vector unsigned char a, vector unsigned char b)
3104{
3105 return ~(a | b);
3106}
3107
3108static vector short __ATTRS_o_ai
3109vec_vnor(vector short a, vector short b)
3110{
3111 return ~(a | b);
3112}
3113
3114static vector unsigned short __ATTRS_o_ai
3115vec_vnor(vector unsigned short a, vector unsigned short b)
3116{
3117 return ~(a | b);
3118}
3119
3120static vector int __ATTRS_o_ai
3121vec_vnor(vector int a, vector int b)
3122{
3123 return ~(a | b);
3124}
3125
3126static vector unsigned int __ATTRS_o_ai
3127vec_vnor(vector unsigned int a, vector unsigned int b)
3128{
3129 return ~(a | b);
3130}
3131
3132static vector float __ATTRS_o_ai
3133vec_vnor(vector float a, vector float b)
3134{
3135 vector unsigned int res = ~((vector unsigned int)a | (vector unsigned int)b);
3136 return (vector float)res;
3137}
3138
3139/* vec_or */
3140
3141#define __builtin_altivec_vor vec_or
3142
3143static vector signed char __ATTRS_o_ai
3144vec_or(vector signed char a, vector signed char b)
3145{
3146 return a | b;
3147}
3148
3149static vector unsigned char __ATTRS_o_ai
3150vec_or(vector unsigned char a, vector unsigned char b)
3151{
3152 return a | b;
3153}
3154
3155static vector short __ATTRS_o_ai
3156vec_or(vector short a, vector short b)
3157{
3158 return a | b;
3159}
3160
3161static vector unsigned short __ATTRS_o_ai
3162vec_or(vector unsigned short a, vector unsigned short b)
3163{
3164 return a | b;
3165}
3166
3167static vector int __ATTRS_o_ai
3168vec_or(vector int a, vector int b)
3169{
3170 return a | b;
3171}
3172
3173static vector unsigned int __ATTRS_o_ai
3174vec_or(vector unsigned int a, vector unsigned int b)
3175{
3176 return a | b;
3177}
3178
3179static vector float __ATTRS_o_ai
3180vec_or(vector float a, vector float b)
3181{
3182 vector unsigned int res = (vector unsigned int)a | (vector unsigned int)b;
3183 return (vector float)res;
3184}
3185
3186/* vec_vor */
3187
3188static vector signed char __ATTRS_o_ai
3189vec_vor(vector signed char a, vector signed char b)
3190{
3191 return a | b;
3192}
3193
3194static vector unsigned char __ATTRS_o_ai
3195vec_vor(vector unsigned char a, vector unsigned char b)
3196{
3197 return a | b;
3198}
3199
3200static vector short __ATTRS_o_ai
3201vec_vor(vector short a, vector short b)
3202{
3203 return a | b;
3204}
3205
3206static vector unsigned short __ATTRS_o_ai
3207vec_vor(vector unsigned short a, vector unsigned short b)
3208{
3209 return a | b;
3210}
3211
3212static vector int __ATTRS_o_ai
3213vec_vor(vector int a, vector int b)
3214{
3215 return a | b;
3216}
3217
3218static vector unsigned int __ATTRS_o_ai
3219vec_vor(vector unsigned int a, vector unsigned int b)
3220{
3221 return a | b;
3222}
3223
3224static vector float __ATTRS_o_ai
3225vec_vor(vector float a, vector float b)
3226{
3227 vector unsigned int res = (vector unsigned int)a | (vector unsigned int)b;
3228 return (vector float)res;
3229}
3230
3231/* vec_pack */
3232
3233static vector signed char __ATTRS_o_ai
3234vec_pack(vector signed short a, vector signed short b)
3235{
3236 return (vector signed char)vec_perm(a, b, (vector unsigned char)
3237 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
3238 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
3239}
3240
3241static vector unsigned char __ATTRS_o_ai
3242vec_pack(vector unsigned short a, vector unsigned short b)
3243{
3244 return (vector unsigned char)vec_perm(a, b, (vector unsigned char)
3245 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
3246 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
3247}
3248
3249static vector short __ATTRS_o_ai
3250vec_pack(vector int a, vector int b)
3251{
3252 return (vector short)vec_perm(a, b, (vector unsigned char)
3253 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
3254 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
3255}
3256
3257static vector unsigned short __ATTRS_o_ai
3258vec_pack(vector unsigned int a, vector unsigned int b)
3259{
3260 return (vector unsigned short)vec_perm(a, b, (vector unsigned char)
3261 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
3262 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
3263}
3264
3265/* vec_vpkuhum */
3266
3267#define __builtin_altivec_vpkuhum vec_vpkuhum
3268
3269static vector signed char __ATTRS_o_ai
3270vec_vpkuhum(vector signed short a, vector signed short b)
3271{
3272 return (vector signed char)vec_perm(a, b, (vector unsigned char)
3273 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
3274 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
3275}
3276
3277static vector unsigned char __ATTRS_o_ai
3278vec_vpkuhum(vector unsigned short a, vector unsigned short b)
3279{
3280 return (vector unsigned char)vec_perm(a, b, (vector unsigned char)
3281 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
3282 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
3283}
3284
3285/* vec_vpkuwum */
3286
3287#define __builtin_altivec_vpkuwum vec_vpkuwum
3288
3289static vector short __ATTRS_o_ai
3290vec_vpkuwum(vector int a, vector int b)
3291{
3292 return (vector short)vec_perm(a, b, (vector unsigned char)
3293 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
3294 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
3295}
3296
3297static vector unsigned short __ATTRS_o_ai
3298vec_vpkuwum(vector unsigned int a, vector unsigned int b)
3299{
3300 return (vector unsigned short)vec_perm(a, b, (vector unsigned char)
3301 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
3302 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
3303}
3304
3305/* vec_packpx */
3306
3307static vector pixel __attribute__((__always_inline__))
3308vec_packpx(vector unsigned int a, vector unsigned int b)
3309{
3310 return (vector pixel)__builtin_altivec_vpkpx(a, b);
3311}
3312
3313/* vec_vpkpx */
3314
3315static vector pixel __attribute__((__always_inline__))
3316vec_vpkpx(vector unsigned int a, vector unsigned int b)
3317{
3318 return (vector pixel)__builtin_altivec_vpkpx(a, b);
3319}
3320
3321/* vec_packs */
3322
3323static vector signed char __ATTRS_o_ai
3324vec_packs(vector short a, vector short b)
3325{
3326 return __builtin_altivec_vpkshss(a, b);
3327}
3328
3329static vector unsigned char __ATTRS_o_ai
3330vec_packs(vector unsigned short a, vector unsigned short b)
3331{
3332 return __builtin_altivec_vpkuhus(a, b);
3333}
3334
3335static vector signed short __ATTRS_o_ai
3336vec_packs(vector int a, vector int b)
3337{
3338 return __builtin_altivec_vpkswss(a, b);
3339}
3340
3341static vector unsigned short __ATTRS_o_ai
3342vec_packs(vector unsigned int a, vector unsigned int b)
3343{
3344 return __builtin_altivec_vpkuwus(a, b);
3345}
3346
3347/* vec_vpkshss */
3348
3349static vector signed char __attribute__((__always_inline__))
3350vec_vpkshss(vector short a, vector short b)
3351{
3352 return __builtin_altivec_vpkshss(a, b);
3353}
3354
3355/* vec_vpkuhus */
3356
3357static vector unsigned char __attribute__((__always_inline__))
3358vec_vpkuhus(vector unsigned short a, vector unsigned short b)
3359{
3360 return __builtin_altivec_vpkuhus(a, b);
3361}
3362
3363/* vec_vpkswss */
3364
3365static vector signed short __attribute__((__always_inline__))
3366vec_vpkswss(vector int a, vector int b)
3367{
3368 return __builtin_altivec_vpkswss(a, b);
3369}
3370
3371/* vec_vpkuwus */
3372
3373static vector unsigned short __attribute__((__always_inline__))
3374vec_vpkuwus(vector unsigned int a, vector unsigned int b)
3375{
3376 return __builtin_altivec_vpkuwus(a, b);
3377}
3378
3379/* vec_packsu */
3380
3381static vector unsigned char __ATTRS_o_ai
3382vec_packsu(vector short a, vector short b)
3383{
3384 return __builtin_altivec_vpkshus(a, b);
3385}
3386
3387static vector unsigned char __ATTRS_o_ai
3388vec_packsu(vector unsigned short a, vector unsigned short b)
3389{
3390 return __builtin_altivec_vpkuhus(a, b);
3391}
3392
3393static vector unsigned short __ATTRS_o_ai
3394vec_packsu(vector int a, vector int b)
3395{
3396 return __builtin_altivec_vpkswus(a, b);
3397}
3398
3399static vector unsigned short __ATTRS_o_ai
3400vec_packsu(vector unsigned int a, vector unsigned int b)
3401{
3402 return __builtin_altivec_vpkuwus(a, b);
3403}
3404
3405/* vec_vpkshus */
3406
3407static vector unsigned char __ATTRS_o_ai
3408vec_vpkshus(vector short a, vector short b)
3409{
3410 return __builtin_altivec_vpkshus(a, b);
3411}
3412
3413static vector unsigned char __ATTRS_o_ai
3414vec_vpkshus(vector unsigned short a, vector unsigned short b)
3415{
3416 return __builtin_altivec_vpkuhus(a, b);
3417}
3418
3419/* vec_vpkswus */
3420
3421static vector unsigned short __ATTRS_o_ai
3422vec_vpkswus(vector int a, vector int b)
3423{
3424 return __builtin_altivec_vpkswus(a, b);
3425}
3426
3427static vector unsigned short __ATTRS_o_ai
3428vec_vpkswus(vector unsigned int a, vector unsigned int b)
3429{
3430 return __builtin_altivec_vpkuwus(a, b);
3431}
3432
3433/* vec_perm */
3434
3435vector signed char __ATTRS_o_ai
3436vec_perm(vector signed char a, vector signed char b, vector unsigned char c)
3437{
3438 return (vector signed char)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
3439}
3440
3441vector unsigned char __ATTRS_o_ai
3442vec_perm(vector unsigned char a, vector unsigned char b, vector unsigned char c)
3443{
3444 return (vector unsigned char)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
3445}
3446
3447vector short __ATTRS_o_ai
3448vec_perm(vector short a, vector short b, vector unsigned char c)
3449{
3450 return (vector short)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
3451}
3452
3453vector unsigned short __ATTRS_o_ai
3454vec_perm(vector unsigned short a, vector unsigned short b, vector unsigned char c)
3455{
3456 return (vector unsigned short)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
3457}
3458
3459vector int __ATTRS_o_ai
3460vec_perm(vector int a, vector int b, vector unsigned char c)
3461{
3462 return (vector int)__builtin_altivec_vperm_4si(a, b, c);
3463}
3464
3465vector unsigned int __ATTRS_o_ai
3466vec_perm(vector unsigned int a, vector unsigned int b, vector unsigned char c)
3467{
3468 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
3469}
3470
3471vector float __ATTRS_o_ai
3472vec_perm(vector float a, vector float b, vector unsigned char c)
3473{
3474 return (vector float)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
3475}
3476
3477/* vec_vperm */
3478
3479vector signed char __ATTRS_o_ai
3480vec_vperm(vector signed char a, vector signed char b, vector unsigned char c)
3481{
3482 return (vector signed char)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
3483}
3484
3485vector unsigned char __ATTRS_o_ai
3486vec_vperm(vector unsigned char a, vector unsigned char b, vector unsigned char c)
3487{
3488 return (vector unsigned char)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
3489}
3490
3491vector short __ATTRS_o_ai
3492vec_vperm(vector short a, vector short b, vector unsigned char c)
3493{
3494 return (vector short)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
3495}
3496
3497vector unsigned short __ATTRS_o_ai
3498vec_vperm(vector unsigned short a, vector unsigned short b, vector unsigned char c)
3499{
3500 return (vector unsigned short)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
3501}
3502
3503vector int __ATTRS_o_ai
3504vec_vperm(vector int a, vector int b, vector unsigned char c)
3505{
3506 return (vector int)__builtin_altivec_vperm_4si(a, b, c);
3507}
3508
3509vector unsigned int __ATTRS_o_ai
3510vec_vperm(vector unsigned int a, vector unsigned int b, vector unsigned char c)
3511{
3512 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
3513}
3514
3515vector float __ATTRS_o_ai
3516vec_vperm(vector float a, vector float b, vector unsigned char c)
3517{
3518 return (vector float)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
3519}
3520
3521/* vec_re */
3522
3523vector float __attribute__((__always_inline__))
3524vec_re(vector float a)
3525{
3526 return __builtin_altivec_vrefp(a);
3527}
3528
3529/* vec_vrefp */
3530
3531vector float __attribute__((__always_inline__))
3532vec_vrefp(vector float a)
3533{
3534 return __builtin_altivec_vrefp(a);
3535}
3536
3537/* vec_rl */
3538
3539static vector signed char __ATTRS_o_ai
3540vec_rl(vector signed char a, vector unsigned char b)
3541{
3542 return (vector signed char)__builtin_altivec_vrlb((vector char)a, b);
3543}
3544
3545static vector unsigned char __ATTRS_o_ai
3546vec_rl(vector unsigned char a, vector unsigned char b)
3547{
3548 return (vector unsigned char)__builtin_altivec_vrlb((vector char)a, b);
3549}
3550
3551static vector short __ATTRS_o_ai
3552vec_rl(vector short a, vector unsigned short b)
3553{
3554 return __builtin_altivec_vrlh(a, b);
3555}
3556
3557static vector unsigned short __ATTRS_o_ai
3558vec_rl(vector unsigned short a, vector unsigned short b)
3559{
3560 return (vector unsigned short)__builtin_altivec_vrlh((vector short)a, b);
3561}
3562
3563static vector int __ATTRS_o_ai
3564vec_rl(vector int a, vector unsigned int b)
3565{
3566 return __builtin_altivec_vrlw(a, b);
3567}
3568
3569static vector unsigned int __ATTRS_o_ai
3570vec_rl(vector unsigned int a, vector unsigned int b)
3571{
3572 return (vector unsigned int)__builtin_altivec_vrlw((vector int)a, b);
3573}
3574
3575/* vec_vrlb */
3576
3577static vector signed char __ATTRS_o_ai
3578vec_vrlb(vector signed char a, vector unsigned char b)
3579{
3580 return (vector signed char)__builtin_altivec_vrlb((vector char)a, b);
3581}
3582
3583static vector unsigned char __ATTRS_o_ai
3584vec_vrlb(vector unsigned char a, vector unsigned char b)
3585{
3586 return (vector unsigned char)__builtin_altivec_vrlb((vector char)a, b);
3587}
3588
3589/* vec_vrlh */
3590
3591static vector short __ATTRS_o_ai
3592vec_vrlh(vector short a, vector unsigned short b)
3593{
3594 return __builtin_altivec_vrlh(a, b);
3595}
3596
3597static vector unsigned short __ATTRS_o_ai
3598vec_vrlh(vector unsigned short a, vector unsigned short b)
3599{
3600 return (vector unsigned short)__builtin_altivec_vrlh((vector short)a, b);
3601}
3602
3603/* vec_vrlw */
3604
3605static vector int __ATTRS_o_ai
3606vec_vrlw(vector int a, vector unsigned int b)
3607{
3608 return __builtin_altivec_vrlw(a, b);
3609}
3610
3611static vector unsigned int __ATTRS_o_ai
3612vec_vrlw(vector unsigned int a, vector unsigned int b)
3613{
3614 return (vector unsigned int)__builtin_altivec_vrlw((vector int)a, b);
3615}
3616
3617/* vec_round */
3618
3619static vector float __attribute__((__always_inline__))
3620vec_round(vector float a)
3621{
3622 return __builtin_altivec_vrfin(a);
3623}
3624
3625/* vec_vrfin */
3626
3627static vector float __attribute__((__always_inline__))
3628vec_vrfin(vector float a)
3629{
3630 return __builtin_altivec_vrfin(a);
3631}
3632
3633/* vec_rsqrte */
3634
3635static __vector float __attribute__((__always_inline__))
3636vec_rsqrte(vector float a)
3637{
3638 return __builtin_altivec_vrsqrtefp(a);
3639}
3640
3641/* vec_vrsqrtefp */
3642
3643static __vector float __attribute__((__always_inline__))
3644vec_vrsqrtefp(vector float a)
3645{
3646 return __builtin_altivec_vrsqrtefp(a);
3647}
3648
3649/* vec_sel */
3650
3651#define __builtin_altivec_vsel_4si vec_sel
3652
3653static vector signed char __ATTRS_o_ai
3654vec_sel(vector signed char a, vector signed char b, vector unsigned char c)
3655{
3656 return (a & ~(vector signed char)c) | (b & (vector signed char)c);
3657}
3658
3659static vector unsigned char __ATTRS_o_ai
3660vec_sel(vector unsigned char a, vector unsigned char b, vector unsigned char c)
3661{
3662 return (a & ~c) | (b & c);
3663}
3664
3665static vector short __ATTRS_o_ai
3666vec_sel(vector short a, vector short b, vector unsigned short c)
3667{
3668 return (a & ~(vector short)c) | (b & (vector short)c);
3669}
3670
3671static vector unsigned short __ATTRS_o_ai
3672vec_sel(vector unsigned short a, vector unsigned short b, vector unsigned short c)
3673{
3674 return (a & ~c) | (b & c);
3675}
3676
3677static vector int __ATTRS_o_ai
3678vec_sel(vector int a, vector int b, vector unsigned int c)
3679{
3680 return (a & ~(vector int)c) | (b & (vector int)c);
3681}
3682
3683static vector unsigned int __ATTRS_o_ai
3684vec_sel(vector unsigned int a, vector unsigned int b, vector unsigned int c)
3685{
3686 return (a & ~c) | (b & c);
3687}
3688
3689static vector float __ATTRS_o_ai
3690vec_sel(vector float a, vector float b, vector unsigned int c)
3691{
3692 vector int res = ((vector int)a & ~(vector int)c) | ((vector int)b & (vector int)c);
3693 return (vector float)res;
3694}
3695
3696/* vec_vsel */
3697
3698static vector signed char __ATTRS_o_ai
3699vec_vsel(vector signed char a, vector signed char b, vector unsigned char c)
3700{
3701 return (a & ~(vector signed char)c) | (b & (vector signed char)c);
3702}
3703
3704static vector unsigned char __ATTRS_o_ai
3705vec_vsel(vector unsigned char a, vector unsigned char b, vector unsigned char c)
3706{
3707 return (a & ~c) | (b & c);
3708}
3709
3710static vector short __ATTRS_o_ai
3711vec_vsel(vector short a, vector short b, vector unsigned short c)
3712{
3713 return (a & ~(vector short)c) | (b & (vector short)c);
3714}
3715
3716static vector unsigned short __ATTRS_o_ai
3717vec_vsel(vector unsigned short a, vector unsigned short b, vector unsigned short c)
3718{
3719 return (a & ~c) | (b & c);
3720}
3721
3722static vector int __ATTRS_o_ai
3723vec_vsel(vector int a, vector int b, vector unsigned int c)
3724{
3725 return (a & ~(vector int)c) | (b & (vector int)c);
3726}
3727
3728static vector unsigned int __ATTRS_o_ai
3729vec_vsel(vector unsigned int a, vector unsigned int b, vector unsigned int c)
3730{
3731 return (a & ~c) | (b & c);
3732}
3733
3734static vector float __ATTRS_o_ai
3735vec_vsel(vector float a, vector float b, vector unsigned int c)
3736{
3737 vector int res = ((vector int)a & ~(vector int)c) | ((vector int)b & (vector int)c);
3738 return (vector float)res;
3739}
3740
3741/* vec_sl */
3742
3743static vector signed char __ATTRS_o_ai
3744vec_sl(vector signed char a, vector unsigned char b)
3745{
3746 return a << (vector signed char)b;
3747}
3748
3749static vector unsigned char __ATTRS_o_ai
3750vec_sl(vector unsigned char a, vector unsigned char b)
3751{
3752 return a << b;
3753}
3754
3755static vector short __ATTRS_o_ai
3756vec_sl(vector short a, vector unsigned short b)
3757{
3758 return a << (vector short)b;
3759}
3760
3761static vector unsigned short __ATTRS_o_ai
3762vec_sl(vector unsigned short a, vector unsigned short b)
3763{
3764 return a << b;
3765}
3766
3767static vector int __ATTRS_o_ai
3768vec_sl(vector int a, vector unsigned int b)
3769{
3770 return a << (vector int)b;
3771}
3772
3773static vector unsigned int __ATTRS_o_ai
3774vec_sl(vector unsigned int a, vector unsigned int b)
3775{
3776 return a << b;
3777}
3778
3779/* vec_vslb */
3780
3781#define __builtin_altivec_vslb vec_vslb
3782
3783static vector signed char __ATTRS_o_ai
3784vec_vslb(vector signed char a, vector unsigned char b)
3785{
3786 return vec_sl(a, b);
3787}
3788
3789static vector unsigned char __ATTRS_o_ai
3790vec_vslb(vector unsigned char a, vector unsigned char b)
3791{
3792 return vec_sl(a, b);
3793}
3794
3795/* vec_vslh */
3796
3797#define __builtin_altivec_vslh vec_vslh
3798
3799static vector short __ATTRS_o_ai
3800vec_vslh(vector short a, vector unsigned short b)
3801{
3802 return vec_sl(a, b);
3803}
3804
3805static vector unsigned short __ATTRS_o_ai
3806vec_vslh(vector unsigned short a, vector unsigned short b)
3807{
3808 return vec_sl(a, b);
3809}
3810
3811/* vec_vslw */
3812
3813#define __builtin_altivec_vslw vec_vslw
3814
3815static vector int __ATTRS_o_ai
3816vec_vslw(vector int a, vector unsigned int b)
3817{
3818 return vec_sl(a, b);
3819}
3820
3821static vector unsigned int __ATTRS_o_ai
3822vec_vslw(vector unsigned int a, vector unsigned int b)
3823{
3824 return vec_sl(a, b);
3825}
3826
3827/* vec_sld */
3828
3829#define __builtin_altivec_vsldoi_4si vec_sld
3830
3831static vector signed char __ATTRS_o_ai
3832vec_sld(vector signed char a, vector signed char b, unsigned char c)
3833{
3834 return (vector signed char)vec_perm(a, b, (vector unsigned char)
3835 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
3836 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
3837}
3838
3839static vector unsigned char __ATTRS_o_ai
3840vec_sld(vector unsigned char a, vector unsigned char b, unsigned char c)
3841{
3842 return (vector unsigned char)vec_perm(a, b, (vector unsigned char)
3843 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
3844 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
3845}
3846
3847static vector short __ATTRS_o_ai
3848vec_sld(vector short a, vector short b, unsigned char c)
3849{
3850 return (vector short)vec_perm(a, b, (vector unsigned char)
3851 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
3852 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
3853}
3854
3855static vector unsigned short __ATTRS_o_ai
3856vec_sld(vector unsigned short a, vector unsigned short b, unsigned char c)
3857{
3858 return (vector unsigned short)vec_perm(a, b, (vector unsigned char)
3859 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
3860 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
3861}
3862
3863static vector int __ATTRS_o_ai
3864vec_sld(vector int a, vector int b, unsigned char c)
3865{
3866 return vec_perm(a, b, (vector unsigned char)
3867 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
3868 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
3869}
3870
3871static vector unsigned int __ATTRS_o_ai
3872vec_sld(vector unsigned int a, vector unsigned int b, unsigned char c)
3873{
3874 return (vector unsigned int)vec_perm(a, b, (vector unsigned char)
3875 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
3876 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
3877}
3878
3879static vector float __ATTRS_o_ai
3880vec_sld(vector float a, vector float b, unsigned char c)
3881{
3882 return (vector float)vec_perm(a, b, (vector unsigned char)
3883 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
3884 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
3885}
3886
3887/* vec_vsldoi */
3888
3889static vector signed char __ATTRS_o_ai
3890vec_vsldoi(vector signed char a, vector signed char b, unsigned char c)
3891{
3892 return (vector signed char)vec_perm(a, b, (vector unsigned char)
3893 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
3894 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
3895}
3896
3897static vector unsigned char __ATTRS_o_ai
3898vec_vsldoi(vector unsigned char a, vector unsigned char b, unsigned char c)
3899{
3900 return (vector unsigned char)vec_perm(a, b, (vector unsigned char)
3901 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
3902 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
3903}
3904
3905static vector short __ATTRS_o_ai
3906vec_vsldoi(vector short a, vector short b, unsigned char c)
3907{
3908 return (vector short)vec_perm(a, b, (vector unsigned char)
3909 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
3910 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
3911}
3912
3913static vector unsigned short __ATTRS_o_ai
3914vec_vsldoi(vector unsigned short a, vector unsigned short b, unsigned char c)
3915{
3916 return (vector unsigned short)vec_perm(a, b, (vector unsigned char)
3917 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
3918 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
3919}
3920
3921static vector int __ATTRS_o_ai
3922vec_vsldoi(vector int a, vector int b, unsigned char c)
3923{
3924 return vec_perm(a, b, (vector unsigned char)
3925 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
3926 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
3927}
3928
3929static vector unsigned int __ATTRS_o_ai
3930vec_vsldoi(vector unsigned int a, vector unsigned int b, unsigned char c)
3931{
3932 return (vector unsigned int)vec_perm(a, b, (vector unsigned char)
3933 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
3934 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
3935}
3936
3937static vector float __ATTRS_o_ai
3938vec_vsldoi(vector float a, vector float b, unsigned char c)
3939{
3940 return (vector float)vec_perm(a, b, (vector unsigned char)
3941 (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7,
3942 c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
3943}
3944
3945/* vec_sll */
3946
3947static vector signed char __ATTRS_o_ai
3948vec_sll(vector signed char a, vector unsigned char b)
3949{
3950 return (vector signed char)__builtin_altivec_vsl((vector int)a, (vector int)b);
3951}
3952
3953static vector signed char __ATTRS_o_ai
3954vec_sll(vector signed char a, vector unsigned short b)
3955{
3956 return (vector signed char)__builtin_altivec_vsl((vector int)a, (vector int)b);
3957}
3958
3959static vector signed char __ATTRS_o_ai
3960vec_sll(vector signed char a, vector unsigned int b)
3961{
3962 return (vector signed char)__builtin_altivec_vsl((vector int)a, (vector int)b);
3963}
3964
3965static vector unsigned char __ATTRS_o_ai
3966vec_sll(vector unsigned char a, vector unsigned char b)
3967{
3968 return (vector unsigned char)__builtin_altivec_vsl((vector int)a, (vector int)b);
3969}
3970
3971static vector unsigned char __ATTRS_o_ai
3972vec_sll(vector unsigned char a, vector unsigned short b)
3973{
3974 return (vector unsigned char)__builtin_altivec_vsl((vector int)a, (vector int)b);
3975}
3976
3977static vector unsigned char __ATTRS_o_ai
3978vec_sll(vector unsigned char a, vector unsigned int b)
3979{
3980 return (vector unsigned char)__builtin_altivec_vsl((vector int)a, (vector int)b);
3981}
3982
3983static vector short __ATTRS_o_ai
3984vec_sll(vector short a, vector unsigned char b)
3985{
3986 return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b);
3987}
3988
3989static vector short __ATTRS_o_ai
3990vec_sll(vector short a, vector unsigned short b)
3991{
3992 return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b);
3993}
3994
3995static vector short __ATTRS_o_ai
3996vec_sll(vector short a, vector unsigned int b)
3997{
3998 return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b);
3999}
4000
4001static vector unsigned short __ATTRS_o_ai
4002vec_sll(vector unsigned short a, vector unsigned char b)
4003{
4004 return (vector unsigned short)__builtin_altivec_vsl((vector int)a, (vector int)b);
4005}
4006
4007static vector unsigned short __ATTRS_o_ai
4008vec_sll(vector unsigned short a, vector unsigned short b)
4009{
4010 return (vector unsigned short)__builtin_altivec_vsl((vector int)a, (vector int)b);
4011}
4012
4013static vector unsigned short __ATTRS_o_ai
4014vec_sll(vector unsigned short a, vector unsigned int b)
4015{
4016 return (vector unsigned short)__builtin_altivec_vsl((vector int)a, (vector int)b);
4017}
4018
4019static vector int __ATTRS_o_ai
4020vec_sll(vector int a, vector unsigned char b)
4021{
4022 return (vector int)__builtin_altivec_vsl(a, (vector int)b);
4023}
4024
4025static vector int __ATTRS_o_ai
4026vec_sll(vector int a, vector unsigned short b)
4027{
4028 return (vector int)__builtin_altivec_vsl(a, (vector int)b);
4029}
4030
4031static vector int __ATTRS_o_ai
4032vec_sll(vector int a, vector unsigned int b)
4033{
4034 return (vector int)__builtin_altivec_vsl(a, (vector int)b);
4035}
4036
4037static vector unsigned int __ATTRS_o_ai
4038vec_sll(vector unsigned int a, vector unsigned char b)
4039{
4040 return (vector unsigned int)__builtin_altivec_vsl((vector int)a, (vector int)b);
4041}
4042
4043static vector unsigned int __ATTRS_o_ai
4044vec_sll(vector unsigned int a, vector unsigned short b)
4045{
4046 return (vector unsigned int)__builtin_altivec_vsl((vector int)a, (vector int)b);
4047}
4048
4049static vector unsigned int __ATTRS_o_ai
4050vec_sll(vector unsigned int a, vector unsigned int b)
4051{
4052 return (vector unsigned int)__builtin_altivec_vsl((vector int)a, (vector int)b);
4053}
4054
4055/* vec_vsl */
4056
4057static vector signed char __ATTRS_o_ai
4058vec_vsl(vector signed char a, vector unsigned char b)
4059{
4060 return (vector signed char)__builtin_altivec_vsl((vector int)a, (vector int)b);
4061}
4062
4063static vector signed char __ATTRS_o_ai
4064vec_vsl(vector signed char a, vector unsigned short b)
4065{
4066 return (vector signed char)__builtin_altivec_vsl((vector int)a, (vector int)b);
4067}
4068
4069static vector signed char __ATTRS_o_ai
4070vec_vsl(vector signed char a, vector unsigned int b)
4071{
4072 return (vector signed char)__builtin_altivec_vsl((vector int)a, (vector int)b);
4073}
4074
4075static vector unsigned char __ATTRS_o_ai
4076vec_vsl(vector unsigned char a, vector unsigned char b)
4077{
4078 return (vector unsigned char)__builtin_altivec_vsl((vector int)a, (vector int)b);
4079}
4080
4081static vector unsigned char __ATTRS_o_ai
4082vec_vsl(vector unsigned char a, vector unsigned short b)
4083{
4084 return (vector unsigned char)__builtin_altivec_vsl((vector int)a, (vector int)b);
4085}
4086
4087static vector unsigned char __ATTRS_o_ai
4088vec_vsl(vector unsigned char a, vector unsigned int b)
4089{
4090 return (vector unsigned char)__builtin_altivec_vsl((vector int)a, (vector int)b);
4091}
4092
4093static vector short __ATTRS_o_ai
4094vec_vsl(vector short a, vector unsigned char b)
4095{
4096 return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b);
4097}
4098
4099static vector short __ATTRS_o_ai
4100vec_vsl(vector short a, vector unsigned short b)
4101{
4102 return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b);
4103}
4104
4105static vector short __ATTRS_o_ai
4106vec_vsl(vector short a, vector unsigned int b)
4107{
4108 return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b);
4109}
4110
4111static vector unsigned short __ATTRS_o_ai
4112vec_vsl(vector unsigned short a, vector unsigned char b)
4113{
4114 return (vector unsigned short)__builtin_altivec_vsl((vector int)a, (vector int)b);
4115}
4116
4117static vector unsigned short __ATTRS_o_ai
4118vec_vsl(vector unsigned short a, vector unsigned short b)
4119{
4120 return (vector unsigned short)__builtin_altivec_vsl((vector int)a, (vector int)b);
4121}
4122
4123static vector unsigned short __ATTRS_o_ai
4124vec_vsl(vector unsigned short a, vector unsigned int b)
4125{
4126 return (vector unsigned short)__builtin_altivec_vsl((vector int)a, (vector int)b);
4127}
4128
4129static vector int __ATTRS_o_ai
4130vec_vsl(vector int a, vector unsigned char b)
4131{
4132 return (vector int)__builtin_altivec_vsl(a, (vector int)b);
4133}
4134
4135static vector int __ATTRS_o_ai
4136vec_vsl(vector int a, vector unsigned short b)
4137{
4138 return (vector int)__builtin_altivec_vsl(a, (vector int)b);
4139}
4140
4141static vector int __ATTRS_o_ai
4142vec_vsl(vector int a, vector unsigned int b)
4143{
4144 return (vector int)__builtin_altivec_vsl(a, (vector int)b);
4145}
4146
4147static vector unsigned int __ATTRS_o_ai
4148vec_vsl(vector unsigned int a, vector unsigned char b)
4149{
4150 return (vector unsigned int)__builtin_altivec_vsl((vector int)a, (vector int)b);
4151}
4152
4153static vector unsigned int __ATTRS_o_ai
4154vec_vsl(vector unsigned int a, vector unsigned short b)
4155{
4156 return (vector unsigned int)__builtin_altivec_vsl((vector int)a, (vector int)b);
4157}
4158
4159static vector unsigned int __ATTRS_o_ai
4160vec_vsl(vector unsigned int a, vector unsigned int b)
4161{
4162 return (vector unsigned int)__builtin_altivec_vsl((vector int)a, (vector int)b);
4163}
4164
4165/* vec_slo */
4166
4167static vector signed char __ATTRS_o_ai
4168vec_slo(vector signed char a, vector signed char b)
4169{
4170 return (vector signed char)__builtin_altivec_vslo((vector int)a, (vector int)b);
4171}
4172
4173static vector signed char __ATTRS_o_ai
4174vec_slo(vector signed char a, vector unsigned char b)
4175{
4176 return (vector signed char)__builtin_altivec_vslo((vector int)a, (vector int)b);
4177}
4178
4179static vector unsigned char __ATTRS_o_ai
4180vec_slo(vector unsigned char a, vector signed char b)
4181{
4182 return (vector unsigned char)__builtin_altivec_vslo((vector int)a, (vector int)b);
4183}
4184
4185static vector unsigned char __ATTRS_o_ai
4186vec_slo(vector unsigned char a, vector unsigned char b)
4187{
4188 return (vector unsigned char)__builtin_altivec_vslo((vector int)a, (vector int)b);
4189}
4190
4191static vector short __ATTRS_o_ai
4192vec_slo(vector short a, vector signed char b)
4193{
4194 return (vector short)__builtin_altivec_vslo((vector int)a, (vector int)b);
4195}
4196
4197static vector short __ATTRS_o_ai
4198vec_slo(vector short a, vector unsigned char b)
4199{
4200 return (vector short)__builtin_altivec_vslo((vector int)a, (vector int)b);
4201}
4202
4203static vector unsigned short __ATTRS_o_ai
4204vec_slo(vector unsigned short a, vector signed char b)
4205{
4206 return (vector unsigned short)__builtin_altivec_vslo((vector int)a, (vector int)b);
4207}
4208
4209static vector unsigned short __ATTRS_o_ai
4210vec_slo(vector unsigned short a, vector unsigned char b)
4211{
4212 return (vector unsigned short)__builtin_altivec_vslo((vector int)a, (vector int)b);
4213}
4214
4215static vector int __ATTRS_o_ai
4216vec_slo(vector int a, vector signed char b)
4217{
4218 return (vector int)__builtin_altivec_vslo(a, (vector int)b);
4219}
4220
4221static vector int __ATTRS_o_ai
4222vec_slo(vector int a, vector unsigned char b)
4223{
4224 return (vector int)__builtin_altivec_vslo(a, (vector int)b);
4225}
4226
4227static vector unsigned int __ATTRS_o_ai
4228vec_slo(vector unsigned int a, vector signed char b)
4229{
4230 return (vector unsigned int)__builtin_altivec_vslo((vector int)a, (vector int)b);
4231}
4232
4233static vector unsigned int __ATTRS_o_ai
4234vec_slo(vector unsigned int a, vector unsigned char b)
4235{
4236 return (vector unsigned int)__builtin_altivec_vslo((vector int)a, (vector int)b);
4237}
4238
4239static vector float __ATTRS_o_ai
4240vec_slo(vector float a, vector signed char b)
4241{
4242 return (vector float)__builtin_altivec_vslo((vector int)a, (vector int)b);
4243}
4244
4245static vector float __ATTRS_o_ai
4246vec_slo(vector float a, vector unsigned char b)
4247{
4248 return (vector float)__builtin_altivec_vslo((vector int)a, (vector int)b);
4249}
4250
4251/* vec_vslo */
4252
4253static vector signed char __ATTRS_o_ai
4254vec_vslo(vector signed char a, vector signed char b)
4255{
4256 return (vector signed char)__builtin_altivec_vslo((vector int)a, (vector int)b);
4257}
4258
4259static vector signed char __ATTRS_o_ai
4260vec_vslo(vector signed char a, vector unsigned char b)
4261{
4262 return (vector signed char)__builtin_altivec_vslo((vector int)a, (vector int)b);
4263}
4264
4265static vector unsigned char __ATTRS_o_ai
4266vec_vslo(vector unsigned char a, vector signed char b)
4267{
4268 return (vector unsigned char)__builtin_altivec_vslo((vector int)a, (vector int)b);
4269}
4270
4271static vector unsigned char __ATTRS_o_ai
4272vec_vslo(vector unsigned char a, vector unsigned char b)
4273{
4274 return (vector unsigned char)__builtin_altivec_vslo((vector int)a, (vector int)b);
4275}
4276
4277static vector short __ATTRS_o_ai
4278vec_vslo(vector short a, vector signed char b)
4279{
4280 return (vector short)__builtin_altivec_vslo((vector int)a, (vector int)b);
4281}
4282
4283static vector short __ATTRS_o_ai
4284vec_vslo(vector short a, vector unsigned char b)
4285{
4286 return (vector short)__builtin_altivec_vslo((vector int)a, (vector int)b);
4287}
4288
4289static vector unsigned short __ATTRS_o_ai
4290vec_vslo(vector unsigned short a, vector signed char b)
4291{
4292 return (vector unsigned short)__builtin_altivec_vslo((vector int)a, (vector int)b);
4293}
4294
4295static vector unsigned short __ATTRS_o_ai
4296vec_vslo(vector unsigned short a, vector unsigned char b)
4297{
4298 return (vector unsigned short)__builtin_altivec_vslo((vector int)a, (vector int)b);
4299}
4300
4301static vector int __ATTRS_o_ai
4302vec_vslo(vector int a, vector signed char b)
4303{
4304 return (vector int)__builtin_altivec_vslo(a, (vector int)b);
4305}
4306
4307static vector int __ATTRS_o_ai
4308vec_vslo(vector int a, vector unsigned char b)
4309{
4310 return (vector int)__builtin_altivec_vslo(a, (vector int)b);
4311}
4312
4313static vector unsigned int __ATTRS_o_ai
4314vec_vslo(vector unsigned int a, vector signed char b)
4315{
4316 return (vector unsigned int)__builtin_altivec_vslo((vector int)a, (vector int)b);
4317}
4318
4319static vector unsigned int __ATTRS_o_ai
4320vec_vslo(vector unsigned int a, vector unsigned char b)
4321{
4322 return (vector unsigned int)__builtin_altivec_vslo((vector int)a, (vector int)b);
4323}
4324
4325static vector float __ATTRS_o_ai
4326vec_vslo(vector float a, vector signed char b)
4327{
4328 return (vector float)__builtin_altivec_vslo((vector int)a, (vector int)b);
4329}
4330
4331static vector float __ATTRS_o_ai
4332vec_vslo(vector float a, vector unsigned char b)
4333{
4334 return (vector float)__builtin_altivec_vslo((vector int)a, (vector int)b);
4335}
4336
4337/* vec_splat */
4338
4339static vector signed char __ATTRS_o_ai
4340vec_splat(vector signed char a, unsigned char b)
4341{
4342 return (vector signed char)vec_perm(a, a, (vector unsigned char)(b));
4343}
4344
4345static vector unsigned char __ATTRS_o_ai
4346vec_splat(vector unsigned char a, unsigned char b)
4347{
4348 return (vector unsigned char)vec_perm(a, a, (vector unsigned char)(b));
4349}
4350
4351static vector short __ATTRS_o_ai
4352vec_splat(vector short a, unsigned char b)
4353{
4354 b *= 2;
4355 return (vector short)vec_perm(a, a, (vector unsigned char)
4356 (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1));
4357}
4358
4359static vector unsigned short __ATTRS_o_ai
4360vec_splat(vector unsigned short a, unsigned char b)
4361{
4362 b *= 2;
4363 return (vector unsigned short)vec_perm(a, a, (vector unsigned char)
4364 (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1));
4365}
4366
4367static vector int __ATTRS_o_ai
4368vec_splat(vector int a, unsigned char b)
4369{
4370 b *= 4;
4371 return vec_perm(a, a, (vector unsigned char)
4372 (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));
4373}
4374
4375static vector unsigned int __ATTRS_o_ai
4376vec_splat(vector unsigned int a, unsigned char b)
4377{
4378 b *= 4;
4379 return (vector unsigned int)vec_perm(a, a, (vector unsigned char)
4380 (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));
4381}
4382
4383static vector float __ATTRS_o_ai
4384vec_splat(vector float a, unsigned char b)
4385{
4386 b *= 4;
4387 return (vector float)vec_perm(a, a, (vector unsigned char)
4388 (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));
4389}
4390
4391/* vec_vspltb */
4392
4393#define __builtin_altivec_vspltb vec_vspltb
4394
4395static vector signed char __ATTRS_o_ai
4396vec_vspltb(vector signed char a, unsigned char b)
4397{
4398 return (vector signed char)vec_perm(a, a, (vector unsigned char)(b));
4399}
4400
4401static vector unsigned char __ATTRS_o_ai
4402vec_vspltb(vector unsigned char a, unsigned char b)
4403{
4404 return (vector unsigned char)vec_perm(a, a, (vector unsigned char)(b));
4405}
4406
4407/* vec_vsplth */
4408
4409#define __builtin_altivec_vsplth vec_vsplth
4410
4411static vector short __ATTRS_o_ai
4412vec_vsplth(vector short a, unsigned char b)
4413{
4414 b *= 2;
4415 return (vector short)vec_perm(a, a, (vector unsigned char)
4416 (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1));
4417}
4418
4419static vector unsigned short __ATTRS_o_ai
4420vec_vsplth(vector unsigned short a, unsigned char b)
4421{
4422 b *= 2;
4423 return (vector unsigned short)vec_perm(a, a, (vector unsigned char)
4424 (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1));
4425}
4426
4427/* vec_vspltw */
4428
4429#define __builtin_altivec_vspltw vec_vspltw
4430
4431static vector int __ATTRS_o_ai
4432vec_vspltw(vector int a, unsigned char b)
4433{
4434 b *= 4;
4435 return (vector int)vec_perm(a, a, (vector unsigned char)
4436 (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));
4437}
4438
4439static vector unsigned int __ATTRS_o_ai
4440vec_vspltw(vector unsigned int a, unsigned char b)
4441{
4442 b *= 4;
4443 return (vector unsigned int)vec_perm(a, a, (vector unsigned char)
4444 (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));
4445}
4446
4447static vector float __ATTRS_o_ai
4448vec_vspltw(vector float a, unsigned char b)
4449{
4450 b *= 4;
4451 return (vector float)vec_perm(a, a, (vector unsigned char)
4452 (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));
4453}
4454
4455/* vec_splat_s8 */
4456
4457#define __builtin_altivec_vspltisb vec_splat_s8
4458
4459// FIXME: parameter should be treated as 5-bit signed literal
4460static vector signed char __ATTRS_o_ai
4461vec_splat_s8(signed char a)
4462{
4463 return (vector signed char)(a);
4464}
4465
4466/* vec_vspltisb */
4467
4468// FIXME: parameter should be treated as 5-bit signed literal
4469static vector signed char __ATTRS_o_ai
4470vec_vspltisb(signed char a)
4471{
4472 return (vector signed char)(a);
4473}
4474
4475/* vec_splat_s16 */
4476
4477#define __builtin_altivec_vspltish vec_splat_s16
4478
4479// FIXME: parameter should be treated as 5-bit signed literal
4480static vector short __ATTRS_o_ai
4481vec_splat_s16(signed char a)
4482{
4483 return (vector short)(a);
4484}
4485
4486/* vec_vspltish */
4487
4488// FIXME: parameter should be treated as 5-bit signed literal
4489static vector short __ATTRS_o_ai
4490vec_vspltish(signed char a)
4491{
4492 return (vector short)(a);
4493}
4494
4495/* vec_splat_s32 */
4496
4497#define __builtin_altivec_vspltisw vec_splat_s32
4498
4499// FIXME: parameter should be treated as 5-bit signed literal
4500static vector int __ATTRS_o_ai
4501vec_splat_s32(signed char a)
4502{
4503 return (vector int)(a);
4504}
4505
4506/* vec_vspltisw */
4507
4508// FIXME: parameter should be treated as 5-bit signed literal
4509static vector int __ATTRS_o_ai
4510vec_vspltisw(signed char a)
4511{
4512 return (vector int)(a);
4513}
4514
4515/* vec_splat_u8 */
4516
4517// FIXME: parameter should be treated as 5-bit signed literal
4518static vector unsigned char __ATTRS_o_ai
4519vec_splat_u8(unsigned char a)
4520{
4521 return (vector unsigned char)(a);
4522}
4523
4524/* vec_splat_u16 */
4525
4526// FIXME: parameter should be treated as 5-bit signed literal
4527static vector unsigned short __ATTRS_o_ai
4528vec_splat_u16(signed char a)
4529{
4530 return (vector unsigned short)(a);
4531}
4532
4533/* vec_splat_u32 */
4534
4535// FIXME: parameter should be treated as 5-bit signed literal
4536static vector unsigned int __ATTRS_o_ai
4537vec_splat_u32(signed char a)
4538{
4539 return (vector unsigned int)(a);
4540}
4541
4542/* vec_sr */
4543
4544static vector signed char __ATTRS_o_ai
4545vec_sr(vector signed char a, vector unsigned char b)
4546{
4547 return a >> (vector signed char)b;
4548}
4549
4550static vector unsigned char __ATTRS_o_ai
4551vec_sr(vector unsigned char a, vector unsigned char b)
4552{
4553 return a >> b;
4554}
4555
4556static vector short __ATTRS_o_ai
4557vec_sr(vector short a, vector unsigned short b)
4558{
4559 return a >> (vector short)b;
4560}
4561
4562static vector unsigned short __ATTRS_o_ai
4563vec_sr(vector unsigned short a, vector unsigned short b)
4564{
4565 return a >> b;
4566}
4567
4568static vector int __ATTRS_o_ai
4569vec_sr(vector int a, vector unsigned int b)
4570{
4571 return a >> (vector int)b;
4572}
4573
4574static vector unsigned int __ATTRS_o_ai
4575vec_sr(vector unsigned int a, vector unsigned int b)
4576{
4577 return a >> b;
4578}
4579
4580/* vec_vsrb */
4581
4582#define __builtin_altivec_vsrb vec_vsrb
4583
4584static vector signed char __ATTRS_o_ai
4585vec_vsrb(vector signed char a, vector unsigned char b)
4586{
4587 return a >> (vector signed char)b;
4588}
4589
4590static vector unsigned char __ATTRS_o_ai
4591vec_vsrb(vector unsigned char a, vector unsigned char b)
4592{
4593 return a >> b;
4594}
4595
4596/* vec_vsrh */
4597
4598#define __builtin_altivec_vsrh vec_vsrh
4599
4600static vector short __ATTRS_o_ai
4601vec_vsrh(vector short a, vector unsigned short b)
4602{
4603 return a >> (vector short)b;
4604}
4605
4606static vector unsigned short __ATTRS_o_ai
4607vec_vsrh(vector unsigned short a, vector unsigned short b)
4608{
4609 return a >> b;
4610}
4611
4612/* vec_vsrw */
4613
4614#define __builtin_altivec_vsrw vec_vsrw
4615
4616static vector int __ATTRS_o_ai
4617vec_vsrw(vector int a, vector unsigned int b)
4618{
4619 return a >> (vector int)b;
4620}
4621
4622static vector unsigned int __ATTRS_o_ai
4623vec_vsrw(vector unsigned int a, vector unsigned int b)
4624{
4625 return a >> b;
4626}
4627
4628/* vec_sra */
4629
4630static vector signed char __ATTRS_o_ai
4631vec_sra(vector signed char a, vector unsigned char b)
4632{
4633 return (vector signed char)__builtin_altivec_vsrab((vector char)a, b);
4634}
4635
4636static vector unsigned char __ATTRS_o_ai
4637vec_sra(vector unsigned char a, vector unsigned char b)
4638{
4639 return (vector unsigned char)__builtin_altivec_vsrab((vector char)a, b);
4640}
4641
4642static vector short __ATTRS_o_ai
4643vec_sra(vector short a, vector unsigned short b)
4644{
4645 return __builtin_altivec_vsrah(a, (vector unsigned short)b);
4646}
4647
4648static vector unsigned short __ATTRS_o_ai
4649vec_sra(vector unsigned short a, vector unsigned short b)
4650{
4651 return (vector unsigned short)__builtin_altivec_vsrah((vector short)a, b);
4652}
4653
4654static vector int __ATTRS_o_ai
4655vec_sra(vector int a, vector unsigned int b)
4656{
4657 return __builtin_altivec_vsraw(a, b);
4658}
4659
4660static vector unsigned int __ATTRS_o_ai
4661vec_sra(vector unsigned int a, vector unsigned int b)
4662{
4663 return (vector unsigned int)__builtin_altivec_vsraw((vector int)a, b);
4664}
4665
4666/* vec_vsrab */
4667
4668static vector signed char __ATTRS_o_ai
4669vec_vsrab(vector signed char a, vector unsigned char b)
4670{
4671 return (vector signed char)__builtin_altivec_vsrab((vector char)a, b);
4672}
4673
4674static vector unsigned char __ATTRS_o_ai
4675vec_vsrab(vector unsigned char a, vector unsigned char b)
4676{
4677 return (vector unsigned char)__builtin_altivec_vsrab((vector char)a, b);
4678}
4679
4680/* vec_vsrah */
4681
4682static vector short __ATTRS_o_ai
4683vec_vsrah(vector short a, vector unsigned short b)
4684{
4685 return __builtin_altivec_vsrah(a, (vector unsigned short)b);
4686}
4687
4688static vector unsigned short __ATTRS_o_ai
4689vec_vsrah(vector unsigned short a, vector unsigned short b)
4690{
4691 return (vector unsigned short)__builtin_altivec_vsrah((vector short)a, b);
4692}
4693
4694/* vec_vsraw */
4695
4696static vector int __ATTRS_o_ai
4697vec_vsraw(vector int a, vector unsigned int b)
4698{
4699 return __builtin_altivec_vsraw(a, b);
4700}
4701
4702static vector unsigned int __ATTRS_o_ai
4703vec_vsraw(vector unsigned int a, vector unsigned int b)
4704{
4705 return (vector unsigned int)__builtin_altivec_vsraw((vector int)a, b);
4706}
4707
4708/* vec_srl */
4709
4710static vector signed char __ATTRS_o_ai
4711vec_srl(vector signed char a, vector unsigned char b)
4712{
4713 return (vector signed char)__builtin_altivec_vsr((vector int)a, (vector int)b);
4714}
4715
4716static vector signed char __ATTRS_o_ai
4717vec_srl(vector signed char a, vector unsigned short b)
4718{
4719 return (vector signed char)__builtin_altivec_vsr((vector int)a, (vector int)b);
4720}
4721
4722static vector signed char __ATTRS_o_ai
4723vec_srl(vector signed char a, vector unsigned int b)
4724{
4725 return (vector signed char)__builtin_altivec_vsr((vector int)a, (vector int)b);
4726}
4727
4728static vector unsigned char __ATTRS_o_ai
4729vec_srl(vector unsigned char a, vector unsigned char b)
4730{
4731 return (vector unsigned char)__builtin_altivec_vsr((vector int)a, (vector int)b);
4732}
4733
4734static vector unsigned char __ATTRS_o_ai
4735vec_srl(vector unsigned char a, vector unsigned short b)
4736{
4737 return (vector unsigned char)__builtin_altivec_vsr((vector int)a, (vector int)b);
4738}
4739
4740static vector unsigned char __ATTRS_o_ai
4741vec_srl(vector unsigned char a, vector unsigned int b)
4742{
4743 return (vector unsigned char)__builtin_altivec_vsr((vector int)a, (vector int)b);
4744}
4745
4746static vector short __ATTRS_o_ai
4747vec_srl(vector short a, vector unsigned char b)
4748{
4749 return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b);
4750}
4751
4752static vector short __ATTRS_o_ai
4753vec_srl(vector short a, vector unsigned short b)
4754{
4755 return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b);
4756}
4757
4758static vector short __ATTRS_o_ai
4759vec_srl(vector short a, vector unsigned int b)
4760{
4761 return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b);
4762}
4763
4764static vector unsigned short __ATTRS_o_ai
4765vec_srl(vector unsigned short a, vector unsigned char b)
4766{
4767 return (vector unsigned short)__builtin_altivec_vsr((vector int)a, (vector int)b);
4768}
4769
4770static vector unsigned short __ATTRS_o_ai
4771vec_srl(vector unsigned short a, vector unsigned short b)
4772{
4773 return (vector unsigned short)__builtin_altivec_vsr((vector int)a, (vector int)b);
4774}
4775
4776static vector unsigned short __ATTRS_o_ai
4777vec_srl(vector unsigned short a, vector unsigned int b)
4778{
4779 return (vector unsigned short)__builtin_altivec_vsr((vector int)a, (vector int)b);
4780}
4781
4782static vector int __ATTRS_o_ai
4783vec_srl(vector int a, vector unsigned char b)
4784{
4785 return (vector int)__builtin_altivec_vsr(a, (vector int)b);
4786}
4787
4788static vector int __ATTRS_o_ai
4789vec_srl(vector int a, vector unsigned short b)
4790{
4791 return (vector int)__builtin_altivec_vsr(a, (vector int)b);
4792}
4793
4794static vector int __ATTRS_o_ai
4795vec_srl(vector int a, vector unsigned int b)
4796{
4797 return (vector int)__builtin_altivec_vsr(a, (vector int)b);
4798}
4799
4800static vector unsigned int __ATTRS_o_ai
4801vec_srl(vector unsigned int a, vector unsigned char b)
4802{
4803 return (vector unsigned int)__builtin_altivec_vsr((vector int)a, (vector int)b);
4804}
4805
4806static vector unsigned int __ATTRS_o_ai
4807vec_srl(vector unsigned int a, vector unsigned short b)
4808{
4809 return (vector unsigned int)__builtin_altivec_vsr((vector int)a, (vector int)b);
4810}
4811
4812static vector unsigned int __ATTRS_o_ai
4813vec_srl(vector unsigned int a, vector unsigned int b)
4814{
4815 return (vector unsigned int)__builtin_altivec_vsr((vector int)a, (vector int)b);
4816}
4817
4818/* vec_vsr */
4819
4820static vector signed char __ATTRS_o_ai
4821vec_vsr(vector signed char a, vector unsigned char b)
4822{
4823 return (vector signed char)__builtin_altivec_vsr((vector int)a, (vector int)b);
4824}
4825
4826static vector signed char __ATTRS_o_ai
4827vec_vsr(vector signed char a, vector unsigned short b)
4828{
4829 return (vector signed char)__builtin_altivec_vsr((vector int)a, (vector int)b);
4830}
4831
4832static vector signed char __ATTRS_o_ai
4833vec_vsr(vector signed char a, vector unsigned int b)
4834{
4835 return (vector signed char)__builtin_altivec_vsr((vector int)a, (vector int)b);
4836}
4837
4838static vector unsigned char __ATTRS_o_ai
4839vec_vsr(vector unsigned char a, vector unsigned char b)
4840{
4841 return (vector unsigned char)__builtin_altivec_vsr((vector int)a, (vector int)b);
4842}
4843
4844static vector unsigned char __ATTRS_o_ai
4845vec_vsr(vector unsigned char a, vector unsigned short b)
4846{
4847 return (vector unsigned char)__builtin_altivec_vsr((vector int)a, (vector int)b);
4848}
4849
4850static vector unsigned char __ATTRS_o_ai
4851vec_vsr(vector unsigned char a, vector unsigned int b)
4852{
4853 return (vector unsigned char)__builtin_altivec_vsr((vector int)a, (vector int)b);
4854}
4855
4856static vector short __ATTRS_o_ai
4857vec_vsr(vector short a, vector unsigned char b)
4858{
4859 return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b);
4860}
4861
4862static vector short __ATTRS_o_ai
4863vec_vsr(vector short a, vector unsigned short b)
4864{
4865 return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b);
4866}
4867
4868static vector short __ATTRS_o_ai
4869vec_vsr(vector short a, vector unsigned int b)
4870{
4871 return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b);
4872}
4873
4874static vector unsigned short __ATTRS_o_ai
4875vec_vsr(vector unsigned short a, vector unsigned char b)
4876{
4877 return (vector unsigned short)__builtin_altivec_vsr((vector int)a, (vector int)b);
4878}
4879
4880static vector unsigned short __ATTRS_o_ai
4881vec_vsr(vector unsigned short a, vector unsigned short b)
4882{
4883 return (vector unsigned short)__builtin_altivec_vsr((vector int)a, (vector int)b);
4884}
4885
4886static vector unsigned short __ATTRS_o_ai
4887vec_vsr(vector unsigned short a, vector unsigned int b)
4888{
4889 return (vector unsigned short)__builtin_altivec_vsr((vector int)a, (vector int)b);
4890}
4891
4892static vector int __ATTRS_o_ai
4893vec_vsr(vector int a, vector unsigned char b)
4894{
4895 return (vector int)__builtin_altivec_vsr(a, (vector int)b);
4896}
4897
4898static vector int __ATTRS_o_ai
4899vec_vsr(vector int a, vector unsigned short b)
4900{
4901 return (vector int)__builtin_altivec_vsr(a, (vector int)b);
4902}
4903
4904static vector int __ATTRS_o_ai
4905vec_vsr(vector int a, vector unsigned int b)
4906{
4907 return (vector int)__builtin_altivec_vsr(a, (vector int)b);
4908}
4909
4910static vector unsigned int __ATTRS_o_ai
4911vec_vsr(vector unsigned int a, vector unsigned char b)
4912{
4913 return (vector unsigned int)__builtin_altivec_vsr((vector int)a, (vector int)b);
4914}
4915
4916static vector unsigned int __ATTRS_o_ai
4917vec_vsr(vector unsigned int a, vector unsigned short b)
4918{
4919 return (vector unsigned int)__builtin_altivec_vsr((vector int)a, (vector int)b);
4920}
4921
4922static vector unsigned int __ATTRS_o_ai
4923vec_vsr(vector unsigned int a, vector unsigned int b)
4924{
4925 return (vector unsigned int)__builtin_altivec_vsr((vector int)a, (vector int)b);
4926}
4927
4928/* vec_sro */
4929
4930static vector signed char __ATTRS_o_ai
4931vec_sro(vector signed char a, vector signed char b)
4932{
4933 return (vector signed char)__builtin_altivec_vsro((vector int)a, (vector int)b);
4934}
4935
4936static vector signed char __ATTRS_o_ai
4937vec_sro(vector signed char a, vector unsigned char b)
4938{
4939 return (vector signed char)__builtin_altivec_vsro((vector int)a, (vector int)b);
4940}
4941
4942static vector unsigned char __ATTRS_o_ai
4943vec_sro(vector unsigned char a, vector signed char b)
4944{
4945 return (vector unsigned char)__builtin_altivec_vsro((vector int)a, (vector int)b);
4946}
4947
4948static vector unsigned char __ATTRS_o_ai
4949vec_sro(vector unsigned char a, vector unsigned char b)
4950{
4951 return (vector unsigned char)__builtin_altivec_vsro((vector int)a, (vector int)b);
4952}
4953
4954static vector short __ATTRS_o_ai
4955vec_sro(vector short a, vector signed char b)
4956{
4957 return (vector short)__builtin_altivec_vsro((vector int)a, (vector int)b);
4958}
4959
4960static vector short __ATTRS_o_ai
4961vec_sro(vector short a, vector unsigned char b)
4962{
4963 return (vector short)__builtin_altivec_vsro((vector int)a, (vector int)b);
4964}
4965
4966static vector unsigned short __ATTRS_o_ai
4967vec_sro(vector unsigned short a, vector signed char b)
4968{
4969 return (vector unsigned short)__builtin_altivec_vsro((vector int)a, (vector int)b);
4970}
4971
4972static vector unsigned short __ATTRS_o_ai
4973vec_sro(vector unsigned short a, vector unsigned char b)
4974{
4975 return (vector unsigned short)__builtin_altivec_vsro((vector int)a, (vector int)b);
4976}
4977
4978static vector int __ATTRS_o_ai
4979vec_sro(vector int a, vector signed char b)
4980{
4981 return (vector int)__builtin_altivec_vsro(a, (vector int)b);
4982}
4983
4984static vector int __ATTRS_o_ai
4985vec_sro(vector int a, vector unsigned char b)
4986{
4987 return (vector int)__builtin_altivec_vsro(a, (vector int)b);
4988}
4989
4990static vector unsigned int __ATTRS_o_ai
4991vec_sro(vector unsigned int a, vector signed char b)
4992{
4993 return (vector unsigned int)__builtin_altivec_vsro((vector int)a, (vector int)b);
4994}
4995
4996static vector unsigned int __ATTRS_o_ai
4997vec_sro(vector unsigned int a, vector unsigned char b)
4998{
4999 return (vector unsigned int)__builtin_altivec_vsro((vector int)a, (vector int)b);
5000}
5001
5002static vector float __ATTRS_o_ai
5003vec_sro(vector float a, vector signed char b)
5004{
5005 return (vector float)__builtin_altivec_vsro((vector int)a, (vector int)b);
5006}
5007
5008static vector float __ATTRS_o_ai
5009vec_sro(vector float a, vector unsigned char b)
5010{
5011 return (vector float)__builtin_altivec_vsro((vector int)a, (vector int)b);
5012}
5013
5014/* vec_vsro */
5015
5016static vector signed char __ATTRS_o_ai
5017vec_vsro(vector signed char a, vector signed char b)
5018{
5019 return (vector signed char)__builtin_altivec_vsro((vector int)a, (vector int)b);
5020}
5021
5022static vector signed char __ATTRS_o_ai
5023vec_vsro(vector signed char a, vector unsigned char b)
5024{
5025 return (vector signed char)__builtin_altivec_vsro((vector int)a, (vector int)b);
5026}
5027
5028static vector unsigned char __ATTRS_o_ai
5029vec_vsro(vector unsigned char a, vector signed char b)
5030{
5031 return (vector unsigned char)__builtin_altivec_vsro((vector int)a, (vector int)b);
5032}
5033
5034static vector unsigned char __ATTRS_o_ai
5035vec_vsro(vector unsigned char a, vector unsigned char b)
5036{
5037 return (vector unsigned char)__builtin_altivec_vsro((vector int)a, (vector int)b);
5038}
5039
5040static vector short __ATTRS_o_ai
5041vec_vsro(vector short a, vector signed char b)
5042{
5043 return (vector short)__builtin_altivec_vsro((vector int)a, (vector int)b);
5044}
5045
5046static vector short __ATTRS_o_ai
5047vec_vsro(vector short a, vector unsigned char b)
5048{
5049 return (vector short)__builtin_altivec_vsro((vector int)a, (vector int)b);
5050}
5051
5052static vector unsigned short __ATTRS_o_ai
5053vec_vsro(vector unsigned short a, vector signed char b)
5054{
5055 return (vector unsigned short)__builtin_altivec_vsro((vector int)a, (vector int)b);
5056}
5057
5058static vector unsigned short __ATTRS_o_ai
5059vec_vsro(vector unsigned short a, vector unsigned char b)
5060{
5061 return (vector unsigned short)__builtin_altivec_vsro((vector int)a, (vector int)b);
5062}
5063
5064static vector int __ATTRS_o_ai
5065vec_vsro(vector int a, vector signed char b)
5066{
5067 return (vector int)__builtin_altivec_vsro(a, (vector int)b);
5068}
5069
5070static vector int __ATTRS_o_ai
5071vec_vsro(vector int a, vector unsigned char b)
5072{
5073 return (vector int)__builtin_altivec_vsro(a, (vector int)b);
5074}
5075
5076static vector unsigned int __ATTRS_o_ai
5077vec_vsro(vector unsigned int a, vector signed char b)
5078{
5079 return (vector unsigned int)__builtin_altivec_vsro((vector int)a, (vector int)b);
5080}
5081
5082static vector unsigned int __ATTRS_o_ai
5083vec_vsro(vector unsigned int a, vector unsigned char b)
5084{
5085 return (vector unsigned int)__builtin_altivec_vsro((vector int)a, (vector int)b);
5086}
5087
5088static vector float __ATTRS_o_ai
5089vec_vsro(vector float a, vector signed char b)
5090{
5091 return (vector float)__builtin_altivec_vsro((vector int)a, (vector int)b);
5092}
5093
5094static vector float __ATTRS_o_ai
5095vec_vsro(vector float a, vector unsigned char b)
5096{
5097 return (vector float)__builtin_altivec_vsro((vector int)a, (vector int)b);
5098}
5099
5100/* vec_st */
5101
5102static void __ATTRS_o_ai
5103vec_st(vector signed char a, int b, vector signed char *c)
5104{
5105 __builtin_altivec_stvx((vector int)a, b, c);
5106}
5107
5108static void __ATTRS_o_ai
5109vec_st(vector signed char a, int b, signed char *c)
5110{
5111 __builtin_altivec_stvx((vector int)a, b, c);
5112}
5113
5114static void __ATTRS_o_ai
5115vec_st(vector unsigned char a, int b, vector unsigned char *c)
5116{
5117 __builtin_altivec_stvx((vector int)a, b, c);
5118}
5119
5120static void __ATTRS_o_ai
5121vec_st(vector unsigned char a, int b, unsigned char *c)
5122{
5123 __builtin_altivec_stvx((vector int)a, b, c);
5124}
5125
5126static void __ATTRS_o_ai
5127vec_st(vector short a, int b, vector short *c)
5128{
5129 __builtin_altivec_stvx((vector int)a, b, c);
5130}
5131
5132static void __ATTRS_o_ai
5133vec_st(vector short a, int b, short *c)
5134{
5135 __builtin_altivec_stvx((vector int)a, b, c);
5136}
5137
5138static void __ATTRS_o_ai
5139vec_st(vector unsigned short a, int b, vector unsigned short *c)
5140{
5141 __builtin_altivec_stvx((vector int)a, b, c);
5142}
5143
5144static void __ATTRS_o_ai
5145vec_st(vector unsigned short a, int b, unsigned short *c)
5146{
5147 __builtin_altivec_stvx((vector int)a, b, c);
5148}
5149
5150static void __ATTRS_o_ai
5151vec_st(vector int a, int b, vector int *c)
5152{
5153 __builtin_altivec_stvx(a, b, c);
5154}
5155
5156static void __ATTRS_o_ai
5157vec_st(vector int a, int b, int *c)
5158{
5159 __builtin_altivec_stvx(a, b, c);
5160}
5161
5162static void __ATTRS_o_ai
5163vec_st(vector unsigned int a, int b, vector unsigned int *c)
5164{
5165 __builtin_altivec_stvx((vector int)a, b, c);
5166}
5167
5168static void __ATTRS_o_ai
5169vec_st(vector unsigned int a, int b, unsigned int *c)
5170{
5171 __builtin_altivec_stvx((vector int)a, b, c);
5172}
5173
5174static void __ATTRS_o_ai
5175vec_st(vector float a, int b, vector float *c)
5176{
5177 __builtin_altivec_stvx((vector int)a, b, c);
5178}
5179
5180static void __ATTRS_o_ai
5181vec_st(vector float a, int b, float *c)
5182{
5183 __builtin_altivec_stvx((vector int)a, b, c);
5184}
5185
5186/* vec_stvx */
5187
5188static void __ATTRS_o_ai
5189vec_stvx(vector signed char a, int b, vector signed char *c)
5190{
5191 __builtin_altivec_stvx((vector int)a, b, c);
5192}
5193
5194static void __ATTRS_o_ai
5195vec_stvx(vector signed char a, int b, signed char *c)
5196{
5197 __builtin_altivec_stvx((vector int)a, b, c);
5198}
5199
5200static void __ATTRS_o_ai
5201vec_stvx(vector unsigned char a, int b, vector unsigned char *c)
5202{
5203 __builtin_altivec_stvx((vector int)a, b, c);
5204}
5205
5206static void __ATTRS_o_ai
5207vec_stvx(vector unsigned char a, int b, unsigned char *c)
5208{
5209 __builtin_altivec_stvx((vector int)a, b, c);
5210}
5211
5212static void __ATTRS_o_ai
5213vec_stvx(vector short a, int b, vector short *c)
5214{
5215 __builtin_altivec_stvx((vector int)a, b, c);
5216}
5217
5218static void __ATTRS_o_ai
5219vec_stvx(vector short a, int b, short *c)
5220{
5221 __builtin_altivec_stvx((vector int)a, b, c);
5222}
5223
5224static void __ATTRS_o_ai
5225vec_stvx(vector unsigned short a, int b, vector unsigned short *c)
5226{
5227 __builtin_altivec_stvx((vector int)a, b, c);
5228}
5229
5230static void __ATTRS_o_ai
5231vec_stvx(vector unsigned short a, int b, unsigned short *c)
5232{
5233 __builtin_altivec_stvx((vector int)a, b, c);
5234}
5235
5236static void __ATTRS_o_ai
5237vec_stvx(vector int a, int b, vector int *c)
5238{
5239 __builtin_altivec_stvx(a, b, c);
5240}
5241
5242static void __ATTRS_o_ai
5243vec_stvx(vector int a, int b, int *c)
5244{
5245 __builtin_altivec_stvx(a, b, c);
5246}
5247
5248static void __ATTRS_o_ai
5249vec_stvx(vector unsigned int a, int b, vector unsigned int *c)
5250{
5251 __builtin_altivec_stvx((vector int)a, b, c);
5252}
5253
5254static void __ATTRS_o_ai
5255vec_stvx(vector unsigned int a, int b, unsigned int *c)
5256{
5257 __builtin_altivec_stvx((vector int)a, b, c);
5258}
5259
5260static void __ATTRS_o_ai
5261vec_stvx(vector float a, int b, vector float *c)
5262{
5263 __builtin_altivec_stvx((vector int)a, b, c);
5264}
5265
5266static void __ATTRS_o_ai
5267vec_stvx(vector float a, int b, float *c)
5268{
5269 __builtin_altivec_stvx((vector int)a, b, c);
5270}
5271
5272/* vec_ste */
5273
5274static void __ATTRS_o_ai
5275vec_ste(vector signed char a, int b, signed char *c)
5276{
5277 __builtin_altivec_stvebx((vector char)a, b, c);
5278}
5279
5280static void __ATTRS_o_ai
5281vec_ste(vector unsigned char a, int b, unsigned char *c)
5282{
5283 __builtin_altivec_stvebx((vector char)a, b, c);
5284}
5285
5286static void __ATTRS_o_ai
5287vec_ste(vector short a, int b, short *c)
5288{
5289 __builtin_altivec_stvehx(a, b, c);
5290}
5291
5292static void __ATTRS_o_ai
5293vec_ste(vector unsigned short a, int b, unsigned short *c)
5294{
5295 __builtin_altivec_stvehx((vector short)a, b, c);
5296}
5297
5298static void __ATTRS_o_ai
5299vec_ste(vector int a, int b, int *c)
5300{
5301 __builtin_altivec_stvewx(a, b, c);
5302}
5303
5304static void __ATTRS_o_ai
5305vec_ste(vector unsigned int a, int b, unsigned int *c)
5306{
5307 __builtin_altivec_stvewx((vector int)a, b, c);
5308}
5309
5310static void __ATTRS_o_ai
5311vec_ste(vector float a, int b, float *c)
5312{
5313 __builtin_altivec_stvewx((vector int)a, b, c);
5314}
5315
5316/* vec_stvebx */
5317
5318static void __ATTRS_o_ai
5319vec_stvebx(vector signed char a, int b, signed char *c)
5320{
5321 __builtin_altivec_stvebx((vector char)a, b, c);
5322}
5323
5324static void __ATTRS_o_ai
5325vec_stvebx(vector unsigned char a, int b, unsigned char *c)
5326{
5327 __builtin_altivec_stvebx((vector char)a, b, c);
5328}
5329
5330/* vec_stvehx */
5331
5332static void __ATTRS_o_ai
5333vec_stvehx(vector short a, int b, short *c)
5334{
5335 __builtin_altivec_stvehx(a, b, c);
5336}
5337
5338static void __ATTRS_o_ai
5339vec_stvehx(vector unsigned short a, int b, unsigned short *c)
5340{
5341 __builtin_altivec_stvehx((vector short)a, b, c);
5342}
5343
5344/* vec_stvewx */
5345
5346static void __ATTRS_o_ai
5347vec_stvewx(vector int a, int b, int *c)
5348{
5349 __builtin_altivec_stvewx(a, b, c);
5350}
5351
5352static void __ATTRS_o_ai
5353vec_stvewx(vector unsigned int a, int b, unsigned int *c)
5354{
5355 __builtin_altivec_stvewx((vector int)a, b, c);
5356}
5357
5358static void __ATTRS_o_ai
5359vec_stvewx(vector float a, int b, float *c)
5360{
5361 __builtin_altivec_stvewx((vector int)a, b, c);
5362}
5363
5364/* vec_stl */
5365
5366static void __ATTRS_o_ai
5367vec_stl(vector signed char a, int b, vector signed char *c)
5368{
5369 __builtin_altivec_stvxl((vector int)a, b, c);
5370}
5371
5372static void __ATTRS_o_ai
5373vec_stl(vector signed char a, int b, signed char *c)
5374{
5375 __builtin_altivec_stvxl((vector int)a, b, c);
5376}
5377
5378static void __ATTRS_o_ai
5379vec_stl(vector unsigned char a, int b, vector unsigned char *c)
5380{
5381 __builtin_altivec_stvxl((vector int)a, b, c);
5382}
5383
5384static void __ATTRS_o_ai
5385vec_stl(vector unsigned char a, int b, unsigned char *c)
5386{
5387 __builtin_altivec_stvxl((vector int)a, b, c);
5388}
5389
5390static void __ATTRS_o_ai
5391vec_stl(vector short a, int b, vector short *c)
5392{
5393 __builtin_altivec_stvxl((vector int)a, b, c);
5394}
5395
5396static void __ATTRS_o_ai
5397vec_stl(vector short a, int b, short *c)
5398{
5399 __builtin_altivec_stvxl((vector int)a, b, c);
5400}
5401
5402static void __ATTRS_o_ai
5403vec_stl(vector unsigned short a, int b, vector unsigned short *c)
5404{
5405 __builtin_altivec_stvxl((vector int)a, b, c);
5406}
5407
5408static void __ATTRS_o_ai
5409vec_stl(vector unsigned short a, int b, unsigned short *c)
5410{
5411 __builtin_altivec_stvxl((vector int)a, b, c);
5412}
5413
5414static void __ATTRS_o_ai
5415vec_stl(vector int a, int b, vector int *c)
5416{
5417 __builtin_altivec_stvxl(a, b, c);
5418}
5419
5420static void __ATTRS_o_ai
5421vec_stl(vector int a, int b, int *c)
5422{
5423 __builtin_altivec_stvxl(a, b, c);
5424}
5425
5426static void __ATTRS_o_ai
5427vec_stl(vector unsigned int a, int b, vector unsigned int *c)
5428{
5429 __builtin_altivec_stvxl((vector int)a, b, c);
5430}
5431
5432static void __ATTRS_o_ai
5433vec_stl(vector unsigned int a, int b, unsigned int *c)
5434{
5435 __builtin_altivec_stvxl((vector int)a, b, c);
5436}
5437
5438static void __ATTRS_o_ai
5439vec_stl(vector float a, int b, vector float *c)
5440{
5441 __builtin_altivec_stvxl((vector int)a, b, c);
5442}
5443
5444static void __ATTRS_o_ai
5445vec_stl(vector float a, int b, float *c)
5446{
5447 __builtin_altivec_stvxl((vector int)a, b, c);
5448}
5449
5450/* vec_stvxl */
5451
5452static void __ATTRS_o_ai
5453vec_stvxl(vector signed char a, int b, vector signed char *c)
5454{
5455 __builtin_altivec_stvxl((vector int)a, b, c);
5456}
5457
5458static void __ATTRS_o_ai
5459vec_stvxl(vector signed char a, int b, signed char *c)
5460{
5461 __builtin_altivec_stvxl((vector int)a, b, c);
5462}
5463
5464static void __ATTRS_o_ai
5465vec_stvxl(vector unsigned char a, int b, vector unsigned char *c)
5466{
5467 __builtin_altivec_stvxl((vector int)a, b, c);
5468}
5469
5470static void __ATTRS_o_ai
5471vec_stvxl(vector unsigned char a, int b, unsigned char *c)
5472{
5473 __builtin_altivec_stvxl((vector int)a, b, c);
5474}
5475
5476static void __ATTRS_o_ai
5477vec_stvxl(vector short a, int b, vector short *c)
5478{
5479 __builtin_altivec_stvxl((vector int)a, b, c);
5480}
5481
5482static void __ATTRS_o_ai
5483vec_stvxl(vector short a, int b, short *c)
5484{
5485 __builtin_altivec_stvxl((vector int)a, b, c);
5486}
5487
5488static void __ATTRS_o_ai
5489vec_stvxl(vector unsigned short a, int b, vector unsigned short *c)
5490{
5491 __builtin_altivec_stvxl((vector int)a, b, c);
5492}
5493
5494static void __ATTRS_o_ai
5495vec_stvxl(vector unsigned short a, int b, unsigned short *c)
5496{
5497 __builtin_altivec_stvxl((vector int)a, b, c);
5498}
5499
5500static void __ATTRS_o_ai
5501vec_stvxl(vector int a, int b, vector int *c)
5502{
5503 __builtin_altivec_stvxl(a, b, c);
5504}
5505
5506static void __ATTRS_o_ai
5507vec_stvxl(vector int a, int b, int *c)
5508{
5509 __builtin_altivec_stvxl(a, b, c);
5510}
5511
5512static void __ATTRS_o_ai
5513vec_stvxl(vector unsigned int a, int b, vector unsigned int *c)
5514{
5515 __builtin_altivec_stvxl((vector int)a, b, c);
5516}
5517
5518static void __ATTRS_o_ai
5519vec_stvxl(vector unsigned int a, int b, unsigned int *c)
5520{
5521 __builtin_altivec_stvxl((vector int)a, b, c);
5522}
5523
5524static void __ATTRS_o_ai
5525vec_stvxl(vector float a, int b, vector float *c)
5526{
5527 __builtin_altivec_stvxl((vector int)a, b, c);
5528}
5529
5530static void __ATTRS_o_ai
5531vec_stvxl(vector float a, int b, float *c)
5532{
5533 __builtin_altivec_stvxl((vector int)a, b, c);
5534}
5535
5536/* vec_sub */
5537
5538static vector signed char __ATTRS_o_ai
5539vec_sub(vector signed char a, vector signed char b)
5540{
5541 return a - b;
5542}
5543
5544static vector unsigned char __ATTRS_o_ai
5545vec_sub(vector unsigned char a, vector unsigned char b)
5546{
5547 return a - b;
5548}
5549
5550static vector short __ATTRS_o_ai
5551vec_sub(vector short a, vector short b)
5552{
5553 return a - b;
5554}
5555
5556static vector unsigned short __ATTRS_o_ai
5557vec_sub(vector unsigned short a, vector unsigned short b)
5558{
5559 return a - b;
5560}
5561
5562static vector int __ATTRS_o_ai
5563vec_sub(vector int a, vector int b)
5564{
5565 return a - b;
5566}
5567
5568static vector unsigned int __ATTRS_o_ai
5569vec_sub(vector unsigned int a, vector unsigned int b)
5570{
5571 return a - b;
5572}
5573
5574static vector float __ATTRS_o_ai
5575vec_sub(vector float a, vector float b)
5576{
5577 return a - b;
5578}
5579
5580/* vec_vsububm */
5581
5582#define __builtin_altivec_vsububm vec_vsububm
5583
5584static vector signed char __ATTRS_o_ai
5585vec_vsububm(vector signed char a, vector signed char b)
5586{
5587 return a - b;
5588}
5589
5590static vector unsigned char __ATTRS_o_ai
5591vec_vsububm(vector unsigned char a, vector unsigned char b)
5592{
5593 return a - b;
5594}
5595
5596/* vec_vsubuhm */
5597
5598#define __builtin_altivec_vsubuhm vec_vsubuhm
5599
5600static vector short __ATTRS_o_ai
5601vec_vsubuhm(vector short a, vector short b)
5602{
5603 return a - b;
5604}
5605
5606static vector unsigned short __ATTRS_o_ai
5607vec_vsubuhm(vector unsigned short a, vector unsigned short b)
5608{
5609 return a - b;
5610}
5611
5612/* vec_vsubuwm */
5613
5614#define __builtin_altivec_vsubuwm vec_vsubuwm
5615
5616static vector int __ATTRS_o_ai
5617vec_vsubuwm(vector int a, vector int b)
5618{
5619 return a - b;
5620}
5621
5622static vector unsigned int __ATTRS_o_ai
5623vec_vsubuwm(vector unsigned int a, vector unsigned int b)
5624{
5625 return a - b;
5626}
5627
5628/* vec_vsubfp */
5629
5630#define __builtin_altivec_vsubfp vec_vsubfp
5631
5632static vector float __attribute__((__always_inline__))
5633vec_vsubfp(vector float a, vector float b)
5634{
5635 return a - b;
5636}
5637
5638/* vec_subc */
5639
5640static vector unsigned int __attribute__((__always_inline__))
5641vec_subc(vector unsigned int a, vector unsigned int b)
5642{
5643 return __builtin_altivec_vsubcuw(a, b);
5644}
5645
5646/* vec_vsubcuw */
5647
5648static vector unsigned int __attribute__((__always_inline__))
5649vec_vsubcuw(vector unsigned int a, vector unsigned int b)
5650{
5651 return __builtin_altivec_vsubcuw(a, b);
5652}
5653
5654/* vec_subs */
5655
5656static vector signed char __ATTRS_o_ai
5657vec_subs(vector signed char a, vector signed char b)
5658{
5659 return __builtin_altivec_vsubsbs(a, b);
5660}
5661
5662static vector unsigned char __ATTRS_o_ai
5663vec_subs(vector unsigned char a, vector unsigned char b)
5664{
5665 return __builtin_altivec_vsububs(a, b);
5666}
5667
5668static vector short __ATTRS_o_ai
5669vec_subs(vector short a, vector short b)
5670{
5671 return __builtin_altivec_vsubshs(a, b);
5672}
5673
5674static vector unsigned short __ATTRS_o_ai
5675vec_subs(vector unsigned short a, vector unsigned short b)
5676{
5677 return __builtin_altivec_vsubuhs(a, b);
5678}
5679
5680static vector int __ATTRS_o_ai
5681vec_subs(vector int a, vector int b)
5682{
5683 return __builtin_altivec_vsubsws(a, b);
5684}
5685
5686static vector unsigned int __ATTRS_o_ai
5687vec_subs(vector unsigned int a, vector unsigned int b)
5688{
5689 return __builtin_altivec_vsubuws(a, b);
5690}
5691
5692/* vec_vsubsbs */
5693
5694static vector signed char __attribute__((__always_inline__))
5695vec_vsubsbs(vector signed char a, vector signed char b)
5696{
5697 return __builtin_altivec_vsubsbs(a, b);
5698}
5699
5700/* vec_vsububs */
5701
5702static vector unsigned char __attribute__((__always_inline__))
5703vec_vsububs(vector unsigned char a, vector unsigned char b)
5704{
5705 return __builtin_altivec_vsububs(a, b);
5706}
5707
5708/* vec_vsubshs */
5709
5710static vector short __attribute__((__always_inline__))
5711vec_vsubshs(vector short a, vector short b)
5712{
5713 return __builtin_altivec_vsubshs(a, b);
5714}
5715
5716/* vec_vsubuhs */
5717
5718static vector unsigned short __attribute__((__always_inline__))
5719vec_vsubuhs(vector unsigned short a, vector unsigned short b)
5720{
5721 return __builtin_altivec_vsubuhs(a, b);
5722}
5723
5724/* vec_vsubsws */
5725
5726static vector int __attribute__((__always_inline__))
5727vec_vsubsws(vector int a, vector int b)
5728{
5729 return __builtin_altivec_vsubsws(a, b);
5730}
5731
5732/* vec_vsubuws */
5733
5734static vector unsigned int __attribute__((__always_inline__))
5735vec_vsubuws(vector unsigned int a, vector unsigned int b)
5736{
5737 return __builtin_altivec_vsubuws(a, b);
5738}
5739
5740/* vec_sum4s */
5741
5742static vector int __ATTRS_o_ai
5743vec_sum4s(vector signed char a, vector int b)
5744{
5745 return __builtin_altivec_vsum4sbs(a, b);
5746}
5747
5748static vector unsigned int __ATTRS_o_ai
5749vec_sum4s(vector unsigned char a, vector unsigned int b)
5750{
5751 return __builtin_altivec_vsum4ubs(a, b);
5752}
5753
5754static vector int __ATTRS_o_ai
5755vec_sum4s(vector signed short a, vector int b)
5756{
5757 return __builtin_altivec_vsum4shs(a, b);
5758}
5759
5760/* vec_vsum4sbs */
5761
5762static vector int __attribute__((__always_inline__))
5763vec_vsum4sbs(vector signed char a, vector int b)
5764{
5765 return __builtin_altivec_vsum4sbs(a, b);
5766}
5767
5768/* vec_vsum4ubs */
5769
5770static vector unsigned int __attribute__((__always_inline__))
5771vec_vsum4ubs(vector unsigned char a, vector unsigned int b)
5772{
5773 return __builtin_altivec_vsum4ubs(a, b);
5774}
5775
5776/* vec_vsum4shs */
5777
5778static vector int __attribute__((__always_inline__))
5779vec_vsum4shs(vector signed short a, vector int b)
5780{
5781 return __builtin_altivec_vsum4shs(a, b);
5782}
5783
5784/* vec_sum2s */
5785
5786static vector signed int __attribute__((__always_inline__))
5787vec_sum2s(vector int a, vector int b)
5788{
5789 return __builtin_altivec_vsum2sws(a, b);
5790}
5791
5792/* vec_vsum2sws */
5793
5794static vector signed int __attribute__((__always_inline__))
5795vec_vsum2sws(vector int a, vector int b)
5796{
5797 return __builtin_altivec_vsum2sws(a, b);
5798}
5799
5800/* vec_sums */
5801
5802static vector signed int __attribute__((__always_inline__))
5803vec_sums(vector signed int a, vector signed int b)
5804{
5805 return __builtin_altivec_vsumsws(a, b);
5806}
5807
5808/* vec_vsumsws */
5809
5810static vector signed int __attribute__((__always_inline__))
5811vec_vsumsws(vector signed int a, vector signed int b)
5812{
5813 return __builtin_altivec_vsumsws(a, b);
5814}
5815
5816/* vec_trunc */
5817
5818static vector float __attribute__((__always_inline__))
5819vec_trunc(vector float a)
5820{
5821 return __builtin_altivec_vrfiz(a);
5822}
5823
5824/* vec_vrfiz */
5825
5826static vector float __attribute__((__always_inline__))
5827vec_vrfiz(vector float a)
5828{
5829 return __builtin_altivec_vrfiz(a);
5830}
5831
5832/* vec_unpackh */
5833
5834static vector short __ATTRS_o_ai
5835vec_unpackh(vector signed char a)
5836{
5837 return __builtin_altivec_vupkhsb((vector char)a);
5838}
5839
5840static vector int __ATTRS_o_ai
5841vec_unpackh(vector short a)
5842{
5843 return __builtin_altivec_vupkhsh(a);
5844}
5845
5846/* vec_vupkhsb */
5847
5848static vector short __attribute__((__always_inline__))
5849vec_vupkhsb(vector signed char a)
5850{
5851 return __builtin_altivec_vupkhsb((vector char)a);
5852}
5853
5854/* vec_vupkhsh */
5855
5856static vector int __attribute__((__always_inline__))
5857vec_vupkhsh(vector short a)
5858{
5859 return __builtin_altivec_vupkhsh(a);
5860}
5861
5862/* vec_unpackl */
5863
5864static vector short __ATTRS_o_ai
5865vec_unpackl(vector signed char a)
5866{
5867 return __builtin_altivec_vupklsb((vector char)a);
5868}
5869
5870static vector int __ATTRS_o_ai
5871vec_unpackl(vector short a)
5872{
5873 return __builtin_altivec_vupklsh(a);
5874}
5875
5876/* vec_vupklsb */
5877
5878static vector short __attribute__((__always_inline__))
5879vec_vupklsb(vector signed char a)
5880{
5881 return __builtin_altivec_vupklsb((vector char)a);
5882}
5883
5884/* vec_vupklsh */
5885
5886static vector int __attribute__((__always_inline__))
5887vec_vupklsh(vector short a)
5888{
5889 return __builtin_altivec_vupklsh(a);
5890}
5891
5892/* vec_xor */
5893
5894#define __builtin_altivec_vxor vec_xor
5895
5896static vector signed char __ATTRS_o_ai
5897vec_xor(vector signed char a, vector signed char b)
5898{
5899 return a ^ b;
5900}
5901
5902static vector unsigned char __ATTRS_o_ai
5903vec_xor(vector unsigned char a, vector unsigned char b)
5904{
5905 return a ^ b;
5906}
5907
5908static vector short __ATTRS_o_ai
5909vec_xor(vector short a, vector short b)
5910{
5911 return a ^ b;
5912}
5913
5914static vector unsigned short __ATTRS_o_ai
5915vec_xor(vector unsigned short a, vector unsigned short b)
5916{
5917 return a ^ b;
5918}
5919
5920static vector int __ATTRS_o_ai
5921vec_xor(vector int a, vector int b)
5922{
5923 return a ^ b;
5924}
5925
5926static vector unsigned int __ATTRS_o_ai
5927vec_xor(vector unsigned int a, vector unsigned int b)
5928{
5929 return a ^ b;
5930}
5931
5932static vector float __ATTRS_o_ai
5933vec_xor(vector float a, vector float b)
5934{
5935 vector unsigned int res = (vector unsigned int)a ^ (vector unsigned int)b;
5936 return (vector float)res;
5937}
5938
5939/* vec_vxor */
5940
5941static vector signed char __ATTRS_o_ai
5942vec_vxor(vector signed char a, vector signed char b)
5943{
5944 return a ^ b;
5945}
5946
5947static vector unsigned char __ATTRS_o_ai
5948vec_vxor(vector unsigned char a, vector unsigned char b)
5949{
5950 return a ^ b;
5951}
5952
5953static vector short __ATTRS_o_ai
5954vec_vxor(vector short a, vector short b)
5955{
5956 return a ^ b;
5957}
5958
5959static vector unsigned short __ATTRS_o_ai
5960vec_vxor(vector unsigned short a, vector unsigned short b)
5961{
5962 return a ^ b;
5963}
5964
5965static vector int __ATTRS_o_ai
5966vec_vxor(vector int a, vector int b)
5967{
5968 return a ^ b;
5969}
5970
5971static vector unsigned int __ATTRS_o_ai
5972vec_vxor(vector unsigned int a, vector unsigned int b)
5973{
5974 return a ^ b;
5975}
5976
5977static vector float __ATTRS_o_ai
5978vec_vxor(vector float a, vector float b)
5979{
5980 vector unsigned int res = (vector unsigned int)a ^ (vector unsigned int)b;
5981 return (vector float)res;
5982}
Chris Lattnerdd173942010-04-14 03:54:58 +00005983
5984/* ------------------------------ predicates ------------------------------------ */
5985
Chris Lattnerdd173942010-04-14 03:54:58 +00005986/* vec_all_eq */
5987
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005988static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00005989vec_all_eq(vector signed char a, vector signed char b)
5990{
Chris Lattnerab866b42010-04-14 20:35:39 +00005991 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)a, (vector char)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00005992}
5993
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00005994static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00005995vec_all_eq(vector unsigned char a, vector unsigned char b)
5996{
Chris Lattnerab866b42010-04-14 20:35:39 +00005997 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)a, (vector char)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00005998}
5999
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006000static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006001vec_all_eq(vector short a, vector short b)
6002{
6003 return __builtin_altivec_vcmpequh_p(__CR6_LT, a, b);
6004}
6005
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006006static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006007vec_all_eq(vector unsigned short a, vector unsigned short b)
6008{
Chris Lattnerab866b42010-04-14 20:35:39 +00006009 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)a, (vector short)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00006010}
6011
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006012static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006013vec_all_eq(vector int a, vector int b)
6014{
6015 return __builtin_altivec_vcmpequw_p(__CR6_LT, a, b);
6016}
6017
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006018static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006019vec_all_eq(vector unsigned int a, vector unsigned int b)
6020{
Chris Lattnerab866b42010-04-14 20:35:39 +00006021 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)a, (vector int)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00006022}
6023
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006024static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006025vec_all_eq(vector float a, vector float b)
6026{
6027 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, a, b);
6028}
6029
6030/* vec_all_ge */
6031
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006032static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006033vec_all_ge(vector signed char a, vector signed char b)
6034{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006035 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00006036}
6037
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006038static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006039vec_all_ge(vector unsigned char a, vector unsigned char b)
6040{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006041 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00006042}
6043
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006044static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006045vec_all_ge(vector short a, vector short b)
6046{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006047 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00006048}
6049
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006050static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006051vec_all_ge(vector unsigned short a, vector unsigned short b)
6052{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006053 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00006054}
6055
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006056static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006057vec_all_ge(vector int a, vector int b)
6058{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006059 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00006060}
6061
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006062static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006063vec_all_ge(vector unsigned int a, vector unsigned int b)
6064{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006065 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00006066}
6067
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006068static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006069vec_all_ge(vector float a, vector float b)
6070{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006071 return __builtin_altivec_vcmpgefp_p(__CR6_LT, a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00006072}
6073
6074/* vec_all_gt */
6075
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006076static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006077vec_all_gt(vector signed char a, vector signed char b)
6078{
6079 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, a, b);
6080}
6081
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006082static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006083vec_all_gt(vector unsigned char a, vector unsigned char b)
6084{
6085 return __builtin_altivec_vcmpgtub_p(__CR6_LT, a, b);
6086}
6087
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006088static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006089vec_all_gt(vector short a, vector short b)
6090{
6091 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, a, b);
6092}
6093
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006094static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006095vec_all_gt(vector unsigned short a, vector unsigned short b)
6096{
6097 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, a, b);
6098}
6099
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006100static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006101vec_all_gt(vector int a, vector int b)
6102{
6103 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, a, b);
6104}
6105
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006106static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006107vec_all_gt(vector unsigned int a, vector unsigned int b)
6108{
6109 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, a, b);
6110}
6111
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006112static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006113vec_all_gt(vector float a, vector float b)
6114{
6115 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, a, b);
6116}
6117
6118/* vec_all_in */
6119
6120static int __attribute__((__always_inline__))
6121vec_all_in(vector float a, vector float b)
6122{
6123 return __builtin_altivec_vcmpbfp_p(__CR6_EQ, a, b);
6124}
6125
6126/* vec_all_le */
6127
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006128static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006129vec_all_le(vector signed char a, vector signed char b)
6130{
6131 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, a, b);
6132}
6133
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006134static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006135vec_all_le(vector unsigned char a, vector unsigned char b)
6136{
6137 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, a, b);
6138}
6139
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006140static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006141vec_all_le(vector short a, vector short b)
6142{
6143 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, a, b);
6144}
6145
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006146static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006147vec_all_le(vector unsigned short a, vector unsigned short b)
6148{
6149 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, a, b);
6150}
6151
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006152static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006153vec_all_le(vector int a, vector int b)
6154{
6155 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, a, b);
6156}
6157
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006158static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006159vec_all_le(vector unsigned int a, vector unsigned int b)
6160{
6161 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, a, b);
6162}
6163
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006164static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006165vec_all_le(vector float a, vector float b)
6166{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006167 return __builtin_altivec_vcmpgefp_p(__CR6_LT, b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00006168}
6169
6170/* vec_all_lt */
6171
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006172static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006173vec_all_lt(vector signed char a, vector signed char b)
6174{
6175 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, b, a);
6176}
6177
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006178static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006179vec_all_lt(vector unsigned char a, vector unsigned char b)
6180{
6181 return __builtin_altivec_vcmpgtub_p(__CR6_LT, b, a);
6182}
6183
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006184static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006185vec_all_lt(vector short a, vector short b)
6186{
6187 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, b, a);
6188}
6189
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006190static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006191vec_all_lt(vector unsigned short a, vector unsigned short b)
6192{
6193 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, b, a);
6194}
6195
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006196static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006197vec_all_lt(vector int a, vector int b)
6198{
6199 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, b, a);
6200}
6201
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006202static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006203vec_all_lt(vector unsigned int a, vector unsigned int b)
6204{
6205 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, b, a);
6206}
6207
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006208static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006209vec_all_lt(vector float a, vector float b)
6210{
6211 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, b, a);
6212}
6213
6214/* vec_all_nan */
6215
6216static int __attribute__((__always_inline__))
6217vec_all_nan(vector float a)
6218{
6219 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, a, a);
6220}
6221
6222/* vec_all_ne */
6223
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006224static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006225vec_all_ne(vector signed char a, vector signed char b)
6226{
Chris Lattnerab866b42010-04-14 20:35:39 +00006227 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)a, (vector char)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00006228}
6229
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006230static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006231vec_all_ne(vector unsigned char a, vector unsigned char b)
6232{
Chris Lattnerab866b42010-04-14 20:35:39 +00006233 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)a, (vector char)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00006234}
6235
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006236static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006237vec_all_ne(vector short a, vector short b)
6238{
6239 return __builtin_altivec_vcmpequh_p(__CR6_EQ, a, b);
6240}
6241
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006242static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006243vec_all_ne(vector unsigned short a, vector unsigned short b)
6244{
Chris Lattnerab866b42010-04-14 20:35:39 +00006245 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)a, (vector short)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00006246}
6247
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006248static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006249vec_all_ne(vector int a, vector int b)
6250{
6251 return __builtin_altivec_vcmpequw_p(__CR6_EQ, a, b);
6252}
6253
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006254static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006255vec_all_ne(vector unsigned int a, vector unsigned int b)
6256{
Chris Lattnerab866b42010-04-14 20:35:39 +00006257 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)a, (vector int)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00006258}
6259
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006260static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006261vec_all_ne(vector float a, vector float b)
6262{
6263 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, a, b);
6264}
6265
6266/* vec_all_nge */
6267
6268static int __attribute__((__always_inline__))
6269vec_all_nge(vector float a, vector float b)
6270{
6271 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, a, b);
6272}
6273
6274/* vec_all_ngt */
6275
6276static int __attribute__((__always_inline__))
6277vec_all_ngt(vector float a, vector float b)
6278{
6279 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, a, b);
6280}
6281
6282/* vec_all_nle */
6283
6284static int __attribute__((__always_inline__))
6285vec_all_nle(vector float a, vector float b)
6286{
6287 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, b, a);
6288}
6289
6290/* vec_all_nlt */
6291
6292static int __attribute__((__always_inline__))
6293vec_all_nlt(vector float a, vector float b)
6294{
6295 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, b, a);
6296}
6297
6298/* vec_all_numeric */
6299
6300static int __attribute__((__always_inline__))
6301vec_all_numeric(vector float a)
6302{
6303 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, a, a);
6304}
6305
6306/* vec_any_eq */
6307
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006308static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006309vec_any_eq(vector signed char a, vector signed char b)
6310{
Chris Lattnerab866b42010-04-14 20:35:39 +00006311 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)a, (vector char)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00006312}
6313
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006314static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006315vec_any_eq(vector unsigned char a, vector unsigned char b)
6316{
Chris Lattnerab866b42010-04-14 20:35:39 +00006317 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)a, (vector char)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00006318}
6319
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006320static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006321vec_any_eq(vector short a, vector short b)
6322{
6323 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, a, b);
6324}
6325
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006326static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006327vec_any_eq(vector unsigned short a, vector unsigned short b)
6328{
Chris Lattnerab866b42010-04-14 20:35:39 +00006329 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)a, (vector short)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00006330}
6331
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006332static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006333vec_any_eq(vector int a, vector int b)
6334{
6335 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, a, b);
6336}
6337
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006338static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006339vec_any_eq(vector unsigned int a, vector unsigned int b)
6340{
Chris Lattnerab866b42010-04-14 20:35:39 +00006341 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)a, (vector int)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00006342}
6343
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006344static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006345vec_any_eq(vector float a, vector float b)
6346{
6347 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, a, b);
6348}
6349
6350/* vec_any_ge */
6351
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006352static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006353vec_any_ge(vector signed char a, vector signed char b)
6354{
6355 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, b, a);
6356}
6357
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006358static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006359vec_any_ge(vector unsigned char a, vector unsigned char b)
6360{
6361 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, b, a);
6362}
6363
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006364static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006365vec_any_ge(vector short a, vector short b)
6366{
6367 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, b, a);
6368}
6369
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006370static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006371vec_any_ge(vector unsigned short a, vector unsigned short b)
6372{
6373 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, b, a);
6374}
6375
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006376static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006377vec_any_ge(vector int a, vector int b)
6378{
6379 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, b, a);
6380}
6381
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006382static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006383vec_any_ge(vector unsigned int a, vector unsigned int b)
6384{
6385 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, b, a);
6386}
6387
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006388static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006389vec_any_ge(vector float a, vector float b)
6390{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006391 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, a, b);
Chris Lattnerdd173942010-04-14 03:54:58 +00006392}
6393
6394/* vec_any_gt */
6395
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006396static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006397vec_any_gt(vector signed char a, vector signed char b)
6398{
6399 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, a, b);
6400}
6401
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006402static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006403vec_any_gt(vector unsigned char a, vector unsigned char b)
6404{
6405 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, a, b);
6406}
6407
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006408static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006409vec_any_gt(vector short a, vector short b)
6410{
6411 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, a, b);
6412}
6413
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006414static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006415vec_any_gt(vector unsigned short a, vector unsigned short b)
6416{
6417 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, a, b);
6418}
6419
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006420static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006421vec_any_gt(vector int a, vector int b)
6422{
6423 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, a, b);
6424}
6425
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006426static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006427vec_any_gt(vector unsigned int a, vector unsigned int b)
6428{
6429 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, a, b);
6430}
6431
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006432static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006433vec_any_gt(vector float a, vector float b)
6434{
6435 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, a, b);
6436}
6437
6438/* vec_any_le */
6439
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006440static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006441vec_any_le(vector signed char a, vector signed char b)
6442{
6443 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, a, b);
6444}
6445
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006446static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006447vec_any_le(vector unsigned char a, vector unsigned char b)
6448{
6449 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, a, b);
6450}
6451
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006452static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006453vec_any_le(vector short a, vector short b)
6454{
6455 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, a, b);
6456}
6457
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006458static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006459vec_any_le(vector unsigned short a, vector unsigned short b)
6460{
6461 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, a, b);
6462}
6463
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006464static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006465vec_any_le(vector int a, vector int b)
6466{
6467 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, a, b);
6468}
6469
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006470static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006471vec_any_le(vector unsigned int a, vector unsigned int b)
6472{
6473 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, a, b);
6474}
6475
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006476static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006477vec_any_le(vector float a, vector float b)
6478{
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006479 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, b, a);
Chris Lattnerdd173942010-04-14 03:54:58 +00006480}
6481
6482/* vec_any_lt */
6483
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006484static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006485vec_any_lt(vector signed char a, vector signed char b)
6486{
6487 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, b, a);
6488}
6489
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006490static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006491vec_any_lt(vector unsigned char a, vector unsigned char b)
6492{
6493 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, b, a);
6494}
6495
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006496static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006497vec_any_lt(vector short a, vector short b)
6498{
6499 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, b, a);
6500}
6501
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006502static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006503vec_any_lt(vector unsigned short a, vector unsigned short b)
6504{
6505 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, b, a);
6506}
6507
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006508static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006509vec_any_lt(vector int a, vector int b)
6510{
6511 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, b, a);
6512}
6513
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006514static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006515vec_any_lt(vector unsigned int a, vector unsigned int b)
6516{
6517 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, b, a);
6518}
6519
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006520static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006521vec_any_lt(vector float a, vector float b)
6522{
6523 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, b, a);
6524}
6525
6526/* vec_any_nan */
6527
6528static int __attribute__((__always_inline__))
6529vec_any_nan(vector float a)
6530{
6531 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, a, a);
6532}
6533
6534/* vec_any_ne */
6535
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006536static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006537vec_any_ne(vector signed char a, vector signed char b)
6538{
Chris Lattnerab866b42010-04-14 20:35:39 +00006539 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)a, (vector char)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00006540}
6541
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006542static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006543vec_any_ne(vector unsigned char a, vector unsigned char b)
6544{
Chris Lattnerab866b42010-04-14 20:35:39 +00006545 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)a, (vector char)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00006546}
6547
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006548static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006549vec_any_ne(vector short a, vector short b)
6550{
6551 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, a, b);
6552}
6553
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006554static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006555vec_any_ne(vector unsigned short a, vector unsigned short b)
6556{
Chris Lattnerab866b42010-04-14 20:35:39 +00006557 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)a, (vector short)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00006558}
6559
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006560static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006561vec_any_ne(vector int a, vector int b)
6562{
6563 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, a, b);
6564}
6565
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006566static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006567vec_any_ne(vector unsigned int a, vector unsigned int b)
6568{
Chris Lattnerab866b42010-04-14 20:35:39 +00006569 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)a, (vector int)b);
Chris Lattnerdd173942010-04-14 03:54:58 +00006570}
6571
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006572static int __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006573vec_any_ne(vector float a, vector float b)
6574{
6575 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, a, b);
6576}
6577
6578/* vec_any_nge */
6579
6580static int __attribute__((__always_inline__))
6581vec_any_nge(vector float a, vector float b)
6582{
6583 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, a, b);
6584}
6585
6586/* vec_any_ngt */
6587
6588static int __attribute__((__always_inline__))
6589vec_any_ngt(vector float a, vector float b)
6590{
6591 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, a, b);
6592}
6593
6594/* vec_any_nle */
6595
6596static int __attribute__((__always_inline__))
6597vec_any_nle(vector float a, vector float b)
6598{
6599 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, b, a);
6600}
6601
6602/* vec_any_nlt */
6603
6604static int __attribute__((__always_inline__))
6605vec_any_nlt(vector float a, vector float b)
6606{
6607 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, b, a);
6608}
6609
6610/* vec_any_numeric */
6611
6612static int __attribute__((__always_inline__))
6613vec_any_numeric(vector float a)
6614{
6615 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, a, a);
6616}
6617
6618/* vec_any_out */
6619
6620static int __attribute__((__always_inline__))
6621vec_any_out(vector float a, vector float b)
6622{
6623 return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, a, b);
6624}
6625
Anton Korobeynikov4d3a7b02010-06-19 09:47:18 +00006626#undef __ATTRS_o_ai
Chris Lattnerdd173942010-04-14 03:54:58 +00006627
6628#endif /* __ALTIVEC_H */