1 /*===---- altivec.h - Standard header for type generic math ---------------===*\
2 *
3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 * See https://llvm.org/LICENSE.txt for license information.
5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 *
7 \*===----------------------------------------------------------------------===*/
8
9 #ifndef __ALTIVEC_H
10 #define __ALTIVEC_H
11
12 #ifndef __ALTIVEC__
13 #error "AltiVec support not enabled"
14 #endif
15
16 /* Constants for mapping CR6 bits to predicate result. */
17
18 #define __CR6_EQ 0
19 #define __CR6_EQ_REV 1
20 #define __CR6_LT 2
21 #define __CR6_LT_REV 3
22
23 /* Constants for vec_test_data_class */
24 #define __VEC_CLASS_FP_SUBNORMAL_N (1 << 0)
25 #define __VEC_CLASS_FP_SUBNORMAL_P (1 << 1)
26 #define __VEC_CLASS_FP_SUBNORMAL (__VEC_CLASS_FP_SUBNORMAL_P | \
27 __VEC_CLASS_FP_SUBNORMAL_N)
28 #define __VEC_CLASS_FP_ZERO_N (1<<2)
29 #define __VEC_CLASS_FP_ZERO_P (1<<3)
30 #define __VEC_CLASS_FP_ZERO (__VEC_CLASS_FP_ZERO_P | \
31 __VEC_CLASS_FP_ZERO_N)
32 #define __VEC_CLASS_FP_INFINITY_N (1<<4)
33 #define __VEC_CLASS_FP_INFINITY_P (1<<5)
34 #define __VEC_CLASS_FP_INFINITY (__VEC_CLASS_FP_INFINITY_P | \
35 __VEC_CLASS_FP_INFINITY_N)
36 #define __VEC_CLASS_FP_NAN (1<<6)
37 #define __VEC_CLASS_FP_NOT_NORMAL (__VEC_CLASS_FP_NAN | \
38 __VEC_CLASS_FP_SUBNORMAL | \
39 __VEC_CLASS_FP_ZERO | \
40 __VEC_CLASS_FP_INFINITY)
41
42 #define __ATTRS_o_ai __attribute__((__overloadable__, __always_inline__))
43
44 #ifdef __POWER9_VECTOR__
45 #include <stddef.h>
46 #endif
47
48 static __inline__ vector signed char __ATTRS_o_ai vec_perm(
49 vector signed char __a, vector signed char __b, vector unsigned char __c);
50
51 static __inline__ vector unsigned char __ATTRS_o_ai
52 vec_perm(vector unsigned char __a, vector unsigned char __b,
53 vector unsigned char __c);
54
55 static __inline__ vector bool char __ATTRS_o_ai
56 vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c);
57
58 static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a,
59 vector signed short __b,
60 vector unsigned char __c);
61
62 static __inline__ vector unsigned short __ATTRS_o_ai
63 vec_perm(vector unsigned short __a, vector unsigned short __b,
64 vector unsigned char __c);
65
66 static __inline__ vector bool short __ATTRS_o_ai vec_perm(
67 vector bool short __a, vector bool short __b, vector unsigned char __c);
68
69 static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a,
70 vector pixel __b,
71 vector unsigned char __c);
72
73 static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a,
74 vector signed int __b,
75 vector unsigned char __c);
76
77 static __inline__ vector unsigned int __ATTRS_o_ai vec_perm(
78 vector unsigned int __a, vector unsigned int __b, vector unsigned char __c);
79
80 static __inline__ vector bool int __ATTRS_o_ai
81 vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c);
82
83 static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a,
84 vector float __b,
85 vector unsigned char __c);
86
87 #ifdef __VSX__
88 static __inline__ vector long long __ATTRS_o_ai
89 vec_perm(vector signed long long __a, vector signed long long __b,
90 vector unsigned char __c);
91
92 static __inline__ vector unsigned long long __ATTRS_o_ai
93 vec_perm(vector unsigned long long __a, vector unsigned long long __b,
94 vector unsigned char __c);
95
96 static __inline__ vector bool long long __ATTRS_o_ai
97 vec_perm(vector bool long long __a, vector bool long long __b,
98 vector unsigned char __c);
99
100 static __inline__ vector double __ATTRS_o_ai vec_perm(vector double __a,
101 vector double __b,
102 vector unsigned char __c);
103 #endif
104
105 static __inline__ vector unsigned char __ATTRS_o_ai
106 vec_xor(vector unsigned char __a, vector unsigned char __b);
107
108 /* vec_abs */
109
110 #define __builtin_altivec_abs_v16qi vec_abs
111 #define __builtin_altivec_abs_v8hi vec_abs
112 #define __builtin_altivec_abs_v4si vec_abs
113
114 static __inline__ vector signed char __ATTRS_o_ai
vec_abs(vector signed char __a)115 vec_abs(vector signed char __a) {
116 return __builtin_altivec_vmaxsb(__a, -__a);
117 }
118
119 static __inline__ vector signed short __ATTRS_o_ai
vec_abs(vector signed short __a)120 vec_abs(vector signed short __a) {
121 return __builtin_altivec_vmaxsh(__a, -__a);
122 }
123
124 static __inline__ vector signed int __ATTRS_o_ai
vec_abs(vector signed int __a)125 vec_abs(vector signed int __a) {
126 return __builtin_altivec_vmaxsw(__a, -__a);
127 }
128
129 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
130 static __inline__ vector signed long long __ATTRS_o_ai
vec_abs(vector signed long long __a)131 vec_abs(vector signed long long __a) {
132 return __builtin_altivec_vmaxsd(__a, -__a);
133 }
134 #endif
135
vec_abs(vector float __a)136 static __inline__ vector float __ATTRS_o_ai vec_abs(vector float __a) {
137 #ifdef __VSX__
138 return __builtin_vsx_xvabssp(__a);
139 #else
140 vector unsigned int __res =
141 (vector unsigned int)__a & (vector unsigned int)(0x7FFFFFFF);
142 return (vector float)__res;
143 #endif
144 }
145
146 #ifdef __VSX__
vec_abs(vector double __a)147 static __inline__ vector double __ATTRS_o_ai vec_abs(vector double __a) {
148 return __builtin_vsx_xvabsdp(__a);
149 }
150 #endif
151
152 /* vec_abss */
153 #define __builtin_altivec_abss_v16qi vec_abss
154 #define __builtin_altivec_abss_v8hi vec_abss
155 #define __builtin_altivec_abss_v4si vec_abss
156
157 static __inline__ vector signed char __ATTRS_o_ai
vec_abss(vector signed char __a)158 vec_abss(vector signed char __a) {
159 return __builtin_altivec_vmaxsb(
160 __a, __builtin_altivec_vsubsbs((vector signed char)(0), __a));
161 }
162
163 static __inline__ vector signed short __ATTRS_o_ai
vec_abss(vector signed short __a)164 vec_abss(vector signed short __a) {
165 return __builtin_altivec_vmaxsh(
166 __a, __builtin_altivec_vsubshs((vector signed short)(0), __a));
167 }
168
169 static __inline__ vector signed int __ATTRS_o_ai
vec_abss(vector signed int __a)170 vec_abss(vector signed int __a) {
171 return __builtin_altivec_vmaxsw(
172 __a, __builtin_altivec_vsubsws((vector signed int)(0), __a));
173 }
174
175 /* vec_absd */
176 #if defined(__POWER9_VECTOR__)
177
178 static __inline__ vector unsigned char __ATTRS_o_ai
vec_absd(vector unsigned char __a,vector unsigned char __b)179 vec_absd(vector unsigned char __a, vector unsigned char __b) {
180 return __builtin_altivec_vabsdub(__a, __b);
181 }
182
183 static __inline__ vector unsigned short __ATTRS_o_ai
vec_absd(vector unsigned short __a,vector unsigned short __b)184 vec_absd(vector unsigned short __a, vector unsigned short __b) {
185 return __builtin_altivec_vabsduh(__a, __b);
186 }
187
188 static __inline__ vector unsigned int __ATTRS_o_ai
vec_absd(vector unsigned int __a,vector unsigned int __b)189 vec_absd(vector unsigned int __a, vector unsigned int __b) {
190 return __builtin_altivec_vabsduw(__a, __b);
191 }
192
193 #endif /* End __POWER9_VECTOR__ */
194
195 /* vec_add */
196
197 static __inline__ vector signed char __ATTRS_o_ai
vec_add(vector signed char __a,vector signed char __b)198 vec_add(vector signed char __a, vector signed char __b) {
199 return __a + __b;
200 }
201
202 static __inline__ vector signed char __ATTRS_o_ai
vec_add(vector bool char __a,vector signed char __b)203 vec_add(vector bool char __a, vector signed char __b) {
204 return (vector signed char)__a + __b;
205 }
206
207 static __inline__ vector signed char __ATTRS_o_ai
vec_add(vector signed char __a,vector bool char __b)208 vec_add(vector signed char __a, vector bool char __b) {
209 return __a + (vector signed char)__b;
210 }
211
212 static __inline__ vector unsigned char __ATTRS_o_ai
vec_add(vector unsigned char __a,vector unsigned char __b)213 vec_add(vector unsigned char __a, vector unsigned char __b) {
214 return __a + __b;
215 }
216
217 static __inline__ vector unsigned char __ATTRS_o_ai
vec_add(vector bool char __a,vector unsigned char __b)218 vec_add(vector bool char __a, vector unsigned char __b) {
219 return (vector unsigned char)__a + __b;
220 }
221
222 static __inline__ vector unsigned char __ATTRS_o_ai
vec_add(vector unsigned char __a,vector bool char __b)223 vec_add(vector unsigned char __a, vector bool char __b) {
224 return __a + (vector unsigned char)__b;
225 }
226
vec_add(vector short __a,vector short __b)227 static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a,
228 vector short __b) {
229 return __a + __b;
230 }
231
vec_add(vector bool short __a,vector short __b)232 static __inline__ vector short __ATTRS_o_ai vec_add(vector bool short __a,
233 vector short __b) {
234 return (vector short)__a + __b;
235 }
236
vec_add(vector short __a,vector bool short __b)237 static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a,
238 vector bool short __b) {
239 return __a + (vector short)__b;
240 }
241
242 static __inline__ vector unsigned short __ATTRS_o_ai
vec_add(vector unsigned short __a,vector unsigned short __b)243 vec_add(vector unsigned short __a, vector unsigned short __b) {
244 return __a + __b;
245 }
246
247 static __inline__ vector unsigned short __ATTRS_o_ai
vec_add(vector bool short __a,vector unsigned short __b)248 vec_add(vector bool short __a, vector unsigned short __b) {
249 return (vector unsigned short)__a + __b;
250 }
251
252 static __inline__ vector unsigned short __ATTRS_o_ai
vec_add(vector unsigned short __a,vector bool short __b)253 vec_add(vector unsigned short __a, vector bool short __b) {
254 return __a + (vector unsigned short)__b;
255 }
256
vec_add(vector int __a,vector int __b)257 static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a,
258 vector int __b) {
259 return __a + __b;
260 }
261
vec_add(vector bool int __a,vector int __b)262 static __inline__ vector int __ATTRS_o_ai vec_add(vector bool int __a,
263 vector int __b) {
264 return (vector int)__a + __b;
265 }
266
vec_add(vector int __a,vector bool int __b)267 static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a,
268 vector bool int __b) {
269 return __a + (vector int)__b;
270 }
271
272 static __inline__ vector unsigned int __ATTRS_o_ai
vec_add(vector unsigned int __a,vector unsigned int __b)273 vec_add(vector unsigned int __a, vector unsigned int __b) {
274 return __a + __b;
275 }
276
277 static __inline__ vector unsigned int __ATTRS_o_ai
vec_add(vector bool int __a,vector unsigned int __b)278 vec_add(vector bool int __a, vector unsigned int __b) {
279 return (vector unsigned int)__a + __b;
280 }
281
282 static __inline__ vector unsigned int __ATTRS_o_ai
vec_add(vector unsigned int __a,vector bool int __b)283 vec_add(vector unsigned int __a, vector bool int __b) {
284 return __a + (vector unsigned int)__b;
285 }
286
287 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
288 static __inline__ vector signed long long __ATTRS_o_ai
vec_add(vector signed long long __a,vector signed long long __b)289 vec_add(vector signed long long __a, vector signed long long __b) {
290 return __a + __b;
291 }
292
293 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_add(vector unsigned long long __a,vector unsigned long long __b)294 vec_add(vector unsigned long long __a, vector unsigned long long __b) {
295 return __a + __b;
296 }
297
298 static __inline__ vector signed __int128 __ATTRS_o_ai
vec_add(vector signed __int128 __a,vector signed __int128 __b)299 vec_add(vector signed __int128 __a, vector signed __int128 __b) {
300 return __a + __b;
301 }
302
303 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_add(vector unsigned __int128 __a,vector unsigned __int128 __b)304 vec_add(vector unsigned __int128 __a, vector unsigned __int128 __b) {
305 return __a + __b;
306 }
307 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
308
vec_add(vector float __a,vector float __b)309 static __inline__ vector float __ATTRS_o_ai vec_add(vector float __a,
310 vector float __b) {
311 return __a + __b;
312 }
313
314 #ifdef __VSX__
vec_add(vector double __a,vector double __b)315 static __inline__ vector double __ATTRS_o_ai vec_add(vector double __a,
316 vector double __b) {
317 return __a + __b;
318 }
319 #endif // __VSX__
320
321 /* vec_adde */
322
323 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
324 static __inline__ vector signed __int128 __ATTRS_o_ai
vec_adde(vector signed __int128 __a,vector signed __int128 __b,vector signed __int128 __c)325 vec_adde(vector signed __int128 __a, vector signed __int128 __b,
326 vector signed __int128 __c) {
327 return __builtin_altivec_vaddeuqm(__a, __b, __c);
328 }
329
330 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_adde(vector unsigned __int128 __a,vector unsigned __int128 __b,vector unsigned __int128 __c)331 vec_adde(vector unsigned __int128 __a, vector unsigned __int128 __b,
332 vector unsigned __int128 __c) {
333 return __builtin_altivec_vaddeuqm(__a, __b, __c);
334 }
335 #endif
336
337 static __inline__ vector signed int __ATTRS_o_ai
vec_adde(vector signed int __a,vector signed int __b,vector signed int __c)338 vec_adde(vector signed int __a, vector signed int __b,
339 vector signed int __c) {
340 vector signed int __mask = {1, 1, 1, 1};
341 vector signed int __carry = __c & __mask;
342 return vec_add(vec_add(__a, __b), __carry);
343 }
344
345 static __inline__ vector unsigned int __ATTRS_o_ai
vec_adde(vector unsigned int __a,vector unsigned int __b,vector unsigned int __c)346 vec_adde(vector unsigned int __a, vector unsigned int __b,
347 vector unsigned int __c) {
348 vector unsigned int __mask = {1, 1, 1, 1};
349 vector unsigned int __carry = __c & __mask;
350 return vec_add(vec_add(__a, __b), __carry);
351 }
352
353 /* vec_addec */
354
355 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
356 static __inline__ vector signed __int128 __ATTRS_o_ai
vec_addec(vector signed __int128 __a,vector signed __int128 __b,vector signed __int128 __c)357 vec_addec(vector signed __int128 __a, vector signed __int128 __b,
358 vector signed __int128 __c) {
359 return __builtin_altivec_vaddecuq(__a, __b, __c);
360 }
361
362 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_addec(vector unsigned __int128 __a,vector unsigned __int128 __b,vector unsigned __int128 __c)363 vec_addec(vector unsigned __int128 __a, vector unsigned __int128 __b,
364 vector unsigned __int128 __c) {
365 return __builtin_altivec_vaddecuq(__a, __b, __c);
366 }
367
368 static __inline__ vector signed int __ATTRS_o_ai
vec_addec(vector signed int __a,vector signed int __b,vector signed int __c)369 vec_addec(vector signed int __a, vector signed int __b,
370 vector signed int __c) {
371
372 signed int __result[4];
373 for (int i = 0; i < 4; i++) {
374 unsigned int __tempa = (unsigned int) __a[i];
375 unsigned int __tempb = (unsigned int) __b[i];
376 unsigned int __tempc = (unsigned int) __c[i];
377 __tempc = __tempc & 0x00000001;
378 unsigned long long __longa = (unsigned long long) __tempa;
379 unsigned long long __longb = (unsigned long long) __tempb;
380 unsigned long long __longc = (unsigned long long) __tempc;
381 unsigned long long __sum = __longa + __longb + __longc;
382 unsigned long long __res = (__sum >> 32) & 0x01;
383 unsigned long long __tempres = (unsigned int) __res;
384 __result[i] = (signed int) __tempres;
385 }
386
387 vector signed int ret = { __result[0], __result[1], __result[2], __result[3] };
388 return ret;
389 }
390
391 static __inline__ vector unsigned int __ATTRS_o_ai
vec_addec(vector unsigned int __a,vector unsigned int __b,vector unsigned int __c)392 vec_addec(vector unsigned int __a, vector unsigned int __b,
393 vector unsigned int __c) {
394
395 unsigned int __result[4];
396 for (int i = 0; i < 4; i++) {
397 unsigned int __tempc = __c[i] & 1;
398 unsigned long long __longa = (unsigned long long) __a[i];
399 unsigned long long __longb = (unsigned long long) __b[i];
400 unsigned long long __longc = (unsigned long long) __tempc;
401 unsigned long long __sum = __longa + __longb + __longc;
402 unsigned long long __res = (__sum >> 32) & 0x01;
403 unsigned long long __tempres = (unsigned int) __res;
404 __result[i] = (signed int) __tempres;
405 }
406
407 vector unsigned int ret = { __result[0], __result[1], __result[2], __result[3] };
408 return ret;
409 }
410
411 #endif
412
413 /* vec_vaddubm */
414
415 #define __builtin_altivec_vaddubm vec_vaddubm
416
417 static __inline__ vector signed char __ATTRS_o_ai
vec_vaddubm(vector signed char __a,vector signed char __b)418 vec_vaddubm(vector signed char __a, vector signed char __b) {
419 return __a + __b;
420 }
421
422 static __inline__ vector signed char __ATTRS_o_ai
vec_vaddubm(vector bool char __a,vector signed char __b)423 vec_vaddubm(vector bool char __a, vector signed char __b) {
424 return (vector signed char)__a + __b;
425 }
426
427 static __inline__ vector signed char __ATTRS_o_ai
vec_vaddubm(vector signed char __a,vector bool char __b)428 vec_vaddubm(vector signed char __a, vector bool char __b) {
429 return __a + (vector signed char)__b;
430 }
431
432 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vaddubm(vector unsigned char __a,vector unsigned char __b)433 vec_vaddubm(vector unsigned char __a, vector unsigned char __b) {
434 return __a + __b;
435 }
436
437 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vaddubm(vector bool char __a,vector unsigned char __b)438 vec_vaddubm(vector bool char __a, vector unsigned char __b) {
439 return (vector unsigned char)__a + __b;
440 }
441
442 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vaddubm(vector unsigned char __a,vector bool char __b)443 vec_vaddubm(vector unsigned char __a, vector bool char __b) {
444 return __a + (vector unsigned char)__b;
445 }
446
447 /* vec_vadduhm */
448
449 #define __builtin_altivec_vadduhm vec_vadduhm
450
vec_vadduhm(vector short __a,vector short __b)451 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a,
452 vector short __b) {
453 return __a + __b;
454 }
455
vec_vadduhm(vector bool short __a,vector short __b)456 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector bool short __a,
457 vector short __b) {
458 return (vector short)__a + __b;
459 }
460
vec_vadduhm(vector short __a,vector bool short __b)461 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a,
462 vector bool short __b) {
463 return __a + (vector short)__b;
464 }
465
466 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vadduhm(vector unsigned short __a,vector unsigned short __b)467 vec_vadduhm(vector unsigned short __a, vector unsigned short __b) {
468 return __a + __b;
469 }
470
471 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vadduhm(vector bool short __a,vector unsigned short __b)472 vec_vadduhm(vector bool short __a, vector unsigned short __b) {
473 return (vector unsigned short)__a + __b;
474 }
475
476 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vadduhm(vector unsigned short __a,vector bool short __b)477 vec_vadduhm(vector unsigned short __a, vector bool short __b) {
478 return __a + (vector unsigned short)__b;
479 }
480
481 /* vec_vadduwm */
482
483 #define __builtin_altivec_vadduwm vec_vadduwm
484
vec_vadduwm(vector int __a,vector int __b)485 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a,
486 vector int __b) {
487 return __a + __b;
488 }
489
vec_vadduwm(vector bool int __a,vector int __b)490 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector bool int __a,
491 vector int __b) {
492 return (vector int)__a + __b;
493 }
494
vec_vadduwm(vector int __a,vector bool int __b)495 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a,
496 vector bool int __b) {
497 return __a + (vector int)__b;
498 }
499
500 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vadduwm(vector unsigned int __a,vector unsigned int __b)501 vec_vadduwm(vector unsigned int __a, vector unsigned int __b) {
502 return __a + __b;
503 }
504
505 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vadduwm(vector bool int __a,vector unsigned int __b)506 vec_vadduwm(vector bool int __a, vector unsigned int __b) {
507 return (vector unsigned int)__a + __b;
508 }
509
510 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vadduwm(vector unsigned int __a,vector bool int __b)511 vec_vadduwm(vector unsigned int __a, vector bool int __b) {
512 return __a + (vector unsigned int)__b;
513 }
514
515 /* vec_vaddfp */
516
517 #define __builtin_altivec_vaddfp vec_vaddfp
518
519 static __inline__ vector float __attribute__((__always_inline__))
vec_vaddfp(vector float __a,vector float __b)520 vec_vaddfp(vector float __a, vector float __b) {
521 return __a + __b;
522 }
523
524 /* vec_addc */
525
526 static __inline__ vector signed int __ATTRS_o_ai
vec_addc(vector signed int __a,vector signed int __b)527 vec_addc(vector signed int __a, vector signed int __b) {
528 return (vector signed int)__builtin_altivec_vaddcuw((vector unsigned int)__a,
529 (vector unsigned int)__b);
530 }
531
532 static __inline__ vector unsigned int __ATTRS_o_ai
vec_addc(vector unsigned int __a,vector unsigned int __b)533 vec_addc(vector unsigned int __a, vector unsigned int __b) {
534 return __builtin_altivec_vaddcuw(__a, __b);
535 }
536
537 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
538 static __inline__ vector signed __int128 __ATTRS_o_ai
vec_addc(vector signed __int128 __a,vector signed __int128 __b)539 vec_addc(vector signed __int128 __a, vector signed __int128 __b) {
540 return (vector signed __int128)__builtin_altivec_vaddcuq(
541 (vector unsigned __int128)__a, (vector unsigned __int128)__b);
542 }
543
544 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_addc(vector unsigned __int128 __a,vector unsigned __int128 __b)545 vec_addc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
546 return __builtin_altivec_vaddcuq(__a, __b);
547 }
548 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
549
550 /* vec_vaddcuw */
551
552 static __inline__ vector unsigned int __attribute__((__always_inline__))
vec_vaddcuw(vector unsigned int __a,vector unsigned int __b)553 vec_vaddcuw(vector unsigned int __a, vector unsigned int __b) {
554 return __builtin_altivec_vaddcuw(__a, __b);
555 }
556
557 /* vec_adds */
558
559 static __inline__ vector signed char __ATTRS_o_ai
vec_adds(vector signed char __a,vector signed char __b)560 vec_adds(vector signed char __a, vector signed char __b) {
561 return __builtin_altivec_vaddsbs(__a, __b);
562 }
563
564 static __inline__ vector signed char __ATTRS_o_ai
vec_adds(vector bool char __a,vector signed char __b)565 vec_adds(vector bool char __a, vector signed char __b) {
566 return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
567 }
568
569 static __inline__ vector signed char __ATTRS_o_ai
vec_adds(vector signed char __a,vector bool char __b)570 vec_adds(vector signed char __a, vector bool char __b) {
571 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
572 }
573
574 static __inline__ vector unsigned char __ATTRS_o_ai
vec_adds(vector unsigned char __a,vector unsigned char __b)575 vec_adds(vector unsigned char __a, vector unsigned char __b) {
576 return __builtin_altivec_vaddubs(__a, __b);
577 }
578
579 static __inline__ vector unsigned char __ATTRS_o_ai
vec_adds(vector bool char __a,vector unsigned char __b)580 vec_adds(vector bool char __a, vector unsigned char __b) {
581 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
582 }
583
584 static __inline__ vector unsigned char __ATTRS_o_ai
vec_adds(vector unsigned char __a,vector bool char __b)585 vec_adds(vector unsigned char __a, vector bool char __b) {
586 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
587 }
588
vec_adds(vector short __a,vector short __b)589 static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a,
590 vector short __b) {
591 return __builtin_altivec_vaddshs(__a, __b);
592 }
593
vec_adds(vector bool short __a,vector short __b)594 static __inline__ vector short __ATTRS_o_ai vec_adds(vector bool short __a,
595 vector short __b) {
596 return __builtin_altivec_vaddshs((vector short)__a, __b);
597 }
598
vec_adds(vector short __a,vector bool short __b)599 static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a,
600 vector bool short __b) {
601 return __builtin_altivec_vaddshs(__a, (vector short)__b);
602 }
603
604 static __inline__ vector unsigned short __ATTRS_o_ai
vec_adds(vector unsigned short __a,vector unsigned short __b)605 vec_adds(vector unsigned short __a, vector unsigned short __b) {
606 return __builtin_altivec_vadduhs(__a, __b);
607 }
608
609 static __inline__ vector unsigned short __ATTRS_o_ai
vec_adds(vector bool short __a,vector unsigned short __b)610 vec_adds(vector bool short __a, vector unsigned short __b) {
611 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
612 }
613
614 static __inline__ vector unsigned short __ATTRS_o_ai
vec_adds(vector unsigned short __a,vector bool short __b)615 vec_adds(vector unsigned short __a, vector bool short __b) {
616 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
617 }
618
vec_adds(vector int __a,vector int __b)619 static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a,
620 vector int __b) {
621 return __builtin_altivec_vaddsws(__a, __b);
622 }
623
vec_adds(vector bool int __a,vector int __b)624 static __inline__ vector int __ATTRS_o_ai vec_adds(vector bool int __a,
625 vector int __b) {
626 return __builtin_altivec_vaddsws((vector int)__a, __b);
627 }
628
vec_adds(vector int __a,vector bool int __b)629 static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a,
630 vector bool int __b) {
631 return __builtin_altivec_vaddsws(__a, (vector int)__b);
632 }
633
634 static __inline__ vector unsigned int __ATTRS_o_ai
vec_adds(vector unsigned int __a,vector unsigned int __b)635 vec_adds(vector unsigned int __a, vector unsigned int __b) {
636 return __builtin_altivec_vadduws(__a, __b);
637 }
638
639 static __inline__ vector unsigned int __ATTRS_o_ai
vec_adds(vector bool int __a,vector unsigned int __b)640 vec_adds(vector bool int __a, vector unsigned int __b) {
641 return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
642 }
643
644 static __inline__ vector unsigned int __ATTRS_o_ai
vec_adds(vector unsigned int __a,vector bool int __b)645 vec_adds(vector unsigned int __a, vector bool int __b) {
646 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
647 }
648
649 /* vec_vaddsbs */
650
651 static __inline__ vector signed char __ATTRS_o_ai
vec_vaddsbs(vector signed char __a,vector signed char __b)652 vec_vaddsbs(vector signed char __a, vector signed char __b) {
653 return __builtin_altivec_vaddsbs(__a, __b);
654 }
655
656 static __inline__ vector signed char __ATTRS_o_ai
vec_vaddsbs(vector bool char __a,vector signed char __b)657 vec_vaddsbs(vector bool char __a, vector signed char __b) {
658 return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
659 }
660
661 static __inline__ vector signed char __ATTRS_o_ai
vec_vaddsbs(vector signed char __a,vector bool char __b)662 vec_vaddsbs(vector signed char __a, vector bool char __b) {
663 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
664 }
665
666 /* vec_vaddubs */
667
668 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vaddubs(vector unsigned char __a,vector unsigned char __b)669 vec_vaddubs(vector unsigned char __a, vector unsigned char __b) {
670 return __builtin_altivec_vaddubs(__a, __b);
671 }
672
673 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vaddubs(vector bool char __a,vector unsigned char __b)674 vec_vaddubs(vector bool char __a, vector unsigned char __b) {
675 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
676 }
677
678 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vaddubs(vector unsigned char __a,vector bool char __b)679 vec_vaddubs(vector unsigned char __a, vector bool char __b) {
680 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
681 }
682
683 /* vec_vaddshs */
684
vec_vaddshs(vector short __a,vector short __b)685 static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a,
686 vector short __b) {
687 return __builtin_altivec_vaddshs(__a, __b);
688 }
689
vec_vaddshs(vector bool short __a,vector short __b)690 static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector bool short __a,
691 vector short __b) {
692 return __builtin_altivec_vaddshs((vector short)__a, __b);
693 }
694
vec_vaddshs(vector short __a,vector bool short __b)695 static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a,
696 vector bool short __b) {
697 return __builtin_altivec_vaddshs(__a, (vector short)__b);
698 }
699
700 /* vec_vadduhs */
701
702 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vadduhs(vector unsigned short __a,vector unsigned short __b)703 vec_vadduhs(vector unsigned short __a, vector unsigned short __b) {
704 return __builtin_altivec_vadduhs(__a, __b);
705 }
706
707 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vadduhs(vector bool short __a,vector unsigned short __b)708 vec_vadduhs(vector bool short __a, vector unsigned short __b) {
709 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
710 }
711
712 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vadduhs(vector unsigned short __a,vector bool short __b)713 vec_vadduhs(vector unsigned short __a, vector bool short __b) {
714 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
715 }
716
717 /* vec_vaddsws */
718
vec_vaddsws(vector int __a,vector int __b)719 static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a,
720 vector int __b) {
721 return __builtin_altivec_vaddsws(__a, __b);
722 }
723
vec_vaddsws(vector bool int __a,vector int __b)724 static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector bool int __a,
725 vector int __b) {
726 return __builtin_altivec_vaddsws((vector int)__a, __b);
727 }
728
vec_vaddsws(vector int __a,vector bool int __b)729 static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a,
730 vector bool int __b) {
731 return __builtin_altivec_vaddsws(__a, (vector int)__b);
732 }
733
734 /* vec_vadduws */
735
736 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vadduws(vector unsigned int __a,vector unsigned int __b)737 vec_vadduws(vector unsigned int __a, vector unsigned int __b) {
738 return __builtin_altivec_vadduws(__a, __b);
739 }
740
741 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vadduws(vector bool int __a,vector unsigned int __b)742 vec_vadduws(vector bool int __a, vector unsigned int __b) {
743 return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
744 }
745
746 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vadduws(vector unsigned int __a,vector bool int __b)747 vec_vadduws(vector unsigned int __a, vector bool int __b) {
748 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
749 }
750
751 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
752 /* vec_vadduqm */
753
754 static __inline__ vector signed __int128 __ATTRS_o_ai
vec_vadduqm(vector signed __int128 __a,vector signed __int128 __b)755 vec_vadduqm(vector signed __int128 __a, vector signed __int128 __b) {
756 return __a + __b;
757 }
758
759 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_vadduqm(vector unsigned __int128 __a,vector unsigned __int128 __b)760 vec_vadduqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
761 return __a + __b;
762 }
763
764 /* vec_vaddeuqm */
765
766 static __inline__ vector signed __int128 __ATTRS_o_ai
vec_vaddeuqm(vector signed __int128 __a,vector signed __int128 __b,vector signed __int128 __c)767 vec_vaddeuqm(vector signed __int128 __a, vector signed __int128 __b,
768 vector signed __int128 __c) {
769 return __builtin_altivec_vaddeuqm(__a, __b, __c);
770 }
771
772 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_vaddeuqm(vector unsigned __int128 __a,vector unsigned __int128 __b,vector unsigned __int128 __c)773 vec_vaddeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
774 vector unsigned __int128 __c) {
775 return __builtin_altivec_vaddeuqm(__a, __b, __c);
776 }
777
778 /* vec_vaddcuq */
779
780 static __inline__ vector signed __int128 __ATTRS_o_ai
vec_vaddcuq(vector signed __int128 __a,vector signed __int128 __b)781 vec_vaddcuq(vector signed __int128 __a, vector signed __int128 __b) {
782 return __builtin_altivec_vaddcuq(__a, __b);
783 }
784
785 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_vaddcuq(vector unsigned __int128 __a,vector unsigned __int128 __b)786 vec_vaddcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
787 return __builtin_altivec_vaddcuq(__a, __b);
788 }
789
790 /* vec_vaddecuq */
791
792 static __inline__ vector signed __int128 __ATTRS_o_ai
vec_vaddecuq(vector signed __int128 __a,vector signed __int128 __b,vector signed __int128 __c)793 vec_vaddecuq(vector signed __int128 __a, vector signed __int128 __b,
794 vector signed __int128 __c) {
795 return __builtin_altivec_vaddecuq(__a, __b, __c);
796 }
797
798 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_vaddecuq(vector unsigned __int128 __a,vector unsigned __int128 __b,vector unsigned __int128 __c)799 vec_vaddecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
800 vector unsigned __int128 __c) {
801 return __builtin_altivec_vaddecuq(__a, __b, __c);
802 }
803 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
804
805 /* vec_and */
806
807 #define __builtin_altivec_vand vec_and
808
809 static __inline__ vector signed char __ATTRS_o_ai
vec_and(vector signed char __a,vector signed char __b)810 vec_and(vector signed char __a, vector signed char __b) {
811 return __a & __b;
812 }
813
814 static __inline__ vector signed char __ATTRS_o_ai
vec_and(vector bool char __a,vector signed char __b)815 vec_and(vector bool char __a, vector signed char __b) {
816 return (vector signed char)__a & __b;
817 }
818
819 static __inline__ vector signed char __ATTRS_o_ai
vec_and(vector signed char __a,vector bool char __b)820 vec_and(vector signed char __a, vector bool char __b) {
821 return __a & (vector signed char)__b;
822 }
823
824 static __inline__ vector unsigned char __ATTRS_o_ai
vec_and(vector unsigned char __a,vector unsigned char __b)825 vec_and(vector unsigned char __a, vector unsigned char __b) {
826 return __a & __b;
827 }
828
829 static __inline__ vector unsigned char __ATTRS_o_ai
vec_and(vector bool char __a,vector unsigned char __b)830 vec_and(vector bool char __a, vector unsigned char __b) {
831 return (vector unsigned char)__a & __b;
832 }
833
834 static __inline__ vector unsigned char __ATTRS_o_ai
vec_and(vector unsigned char __a,vector bool char __b)835 vec_and(vector unsigned char __a, vector bool char __b) {
836 return __a & (vector unsigned char)__b;
837 }
838
vec_and(vector bool char __a,vector bool char __b)839 static __inline__ vector bool char __ATTRS_o_ai vec_and(vector bool char __a,
840 vector bool char __b) {
841 return __a & __b;
842 }
843
vec_and(vector short __a,vector short __b)844 static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a,
845 vector short __b) {
846 return __a & __b;
847 }
848
vec_and(vector bool short __a,vector short __b)849 static __inline__ vector short __ATTRS_o_ai vec_and(vector bool short __a,
850 vector short __b) {
851 return (vector short)__a & __b;
852 }
853
vec_and(vector short __a,vector bool short __b)854 static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a,
855 vector bool short __b) {
856 return __a & (vector short)__b;
857 }
858
859 static __inline__ vector unsigned short __ATTRS_o_ai
vec_and(vector unsigned short __a,vector unsigned short __b)860 vec_and(vector unsigned short __a, vector unsigned short __b) {
861 return __a & __b;
862 }
863
864 static __inline__ vector unsigned short __ATTRS_o_ai
vec_and(vector bool short __a,vector unsigned short __b)865 vec_and(vector bool short __a, vector unsigned short __b) {
866 return (vector unsigned short)__a & __b;
867 }
868
869 static __inline__ vector unsigned short __ATTRS_o_ai
vec_and(vector unsigned short __a,vector bool short __b)870 vec_and(vector unsigned short __a, vector bool short __b) {
871 return __a & (vector unsigned short)__b;
872 }
873
874 static __inline__ vector bool short __ATTRS_o_ai
vec_and(vector bool short __a,vector bool short __b)875 vec_and(vector bool short __a, vector bool short __b) {
876 return __a & __b;
877 }
878
vec_and(vector int __a,vector int __b)879 static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a,
880 vector int __b) {
881 return __a & __b;
882 }
883
vec_and(vector bool int __a,vector int __b)884 static __inline__ vector int __ATTRS_o_ai vec_and(vector bool int __a,
885 vector int __b) {
886 return (vector int)__a & __b;
887 }
888
vec_and(vector int __a,vector bool int __b)889 static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a,
890 vector bool int __b) {
891 return __a & (vector int)__b;
892 }
893
894 static __inline__ vector unsigned int __ATTRS_o_ai
vec_and(vector unsigned int __a,vector unsigned int __b)895 vec_and(vector unsigned int __a, vector unsigned int __b) {
896 return __a & __b;
897 }
898
899 static __inline__ vector unsigned int __ATTRS_o_ai
vec_and(vector bool int __a,vector unsigned int __b)900 vec_and(vector bool int __a, vector unsigned int __b) {
901 return (vector unsigned int)__a & __b;
902 }
903
904 static __inline__ vector unsigned int __ATTRS_o_ai
vec_and(vector unsigned int __a,vector bool int __b)905 vec_and(vector unsigned int __a, vector bool int __b) {
906 return __a & (vector unsigned int)__b;
907 }
908
vec_and(vector bool int __a,vector bool int __b)909 static __inline__ vector bool int __ATTRS_o_ai vec_and(vector bool int __a,
910 vector bool int __b) {
911 return __a & __b;
912 }
913
vec_and(vector float __a,vector float __b)914 static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a,
915 vector float __b) {
916 vector unsigned int __res =
917 (vector unsigned int)__a & (vector unsigned int)__b;
918 return (vector float)__res;
919 }
920
vec_and(vector bool int __a,vector float __b)921 static __inline__ vector float __ATTRS_o_ai vec_and(vector bool int __a,
922 vector float __b) {
923 vector unsigned int __res =
924 (vector unsigned int)__a & (vector unsigned int)__b;
925 return (vector float)__res;
926 }
927
vec_and(vector float __a,vector bool int __b)928 static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a,
929 vector bool int __b) {
930 vector unsigned int __res =
931 (vector unsigned int)__a & (vector unsigned int)__b;
932 return (vector float)__res;
933 }
934
935 #ifdef __VSX__
vec_and(vector bool long long __a,vector double __b)936 static __inline__ vector double __ATTRS_o_ai vec_and(vector bool long long __a,
937 vector double __b) {
938 vector unsigned long long __res =
939 (vector unsigned long long)__a & (vector unsigned long long)__b;
940 return (vector double)__res;
941 }
942
943 static __inline__ vector double __ATTRS_o_ai
vec_and(vector double __a,vector bool long long __b)944 vec_and(vector double __a, vector bool long long __b) {
945 vector unsigned long long __res =
946 (vector unsigned long long)__a & (vector unsigned long long)__b;
947 return (vector double)__res;
948 }
949
vec_and(vector double __a,vector double __b)950 static __inline__ vector double __ATTRS_o_ai vec_and(vector double __a,
951 vector double __b) {
952 vector unsigned long long __res =
953 (vector unsigned long long)__a & (vector unsigned long long)__b;
954 return (vector double)__res;
955 }
956
957 static __inline__ vector signed long long __ATTRS_o_ai
vec_and(vector signed long long __a,vector signed long long __b)958 vec_and(vector signed long long __a, vector signed long long __b) {
959 return __a & __b;
960 }
961
962 static __inline__ vector signed long long __ATTRS_o_ai
vec_and(vector bool long long __a,vector signed long long __b)963 vec_and(vector bool long long __a, vector signed long long __b) {
964 return (vector signed long long)__a & __b;
965 }
966
967 static __inline__ vector signed long long __ATTRS_o_ai
vec_and(vector signed long long __a,vector bool long long __b)968 vec_and(vector signed long long __a, vector bool long long __b) {
969 return __a & (vector signed long long)__b;
970 }
971
972 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_and(vector unsigned long long __a,vector unsigned long long __b)973 vec_and(vector unsigned long long __a, vector unsigned long long __b) {
974 return __a & __b;
975 }
976
977 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_and(vector bool long long __a,vector unsigned long long __b)978 vec_and(vector bool long long __a, vector unsigned long long __b) {
979 return (vector unsigned long long)__a & __b;
980 }
981
982 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_and(vector unsigned long long __a,vector bool long long __b)983 vec_and(vector unsigned long long __a, vector bool long long __b) {
984 return __a & (vector unsigned long long)__b;
985 }
986
987 static __inline__ vector bool long long __ATTRS_o_ai
vec_and(vector bool long long __a,vector bool long long __b)988 vec_and(vector bool long long __a, vector bool long long __b) {
989 return __a & __b;
990 }
991 #endif
992
993 /* vec_vand */
994
995 static __inline__ vector signed char __ATTRS_o_ai
vec_vand(vector signed char __a,vector signed char __b)996 vec_vand(vector signed char __a, vector signed char __b) {
997 return __a & __b;
998 }
999
1000 static __inline__ vector signed char __ATTRS_o_ai
vec_vand(vector bool char __a,vector signed char __b)1001 vec_vand(vector bool char __a, vector signed char __b) {
1002 return (vector signed char)__a & __b;
1003 }
1004
1005 static __inline__ vector signed char __ATTRS_o_ai
vec_vand(vector signed char __a,vector bool char __b)1006 vec_vand(vector signed char __a, vector bool char __b) {
1007 return __a & (vector signed char)__b;
1008 }
1009
1010 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vand(vector unsigned char __a,vector unsigned char __b)1011 vec_vand(vector unsigned char __a, vector unsigned char __b) {
1012 return __a & __b;
1013 }
1014
1015 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vand(vector bool char __a,vector unsigned char __b)1016 vec_vand(vector bool char __a, vector unsigned char __b) {
1017 return (vector unsigned char)__a & __b;
1018 }
1019
1020 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vand(vector unsigned char __a,vector bool char __b)1021 vec_vand(vector unsigned char __a, vector bool char __b) {
1022 return __a & (vector unsigned char)__b;
1023 }
1024
vec_vand(vector bool char __a,vector bool char __b)1025 static __inline__ vector bool char __ATTRS_o_ai vec_vand(vector bool char __a,
1026 vector bool char __b) {
1027 return __a & __b;
1028 }
1029
vec_vand(vector short __a,vector short __b)1030 static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a,
1031 vector short __b) {
1032 return __a & __b;
1033 }
1034
vec_vand(vector bool short __a,vector short __b)1035 static __inline__ vector short __ATTRS_o_ai vec_vand(vector bool short __a,
1036 vector short __b) {
1037 return (vector short)__a & __b;
1038 }
1039
vec_vand(vector short __a,vector bool short __b)1040 static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a,
1041 vector bool short __b) {
1042 return __a & (vector short)__b;
1043 }
1044
1045 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vand(vector unsigned short __a,vector unsigned short __b)1046 vec_vand(vector unsigned short __a, vector unsigned short __b) {
1047 return __a & __b;
1048 }
1049
1050 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vand(vector bool short __a,vector unsigned short __b)1051 vec_vand(vector bool short __a, vector unsigned short __b) {
1052 return (vector unsigned short)__a & __b;
1053 }
1054
1055 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vand(vector unsigned short __a,vector bool short __b)1056 vec_vand(vector unsigned short __a, vector bool short __b) {
1057 return __a & (vector unsigned short)__b;
1058 }
1059
1060 static __inline__ vector bool short __ATTRS_o_ai
vec_vand(vector bool short __a,vector bool short __b)1061 vec_vand(vector bool short __a, vector bool short __b) {
1062 return __a & __b;
1063 }
1064
vec_vand(vector int __a,vector int __b)1065 static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a,
1066 vector int __b) {
1067 return __a & __b;
1068 }
1069
vec_vand(vector bool int __a,vector int __b)1070 static __inline__ vector int __ATTRS_o_ai vec_vand(vector bool int __a,
1071 vector int __b) {
1072 return (vector int)__a & __b;
1073 }
1074
vec_vand(vector int __a,vector bool int __b)1075 static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a,
1076 vector bool int __b) {
1077 return __a & (vector int)__b;
1078 }
1079
1080 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vand(vector unsigned int __a,vector unsigned int __b)1081 vec_vand(vector unsigned int __a, vector unsigned int __b) {
1082 return __a & __b;
1083 }
1084
1085 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vand(vector bool int __a,vector unsigned int __b)1086 vec_vand(vector bool int __a, vector unsigned int __b) {
1087 return (vector unsigned int)__a & __b;
1088 }
1089
1090 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vand(vector unsigned int __a,vector bool int __b)1091 vec_vand(vector unsigned int __a, vector bool int __b) {
1092 return __a & (vector unsigned int)__b;
1093 }
1094
vec_vand(vector bool int __a,vector bool int __b)1095 static __inline__ vector bool int __ATTRS_o_ai vec_vand(vector bool int __a,
1096 vector bool int __b) {
1097 return __a & __b;
1098 }
1099
vec_vand(vector float __a,vector float __b)1100 static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a,
1101 vector float __b) {
1102 vector unsigned int __res =
1103 (vector unsigned int)__a & (vector unsigned int)__b;
1104 return (vector float)__res;
1105 }
1106
vec_vand(vector bool int __a,vector float __b)1107 static __inline__ vector float __ATTRS_o_ai vec_vand(vector bool int __a,
1108 vector float __b) {
1109 vector unsigned int __res =
1110 (vector unsigned int)__a & (vector unsigned int)__b;
1111 return (vector float)__res;
1112 }
1113
vec_vand(vector float __a,vector bool int __b)1114 static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a,
1115 vector bool int __b) {
1116 vector unsigned int __res =
1117 (vector unsigned int)__a & (vector unsigned int)__b;
1118 return (vector float)__res;
1119 }
1120
1121 #ifdef __VSX__
1122 static __inline__ vector signed long long __ATTRS_o_ai
vec_vand(vector signed long long __a,vector signed long long __b)1123 vec_vand(vector signed long long __a, vector signed long long __b) {
1124 return __a & __b;
1125 }
1126
1127 static __inline__ vector signed long long __ATTRS_o_ai
vec_vand(vector bool long long __a,vector signed long long __b)1128 vec_vand(vector bool long long __a, vector signed long long __b) {
1129 return (vector signed long long)__a & __b;
1130 }
1131
1132 static __inline__ vector signed long long __ATTRS_o_ai
vec_vand(vector signed long long __a,vector bool long long __b)1133 vec_vand(vector signed long long __a, vector bool long long __b) {
1134 return __a & (vector signed long long)__b;
1135 }
1136
1137 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_vand(vector unsigned long long __a,vector unsigned long long __b)1138 vec_vand(vector unsigned long long __a, vector unsigned long long __b) {
1139 return __a & __b;
1140 }
1141
1142 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_vand(vector bool long long __a,vector unsigned long long __b)1143 vec_vand(vector bool long long __a, vector unsigned long long __b) {
1144 return (vector unsigned long long)__a & __b;
1145 }
1146
1147 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_vand(vector unsigned long long __a,vector bool long long __b)1148 vec_vand(vector unsigned long long __a, vector bool long long __b) {
1149 return __a & (vector unsigned long long)__b;
1150 }
1151
1152 static __inline__ vector bool long long __ATTRS_o_ai
vec_vand(vector bool long long __a,vector bool long long __b)1153 vec_vand(vector bool long long __a, vector bool long long __b) {
1154 return __a & __b;
1155 }
1156 #endif
1157
1158 /* vec_andc */
1159
1160 #define __builtin_altivec_vandc vec_andc
1161
1162 static __inline__ vector signed char __ATTRS_o_ai
vec_andc(vector signed char __a,vector signed char __b)1163 vec_andc(vector signed char __a, vector signed char __b) {
1164 return __a & ~__b;
1165 }
1166
1167 static __inline__ vector signed char __ATTRS_o_ai
vec_andc(vector bool char __a,vector signed char __b)1168 vec_andc(vector bool char __a, vector signed char __b) {
1169 return (vector signed char)__a & ~__b;
1170 }
1171
1172 static __inline__ vector signed char __ATTRS_o_ai
vec_andc(vector signed char __a,vector bool char __b)1173 vec_andc(vector signed char __a, vector bool char __b) {
1174 return __a & ~(vector signed char)__b;
1175 }
1176
1177 static __inline__ vector unsigned char __ATTRS_o_ai
vec_andc(vector unsigned char __a,vector unsigned char __b)1178 vec_andc(vector unsigned char __a, vector unsigned char __b) {
1179 return __a & ~__b;
1180 }
1181
1182 static __inline__ vector unsigned char __ATTRS_o_ai
vec_andc(vector bool char __a,vector unsigned char __b)1183 vec_andc(vector bool char __a, vector unsigned char __b) {
1184 return (vector unsigned char)__a & ~__b;
1185 }
1186
1187 static __inline__ vector unsigned char __ATTRS_o_ai
vec_andc(vector unsigned char __a,vector bool char __b)1188 vec_andc(vector unsigned char __a, vector bool char __b) {
1189 return __a & ~(vector unsigned char)__b;
1190 }
1191
vec_andc(vector bool char __a,vector bool char __b)1192 static __inline__ vector bool char __ATTRS_o_ai vec_andc(vector bool char __a,
1193 vector bool char __b) {
1194 return __a & ~__b;
1195 }
1196
vec_andc(vector short __a,vector short __b)1197 static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a,
1198 vector short __b) {
1199 return __a & ~__b;
1200 }
1201
vec_andc(vector bool short __a,vector short __b)1202 static __inline__ vector short __ATTRS_o_ai vec_andc(vector bool short __a,
1203 vector short __b) {
1204 return (vector short)__a & ~__b;
1205 }
1206
vec_andc(vector short __a,vector bool short __b)1207 static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a,
1208 vector bool short __b) {
1209 return __a & ~(vector short)__b;
1210 }
1211
1212 static __inline__ vector unsigned short __ATTRS_o_ai
vec_andc(vector unsigned short __a,vector unsigned short __b)1213 vec_andc(vector unsigned short __a, vector unsigned short __b) {
1214 return __a & ~__b;
1215 }
1216
1217 static __inline__ vector unsigned short __ATTRS_o_ai
vec_andc(vector bool short __a,vector unsigned short __b)1218 vec_andc(vector bool short __a, vector unsigned short __b) {
1219 return (vector unsigned short)__a & ~__b;
1220 }
1221
1222 static __inline__ vector unsigned short __ATTRS_o_ai
vec_andc(vector unsigned short __a,vector bool short __b)1223 vec_andc(vector unsigned short __a, vector bool short __b) {
1224 return __a & ~(vector unsigned short)__b;
1225 }
1226
1227 static __inline__ vector bool short __ATTRS_o_ai
vec_andc(vector bool short __a,vector bool short __b)1228 vec_andc(vector bool short __a, vector bool short __b) {
1229 return __a & ~__b;
1230 }
1231
vec_andc(vector int __a,vector int __b)1232 static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a,
1233 vector int __b) {
1234 return __a & ~__b;
1235 }
1236
vec_andc(vector bool int __a,vector int __b)1237 static __inline__ vector int __ATTRS_o_ai vec_andc(vector bool int __a,
1238 vector int __b) {
1239 return (vector int)__a & ~__b;
1240 }
1241
vec_andc(vector int __a,vector bool int __b)1242 static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a,
1243 vector bool int __b) {
1244 return __a & ~(vector int)__b;
1245 }
1246
1247 static __inline__ vector unsigned int __ATTRS_o_ai
vec_andc(vector unsigned int __a,vector unsigned int __b)1248 vec_andc(vector unsigned int __a, vector unsigned int __b) {
1249 return __a & ~__b;
1250 }
1251
1252 static __inline__ vector unsigned int __ATTRS_o_ai
vec_andc(vector bool int __a,vector unsigned int __b)1253 vec_andc(vector bool int __a, vector unsigned int __b) {
1254 return (vector unsigned int)__a & ~__b;
1255 }
1256
1257 static __inline__ vector unsigned int __ATTRS_o_ai
vec_andc(vector unsigned int __a,vector bool int __b)1258 vec_andc(vector unsigned int __a, vector bool int __b) {
1259 return __a & ~(vector unsigned int)__b;
1260 }
1261
vec_andc(vector bool int __a,vector bool int __b)1262 static __inline__ vector bool int __ATTRS_o_ai vec_andc(vector bool int __a,
1263 vector bool int __b) {
1264 return __a & ~__b;
1265 }
1266
vec_andc(vector float __a,vector float __b)1267 static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a,
1268 vector float __b) {
1269 vector unsigned int __res =
1270 (vector unsigned int)__a & ~(vector unsigned int)__b;
1271 return (vector float)__res;
1272 }
1273
vec_andc(vector bool int __a,vector float __b)1274 static __inline__ vector float __ATTRS_o_ai vec_andc(vector bool int __a,
1275 vector float __b) {
1276 vector unsigned int __res =
1277 (vector unsigned int)__a & ~(vector unsigned int)__b;
1278 return (vector float)__res;
1279 }
1280
vec_andc(vector float __a,vector bool int __b)1281 static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a,
1282 vector bool int __b) {
1283 vector unsigned int __res =
1284 (vector unsigned int)__a & ~(vector unsigned int)__b;
1285 return (vector float)__res;
1286 }
1287
1288 #ifdef __VSX__
vec_andc(vector bool long long __a,vector double __b)1289 static __inline__ vector double __ATTRS_o_ai vec_andc(vector bool long long __a,
1290 vector double __b) {
1291 vector unsigned long long __res =
1292 (vector unsigned long long)__a & ~(vector unsigned long long)__b;
1293 return (vector double)__res;
1294 }
1295
1296 static __inline__ vector double __ATTRS_o_ai
vec_andc(vector double __a,vector bool long long __b)1297 vec_andc(vector double __a, vector bool long long __b) {
1298 vector unsigned long long __res =
1299 (vector unsigned long long)__a & ~(vector unsigned long long)__b;
1300 return (vector double)__res;
1301 }
1302
vec_andc(vector double __a,vector double __b)1303 static __inline__ vector double __ATTRS_o_ai vec_andc(vector double __a,
1304 vector double __b) {
1305 vector unsigned long long __res =
1306 (vector unsigned long long)__a & ~(vector unsigned long long)__b;
1307 return (vector double)__res;
1308 }
1309
1310 static __inline__ vector signed long long __ATTRS_o_ai
vec_andc(vector signed long long __a,vector signed long long __b)1311 vec_andc(vector signed long long __a, vector signed long long __b) {
1312 return __a & ~__b;
1313 }
1314
1315 static __inline__ vector signed long long __ATTRS_o_ai
vec_andc(vector bool long long __a,vector signed long long __b)1316 vec_andc(vector bool long long __a, vector signed long long __b) {
1317 return (vector signed long long)__a & ~__b;
1318 }
1319
1320 static __inline__ vector signed long long __ATTRS_o_ai
vec_andc(vector signed long long __a,vector bool long long __b)1321 vec_andc(vector signed long long __a, vector bool long long __b) {
1322 return __a & ~(vector signed long long)__b;
1323 }
1324
1325 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_andc(vector unsigned long long __a,vector unsigned long long __b)1326 vec_andc(vector unsigned long long __a, vector unsigned long long __b) {
1327 return __a & ~__b;
1328 }
1329
1330 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_andc(vector bool long long __a,vector unsigned long long __b)1331 vec_andc(vector bool long long __a, vector unsigned long long __b) {
1332 return (vector unsigned long long)__a & ~__b;
1333 }
1334
1335 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_andc(vector unsigned long long __a,vector bool long long __b)1336 vec_andc(vector unsigned long long __a, vector bool long long __b) {
1337 return __a & ~(vector unsigned long long)__b;
1338 }
1339
1340 static __inline__ vector bool long long __ATTRS_o_ai
vec_andc(vector bool long long __a,vector bool long long __b)1341 vec_andc(vector bool long long __a, vector bool long long __b) {
1342 return __a & ~__b;
1343 }
1344 #endif
1345
1346 /* vec_vandc */
1347
1348 static __inline__ vector signed char __ATTRS_o_ai
vec_vandc(vector signed char __a,vector signed char __b)1349 vec_vandc(vector signed char __a, vector signed char __b) {
1350 return __a & ~__b;
1351 }
1352
1353 static __inline__ vector signed char __ATTRS_o_ai
vec_vandc(vector bool char __a,vector signed char __b)1354 vec_vandc(vector bool char __a, vector signed char __b) {
1355 return (vector signed char)__a & ~__b;
1356 }
1357
1358 static __inline__ vector signed char __ATTRS_o_ai
vec_vandc(vector signed char __a,vector bool char __b)1359 vec_vandc(vector signed char __a, vector bool char __b) {
1360 return __a & ~(vector signed char)__b;
1361 }
1362
1363 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vandc(vector unsigned char __a,vector unsigned char __b)1364 vec_vandc(vector unsigned char __a, vector unsigned char __b) {
1365 return __a & ~__b;
1366 }
1367
1368 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vandc(vector bool char __a,vector unsigned char __b)1369 vec_vandc(vector bool char __a, vector unsigned char __b) {
1370 return (vector unsigned char)__a & ~__b;
1371 }
1372
1373 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vandc(vector unsigned char __a,vector bool char __b)1374 vec_vandc(vector unsigned char __a, vector bool char __b) {
1375 return __a & ~(vector unsigned char)__b;
1376 }
1377
1378 static __inline__ vector bool char __ATTRS_o_ai
vec_vandc(vector bool char __a,vector bool char __b)1379 vec_vandc(vector bool char __a, vector bool char __b) {
1380 return __a & ~__b;
1381 }
1382
vec_vandc(vector short __a,vector short __b)1383 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a,
1384 vector short __b) {
1385 return __a & ~__b;
1386 }
1387
vec_vandc(vector bool short __a,vector short __b)1388 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector bool short __a,
1389 vector short __b) {
1390 return (vector short)__a & ~__b;
1391 }
1392
vec_vandc(vector short __a,vector bool short __b)1393 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a,
1394 vector bool short __b) {
1395 return __a & ~(vector short)__b;
1396 }
1397
1398 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vandc(vector unsigned short __a,vector unsigned short __b)1399 vec_vandc(vector unsigned short __a, vector unsigned short __b) {
1400 return __a & ~__b;
1401 }
1402
1403 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vandc(vector bool short __a,vector unsigned short __b)1404 vec_vandc(vector bool short __a, vector unsigned short __b) {
1405 return (vector unsigned short)__a & ~__b;
1406 }
1407
1408 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vandc(vector unsigned short __a,vector bool short __b)1409 vec_vandc(vector unsigned short __a, vector bool short __b) {
1410 return __a & ~(vector unsigned short)__b;
1411 }
1412
1413 static __inline__ vector bool short __ATTRS_o_ai
vec_vandc(vector bool short __a,vector bool short __b)1414 vec_vandc(vector bool short __a, vector bool short __b) {
1415 return __a & ~__b;
1416 }
1417
vec_vandc(vector int __a,vector int __b)1418 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a,
1419 vector int __b) {
1420 return __a & ~__b;
1421 }
1422
vec_vandc(vector bool int __a,vector int __b)1423 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector bool int __a,
1424 vector int __b) {
1425 return (vector int)__a & ~__b;
1426 }
1427
vec_vandc(vector int __a,vector bool int __b)1428 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a,
1429 vector bool int __b) {
1430 return __a & ~(vector int)__b;
1431 }
1432
1433 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vandc(vector unsigned int __a,vector unsigned int __b)1434 vec_vandc(vector unsigned int __a, vector unsigned int __b) {
1435 return __a & ~__b;
1436 }
1437
1438 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vandc(vector bool int __a,vector unsigned int __b)1439 vec_vandc(vector bool int __a, vector unsigned int __b) {
1440 return (vector unsigned int)__a & ~__b;
1441 }
1442
1443 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vandc(vector unsigned int __a,vector bool int __b)1444 vec_vandc(vector unsigned int __a, vector bool int __b) {
1445 return __a & ~(vector unsigned int)__b;
1446 }
1447
vec_vandc(vector bool int __a,vector bool int __b)1448 static __inline__ vector bool int __ATTRS_o_ai vec_vandc(vector bool int __a,
1449 vector bool int __b) {
1450 return __a & ~__b;
1451 }
1452
vec_vandc(vector float __a,vector float __b)1453 static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a,
1454 vector float __b) {
1455 vector unsigned int __res =
1456 (vector unsigned int)__a & ~(vector unsigned int)__b;
1457 return (vector float)__res;
1458 }
1459
vec_vandc(vector bool int __a,vector float __b)1460 static __inline__ vector float __ATTRS_o_ai vec_vandc(vector bool int __a,
1461 vector float __b) {
1462 vector unsigned int __res =
1463 (vector unsigned int)__a & ~(vector unsigned int)__b;
1464 return (vector float)__res;
1465 }
1466
vec_vandc(vector float __a,vector bool int __b)1467 static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a,
1468 vector bool int __b) {
1469 vector unsigned int __res =
1470 (vector unsigned int)__a & ~(vector unsigned int)__b;
1471 return (vector float)__res;
1472 }
1473
1474 #ifdef __VSX__
1475 static __inline__ vector signed long long __ATTRS_o_ai
vec_vandc(vector signed long long __a,vector signed long long __b)1476 vec_vandc(vector signed long long __a, vector signed long long __b) {
1477 return __a & ~__b;
1478 }
1479
1480 static __inline__ vector signed long long __ATTRS_o_ai
vec_vandc(vector bool long long __a,vector signed long long __b)1481 vec_vandc(vector bool long long __a, vector signed long long __b) {
1482 return (vector signed long long)__a & ~__b;
1483 }
1484
1485 static __inline__ vector signed long long __ATTRS_o_ai
vec_vandc(vector signed long long __a,vector bool long long __b)1486 vec_vandc(vector signed long long __a, vector bool long long __b) {
1487 return __a & ~(vector signed long long)__b;
1488 }
1489
1490 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_vandc(vector unsigned long long __a,vector unsigned long long __b)1491 vec_vandc(vector unsigned long long __a, vector unsigned long long __b) {
1492 return __a & ~__b;
1493 }
1494
1495 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_vandc(vector bool long long __a,vector unsigned long long __b)1496 vec_vandc(vector bool long long __a, vector unsigned long long __b) {
1497 return (vector unsigned long long)__a & ~__b;
1498 }
1499
1500 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_vandc(vector unsigned long long __a,vector bool long long __b)1501 vec_vandc(vector unsigned long long __a, vector bool long long __b) {
1502 return __a & ~(vector unsigned long long)__b;
1503 }
1504
1505 static __inline__ vector bool long long __ATTRS_o_ai
vec_vandc(vector bool long long __a,vector bool long long __b)1506 vec_vandc(vector bool long long __a, vector bool long long __b) {
1507 return __a & ~__b;
1508 }
1509 #endif
1510
1511 /* vec_avg */
1512
1513 static __inline__ vector signed char __ATTRS_o_ai
vec_avg(vector signed char __a,vector signed char __b)1514 vec_avg(vector signed char __a, vector signed char __b) {
1515 return __builtin_altivec_vavgsb(__a, __b);
1516 }
1517
1518 static __inline__ vector unsigned char __ATTRS_o_ai
vec_avg(vector unsigned char __a,vector unsigned char __b)1519 vec_avg(vector unsigned char __a, vector unsigned char __b) {
1520 return __builtin_altivec_vavgub(__a, __b);
1521 }
1522
vec_avg(vector short __a,vector short __b)1523 static __inline__ vector short __ATTRS_o_ai vec_avg(vector short __a,
1524 vector short __b) {
1525 return __builtin_altivec_vavgsh(__a, __b);
1526 }
1527
1528 static __inline__ vector unsigned short __ATTRS_o_ai
vec_avg(vector unsigned short __a,vector unsigned short __b)1529 vec_avg(vector unsigned short __a, vector unsigned short __b) {
1530 return __builtin_altivec_vavguh(__a, __b);
1531 }
1532
vec_avg(vector int __a,vector int __b)1533 static __inline__ vector int __ATTRS_o_ai vec_avg(vector int __a,
1534 vector int __b) {
1535 return __builtin_altivec_vavgsw(__a, __b);
1536 }
1537
1538 static __inline__ vector unsigned int __ATTRS_o_ai
vec_avg(vector unsigned int __a,vector unsigned int __b)1539 vec_avg(vector unsigned int __a, vector unsigned int __b) {
1540 return __builtin_altivec_vavguw(__a, __b);
1541 }
1542
1543 /* vec_vavgsb */
1544
1545 static __inline__ vector signed char __attribute__((__always_inline__))
vec_vavgsb(vector signed char __a,vector signed char __b)1546 vec_vavgsb(vector signed char __a, vector signed char __b) {
1547 return __builtin_altivec_vavgsb(__a, __b);
1548 }
1549
1550 /* vec_vavgub */
1551
1552 static __inline__ vector unsigned char __attribute__((__always_inline__))
vec_vavgub(vector unsigned char __a,vector unsigned char __b)1553 vec_vavgub(vector unsigned char __a, vector unsigned char __b) {
1554 return __builtin_altivec_vavgub(__a, __b);
1555 }
1556
1557 /* vec_vavgsh */
1558
1559 static __inline__ vector short __attribute__((__always_inline__))
vec_vavgsh(vector short __a,vector short __b)1560 vec_vavgsh(vector short __a, vector short __b) {
1561 return __builtin_altivec_vavgsh(__a, __b);
1562 }
1563
1564 /* vec_vavguh */
1565
1566 static __inline__ vector unsigned short __attribute__((__always_inline__))
vec_vavguh(vector unsigned short __a,vector unsigned short __b)1567 vec_vavguh(vector unsigned short __a, vector unsigned short __b) {
1568 return __builtin_altivec_vavguh(__a, __b);
1569 }
1570
1571 /* vec_vavgsw */
1572
1573 static __inline__ vector int __attribute__((__always_inline__))
vec_vavgsw(vector int __a,vector int __b)1574 vec_vavgsw(vector int __a, vector int __b) {
1575 return __builtin_altivec_vavgsw(__a, __b);
1576 }
1577
1578 /* vec_vavguw */
1579
1580 static __inline__ vector unsigned int __attribute__((__always_inline__))
vec_vavguw(vector unsigned int __a,vector unsigned int __b)1581 vec_vavguw(vector unsigned int __a, vector unsigned int __b) {
1582 return __builtin_altivec_vavguw(__a, __b);
1583 }
1584
1585 /* vec_ceil */
1586
vec_ceil(vector float __a)1587 static __inline__ vector float __ATTRS_o_ai vec_ceil(vector float __a) {
1588 #ifdef __VSX__
1589 return __builtin_vsx_xvrspip(__a);
1590 #else
1591 return __builtin_altivec_vrfip(__a);
1592 #endif
1593 }
1594
1595 #ifdef __VSX__
vec_ceil(vector double __a)1596 static __inline__ vector double __ATTRS_o_ai vec_ceil(vector double __a) {
1597 return __builtin_vsx_xvrdpip(__a);
1598 }
1599 #endif
1600
1601 /* vec_vrfip */
1602
1603 static __inline__ vector float __attribute__((__always_inline__))
vec_vrfip(vector float __a)1604 vec_vrfip(vector float __a) {
1605 return __builtin_altivec_vrfip(__a);
1606 }
1607
1608 /* vec_cmpb */
1609
1610 static __inline__ vector int __attribute__((__always_inline__))
vec_cmpb(vector float __a,vector float __b)1611 vec_cmpb(vector float __a, vector float __b) {
1612 return __builtin_altivec_vcmpbfp(__a, __b);
1613 }
1614
1615 /* vec_vcmpbfp */
1616
1617 static __inline__ vector int __attribute__((__always_inline__))
vec_vcmpbfp(vector float __a,vector float __b)1618 vec_vcmpbfp(vector float __a, vector float __b) {
1619 return __builtin_altivec_vcmpbfp(__a, __b);
1620 }
1621
1622 /* vec_cmpeq */
1623
1624 static __inline__ vector bool char __ATTRS_o_ai
vec_cmpeq(vector signed char __a,vector signed char __b)1625 vec_cmpeq(vector signed char __a, vector signed char __b) {
1626 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
1627 (vector char)__b);
1628 }
1629
1630 static __inline__ vector bool char __ATTRS_o_ai
vec_cmpeq(vector unsigned char __a,vector unsigned char __b)1631 vec_cmpeq(vector unsigned char __a, vector unsigned char __b) {
1632 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
1633 (vector char)__b);
1634 }
1635
1636 static __inline__ vector bool char __ATTRS_o_ai
vec_cmpeq(vector bool char __a,vector bool char __b)1637 vec_cmpeq(vector bool char __a, vector bool char __b) {
1638 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
1639 (vector char)__b);
1640 }
1641
vec_cmpeq(vector short __a,vector short __b)1642 static __inline__ vector bool short __ATTRS_o_ai vec_cmpeq(vector short __a,
1643 vector short __b) {
1644 return (vector bool short)__builtin_altivec_vcmpequh(__a, __b);
1645 }
1646
1647 static __inline__ vector bool short __ATTRS_o_ai
vec_cmpeq(vector unsigned short __a,vector unsigned short __b)1648 vec_cmpeq(vector unsigned short __a, vector unsigned short __b) {
1649 return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a,
1650 (vector short)__b);
1651 }
1652
1653 static __inline__ vector bool short __ATTRS_o_ai
vec_cmpeq(vector bool short __a,vector bool short __b)1654 vec_cmpeq(vector bool short __a, vector bool short __b) {
1655 return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a,
1656 (vector short)__b);
1657 }
1658
vec_cmpeq(vector int __a,vector int __b)1659 static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector int __a,
1660 vector int __b) {
1661 return (vector bool int)__builtin_altivec_vcmpequw(__a, __b);
1662 }
1663
1664 static __inline__ vector bool int __ATTRS_o_ai
vec_cmpeq(vector unsigned int __a,vector unsigned int __b)1665 vec_cmpeq(vector unsigned int __a, vector unsigned int __b) {
1666 return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a,
1667 (vector int)__b);
1668 }
1669
vec_cmpeq(vector bool int __a,vector bool int __b)1670 static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector bool int __a,
1671 vector bool int __b) {
1672 return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a,
1673 (vector int)__b);
1674 }
1675
1676 #ifdef __POWER8_VECTOR__
1677 static __inline__ vector bool long long __ATTRS_o_ai
vec_cmpeq(vector signed long long __a,vector signed long long __b)1678 vec_cmpeq(vector signed long long __a, vector signed long long __b) {
1679 return (vector bool long long)__builtin_altivec_vcmpequd(__a, __b);
1680 }
1681
1682 static __inline__ vector bool long long __ATTRS_o_ai
vec_cmpeq(vector unsigned long long __a,vector unsigned long long __b)1683 vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b) {
1684 return (vector bool long long)__builtin_altivec_vcmpequd(
1685 (vector long long)__a, (vector long long)__b);
1686 }
1687
1688 static __inline__ vector bool long long __ATTRS_o_ai
vec_cmpeq(vector bool long long __a,vector bool long long __b)1689 vec_cmpeq(vector bool long long __a, vector bool long long __b) {
1690 return (vector bool long long)__builtin_altivec_vcmpequd(
1691 (vector long long)__a, (vector long long)__b);
1692 }
1693
1694 #endif
1695
vec_cmpeq(vector float __a,vector float __b)1696 static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector float __a,
1697 vector float __b) {
1698 #ifdef __VSX__
1699 return (vector bool int)__builtin_vsx_xvcmpeqsp(__a, __b);
1700 #else
1701 return (vector bool int)__builtin_altivec_vcmpeqfp(__a, __b);
1702 #endif
1703 }
1704
1705 #ifdef __VSX__
1706 static __inline__ vector bool long long __ATTRS_o_ai
vec_cmpeq(vector double __a,vector double __b)1707 vec_cmpeq(vector double __a, vector double __b) {
1708 return (vector bool long long)__builtin_vsx_xvcmpeqdp(__a, __b);
1709 }
1710 #endif
1711
1712 #ifdef __POWER10_VECTOR__
1713 static __inline__ vector bool __int128 __ATTRS_o_ai
vec_cmpeq(vector signed __int128 __a,vector signed __int128 __b)1714 vec_cmpeq(vector signed __int128 __a, vector signed __int128 __b) {
1715 return (vector bool __int128)__builtin_altivec_vcmpequq(
1716 (vector bool __int128)__a, (vector bool __int128)__b);
1717 }
1718
1719 static __inline__ vector bool __int128 __ATTRS_o_ai
vec_cmpeq(vector unsigned __int128 __a,vector unsigned __int128 __b)1720 vec_cmpeq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
1721 return (vector bool __int128)__builtin_altivec_vcmpequq(
1722 (vector bool __int128)__a, (vector bool __int128)__b);
1723 }
1724 #endif
1725
1726 #ifdef __POWER9_VECTOR__
1727 /* vec_cmpne */
1728
1729 static __inline__ vector bool char __ATTRS_o_ai
vec_cmpne(vector bool char __a,vector bool char __b)1730 vec_cmpne(vector bool char __a, vector bool char __b) {
1731 return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a,
1732 (vector char)__b);
1733 }
1734
1735 static __inline__ vector bool char __ATTRS_o_ai
vec_cmpne(vector signed char __a,vector signed char __b)1736 vec_cmpne(vector signed char __a, vector signed char __b) {
1737 return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a,
1738 (vector char)__b);
1739 }
1740
1741 static __inline__ vector bool char __ATTRS_o_ai
vec_cmpne(vector unsigned char __a,vector unsigned char __b)1742 vec_cmpne(vector unsigned char __a, vector unsigned char __b) {
1743 return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a,
1744 (vector char)__b);
1745 }
1746
1747 static __inline__ vector bool short __ATTRS_o_ai
vec_cmpne(vector bool short __a,vector bool short __b)1748 vec_cmpne(vector bool short __a, vector bool short __b) {
1749 return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a,
1750 (vector short)__b);
1751 }
1752
1753 static __inline__ vector bool short __ATTRS_o_ai
vec_cmpne(vector signed short __a,vector signed short __b)1754 vec_cmpne(vector signed short __a, vector signed short __b) {
1755 return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a,
1756 (vector short)__b);
1757 }
1758
1759 static __inline__ vector bool short __ATTRS_o_ai
vec_cmpne(vector unsigned short __a,vector unsigned short __b)1760 vec_cmpne(vector unsigned short __a, vector unsigned short __b) {
1761 return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a,
1762 (vector short)__b);
1763 }
1764
1765 static __inline__ vector bool int __ATTRS_o_ai
vec_cmpne(vector bool int __a,vector bool int __b)1766 vec_cmpne(vector bool int __a, vector bool int __b) {
1767 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
1768 (vector int)__b);
1769 }
1770
1771 static __inline__ vector bool int __ATTRS_o_ai
vec_cmpne(vector signed int __a,vector signed int __b)1772 vec_cmpne(vector signed int __a, vector signed int __b) {
1773 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
1774 (vector int)__b);
1775 }
1776
1777 static __inline__ vector bool int __ATTRS_o_ai
vec_cmpne(vector unsigned int __a,vector unsigned int __b)1778 vec_cmpne(vector unsigned int __a, vector unsigned int __b) {
1779 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
1780 (vector int)__b);
1781 }
1782
1783 static __inline__ vector bool int __ATTRS_o_ai
vec_cmpne(vector float __a,vector float __b)1784 vec_cmpne(vector float __a, vector float __b) {
1785 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
1786 (vector int)__b);
1787 }
1788
1789 #ifdef __POWER10_VECTOR__
1790 static __inline__ vector bool __int128 __ATTRS_o_ai
vec_cmpne(vector unsigned __int128 __a,vector unsigned __int128 __b)1791 vec_cmpne(vector unsigned __int128 __a, vector unsigned __int128 __b) {
1792 return (vector bool __int128) ~(__builtin_altivec_vcmpequq(
1793 (vector bool __int128)__a, (vector bool __int128)__b));
1794 }
1795
1796 static __inline__ vector bool __int128 __ATTRS_o_ai
vec_cmpne(vector signed __int128 __a,vector signed __int128 __b)1797 vec_cmpne(vector signed __int128 __a, vector signed __int128 __b) {
1798 return (vector bool __int128) ~(__builtin_altivec_vcmpequq(
1799 (vector bool __int128)__a, (vector bool __int128)__b));
1800 }
1801 #endif
1802
1803 /* vec_cmpnez */
1804
1805 static __inline__ vector bool char __ATTRS_o_ai
vec_cmpnez(vector signed char __a,vector signed char __b)1806 vec_cmpnez(vector signed char __a, vector signed char __b) {
1807 return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a,
1808 (vector char)__b);
1809 }
1810
1811 static __inline__ vector bool char __ATTRS_o_ai
vec_cmpnez(vector unsigned char __a,vector unsigned char __b)1812 vec_cmpnez(vector unsigned char __a, vector unsigned char __b) {
1813 return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a,
1814 (vector char)__b);
1815 }
1816
1817 static __inline__ vector bool short __ATTRS_o_ai
vec_cmpnez(vector signed short __a,vector signed short __b)1818 vec_cmpnez(vector signed short __a, vector signed short __b) {
1819 return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a,
1820 (vector short)__b);
1821 }
1822
1823 static __inline__ vector bool short __ATTRS_o_ai
vec_cmpnez(vector unsigned short __a,vector unsigned short __b)1824 vec_cmpnez(vector unsigned short __a, vector unsigned short __b) {
1825 return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a,
1826 (vector short)__b);
1827 }
1828
1829 static __inline__ vector bool int __ATTRS_o_ai
vec_cmpnez(vector signed int __a,vector signed int __b)1830 vec_cmpnez(vector signed int __a, vector signed int __b) {
1831 return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a,
1832 (vector int)__b);
1833 }
1834
1835 static __inline__ vector bool int __ATTRS_o_ai
vec_cmpnez(vector unsigned int __a,vector unsigned int __b)1836 vec_cmpnez(vector unsigned int __a, vector unsigned int __b) {
1837 return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a,
1838 (vector int)__b);
1839 }
1840
1841 static __inline__ signed int __ATTRS_o_ai
vec_cntlz_lsbb(vector signed char __a)1842 vec_cntlz_lsbb(vector signed char __a) {
1843 #ifdef __LITTLE_ENDIAN__
1844 return __builtin_altivec_vctzlsbb(__a);
1845 #else
1846 return __builtin_altivec_vclzlsbb(__a);
1847 #endif
1848 }
1849
1850 static __inline__ signed int __ATTRS_o_ai
vec_cntlz_lsbb(vector unsigned char __a)1851 vec_cntlz_lsbb(vector unsigned char __a) {
1852 #ifdef __LITTLE_ENDIAN__
1853 return __builtin_altivec_vctzlsbb(__a);
1854 #else
1855 return __builtin_altivec_vclzlsbb(__a);
1856 #endif
1857 }
1858
1859 static __inline__ signed int __ATTRS_o_ai
vec_cnttz_lsbb(vector signed char __a)1860 vec_cnttz_lsbb(vector signed char __a) {
1861 #ifdef __LITTLE_ENDIAN__
1862 return __builtin_altivec_vclzlsbb(__a);
1863 #else
1864 return __builtin_altivec_vctzlsbb(__a);
1865 #endif
1866 }
1867
1868 static __inline__ signed int __ATTRS_o_ai
vec_cnttz_lsbb(vector unsigned char __a)1869 vec_cnttz_lsbb(vector unsigned char __a) {
1870 #ifdef __LITTLE_ENDIAN__
1871 return __builtin_altivec_vclzlsbb(__a);
1872 #else
1873 return __builtin_altivec_vctzlsbb(__a);
1874 #endif
1875 }
1876
1877 static __inline__ vector unsigned int __ATTRS_o_ai
vec_parity_lsbb(vector unsigned int __a)1878 vec_parity_lsbb(vector unsigned int __a) {
1879 return __builtin_altivec_vprtybw(__a);
1880 }
1881
1882 static __inline__ vector unsigned int __ATTRS_o_ai
vec_parity_lsbb(vector signed int __a)1883 vec_parity_lsbb(vector signed int __a) {
1884 return __builtin_altivec_vprtybw(__a);
1885 }
1886
1887 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_parity_lsbb(vector unsigned __int128 __a)1888 vec_parity_lsbb(vector unsigned __int128 __a) {
1889 return __builtin_altivec_vprtybq(__a);
1890 }
1891
1892 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_parity_lsbb(vector signed __int128 __a)1893 vec_parity_lsbb(vector signed __int128 __a) {
1894 return __builtin_altivec_vprtybq(__a);
1895 }
1896
1897 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_parity_lsbb(vector unsigned long long __a)1898 vec_parity_lsbb(vector unsigned long long __a) {
1899 return __builtin_altivec_vprtybd(__a);
1900 }
1901
1902 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_parity_lsbb(vector signed long long __a)1903 vec_parity_lsbb(vector signed long long __a) {
1904 return __builtin_altivec_vprtybd(__a);
1905 }
1906
1907 #else
1908 /* vec_cmpne */
1909
1910 static __inline__ vector bool char __ATTRS_o_ai
vec_cmpne(vector bool char __a,vector bool char __b)1911 vec_cmpne(vector bool char __a, vector bool char __b) {
1912 return ~(vec_cmpeq(__a, __b));
1913 }
1914
1915 static __inline__ vector bool char __ATTRS_o_ai
vec_cmpne(vector signed char __a,vector signed char __b)1916 vec_cmpne(vector signed char __a, vector signed char __b) {
1917 return ~(vec_cmpeq(__a, __b));
1918 }
1919
1920 static __inline__ vector bool char __ATTRS_o_ai
vec_cmpne(vector unsigned char __a,vector unsigned char __b)1921 vec_cmpne(vector unsigned char __a, vector unsigned char __b) {
1922 return ~(vec_cmpeq(__a, __b));
1923 }
1924
1925 static __inline__ vector bool short __ATTRS_o_ai
vec_cmpne(vector bool short __a,vector bool short __b)1926 vec_cmpne(vector bool short __a, vector bool short __b) {
1927 return ~(vec_cmpeq(__a, __b));
1928 }
1929
1930 static __inline__ vector bool short __ATTRS_o_ai
vec_cmpne(vector signed short __a,vector signed short __b)1931 vec_cmpne(vector signed short __a, vector signed short __b) {
1932 return ~(vec_cmpeq(__a, __b));
1933 }
1934
1935 static __inline__ vector bool short __ATTRS_o_ai
vec_cmpne(vector unsigned short __a,vector unsigned short __b)1936 vec_cmpne(vector unsigned short __a, vector unsigned short __b) {
1937 return ~(vec_cmpeq(__a, __b));
1938 }
1939
1940 static __inline__ vector bool int __ATTRS_o_ai
vec_cmpne(vector bool int __a,vector bool int __b)1941 vec_cmpne(vector bool int __a, vector bool int __b) {
1942 return ~(vec_cmpeq(__a, __b));
1943 }
1944
1945 static __inline__ vector bool int __ATTRS_o_ai
vec_cmpne(vector signed int __a,vector signed int __b)1946 vec_cmpne(vector signed int __a, vector signed int __b) {
1947 return ~(vec_cmpeq(__a, __b));
1948 }
1949
1950 static __inline__ vector bool int __ATTRS_o_ai
vec_cmpne(vector unsigned int __a,vector unsigned int __b)1951 vec_cmpne(vector unsigned int __a, vector unsigned int __b) {
1952 return ~(vec_cmpeq(__a, __b));
1953 }
1954
1955 static __inline__ vector bool int __ATTRS_o_ai
vec_cmpne(vector float __a,vector float __b)1956 vec_cmpne(vector float __a, vector float __b) {
1957 return ~(vec_cmpeq(__a, __b));
1958 }
1959 #endif
1960
1961 #ifdef __POWER8_VECTOR__
1962 static __inline__ vector bool long long __ATTRS_o_ai
vec_cmpne(vector bool long long __a,vector bool long long __b)1963 vec_cmpne(vector bool long long __a, vector bool long long __b) {
1964 return (vector bool long long)
1965 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b));
1966 }
1967
1968 static __inline__ vector bool long long __ATTRS_o_ai
vec_cmpne(vector signed long long __a,vector signed long long __b)1969 vec_cmpne(vector signed long long __a, vector signed long long __b) {
1970 return (vector bool long long)
1971 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b));
1972 }
1973
1974 static __inline__ vector bool long long __ATTRS_o_ai
vec_cmpne(vector unsigned long long __a,vector unsigned long long __b)1975 vec_cmpne(vector unsigned long long __a, vector unsigned long long __b) {
1976 return (vector bool long long)
1977 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b));
1978 }
1979 #endif
1980
1981 #ifdef __VSX__
1982 static __inline__ vector bool long long __ATTRS_o_ai
vec_cmpne(vector double __a,vector double __b)1983 vec_cmpne(vector double __a, vector double __b) {
1984 return (vector bool long long)
1985 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b));
1986 }
1987 #endif
1988
1989 /* vec_cmpgt */
1990
1991 static __inline__ vector bool char __ATTRS_o_ai
vec_cmpgt(vector signed char __a,vector signed char __b)1992 vec_cmpgt(vector signed char __a, vector signed char __b) {
1993 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
1994 }
1995
1996 static __inline__ vector bool char __ATTRS_o_ai
vec_cmpgt(vector unsigned char __a,vector unsigned char __b)1997 vec_cmpgt(vector unsigned char __a, vector unsigned char __b) {
1998 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
1999 }
2000
vec_cmpgt(vector short __a,vector short __b)2001 static __inline__ vector bool short __ATTRS_o_ai vec_cmpgt(vector short __a,
2002 vector short __b) {
2003 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
2004 }
2005
2006 static __inline__ vector bool short __ATTRS_o_ai
vec_cmpgt(vector unsigned short __a,vector unsigned short __b)2007 vec_cmpgt(vector unsigned short __a, vector unsigned short __b) {
2008 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
2009 }
2010
vec_cmpgt(vector int __a,vector int __b)2011 static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector int __a,
2012 vector int __b) {
2013 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
2014 }
2015
2016 static __inline__ vector bool int __ATTRS_o_ai
vec_cmpgt(vector unsigned int __a,vector unsigned int __b)2017 vec_cmpgt(vector unsigned int __a, vector unsigned int __b) {
2018 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
2019 }
2020
2021 #ifdef __POWER8_VECTOR__
2022 static __inline__ vector bool long long __ATTRS_o_ai
vec_cmpgt(vector signed long long __a,vector signed long long __b)2023 vec_cmpgt(vector signed long long __a, vector signed long long __b) {
2024 return (vector bool long long)__builtin_altivec_vcmpgtsd(__a, __b);
2025 }
2026
2027 static __inline__ vector bool long long __ATTRS_o_ai
vec_cmpgt(vector unsigned long long __a,vector unsigned long long __b)2028 vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b) {
2029 return (vector bool long long)__builtin_altivec_vcmpgtud(__a, __b);
2030 }
2031 #endif
2032
vec_cmpgt(vector float __a,vector float __b)2033 static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector float __a,
2034 vector float __b) {
2035 #ifdef __VSX__
2036 return (vector bool int)__builtin_vsx_xvcmpgtsp(__a, __b);
2037 #else
2038 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
2039 #endif
2040 }
2041
2042 #ifdef __VSX__
2043 static __inline__ vector bool long long __ATTRS_o_ai
vec_cmpgt(vector double __a,vector double __b)2044 vec_cmpgt(vector double __a, vector double __b) {
2045 return (vector bool long long)__builtin_vsx_xvcmpgtdp(__a, __b);
2046 }
2047 #endif
2048
2049 #ifdef __POWER10_VECTOR__
2050 static __inline__ vector bool __int128 __ATTRS_o_ai
vec_cmpgt(vector signed __int128 __a,vector signed __int128 __b)2051 vec_cmpgt(vector signed __int128 __a, vector signed __int128 __b) {
2052 return (vector bool __int128)__builtin_altivec_vcmpgtsq(
2053 (vector bool __int128)__a, (vector bool __int128)__b);
2054 }
2055
2056 static __inline__ vector bool __int128 __ATTRS_o_ai
vec_cmpgt(vector unsigned __int128 __a,vector unsigned __int128 __b)2057 vec_cmpgt(vector unsigned __int128 __a, vector unsigned __int128 __b) {
2058 return (vector bool __int128)__builtin_altivec_vcmpgtuq(
2059 (vector bool __int128)__a, (vector bool __int128)__b);
2060 }
2061 #endif
2062
2063 /* vec_cmpge */
2064
2065 static __inline__ vector bool char __ATTRS_o_ai
vec_cmpge(vector signed char __a,vector signed char __b)2066 vec_cmpge(vector signed char __a, vector signed char __b) {
2067 return ~(vec_cmpgt(__b, __a));
2068 }
2069
2070 static __inline__ vector bool char __ATTRS_o_ai
vec_cmpge(vector unsigned char __a,vector unsigned char __b)2071 vec_cmpge(vector unsigned char __a, vector unsigned char __b) {
2072 return ~(vec_cmpgt(__b, __a));
2073 }
2074
2075 static __inline__ vector bool short __ATTRS_o_ai
vec_cmpge(vector signed short __a,vector signed short __b)2076 vec_cmpge(vector signed short __a, vector signed short __b) {
2077 return ~(vec_cmpgt(__b, __a));
2078 }
2079
2080 static __inline__ vector bool short __ATTRS_o_ai
vec_cmpge(vector unsigned short __a,vector unsigned short __b)2081 vec_cmpge(vector unsigned short __a, vector unsigned short __b) {
2082 return ~(vec_cmpgt(__b, __a));
2083 }
2084
2085 static __inline__ vector bool int __ATTRS_o_ai
vec_cmpge(vector signed int __a,vector signed int __b)2086 vec_cmpge(vector signed int __a, vector signed int __b) {
2087 return ~(vec_cmpgt(__b, __a));
2088 }
2089
2090 static __inline__ vector bool int __ATTRS_o_ai
vec_cmpge(vector unsigned int __a,vector unsigned int __b)2091 vec_cmpge(vector unsigned int __a, vector unsigned int __b) {
2092 return ~(vec_cmpgt(__b, __a));
2093 }
2094
vec_cmpge(vector float __a,vector float __b)2095 static __inline__ vector bool int __ATTRS_o_ai vec_cmpge(vector float __a,
2096 vector float __b) {
2097 #ifdef __VSX__
2098 return (vector bool int)__builtin_vsx_xvcmpgesp(__a, __b);
2099 #else
2100 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
2101 #endif
2102 }
2103
2104 #ifdef __VSX__
2105 static __inline__ vector bool long long __ATTRS_o_ai
vec_cmpge(vector double __a,vector double __b)2106 vec_cmpge(vector double __a, vector double __b) {
2107 return (vector bool long long)__builtin_vsx_xvcmpgedp(__a, __b);
2108 }
2109 #endif
2110
2111 #ifdef __POWER8_VECTOR__
2112 static __inline__ vector bool long long __ATTRS_o_ai
vec_cmpge(vector signed long long __a,vector signed long long __b)2113 vec_cmpge(vector signed long long __a, vector signed long long __b) {
2114 return ~(vec_cmpgt(__b, __a));
2115 }
2116
2117 static __inline__ vector bool long long __ATTRS_o_ai
vec_cmpge(vector unsigned long long __a,vector unsigned long long __b)2118 vec_cmpge(vector unsigned long long __a, vector unsigned long long __b) {
2119 return ~(vec_cmpgt(__b, __a));
2120 }
2121 #endif
2122
2123 #ifdef __POWER10_VECTOR__
2124 static __inline__ vector bool __int128 __ATTRS_o_ai
vec_cmpge(vector signed __int128 __a,vector signed __int128 __b)2125 vec_cmpge(vector signed __int128 __a, vector signed __int128 __b) {
2126 return ~(vec_cmpgt(__b, __a));
2127 }
2128
2129 static __inline__ vector bool __int128 __ATTRS_o_ai
vec_cmpge(vector unsigned __int128 __a,vector unsigned __int128 __b)2130 vec_cmpge(vector unsigned __int128 __a, vector unsigned __int128 __b) {
2131 return ~(vec_cmpgt(__b, __a));
2132 }
2133 #endif
2134
2135 /* vec_vcmpgefp */
2136
2137 static __inline__ vector bool int __attribute__((__always_inline__))
vec_vcmpgefp(vector float __a,vector float __b)2138 vec_vcmpgefp(vector float __a, vector float __b) {
2139 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
2140 }
2141
2142 /* vec_vcmpgtsb */
2143
2144 static __inline__ vector bool char __attribute__((__always_inline__))
vec_vcmpgtsb(vector signed char __a,vector signed char __b)2145 vec_vcmpgtsb(vector signed char __a, vector signed char __b) {
2146 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
2147 }
2148
2149 /* vec_vcmpgtub */
2150
2151 static __inline__ vector bool char __attribute__((__always_inline__))
vec_vcmpgtub(vector unsigned char __a,vector unsigned char __b)2152 vec_vcmpgtub(vector unsigned char __a, vector unsigned char __b) {
2153 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
2154 }
2155
2156 /* vec_vcmpgtsh */
2157
2158 static __inline__ vector bool short __attribute__((__always_inline__))
vec_vcmpgtsh(vector short __a,vector short __b)2159 vec_vcmpgtsh(vector short __a, vector short __b) {
2160 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
2161 }
2162
2163 /* vec_vcmpgtuh */
2164
2165 static __inline__ vector bool short __attribute__((__always_inline__))
vec_vcmpgtuh(vector unsigned short __a,vector unsigned short __b)2166 vec_vcmpgtuh(vector unsigned short __a, vector unsigned short __b) {
2167 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
2168 }
2169
2170 /* vec_vcmpgtsw */
2171
2172 static __inline__ vector bool int __attribute__((__always_inline__))
vec_vcmpgtsw(vector int __a,vector int __b)2173 vec_vcmpgtsw(vector int __a, vector int __b) {
2174 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
2175 }
2176
2177 /* vec_vcmpgtuw */
2178
2179 static __inline__ vector bool int __attribute__((__always_inline__))
vec_vcmpgtuw(vector unsigned int __a,vector unsigned int __b)2180 vec_vcmpgtuw(vector unsigned int __a, vector unsigned int __b) {
2181 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
2182 }
2183
2184 /* vec_vcmpgtfp */
2185
2186 static __inline__ vector bool int __attribute__((__always_inline__))
vec_vcmpgtfp(vector float __a,vector float __b)2187 vec_vcmpgtfp(vector float __a, vector float __b) {
2188 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
2189 }
2190
2191 /* vec_cmple */
2192
2193 static __inline__ vector bool char __ATTRS_o_ai
vec_cmple(vector signed char __a,vector signed char __b)2194 vec_cmple(vector signed char __a, vector signed char __b) {
2195 return vec_cmpge(__b, __a);
2196 }
2197
2198 static __inline__ vector bool char __ATTRS_o_ai
vec_cmple(vector unsigned char __a,vector unsigned char __b)2199 vec_cmple(vector unsigned char __a, vector unsigned char __b) {
2200 return vec_cmpge(__b, __a);
2201 }
2202
2203 static __inline__ vector bool short __ATTRS_o_ai
vec_cmple(vector signed short __a,vector signed short __b)2204 vec_cmple(vector signed short __a, vector signed short __b) {
2205 return vec_cmpge(__b, __a);
2206 }
2207
2208 static __inline__ vector bool short __ATTRS_o_ai
vec_cmple(vector unsigned short __a,vector unsigned short __b)2209 vec_cmple(vector unsigned short __a, vector unsigned short __b) {
2210 return vec_cmpge(__b, __a);
2211 }
2212
2213 static __inline__ vector bool int __ATTRS_o_ai
vec_cmple(vector signed int __a,vector signed int __b)2214 vec_cmple(vector signed int __a, vector signed int __b) {
2215 return vec_cmpge(__b, __a);
2216 }
2217
2218 static __inline__ vector bool int __ATTRS_o_ai
vec_cmple(vector unsigned int __a,vector unsigned int __b)2219 vec_cmple(vector unsigned int __a, vector unsigned int __b) {
2220 return vec_cmpge(__b, __a);
2221 }
2222
vec_cmple(vector float __a,vector float __b)2223 static __inline__ vector bool int __ATTRS_o_ai vec_cmple(vector float __a,
2224 vector float __b) {
2225 return vec_cmpge(__b, __a);
2226 }
2227
2228 #ifdef __VSX__
2229 static __inline__ vector bool long long __ATTRS_o_ai
vec_cmple(vector double __a,vector double __b)2230 vec_cmple(vector double __a, vector double __b) {
2231 return vec_cmpge(__b, __a);
2232 }
2233 #endif
2234
2235 #ifdef __POWER8_VECTOR__
2236 static __inline__ vector bool long long __ATTRS_o_ai
vec_cmple(vector signed long long __a,vector signed long long __b)2237 vec_cmple(vector signed long long __a, vector signed long long __b) {
2238 return vec_cmpge(__b, __a);
2239 }
2240
2241 static __inline__ vector bool long long __ATTRS_o_ai
vec_cmple(vector unsigned long long __a,vector unsigned long long __b)2242 vec_cmple(vector unsigned long long __a, vector unsigned long long __b) {
2243 return vec_cmpge(__b, __a);
2244 }
2245 #endif
2246
2247 #ifdef __POWER10_VECTOR__
2248 static __inline__ vector bool __int128 __ATTRS_o_ai
vec_cmple(vector signed __int128 __a,vector signed __int128 __b)2249 vec_cmple(vector signed __int128 __a, vector signed __int128 __b) {
2250 return vec_cmpge(__b, __a);
2251 }
2252
2253 static __inline__ vector bool __int128 __ATTRS_o_ai
vec_cmple(vector unsigned __int128 __a,vector unsigned __int128 __b)2254 vec_cmple(vector unsigned __int128 __a, vector unsigned __int128 __b) {
2255 return vec_cmpge(__b, __a);
2256 }
2257 #endif
2258
2259 /* vec_cmplt */
2260
2261 static __inline__ vector bool char __ATTRS_o_ai
vec_cmplt(vector signed char __a,vector signed char __b)2262 vec_cmplt(vector signed char __a, vector signed char __b) {
2263 return vec_cmpgt(__b, __a);
2264 }
2265
2266 static __inline__ vector bool char __ATTRS_o_ai
vec_cmplt(vector unsigned char __a,vector unsigned char __b)2267 vec_cmplt(vector unsigned char __a, vector unsigned char __b) {
2268 return vec_cmpgt(__b, __a);
2269 }
2270
vec_cmplt(vector short __a,vector short __b)2271 static __inline__ vector bool short __ATTRS_o_ai vec_cmplt(vector short __a,
2272 vector short __b) {
2273 return vec_cmpgt(__b, __a);
2274 }
2275
2276 static __inline__ vector bool short __ATTRS_o_ai
vec_cmplt(vector unsigned short __a,vector unsigned short __b)2277 vec_cmplt(vector unsigned short __a, vector unsigned short __b) {
2278 return vec_cmpgt(__b, __a);
2279 }
2280
vec_cmplt(vector int __a,vector int __b)2281 static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector int __a,
2282 vector int __b) {
2283 return vec_cmpgt(__b, __a);
2284 }
2285
2286 static __inline__ vector bool int __ATTRS_o_ai
vec_cmplt(vector unsigned int __a,vector unsigned int __b)2287 vec_cmplt(vector unsigned int __a, vector unsigned int __b) {
2288 return vec_cmpgt(__b, __a);
2289 }
2290
vec_cmplt(vector float __a,vector float __b)2291 static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector float __a,
2292 vector float __b) {
2293 return vec_cmpgt(__b, __a);
2294 }
2295
2296 #ifdef __VSX__
2297 static __inline__ vector bool long long __ATTRS_o_ai
vec_cmplt(vector double __a,vector double __b)2298 vec_cmplt(vector double __a, vector double __b) {
2299 return vec_cmpgt(__b, __a);
2300 }
2301 #endif
2302
2303 #ifdef __POWER10_VECTOR__
2304 static __inline__ vector bool __int128 __ATTRS_o_ai
vec_cmplt(vector signed __int128 __a,vector signed __int128 __b)2305 vec_cmplt(vector signed __int128 __a, vector signed __int128 __b) {
2306 return vec_cmpgt(__b, __a);
2307 }
2308
2309 static __inline__ vector bool __int128 __ATTRS_o_ai
vec_cmplt(vector unsigned __int128 __a,vector unsigned __int128 __b)2310 vec_cmplt(vector unsigned __int128 __a, vector unsigned __int128 __b) {
2311 return vec_cmpgt(__b, __a);
2312 }
2313 #endif
2314
2315 #ifdef __POWER8_VECTOR__
2316 static __inline__ vector bool long long __ATTRS_o_ai
vec_cmplt(vector signed long long __a,vector signed long long __b)2317 vec_cmplt(vector signed long long __a, vector signed long long __b) {
2318 return vec_cmpgt(__b, __a);
2319 }
2320
2321 static __inline__ vector bool long long __ATTRS_o_ai
vec_cmplt(vector unsigned long long __a,vector unsigned long long __b)2322 vec_cmplt(vector unsigned long long __a, vector unsigned long long __b) {
2323 return vec_cmpgt(__b, __a);
2324 }
2325
2326 /* vec_popcnt */
2327
2328 static __inline__ vector signed char __ATTRS_o_ai
vec_popcnt(vector signed char __a)2329 vec_popcnt(vector signed char __a) {
2330 return __builtin_altivec_vpopcntb(__a);
2331 }
2332 static __inline__ vector unsigned char __ATTRS_o_ai
vec_popcnt(vector unsigned char __a)2333 vec_popcnt(vector unsigned char __a) {
2334 return __builtin_altivec_vpopcntb(__a);
2335 }
2336 static __inline__ vector signed short __ATTRS_o_ai
vec_popcnt(vector signed short __a)2337 vec_popcnt(vector signed short __a) {
2338 return __builtin_altivec_vpopcnth(__a);
2339 }
2340 static __inline__ vector unsigned short __ATTRS_o_ai
vec_popcnt(vector unsigned short __a)2341 vec_popcnt(vector unsigned short __a) {
2342 return __builtin_altivec_vpopcnth(__a);
2343 }
2344 static __inline__ vector signed int __ATTRS_o_ai
vec_popcnt(vector signed int __a)2345 vec_popcnt(vector signed int __a) {
2346 return __builtin_altivec_vpopcntw(__a);
2347 }
2348 static __inline__ vector unsigned int __ATTRS_o_ai
vec_popcnt(vector unsigned int __a)2349 vec_popcnt(vector unsigned int __a) {
2350 return __builtin_altivec_vpopcntw(__a);
2351 }
2352 static __inline__ vector signed long long __ATTRS_o_ai
vec_popcnt(vector signed long long __a)2353 vec_popcnt(vector signed long long __a) {
2354 return __builtin_altivec_vpopcntd(__a);
2355 }
2356 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_popcnt(vector unsigned long long __a)2357 vec_popcnt(vector unsigned long long __a) {
2358 return __builtin_altivec_vpopcntd(__a);
2359 }
2360
2361 /* vec_cntlz */
2362
2363 static __inline__ vector signed char __ATTRS_o_ai
vec_cntlz(vector signed char __a)2364 vec_cntlz(vector signed char __a) {
2365 return __builtin_altivec_vclzb(__a);
2366 }
2367 static __inline__ vector unsigned char __ATTRS_o_ai
vec_cntlz(vector unsigned char __a)2368 vec_cntlz(vector unsigned char __a) {
2369 return __builtin_altivec_vclzb(__a);
2370 }
2371 static __inline__ vector signed short __ATTRS_o_ai
vec_cntlz(vector signed short __a)2372 vec_cntlz(vector signed short __a) {
2373 return __builtin_altivec_vclzh(__a);
2374 }
2375 static __inline__ vector unsigned short __ATTRS_o_ai
vec_cntlz(vector unsigned short __a)2376 vec_cntlz(vector unsigned short __a) {
2377 return __builtin_altivec_vclzh(__a);
2378 }
2379 static __inline__ vector signed int __ATTRS_o_ai
vec_cntlz(vector signed int __a)2380 vec_cntlz(vector signed int __a) {
2381 return __builtin_altivec_vclzw(__a);
2382 }
2383 static __inline__ vector unsigned int __ATTRS_o_ai
vec_cntlz(vector unsigned int __a)2384 vec_cntlz(vector unsigned int __a) {
2385 return __builtin_altivec_vclzw(__a);
2386 }
2387 static __inline__ vector signed long long __ATTRS_o_ai
vec_cntlz(vector signed long long __a)2388 vec_cntlz(vector signed long long __a) {
2389 return __builtin_altivec_vclzd(__a);
2390 }
2391 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_cntlz(vector unsigned long long __a)2392 vec_cntlz(vector unsigned long long __a) {
2393 return __builtin_altivec_vclzd(__a);
2394 }
2395 #endif
2396
2397 #ifdef __POWER9_VECTOR__
2398
2399 /* vec_cnttz */
2400
2401 static __inline__ vector signed char __ATTRS_o_ai
vec_cnttz(vector signed char __a)2402 vec_cnttz(vector signed char __a) {
2403 return __builtin_altivec_vctzb(__a);
2404 }
2405 static __inline__ vector unsigned char __ATTRS_o_ai
vec_cnttz(vector unsigned char __a)2406 vec_cnttz(vector unsigned char __a) {
2407 return __builtin_altivec_vctzb(__a);
2408 }
2409 static __inline__ vector signed short __ATTRS_o_ai
vec_cnttz(vector signed short __a)2410 vec_cnttz(vector signed short __a) {
2411 return __builtin_altivec_vctzh(__a);
2412 }
2413 static __inline__ vector unsigned short __ATTRS_o_ai
vec_cnttz(vector unsigned short __a)2414 vec_cnttz(vector unsigned short __a) {
2415 return __builtin_altivec_vctzh(__a);
2416 }
2417 static __inline__ vector signed int __ATTRS_o_ai
vec_cnttz(vector signed int __a)2418 vec_cnttz(vector signed int __a) {
2419 return __builtin_altivec_vctzw(__a);
2420 }
2421 static __inline__ vector unsigned int __ATTRS_o_ai
vec_cnttz(vector unsigned int __a)2422 vec_cnttz(vector unsigned int __a) {
2423 return __builtin_altivec_vctzw(__a);
2424 }
2425 static __inline__ vector signed long long __ATTRS_o_ai
vec_cnttz(vector signed long long __a)2426 vec_cnttz(vector signed long long __a) {
2427 return __builtin_altivec_vctzd(__a);
2428 }
2429 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_cnttz(vector unsigned long long __a)2430 vec_cnttz(vector unsigned long long __a) {
2431 return __builtin_altivec_vctzd(__a);
2432 }
2433
2434 /* vec_first_match_index */
2435
2436 static __inline__ unsigned __ATTRS_o_ai
vec_first_match_index(vector signed char __a,vector signed char __b)2437 vec_first_match_index(vector signed char __a, vector signed char __b) {
2438 vector unsigned long long __res =
2439 #ifdef __LITTLE_ENDIAN__
2440 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2441 #else
2442 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2443 #endif
2444 if (__res[0] == 64) {
2445 return (__res[1] + 64) >> 3;
2446 }
2447 return __res[0] >> 3;
2448 }
2449
2450 static __inline__ unsigned __ATTRS_o_ai
vec_first_match_index(vector unsigned char __a,vector unsigned char __b)2451 vec_first_match_index(vector unsigned char __a, vector unsigned char __b) {
2452 vector unsigned long long __res =
2453 #ifdef __LITTLE_ENDIAN__
2454 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2455 #else
2456 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2457 #endif
2458 if (__res[0] == 64) {
2459 return (__res[1] + 64) >> 3;
2460 }
2461 return __res[0] >> 3;
2462 }
2463
2464 static __inline__ unsigned __ATTRS_o_ai
vec_first_match_index(vector signed short __a,vector signed short __b)2465 vec_first_match_index(vector signed short __a, vector signed short __b) {
2466 vector unsigned long long __res =
2467 #ifdef __LITTLE_ENDIAN__
2468 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2469 #else
2470 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2471 #endif
2472 if (__res[0] == 64) {
2473 return (__res[1] + 64) >> 4;
2474 }
2475 return __res[0] >> 4;
2476 }
2477
2478 static __inline__ unsigned __ATTRS_o_ai
vec_first_match_index(vector unsigned short __a,vector unsigned short __b)2479 vec_first_match_index(vector unsigned short __a, vector unsigned short __b) {
2480 vector unsigned long long __res =
2481 #ifdef __LITTLE_ENDIAN__
2482 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2483 #else
2484 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2485 #endif
2486 if (__res[0] == 64) {
2487 return (__res[1] + 64) >> 4;
2488 }
2489 return __res[0] >> 4;
2490 }
2491
2492 static __inline__ unsigned __ATTRS_o_ai
vec_first_match_index(vector signed int __a,vector signed int __b)2493 vec_first_match_index(vector signed int __a, vector signed int __b) {
2494 vector unsigned long long __res =
2495 #ifdef __LITTLE_ENDIAN__
2496 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2497 #else
2498 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2499 #endif
2500 if (__res[0] == 64) {
2501 return (__res[1] + 64) >> 5;
2502 }
2503 return __res[0] >> 5;
2504 }
2505
2506 static __inline__ unsigned __ATTRS_o_ai
vec_first_match_index(vector unsigned int __a,vector unsigned int __b)2507 vec_first_match_index(vector unsigned int __a, vector unsigned int __b) {
2508 vector unsigned long long __res =
2509 #ifdef __LITTLE_ENDIAN__
2510 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2511 #else
2512 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2513 #endif
2514 if (__res[0] == 64) {
2515 return (__res[1] + 64) >> 5;
2516 }
2517 return __res[0] >> 5;
2518 }
2519
2520 /* vec_first_match_or_eos_index */
2521
2522 static __inline__ unsigned __ATTRS_o_ai
vec_first_match_or_eos_index(vector signed char __a,vector signed char __b)2523 vec_first_match_or_eos_index(vector signed char __a, vector signed char __b) {
2524 /* Compare the result of the comparison of two vectors with either and OR the
2525 result. Either the elements are equal or one will equal the comparison
2526 result if either is zero.
2527 */
2528 vector bool char __tmp1 = vec_cmpeq(__a, __b);
2529 vector bool char __tmp2 = __tmp1 |
2530 vec_cmpeq((vector signed char)__tmp1, __a) |
2531 vec_cmpeq((vector signed char)__tmp1, __b);
2532
2533 vector unsigned long long __res =
2534 #ifdef __LITTLE_ENDIAN__
2535 vec_cnttz((vector unsigned long long)__tmp2);
2536 #else
2537 vec_cntlz((vector unsigned long long)__tmp2);
2538 #endif
2539 if (__res[0] == 64) {
2540 return (__res[1] + 64) >> 3;
2541 }
2542 return __res[0] >> 3;
2543 }
2544
2545 static __inline__ unsigned __ATTRS_o_ai
vec_first_match_or_eos_index(vector unsigned char __a,vector unsigned char __b)2546 vec_first_match_or_eos_index(vector unsigned char __a,
2547 vector unsigned char __b) {
2548 vector bool char __tmp1 = vec_cmpeq(__a, __b);
2549 vector bool char __tmp2 = __tmp1 |
2550 vec_cmpeq((vector unsigned char)__tmp1, __a) |
2551 vec_cmpeq((vector unsigned char)__tmp1, __b);
2552
2553 vector unsigned long long __res =
2554 #ifdef __LITTLE_ENDIAN__
2555 vec_cnttz((vector unsigned long long)__tmp2);
2556 #else
2557 vec_cntlz((vector unsigned long long)__tmp2);
2558 #endif
2559 if (__res[0] == 64) {
2560 return (__res[1] + 64) >> 3;
2561 }
2562 return __res[0] >> 3;
2563 }
2564
2565 static __inline__ unsigned __ATTRS_o_ai
vec_first_match_or_eos_index(vector signed short __a,vector signed short __b)2566 vec_first_match_or_eos_index(vector signed short __a, vector signed short __b) {
2567 vector bool short __tmp1 = vec_cmpeq(__a, __b);
2568 vector bool short __tmp2 = __tmp1 |
2569 vec_cmpeq((vector signed short)__tmp1, __a) |
2570 vec_cmpeq((vector signed short)__tmp1, __b);
2571
2572 vector unsigned long long __res =
2573 #ifdef __LITTLE_ENDIAN__
2574 vec_cnttz((vector unsigned long long)__tmp2);
2575 #else
2576 vec_cntlz((vector unsigned long long)__tmp2);
2577 #endif
2578 if (__res[0] == 64) {
2579 return (__res[1] + 64) >> 4;
2580 }
2581 return __res[0] >> 4;
2582 }
2583
2584 static __inline__ unsigned __ATTRS_o_ai
vec_first_match_or_eos_index(vector unsigned short __a,vector unsigned short __b)2585 vec_first_match_or_eos_index(vector unsigned short __a,
2586 vector unsigned short __b) {
2587 vector bool short __tmp1 = vec_cmpeq(__a, __b);
2588 vector bool short __tmp2 = __tmp1 |
2589 vec_cmpeq((vector unsigned short)__tmp1, __a) |
2590 vec_cmpeq((vector unsigned short)__tmp1, __b);
2591
2592 vector unsigned long long __res =
2593 #ifdef __LITTLE_ENDIAN__
2594 vec_cnttz((vector unsigned long long)__tmp2);
2595 #else
2596 vec_cntlz((vector unsigned long long)__tmp2);
2597 #endif
2598 if (__res[0] == 64) {
2599 return (__res[1] + 64) >> 4;
2600 }
2601 return __res[0] >> 4;
2602 }
2603
2604 static __inline__ unsigned __ATTRS_o_ai
vec_first_match_or_eos_index(vector signed int __a,vector signed int __b)2605 vec_first_match_or_eos_index(vector signed int __a, vector signed int __b) {
2606 vector bool int __tmp1 = vec_cmpeq(__a, __b);
2607 vector bool int __tmp2 = __tmp1 | vec_cmpeq((vector signed int)__tmp1, __a) |
2608 vec_cmpeq((vector signed int)__tmp1, __b);
2609
2610 vector unsigned long long __res =
2611 #ifdef __LITTLE_ENDIAN__
2612 vec_cnttz((vector unsigned long long)__tmp2);
2613 #else
2614 vec_cntlz((vector unsigned long long)__tmp2);
2615 #endif
2616 if (__res[0] == 64) {
2617 return (__res[1] + 64) >> 5;
2618 }
2619 return __res[0] >> 5;
2620 }
2621
2622 static __inline__ unsigned __ATTRS_o_ai
vec_first_match_or_eos_index(vector unsigned int __a,vector unsigned int __b)2623 vec_first_match_or_eos_index(vector unsigned int __a, vector unsigned int __b) {
2624 vector bool int __tmp1 = vec_cmpeq(__a, __b);
2625 vector bool int __tmp2 = __tmp1 |
2626 vec_cmpeq((vector unsigned int)__tmp1, __a) |
2627 vec_cmpeq((vector unsigned int)__tmp1, __b);
2628
2629 vector unsigned long long __res =
2630 #ifdef __LITTLE_ENDIAN__
2631 vec_cnttz((vector unsigned long long)__tmp2);
2632 #else
2633 vec_cntlz((vector unsigned long long)__tmp2);
2634 #endif
2635 if (__res[0] == 64) {
2636 return (__res[1] + 64) >> 5;
2637 }
2638 return __res[0] >> 5;
2639 }
2640
2641 /* vec_first_mismatch_index */
2642
2643 static __inline__ unsigned __ATTRS_o_ai
vec_first_mismatch_index(vector signed char __a,vector signed char __b)2644 vec_first_mismatch_index(vector signed char __a, vector signed char __b) {
2645 vector unsigned long long __res =
2646 #ifdef __LITTLE_ENDIAN__
2647 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2648 #else
2649 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2650 #endif
2651 if (__res[0] == 64) {
2652 return (__res[1] + 64) >> 3;
2653 }
2654 return __res[0] >> 3;
2655 }
2656
2657 static __inline__ unsigned __ATTRS_o_ai
vec_first_mismatch_index(vector unsigned char __a,vector unsigned char __b)2658 vec_first_mismatch_index(vector unsigned char __a, vector unsigned char __b) {
2659 vector unsigned long long __res =
2660 #ifdef __LITTLE_ENDIAN__
2661 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2662 #else
2663 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2664 #endif
2665 if (__res[0] == 64) {
2666 return (__res[1] + 64) >> 3;
2667 }
2668 return __res[0] >> 3;
2669 }
2670
2671 static __inline__ unsigned __ATTRS_o_ai
vec_first_mismatch_index(vector signed short __a,vector signed short __b)2672 vec_first_mismatch_index(vector signed short __a, vector signed short __b) {
2673 vector unsigned long long __res =
2674 #ifdef __LITTLE_ENDIAN__
2675 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2676 #else
2677 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2678 #endif
2679 if (__res[0] == 64) {
2680 return (__res[1] + 64) >> 4;
2681 }
2682 return __res[0] >> 4;
2683 }
2684
2685 static __inline__ unsigned __ATTRS_o_ai
vec_first_mismatch_index(vector unsigned short __a,vector unsigned short __b)2686 vec_first_mismatch_index(vector unsigned short __a, vector unsigned short __b) {
2687 vector unsigned long long __res =
2688 #ifdef __LITTLE_ENDIAN__
2689 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2690 #else
2691 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2692 #endif
2693 if (__res[0] == 64) {
2694 return (__res[1] + 64) >> 4;
2695 }
2696 return __res[0] >> 4;
2697 }
2698
2699 static __inline__ unsigned __ATTRS_o_ai
vec_first_mismatch_index(vector signed int __a,vector signed int __b)2700 vec_first_mismatch_index(vector signed int __a, vector signed int __b) {
2701 vector unsigned long long __res =
2702 #ifdef __LITTLE_ENDIAN__
2703 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2704 #else
2705 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2706 #endif
2707 if (__res[0] == 64) {
2708 return (__res[1] + 64) >> 5;
2709 }
2710 return __res[0] >> 5;
2711 }
2712
2713 static __inline__ unsigned __ATTRS_o_ai
vec_first_mismatch_index(vector unsigned int __a,vector unsigned int __b)2714 vec_first_mismatch_index(vector unsigned int __a, vector unsigned int __b) {
2715 vector unsigned long long __res =
2716 #ifdef __LITTLE_ENDIAN__
2717 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2718 #else
2719 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2720 #endif
2721 if (__res[0] == 64) {
2722 return (__res[1] + 64) >> 5;
2723 }
2724 return __res[0] >> 5;
2725 }
2726
2727 /* vec_first_mismatch_or_eos_index */
2728
2729 static __inline__ unsigned __ATTRS_o_ai
vec_first_mismatch_or_eos_index(vector signed char __a,vector signed char __b)2730 vec_first_mismatch_or_eos_index(vector signed char __a,
2731 vector signed char __b) {
2732 vector unsigned long long __res =
2733 #ifdef __LITTLE_ENDIAN__
2734 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2735 #else
2736 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2737 #endif
2738 if (__res[0] == 64) {
2739 return (__res[1] + 64) >> 3;
2740 }
2741 return __res[0] >> 3;
2742 }
2743
2744 static __inline__ unsigned __ATTRS_o_ai
vec_first_mismatch_or_eos_index(vector unsigned char __a,vector unsigned char __b)2745 vec_first_mismatch_or_eos_index(vector unsigned char __a,
2746 vector unsigned char __b) {
2747 vector unsigned long long __res =
2748 #ifdef __LITTLE_ENDIAN__
2749 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2750 #else
2751 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2752 #endif
2753 if (__res[0] == 64) {
2754 return (__res[1] + 64) >> 3;
2755 }
2756 return __res[0] >> 3;
2757 }
2758
2759 static __inline__ unsigned __ATTRS_o_ai
vec_first_mismatch_or_eos_index(vector signed short __a,vector signed short __b)2760 vec_first_mismatch_or_eos_index(vector signed short __a,
2761 vector signed short __b) {
2762 vector unsigned long long __res =
2763 #ifdef __LITTLE_ENDIAN__
2764 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2765 #else
2766 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2767 #endif
2768 if (__res[0] == 64) {
2769 return (__res[1] + 64) >> 4;
2770 }
2771 return __res[0] >> 4;
2772 }
2773
2774 static __inline__ unsigned __ATTRS_o_ai
vec_first_mismatch_or_eos_index(vector unsigned short __a,vector unsigned short __b)2775 vec_first_mismatch_or_eos_index(vector unsigned short __a,
2776 vector unsigned short __b) {
2777 vector unsigned long long __res =
2778 #ifdef __LITTLE_ENDIAN__
2779 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2780 #else
2781 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2782 #endif
2783 if (__res[0] == 64) {
2784 return (__res[1] + 64) >> 4;
2785 }
2786 return __res[0] >> 4;
2787 }
2788
2789 static __inline__ unsigned __ATTRS_o_ai
vec_first_mismatch_or_eos_index(vector signed int __a,vector signed int __b)2790 vec_first_mismatch_or_eos_index(vector signed int __a, vector signed int __b) {
2791 vector unsigned long long __res =
2792 #ifdef __LITTLE_ENDIAN__
2793 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2794 #else
2795 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2796 #endif
2797 if (__res[0] == 64) {
2798 return (__res[1] + 64) >> 5;
2799 }
2800 return __res[0] >> 5;
2801 }
2802
2803 static __inline__ unsigned __ATTRS_o_ai
vec_first_mismatch_or_eos_index(vector unsigned int __a,vector unsigned int __b)2804 vec_first_mismatch_or_eos_index(vector unsigned int __a,
2805 vector unsigned int __b) {
2806 vector unsigned long long __res =
2807 #ifdef __LITTLE_ENDIAN__
2808 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2809 #else
2810 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2811 #endif
2812 if (__res[0] == 64) {
2813 return (__res[1] + 64) >> 5;
2814 }
2815 return __res[0] >> 5;
2816 }
2817
2818 static __inline__ vector double __ATTRS_o_ai
vec_insert_exp(vector double __a,vector unsigned long long __b)2819 vec_insert_exp(vector double __a, vector unsigned long long __b) {
2820 return __builtin_vsx_xviexpdp((vector unsigned long long)__a,__b);
2821 }
2822
2823 static __inline__ vector double __ATTRS_o_ai
vec_insert_exp(vector unsigned long long __a,vector unsigned long long __b)2824 vec_insert_exp(vector unsigned long long __a, vector unsigned long long __b) {
2825 return __builtin_vsx_xviexpdp(__a,__b);
2826 }
2827
2828 static __inline__ vector float __ATTRS_o_ai
vec_insert_exp(vector float __a,vector unsigned int __b)2829 vec_insert_exp(vector float __a, vector unsigned int __b) {
2830 return __builtin_vsx_xviexpsp((vector unsigned int)__a,__b);
2831 }
2832
2833 static __inline__ vector float __ATTRS_o_ai
vec_insert_exp(vector unsigned int __a,vector unsigned int __b)2834 vec_insert_exp(vector unsigned int __a, vector unsigned int __b) {
2835 return __builtin_vsx_xviexpsp(__a,__b);
2836 }
2837
2838 #if defined(__powerpc64__)
vec_xl_len(const signed char * __a,size_t __b)2839 static __inline__ vector signed char __ATTRS_o_ai vec_xl_len(const signed char *__a,
2840 size_t __b) {
2841 return (vector signed char)__builtin_vsx_lxvl(__a, (__b << 56));
2842 }
2843
2844 static __inline__ vector unsigned char __ATTRS_o_ai
vec_xl_len(const unsigned char * __a,size_t __b)2845 vec_xl_len(const unsigned char *__a, size_t __b) {
2846 return (vector unsigned char)__builtin_vsx_lxvl(__a, (__b << 56));
2847 }
2848
vec_xl_len(const signed short * __a,size_t __b)2849 static __inline__ vector signed short __ATTRS_o_ai vec_xl_len(const signed short *__a,
2850 size_t __b) {
2851 return (vector signed short)__builtin_vsx_lxvl(__a, (__b << 56));
2852 }
2853
2854 static __inline__ vector unsigned short __ATTRS_o_ai
vec_xl_len(const unsigned short * __a,size_t __b)2855 vec_xl_len(const unsigned short *__a, size_t __b) {
2856 return (vector unsigned short)__builtin_vsx_lxvl(__a, (__b << 56));
2857 }
2858
vec_xl_len(const signed int * __a,size_t __b)2859 static __inline__ vector signed int __ATTRS_o_ai vec_xl_len(const signed int *__a,
2860 size_t __b) {
2861 return (vector signed int)__builtin_vsx_lxvl(__a, (__b << 56));
2862 }
2863
vec_xl_len(const unsigned int * __a,size_t __b)2864 static __inline__ vector unsigned int __ATTRS_o_ai vec_xl_len(const unsigned int *__a,
2865 size_t __b) {
2866 return (vector unsigned int)__builtin_vsx_lxvl(__a, (__b << 56));
2867 }
2868
vec_xl_len(const float * __a,size_t __b)2869 static __inline__ vector float __ATTRS_o_ai vec_xl_len(const float *__a, size_t __b) {
2870 return (vector float)__builtin_vsx_lxvl(__a, (__b << 56));
2871 }
2872
2873 static __inline__ vector signed __int128 __ATTRS_o_ai
vec_xl_len(const signed __int128 * __a,size_t __b)2874 vec_xl_len(const signed __int128 *__a, size_t __b) {
2875 return (vector signed __int128)__builtin_vsx_lxvl(__a, (__b << 56));
2876 }
2877
2878 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_xl_len(const unsigned __int128 * __a,size_t __b)2879 vec_xl_len(const unsigned __int128 *__a, size_t __b) {
2880 return (vector unsigned __int128)__builtin_vsx_lxvl(__a, (__b << 56));
2881 }
2882
2883 static __inline__ vector signed long long __ATTRS_o_ai
vec_xl_len(const signed long long * __a,size_t __b)2884 vec_xl_len(const signed long long *__a, size_t __b) {
2885 return (vector signed long long)__builtin_vsx_lxvl(__a, (__b << 56));
2886 }
2887
2888 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_xl_len(const unsigned long long * __a,size_t __b)2889 vec_xl_len(const unsigned long long *__a, size_t __b) {
2890 return (vector unsigned long long)__builtin_vsx_lxvl(__a, (__b << 56));
2891 }
2892
vec_xl_len(const double * __a,size_t __b)2893 static __inline__ vector double __ATTRS_o_ai vec_xl_len(const double *__a,
2894 size_t __b) {
2895 return (vector double)__builtin_vsx_lxvl(__a, (__b << 56));
2896 }
2897
2898 static __inline__ vector unsigned char __ATTRS_o_ai
vec_xl_len_r(const unsigned char * __a,size_t __b)2899 vec_xl_len_r(const unsigned char *__a, size_t __b) {
2900 vector unsigned char __res =
2901 (vector unsigned char)__builtin_vsx_lxvll(__a, (__b << 56));
2902 #ifdef __LITTLE_ENDIAN__
2903 vector unsigned char __mask =
2904 (vector unsigned char)__builtin_altivec_lvsr(16 - __b, (int *)NULL);
2905 __res = (vector unsigned char)__builtin_altivec_vperm_4si(
2906 (vector int)__res, (vector int)__res, __mask);
2907 #endif
2908 return __res;
2909 }
2910
2911 // vec_xst_len
vec_xst_len(vector unsigned char __a,unsigned char * __b,size_t __c)2912 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned char __a,
2913 unsigned char *__b,
2914 size_t __c) {
2915 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2916 }
2917
vec_xst_len(vector signed char __a,signed char * __b,size_t __c)2918 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed char __a,
2919 signed char *__b, size_t __c) {
2920 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2921 }
2922
vec_xst_len(vector signed short __a,signed short * __b,size_t __c)2923 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed short __a,
2924 signed short *__b, size_t __c) {
2925 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2926 }
2927
vec_xst_len(vector unsigned short __a,unsigned short * __b,size_t __c)2928 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned short __a,
2929 unsigned short *__b,
2930 size_t __c) {
2931 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2932 }
2933
vec_xst_len(vector signed int __a,signed int * __b,size_t __c)2934 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed int __a,
2935 signed int *__b, size_t __c) {
2936 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2937 }
2938
vec_xst_len(vector unsigned int __a,unsigned int * __b,size_t __c)2939 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned int __a,
2940 unsigned int *__b, size_t __c) {
2941 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2942 }
2943
vec_xst_len(vector float __a,float * __b,size_t __c)2944 static __inline__ void __ATTRS_o_ai vec_xst_len(vector float __a, float *__b,
2945 size_t __c) {
2946 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2947 }
2948
vec_xst_len(vector signed __int128 __a,signed __int128 * __b,size_t __c)2949 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed __int128 __a,
2950 signed __int128 *__b,
2951 size_t __c) {
2952 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2953 }
2954
vec_xst_len(vector unsigned __int128 __a,unsigned __int128 * __b,size_t __c)2955 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned __int128 __a,
2956 unsigned __int128 *__b,
2957 size_t __c) {
2958 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2959 }
2960
vec_xst_len(vector signed long long __a,signed long long * __b,size_t __c)2961 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed long long __a,
2962 signed long long *__b,
2963 size_t __c) {
2964 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2965 }
2966
vec_xst_len(vector unsigned long long __a,unsigned long long * __b,size_t __c)2967 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned long long __a,
2968 unsigned long long *__b,
2969 size_t __c) {
2970 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2971 }
2972
vec_xst_len(vector double __a,double * __b,size_t __c)2973 static __inline__ void __ATTRS_o_ai vec_xst_len(vector double __a, double *__b,
2974 size_t __c) {
2975 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2976 }
2977
vec_xst_len_r(vector unsigned char __a,unsigned char * __b,size_t __c)2978 static __inline__ void __ATTRS_o_ai vec_xst_len_r(vector unsigned char __a,
2979 unsigned char *__b,
2980 size_t __c) {
2981 #ifdef __LITTLE_ENDIAN__
2982 vector unsigned char __mask =
2983 (vector unsigned char)__builtin_altivec_lvsl(16 - __c, (int *)NULL);
2984 vector unsigned char __res =
2985 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__a, __mask);
2986 return __builtin_vsx_stxvll((vector int)__res, __b, (__c << 56));
2987 #else
2988 return __builtin_vsx_stxvll((vector int)__a, __b, (__c << 56));
2989 #endif
2990 }
2991 #endif
2992 #endif
2993
2994 /* vec_cpsgn */
2995
2996 #ifdef __VSX__
vec_cpsgn(vector float __a,vector float __b)2997 static __inline__ vector float __ATTRS_o_ai vec_cpsgn(vector float __a,
2998 vector float __b) {
2999 return __builtin_vsx_xvcpsgnsp(__b, __a);
3000 }
3001
vec_cpsgn(vector double __a,vector double __b)3002 static __inline__ vector double __ATTRS_o_ai vec_cpsgn(vector double __a,
3003 vector double __b) {
3004 return __builtin_vsx_xvcpsgndp(__b, __a);
3005 }
3006 #endif
3007
3008 /* vec_ctf */
3009
3010 #ifdef __VSX__
3011 #define vec_ctf(__a, __b) \
3012 _Generic((__a), vector int \
3013 : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)), \
3014 vector unsigned int \
3015 : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \
3016 (__b)), \
3017 vector unsigned long long \
3018 : (__builtin_convertvector((vector unsigned long long)(__a), \
3019 vector double) * \
3020 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \
3021 << 52)), \
3022 vector signed long long \
3023 : (__builtin_convertvector((vector signed long long)(__a), \
3024 vector double) * \
3025 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \
3026 << 52)))
3027 #else
3028 #define vec_ctf(__a, __b) \
3029 _Generic((__a), vector int \
3030 : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)), \
3031 vector unsigned int \
3032 : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \
3033 (__b)))
3034 #endif
3035
3036 /* vec_vcfsx */
3037
3038 #define vec_vcfux __builtin_altivec_vcfux
3039
3040 /* vec_vcfux */
3041
3042 #define vec_vcfsx(__a, __b) __builtin_altivec_vcfsx((vector int)(__a), (__b))
3043
3044 /* vec_cts */
3045
3046 #ifdef __VSX__
3047 #define vec_cts(__a, __b) \
3048 _Generic((__a), vector float \
3049 : __builtin_altivec_vctsxs((vector float)(__a), (__b)), \
3050 vector double \
3051 : __extension__({ \
3052 vector double __ret = \
3053 (vector double)(__a) * \
3054 (vector double)(vector unsigned long long)((0x3ffULL + (__b)) \
3055 << 52); \
3056 __builtin_convertvector(__ret, vector signed long long); \
3057 }))
3058 #else
3059 #define vec_cts __builtin_altivec_vctsxs
3060 #endif
3061
3062 /* vec_vctsxs */
3063
3064 #define vec_vctsxs __builtin_altivec_vctsxs
3065
3066 /* vec_ctu */
3067
3068 #ifdef __VSX__
3069 #define vec_ctu(__a, __b) \
3070 _Generic((__a), vector float \
3071 : __builtin_altivec_vctuxs((vector float)(__a), (__b)), \
3072 vector double \
3073 : __extension__({ \
3074 vector double __ret = \
3075 (vector double)(__a) * \
3076 (vector double)(vector unsigned long long)((0x3ffULL + __b) \
3077 << 52); \
3078 __builtin_convertvector(__ret, vector unsigned long long); \
3079 }))
3080 #else
3081 #define vec_ctu __builtin_altivec_vctuxs
3082 #endif
3083
3084 /* vec_vctuxs */
3085
3086 #define vec_vctuxs __builtin_altivec_vctuxs
3087
3088 /* vec_signext */
3089
3090 #ifdef __POWER9_VECTOR__
3091 static __inline__ vector signed int __ATTRS_o_ai
vec_signexti(vector signed char __a)3092 vec_signexti(vector signed char __a) {
3093 return __builtin_altivec_vextsb2w(__a);
3094 }
3095
3096 static __inline__ vector signed int __ATTRS_o_ai
vec_signexti(vector signed short __a)3097 vec_signexti(vector signed short __a) {
3098 return __builtin_altivec_vextsh2w(__a);
3099 }
3100
3101 static __inline__ vector signed long long __ATTRS_o_ai
vec_signextll(vector signed char __a)3102 vec_signextll(vector signed char __a) {
3103 return __builtin_altivec_vextsb2d(__a);
3104 }
3105
3106 static __inline__ vector signed long long __ATTRS_o_ai
vec_signextll(vector signed short __a)3107 vec_signextll(vector signed short __a) {
3108 return __builtin_altivec_vextsh2d(__a);
3109 }
3110
3111 static __inline__ vector signed long long __ATTRS_o_ai
vec_signextll(vector signed int __a)3112 vec_signextll(vector signed int __a) {
3113 return __builtin_altivec_vextsw2d(__a);
3114 }
3115 #endif
3116
3117 #ifdef __POWER10_VECTOR__
3118 static __inline__ vector signed __int128 __ATTRS_o_ai
vec_signextq(vector signed long long __a)3119 vec_signextq(vector signed long long __a) {
3120 return __builtin_altivec_vextsd2q(__a);
3121 }
3122 #endif
3123
3124 /* vec_signed */
3125
3126 static __inline__ vector signed int __ATTRS_o_ai
3127 vec_sld(vector signed int, vector signed int, unsigned const int __c);
3128
3129 static __inline__ vector signed int __ATTRS_o_ai
vec_signed(vector float __a)3130 vec_signed(vector float __a) {
3131 return __builtin_convertvector(__a, vector signed int);
3132 }
3133
3134 #ifdef __VSX__
3135 static __inline__ vector signed long long __ATTRS_o_ai
vec_signed(vector double __a)3136 vec_signed(vector double __a) {
3137 return __builtin_convertvector(__a, vector signed long long);
3138 }
3139
3140 static __inline__ vector signed int __attribute__((__always_inline__))
vec_signed2(vector double __a,vector double __b)3141 vec_signed2(vector double __a, vector double __b) {
3142 return (vector signed int) { __a[0], __a[1], __b[0], __b[1] };
3143 }
3144
3145 static __inline__ vector signed int __ATTRS_o_ai
vec_signede(vector double __a)3146 vec_signede(vector double __a) {
3147 #ifdef __LITTLE_ENDIAN__
3148 vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a);
3149 return vec_sld(__ret, __ret, 12);
3150 #else
3151 return __builtin_vsx_xvcvdpsxws(__a);
3152 #endif
3153 }
3154
3155 static __inline__ vector signed int __ATTRS_o_ai
vec_signedo(vector double __a)3156 vec_signedo(vector double __a) {
3157 #ifdef __LITTLE_ENDIAN__
3158 return __builtin_vsx_xvcvdpsxws(__a);
3159 #else
3160 vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a);
3161 return vec_sld(__ret, __ret, 12);
3162 #endif
3163 }
3164 #endif
3165
3166 /* vec_unsigned */
3167
3168 static __inline__ vector unsigned int __ATTRS_o_ai
3169 vec_sld(vector unsigned int, vector unsigned int, unsigned const int __c);
3170
3171 static __inline__ vector unsigned int __ATTRS_o_ai
vec_unsigned(vector float __a)3172 vec_unsigned(vector float __a) {
3173 return __builtin_convertvector(__a, vector unsigned int);
3174 }
3175
3176 #ifdef __VSX__
3177 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_unsigned(vector double __a)3178 vec_unsigned(vector double __a) {
3179 return __builtin_convertvector(__a, vector unsigned long long);
3180 }
3181
3182 static __inline__ vector unsigned int __attribute__((__always_inline__))
vec_unsigned2(vector double __a,vector double __b)3183 vec_unsigned2(vector double __a, vector double __b) {
3184 return (vector unsigned int) { __a[0], __a[1], __b[0], __b[1] };
3185 }
3186
3187 static __inline__ vector unsigned int __ATTRS_o_ai
vec_unsignede(vector double __a)3188 vec_unsignede(vector double __a) {
3189 #ifdef __LITTLE_ENDIAN__
3190 vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a);
3191 return vec_sld(__ret, __ret, 12);
3192 #else
3193 return __builtin_vsx_xvcvdpuxws(__a);
3194 #endif
3195 }
3196
3197 static __inline__ vector unsigned int __ATTRS_o_ai
vec_unsignedo(vector double __a)3198 vec_unsignedo(vector double __a) {
3199 #ifdef __LITTLE_ENDIAN__
3200 return __builtin_vsx_xvcvdpuxws(__a);
3201 #else
3202 vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a);
3203 return vec_sld(__ret, __ret, 12);
3204 #endif
3205 }
3206 #endif
3207
3208 /* vec_float */
3209
3210 static __inline__ vector float __ATTRS_o_ai
3211 vec_sld(vector float, vector float, unsigned const int __c);
3212
3213 static __inline__ vector float __ATTRS_o_ai
vec_float(vector signed int __a)3214 vec_float(vector signed int __a) {
3215 return __builtin_convertvector(__a, vector float);
3216 }
3217
3218 static __inline__ vector float __ATTRS_o_ai
vec_float(vector unsigned int __a)3219 vec_float(vector unsigned int __a) {
3220 return __builtin_convertvector(__a, vector float);
3221 }
3222
3223 #ifdef __VSX__
3224 static __inline__ vector float __ATTRS_o_ai
vec_float2(vector signed long long __a,vector signed long long __b)3225 vec_float2(vector signed long long __a, vector signed long long __b) {
3226 return (vector float) { __a[0], __a[1], __b[0], __b[1] };
3227 }
3228
3229 static __inline__ vector float __ATTRS_o_ai
vec_float2(vector unsigned long long __a,vector unsigned long long __b)3230 vec_float2(vector unsigned long long __a, vector unsigned long long __b) {
3231 return (vector float) { __a[0], __a[1], __b[0], __b[1] };
3232 }
3233
3234 static __inline__ vector float __ATTRS_o_ai
vec_float2(vector double __a,vector double __b)3235 vec_float2(vector double __a, vector double __b) {
3236 return (vector float) { __a[0], __a[1], __b[0], __b[1] };
3237 }
3238
3239 static __inline__ vector float __ATTRS_o_ai
vec_floate(vector signed long long __a)3240 vec_floate(vector signed long long __a) {
3241 #ifdef __LITTLE_ENDIAN__
3242 vector float __ret = __builtin_vsx_xvcvsxdsp(__a);
3243 return vec_sld(__ret, __ret, 12);
3244 #else
3245 return __builtin_vsx_xvcvsxdsp(__a);
3246 #endif
3247 }
3248
3249 static __inline__ vector float __ATTRS_o_ai
vec_floate(vector unsigned long long __a)3250 vec_floate(vector unsigned long long __a) {
3251 #ifdef __LITTLE_ENDIAN__
3252 vector float __ret = __builtin_vsx_xvcvuxdsp(__a);
3253 return vec_sld(__ret, __ret, 12);
3254 #else
3255 return __builtin_vsx_xvcvuxdsp(__a);
3256 #endif
3257 }
3258
3259 static __inline__ vector float __ATTRS_o_ai
vec_floate(vector double __a)3260 vec_floate(vector double __a) {
3261 #ifdef __LITTLE_ENDIAN__
3262 vector float __ret = __builtin_vsx_xvcvdpsp(__a);
3263 return vec_sld(__ret, __ret, 12);
3264 #else
3265 return __builtin_vsx_xvcvdpsp(__a);
3266 #endif
3267 }
3268
3269 static __inline__ vector float __ATTRS_o_ai
vec_floato(vector signed long long __a)3270 vec_floato(vector signed long long __a) {
3271 #ifdef __LITTLE_ENDIAN__
3272 return __builtin_vsx_xvcvsxdsp(__a);
3273 #else
3274 vector float __ret = __builtin_vsx_xvcvsxdsp(__a);
3275 return vec_sld(__ret, __ret, 12);
3276 #endif
3277 }
3278
3279 static __inline__ vector float __ATTRS_o_ai
vec_floato(vector unsigned long long __a)3280 vec_floato(vector unsigned long long __a) {
3281 #ifdef __LITTLE_ENDIAN__
3282 return __builtin_vsx_xvcvuxdsp(__a);
3283 #else
3284 vector float __ret = __builtin_vsx_xvcvuxdsp(__a);
3285 return vec_sld(__ret, __ret, 12);
3286 #endif
3287 }
3288
3289 static __inline__ vector float __ATTRS_o_ai
vec_floato(vector double __a)3290 vec_floato(vector double __a) {
3291 #ifdef __LITTLE_ENDIAN__
3292 return __builtin_vsx_xvcvdpsp(__a);
3293 #else
3294 vector float __ret = __builtin_vsx_xvcvdpsp(__a);
3295 return vec_sld(__ret, __ret, 12);
3296 #endif
3297 }
3298 #endif
3299
3300 /* vec_double */
3301
3302 #ifdef __VSX__
3303 static __inline__ vector double __ATTRS_o_ai
vec_double(vector signed long long __a)3304 vec_double(vector signed long long __a) {
3305 return __builtin_convertvector(__a, vector double);
3306 }
3307
3308 static __inline__ vector double __ATTRS_o_ai
vec_double(vector unsigned long long __a)3309 vec_double(vector unsigned long long __a) {
3310 return __builtin_convertvector(__a, vector double);
3311 }
3312
3313 static __inline__ vector double __ATTRS_o_ai
vec_doublee(vector signed int __a)3314 vec_doublee(vector signed int __a) {
3315 #ifdef __LITTLE_ENDIAN__
3316 return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4));
3317 #else
3318 return __builtin_vsx_xvcvsxwdp(__a);
3319 #endif
3320 }
3321
3322 static __inline__ vector double __ATTRS_o_ai
vec_doublee(vector unsigned int __a)3323 vec_doublee(vector unsigned int __a) {
3324 #ifdef __LITTLE_ENDIAN__
3325 return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4));
3326 #else
3327 return __builtin_vsx_xvcvuxwdp(__a);
3328 #endif
3329 }
3330
3331 static __inline__ vector double __ATTRS_o_ai
vec_doublee(vector float __a)3332 vec_doublee(vector float __a) {
3333 #ifdef __LITTLE_ENDIAN__
3334 return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4));
3335 #else
3336 return __builtin_vsx_xvcvspdp(__a);
3337 #endif
3338 }
3339
3340 static __inline__ vector double __ATTRS_o_ai
vec_doubleh(vector signed int __a)3341 vec_doubleh(vector signed int __a) {
3342 vector double __ret = {__a[0], __a[1]};
3343 return __ret;
3344 }
3345
3346 static __inline__ vector double __ATTRS_o_ai
vec_doubleh(vector unsigned int __a)3347 vec_doubleh(vector unsigned int __a) {
3348 vector double __ret = {__a[0], __a[1]};
3349 return __ret;
3350 }
3351
3352 static __inline__ vector double __ATTRS_o_ai
vec_doubleh(vector float __a)3353 vec_doubleh(vector float __a) {
3354 vector double __ret = {__a[0], __a[1]};
3355 return __ret;
3356 }
3357
3358 static __inline__ vector double __ATTRS_o_ai
vec_doublel(vector signed int __a)3359 vec_doublel(vector signed int __a) {
3360 vector double __ret = {__a[2], __a[3]};
3361 return __ret;
3362 }
3363
3364 static __inline__ vector double __ATTRS_o_ai
vec_doublel(vector unsigned int __a)3365 vec_doublel(vector unsigned int __a) {
3366 vector double __ret = {__a[2], __a[3]};
3367 return __ret;
3368 }
3369
3370 static __inline__ vector double __ATTRS_o_ai
vec_doublel(vector float __a)3371 vec_doublel(vector float __a) {
3372 vector double __ret = {__a[2], __a[3]};
3373 return __ret;
3374 }
3375
3376 static __inline__ vector double __ATTRS_o_ai
vec_doubleo(vector signed int __a)3377 vec_doubleo(vector signed int __a) {
3378 #ifdef __LITTLE_ENDIAN__
3379 return __builtin_vsx_xvcvsxwdp(__a);
3380 #else
3381 return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4));
3382 #endif
3383 }
3384
3385 static __inline__ vector double __ATTRS_o_ai
vec_doubleo(vector unsigned int __a)3386 vec_doubleo(vector unsigned int __a) {
3387 #ifdef __LITTLE_ENDIAN__
3388 return __builtin_vsx_xvcvuxwdp(__a);
3389 #else
3390 return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4));
3391 #endif
3392 }
3393
3394 static __inline__ vector double __ATTRS_o_ai
vec_doubleo(vector float __a)3395 vec_doubleo(vector float __a) {
3396 #ifdef __LITTLE_ENDIAN__
3397 return __builtin_vsx_xvcvspdp(__a);
3398 #else
3399 return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4));
3400 #endif
3401 }
3402 #endif
3403
3404 /* vec_div */
3405
3406 /* Integer vector divides (vectors are scalarized, elements divided
3407 and the vectors reassembled).
3408 */
3409 static __inline__ vector signed char __ATTRS_o_ai
vec_div(vector signed char __a,vector signed char __b)3410 vec_div(vector signed char __a, vector signed char __b) {
3411 return __a / __b;
3412 }
3413
3414 static __inline__ vector unsigned char __ATTRS_o_ai
vec_div(vector unsigned char __a,vector unsigned char __b)3415 vec_div(vector unsigned char __a, vector unsigned char __b) {
3416 return __a / __b;
3417 }
3418
3419 static __inline__ vector signed short __ATTRS_o_ai
vec_div(vector signed short __a,vector signed short __b)3420 vec_div(vector signed short __a, vector signed short __b) {
3421 return __a / __b;
3422 }
3423
3424 static __inline__ vector unsigned short __ATTRS_o_ai
vec_div(vector unsigned short __a,vector unsigned short __b)3425 vec_div(vector unsigned short __a, vector unsigned short __b) {
3426 return __a / __b;
3427 }
3428
3429 static __inline__ vector signed int __ATTRS_o_ai
vec_div(vector signed int __a,vector signed int __b)3430 vec_div(vector signed int __a, vector signed int __b) {
3431 return __a / __b;
3432 }
3433
3434 static __inline__ vector unsigned int __ATTRS_o_ai
vec_div(vector unsigned int __a,vector unsigned int __b)3435 vec_div(vector unsigned int __a, vector unsigned int __b) {
3436 return __a / __b;
3437 }
3438
3439 #ifdef __VSX__
3440 static __inline__ vector signed long long __ATTRS_o_ai
vec_div(vector signed long long __a,vector signed long long __b)3441 vec_div(vector signed long long __a, vector signed long long __b) {
3442 return __a / __b;
3443 }
3444
3445 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_div(vector unsigned long long __a,vector unsigned long long __b)3446 vec_div(vector unsigned long long __a, vector unsigned long long __b) {
3447 return __a / __b;
3448 }
3449
vec_div(vector float __a,vector float __b)3450 static __inline__ vector float __ATTRS_o_ai vec_div(vector float __a,
3451 vector float __b) {
3452 return __a / __b;
3453 }
3454
vec_div(vector double __a,vector double __b)3455 static __inline__ vector double __ATTRS_o_ai vec_div(vector double __a,
3456 vector double __b) {
3457 return __a / __b;
3458 }
3459 #endif
3460
3461 /* vec_dive */
3462
3463 #ifdef __POWER10_VECTOR__
3464 static __inline__ vector signed int __ATTRS_o_ai
vec_dive(vector signed int __a,vector signed int __b)3465 vec_dive(vector signed int __a, vector signed int __b) {
3466 return __builtin_altivec_vdivesw(__a, __b);
3467 }
3468
3469 static __inline__ vector unsigned int __ATTRS_o_ai
vec_dive(vector unsigned int __a,vector unsigned int __b)3470 vec_dive(vector unsigned int __a, vector unsigned int __b) {
3471 return __builtin_altivec_vdiveuw(__a, __b);
3472 }
3473
3474 static __inline__ vector signed long long __ATTRS_o_ai
vec_dive(vector signed long long __a,vector signed long long __b)3475 vec_dive(vector signed long long __a, vector signed long long __b) {
3476 return __builtin_altivec_vdivesd(__a, __b);
3477 }
3478
3479 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_dive(vector unsigned long long __a,vector unsigned long long __b)3480 vec_dive(vector unsigned long long __a, vector unsigned long long __b) {
3481 return __builtin_altivec_vdiveud(__a, __b);
3482 }
3483
3484 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_dive(vector unsigned __int128 __a,vector unsigned __int128 __b)3485 vec_dive(vector unsigned __int128 __a, vector unsigned __int128 __b) {
3486 return __builtin_altivec_vdiveuq(__a, __b);
3487 }
3488
3489 static __inline__ vector signed __int128 __ATTRS_o_ai
vec_dive(vector signed __int128 __a,vector signed __int128 __b)3490 vec_dive(vector signed __int128 __a, vector signed __int128 __b) {
3491 return __builtin_altivec_vdivesq(__a, __b);
3492 }
3493 #endif
3494
3495 #ifdef __POWER10_VECTOR__
3496 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_div(vector unsigned __int128 __a,vector unsigned __int128 __b)3497 vec_div(vector unsigned __int128 __a, vector unsigned __int128 __b) {
3498 return __a / __b;
3499 }
3500
3501 static __inline__ vector signed __int128 __ATTRS_o_ai
vec_div(vector signed __int128 __a,vector signed __int128 __b)3502 vec_div(vector signed __int128 __a, vector signed __int128 __b) {
3503 return __a / __b;
3504 }
3505 #endif /* __POWER10_VECTOR__ */
3506
3507 /* vec_xvtdiv */
3508
3509 #ifdef __VSX__
vec_test_swdiv(vector double __a,vector double __b)3510 static __inline__ int __ATTRS_o_ai vec_test_swdiv(vector double __a,
3511 vector double __b) {
3512 return __builtin_vsx_xvtdivdp(__a, __b);
3513 }
3514
vec_test_swdivs(vector float __a,vector float __b)3515 static __inline__ int __ATTRS_o_ai vec_test_swdivs(vector float __a,
3516 vector float __b) {
3517 return __builtin_vsx_xvtdivsp(__a, __b);
3518 }
3519 #endif
3520
3521 /* vec_dss */
3522
3523 #define vec_dss __builtin_altivec_dss
3524
3525 /* vec_dssall */
3526
vec_dssall(void)3527 static __inline__ void __attribute__((__always_inline__)) vec_dssall(void) {
3528 __builtin_altivec_dssall();
3529 }
3530
3531 /* vec_dst */
3532 #define vec_dst(__PTR, __CW, __STR) \
3533 __builtin_altivec_dst((const void *)(__PTR), (__CW), (__STR))
3534
3535 /* vec_dstst */
3536 #define vec_dstst(__PTR, __CW, __STR) \
3537 __builtin_altivec_dstst((const void *)(__PTR), (__CW), (__STR))
3538
3539 /* vec_dststt */
3540 #define vec_dststt(__PTR, __CW, __STR) \
3541 __builtin_altivec_dststt((const void *)(__PTR), (__CW), (__STR))
3542
3543 /* vec_dstt */
3544 #define vec_dstt(__PTR, __CW, __STR) \
3545 __builtin_altivec_dstt((const void *)(__PTR), (__CW), (__STR))
3546
3547 /* vec_eqv */
3548
3549 #ifdef __POWER8_VECTOR__
3550 static __inline__ vector signed char __ATTRS_o_ai
vec_eqv(vector signed char __a,vector signed char __b)3551 vec_eqv(vector signed char __a, vector signed char __b) {
3552 return (vector signed char)__builtin_vsx_xxleqv((vector unsigned int)__a,
3553 (vector unsigned int)__b);
3554 }
3555
3556 static __inline__ vector unsigned char __ATTRS_o_ai
vec_eqv(vector unsigned char __a,vector unsigned char __b)3557 vec_eqv(vector unsigned char __a, vector unsigned char __b) {
3558 return (vector unsigned char)__builtin_vsx_xxleqv((vector unsigned int)__a,
3559 (vector unsigned int)__b);
3560 }
3561
vec_eqv(vector bool char __a,vector bool char __b)3562 static __inline__ vector bool char __ATTRS_o_ai vec_eqv(vector bool char __a,
3563 vector bool char __b) {
3564 return (vector bool char)__builtin_vsx_xxleqv((vector unsigned int)__a,
3565 (vector unsigned int)__b);
3566 }
3567
3568 static __inline__ vector signed short __ATTRS_o_ai
vec_eqv(vector signed short __a,vector signed short __b)3569 vec_eqv(vector signed short __a, vector signed short __b) {
3570 return (vector signed short)__builtin_vsx_xxleqv((vector unsigned int)__a,
3571 (vector unsigned int)__b);
3572 }
3573
3574 static __inline__ vector unsigned short __ATTRS_o_ai
vec_eqv(vector unsigned short __a,vector unsigned short __b)3575 vec_eqv(vector unsigned short __a, vector unsigned short __b) {
3576 return (vector unsigned short)__builtin_vsx_xxleqv((vector unsigned int)__a,
3577 (vector unsigned int)__b);
3578 }
3579
3580 static __inline__ vector bool short __ATTRS_o_ai
vec_eqv(vector bool short __a,vector bool short __b)3581 vec_eqv(vector bool short __a, vector bool short __b) {
3582 return (vector bool short)__builtin_vsx_xxleqv((vector unsigned int)__a,
3583 (vector unsigned int)__b);
3584 }
3585
3586 static __inline__ vector signed int __ATTRS_o_ai
vec_eqv(vector signed int __a,vector signed int __b)3587 vec_eqv(vector signed int __a, vector signed int __b) {
3588 return (vector signed int)__builtin_vsx_xxleqv((vector unsigned int)__a,
3589 (vector unsigned int)__b);
3590 }
3591
3592 static __inline__ vector unsigned int __ATTRS_o_ai
vec_eqv(vector unsigned int __a,vector unsigned int __b)3593 vec_eqv(vector unsigned int __a, vector unsigned int __b) {
3594 return __builtin_vsx_xxleqv(__a, __b);
3595 }
3596
vec_eqv(vector bool int __a,vector bool int __b)3597 static __inline__ vector bool int __ATTRS_o_ai vec_eqv(vector bool int __a,
3598 vector bool int __b) {
3599 return (vector bool int)__builtin_vsx_xxleqv((vector unsigned int)__a,
3600 (vector unsigned int)__b);
3601 }
3602
3603 static __inline__ vector signed long long __ATTRS_o_ai
vec_eqv(vector signed long long __a,vector signed long long __b)3604 vec_eqv(vector signed long long __a, vector signed long long __b) {
3605 return (vector signed long long)__builtin_vsx_xxleqv(
3606 (vector unsigned int)__a, (vector unsigned int)__b);
3607 }
3608
3609 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_eqv(vector unsigned long long __a,vector unsigned long long __b)3610 vec_eqv(vector unsigned long long __a, vector unsigned long long __b) {
3611 return (vector unsigned long long)__builtin_vsx_xxleqv(
3612 (vector unsigned int)__a, (vector unsigned int)__b);
3613 }
3614
3615 static __inline__ vector bool long long __ATTRS_o_ai
vec_eqv(vector bool long long __a,vector bool long long __b)3616 vec_eqv(vector bool long long __a, vector bool long long __b) {
3617 return (vector bool long long)__builtin_vsx_xxleqv((vector unsigned int)__a,
3618 (vector unsigned int)__b);
3619 }
3620
vec_eqv(vector float __a,vector float __b)3621 static __inline__ vector float __ATTRS_o_ai vec_eqv(vector float __a,
3622 vector float __b) {
3623 return (vector float)__builtin_vsx_xxleqv((vector unsigned int)__a,
3624 (vector unsigned int)__b);
3625 }
3626
vec_eqv(vector double __a,vector double __b)3627 static __inline__ vector double __ATTRS_o_ai vec_eqv(vector double __a,
3628 vector double __b) {
3629 return (vector double)__builtin_vsx_xxleqv((vector unsigned int)__a,
3630 (vector unsigned int)__b);
3631 }
3632 #endif
3633
3634 /* vec_expte */
3635
3636 static __inline__ vector float __attribute__((__always_inline__))
vec_expte(vector float __a)3637 vec_expte(vector float __a) {
3638 return __builtin_altivec_vexptefp(__a);
3639 }
3640
3641 /* vec_vexptefp */
3642
3643 static __inline__ vector float __attribute__((__always_inline__))
vec_vexptefp(vector float __a)3644 vec_vexptefp(vector float __a) {
3645 return __builtin_altivec_vexptefp(__a);
3646 }
3647
3648 /* vec_floor */
3649
vec_floor(vector float __a)3650 static __inline__ vector float __ATTRS_o_ai vec_floor(vector float __a) {
3651 #ifdef __VSX__
3652 return __builtin_vsx_xvrspim(__a);
3653 #else
3654 return __builtin_altivec_vrfim(__a);
3655 #endif
3656 }
3657
3658 #ifdef __VSX__
vec_floor(vector double __a)3659 static __inline__ vector double __ATTRS_o_ai vec_floor(vector double __a) {
3660 return __builtin_vsx_xvrdpim(__a);
3661 }
3662 #endif
3663
3664 /* vec_vrfim */
3665
3666 static __inline__ vector float __attribute__((__always_inline__))
vec_vrfim(vector float __a)3667 vec_vrfim(vector float __a) {
3668 return __builtin_altivec_vrfim(__a);
3669 }
3670
3671 /* vec_ld */
3672
3673 static __inline__ vector signed char __ATTRS_o_ai
vec_ld(int __a,const vector signed char * __b)3674 vec_ld(int __a, const vector signed char *__b) {
3675 return (vector signed char)__builtin_altivec_lvx(__a, __b);
3676 }
3677
3678 static __inline__ vector signed char __ATTRS_o_ai
vec_ld(int __a,const signed char * __b)3679 vec_ld(int __a, const signed char *__b) {
3680 return (vector signed char)__builtin_altivec_lvx(__a, __b);
3681 }
3682
3683 static __inline__ vector unsigned char __ATTRS_o_ai
vec_ld(int __a,const vector unsigned char * __b)3684 vec_ld(int __a, const vector unsigned char *__b) {
3685 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
3686 }
3687
3688 static __inline__ vector unsigned char __ATTRS_o_ai
vec_ld(int __a,const unsigned char * __b)3689 vec_ld(int __a, const unsigned char *__b) {
3690 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
3691 }
3692
3693 static __inline__ vector bool char __ATTRS_o_ai
vec_ld(int __a,const vector bool char * __b)3694 vec_ld(int __a, const vector bool char *__b) {
3695 return (vector bool char)__builtin_altivec_lvx(__a, __b);
3696 }
3697
vec_ld(int __a,const vector short * __b)3698 static __inline__ vector short __ATTRS_o_ai vec_ld(int __a,
3699 const vector short *__b) {
3700 return (vector short)__builtin_altivec_lvx(__a, __b);
3701 }
3702
vec_ld(int __a,const short * __b)3703 static __inline__ vector short __ATTRS_o_ai vec_ld(int __a, const short *__b) {
3704 return (vector short)__builtin_altivec_lvx(__a, __b);
3705 }
3706
3707 static __inline__ vector unsigned short __ATTRS_o_ai
vec_ld(int __a,const vector unsigned short * __b)3708 vec_ld(int __a, const vector unsigned short *__b) {
3709 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
3710 }
3711
3712 static __inline__ vector unsigned short __ATTRS_o_ai
vec_ld(int __a,const unsigned short * __b)3713 vec_ld(int __a, const unsigned short *__b) {
3714 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
3715 }
3716
3717 static __inline__ vector bool short __ATTRS_o_ai
vec_ld(int __a,const vector bool short * __b)3718 vec_ld(int __a, const vector bool short *__b) {
3719 return (vector bool short)__builtin_altivec_lvx(__a, __b);
3720 }
3721
vec_ld(int __a,const vector pixel * __b)3722 static __inline__ vector pixel __ATTRS_o_ai vec_ld(int __a,
3723 const vector pixel *__b) {
3724 return (vector pixel)__builtin_altivec_lvx(__a, __b);
3725 }
3726
vec_ld(int __a,const vector int * __b)3727 static __inline__ vector int __ATTRS_o_ai vec_ld(int __a,
3728 const vector int *__b) {
3729 return (vector int)__builtin_altivec_lvx(__a, __b);
3730 }
3731
vec_ld(int __a,const int * __b)3732 static __inline__ vector int __ATTRS_o_ai vec_ld(int __a, const int *__b) {
3733 return (vector int)__builtin_altivec_lvx(__a, __b);
3734 }
3735
3736 static __inline__ vector unsigned int __ATTRS_o_ai
vec_ld(int __a,const vector unsigned int * __b)3737 vec_ld(int __a, const vector unsigned int *__b) {
3738 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
3739 }
3740
3741 static __inline__ vector unsigned int __ATTRS_o_ai
vec_ld(int __a,const unsigned int * __b)3742 vec_ld(int __a, const unsigned int *__b) {
3743 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
3744 }
3745
3746 static __inline__ vector bool int __ATTRS_o_ai
vec_ld(int __a,const vector bool int * __b)3747 vec_ld(int __a, const vector bool int *__b) {
3748 return (vector bool int)__builtin_altivec_lvx(__a, __b);
3749 }
3750
vec_ld(int __a,const vector float * __b)3751 static __inline__ vector float __ATTRS_o_ai vec_ld(int __a,
3752 const vector float *__b) {
3753 return (vector float)__builtin_altivec_lvx(__a, __b);
3754 }
3755
vec_ld(int __a,const float * __b)3756 static __inline__ vector float __ATTRS_o_ai vec_ld(int __a, const float *__b) {
3757 return (vector float)__builtin_altivec_lvx(__a, __b);
3758 }
3759
3760 /* vec_lvx */
3761
3762 static __inline__ vector signed char __ATTRS_o_ai
vec_lvx(int __a,const vector signed char * __b)3763 vec_lvx(int __a, const vector signed char *__b) {
3764 return (vector signed char)__builtin_altivec_lvx(__a, __b);
3765 }
3766
3767 static __inline__ vector signed char __ATTRS_o_ai
vec_lvx(int __a,const signed char * __b)3768 vec_lvx(int __a, const signed char *__b) {
3769 return (vector signed char)__builtin_altivec_lvx(__a, __b);
3770 }
3771
3772 static __inline__ vector unsigned char __ATTRS_o_ai
vec_lvx(int __a,const vector unsigned char * __b)3773 vec_lvx(int __a, const vector unsigned char *__b) {
3774 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
3775 }
3776
3777 static __inline__ vector unsigned char __ATTRS_o_ai
vec_lvx(int __a,const unsigned char * __b)3778 vec_lvx(int __a, const unsigned char *__b) {
3779 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
3780 }
3781
3782 static __inline__ vector bool char __ATTRS_o_ai
vec_lvx(int __a,const vector bool char * __b)3783 vec_lvx(int __a, const vector bool char *__b) {
3784 return (vector bool char)__builtin_altivec_lvx(__a, __b);
3785 }
3786
vec_lvx(int __a,const vector short * __b)3787 static __inline__ vector short __ATTRS_o_ai vec_lvx(int __a,
3788 const vector short *__b) {
3789 return (vector short)__builtin_altivec_lvx(__a, __b);
3790 }
3791
vec_lvx(int __a,const short * __b)3792 static __inline__ vector short __ATTRS_o_ai vec_lvx(int __a, const short *__b) {
3793 return (vector short)__builtin_altivec_lvx(__a, __b);
3794 }
3795
3796 static __inline__ vector unsigned short __ATTRS_o_ai
vec_lvx(int __a,const vector unsigned short * __b)3797 vec_lvx(int __a, const vector unsigned short *__b) {
3798 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
3799 }
3800
3801 static __inline__ vector unsigned short __ATTRS_o_ai
vec_lvx(int __a,const unsigned short * __b)3802 vec_lvx(int __a, const unsigned short *__b) {
3803 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
3804 }
3805
3806 static __inline__ vector bool short __ATTRS_o_ai
vec_lvx(int __a,const vector bool short * __b)3807 vec_lvx(int __a, const vector bool short *__b) {
3808 return (vector bool short)__builtin_altivec_lvx(__a, __b);
3809 }
3810
vec_lvx(int __a,const vector pixel * __b)3811 static __inline__ vector pixel __ATTRS_o_ai vec_lvx(int __a,
3812 const vector pixel *__b) {
3813 return (vector pixel)__builtin_altivec_lvx(__a, __b);
3814 }
3815
vec_lvx(int __a,const vector int * __b)3816 static __inline__ vector int __ATTRS_o_ai vec_lvx(int __a,
3817 const vector int *__b) {
3818 return (vector int)__builtin_altivec_lvx(__a, __b);
3819 }
3820
vec_lvx(int __a,const int * __b)3821 static __inline__ vector int __ATTRS_o_ai vec_lvx(int __a, const int *__b) {
3822 return (vector int)__builtin_altivec_lvx(__a, __b);
3823 }
3824
3825 static __inline__ vector unsigned int __ATTRS_o_ai
vec_lvx(int __a,const vector unsigned int * __b)3826 vec_lvx(int __a, const vector unsigned int *__b) {
3827 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
3828 }
3829
3830 static __inline__ vector unsigned int __ATTRS_o_ai
vec_lvx(int __a,const unsigned int * __b)3831 vec_lvx(int __a, const unsigned int *__b) {
3832 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
3833 }
3834
3835 static __inline__ vector bool int __ATTRS_o_ai
vec_lvx(int __a,const vector bool int * __b)3836 vec_lvx(int __a, const vector bool int *__b) {
3837 return (vector bool int)__builtin_altivec_lvx(__a, __b);
3838 }
3839
vec_lvx(int __a,const vector float * __b)3840 static __inline__ vector float __ATTRS_o_ai vec_lvx(int __a,
3841 const vector float *__b) {
3842 return (vector float)__builtin_altivec_lvx(__a, __b);
3843 }
3844
vec_lvx(int __a,const float * __b)3845 static __inline__ vector float __ATTRS_o_ai vec_lvx(int __a, const float *__b) {
3846 return (vector float)__builtin_altivec_lvx(__a, __b);
3847 }
3848
3849 /* vec_lde */
3850
3851 static __inline__ vector signed char __ATTRS_o_ai
vec_lde(int __a,const signed char * __b)3852 vec_lde(int __a, const signed char *__b) {
3853 return (vector signed char)__builtin_altivec_lvebx(__a, __b);
3854 }
3855
3856 static __inline__ vector unsigned char __ATTRS_o_ai
vec_lde(int __a,const unsigned char * __b)3857 vec_lde(int __a, const unsigned char *__b) {
3858 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
3859 }
3860
vec_lde(int __a,const short * __b)3861 static __inline__ vector short __ATTRS_o_ai vec_lde(int __a, const short *__b) {
3862 return (vector short)__builtin_altivec_lvehx(__a, __b);
3863 }
3864
3865 static __inline__ vector unsigned short __ATTRS_o_ai
vec_lde(int __a,const unsigned short * __b)3866 vec_lde(int __a, const unsigned short *__b) {
3867 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
3868 }
3869
vec_lde(int __a,const int * __b)3870 static __inline__ vector int __ATTRS_o_ai vec_lde(int __a, const int *__b) {
3871 return (vector int)__builtin_altivec_lvewx(__a, __b);
3872 }
3873
3874 static __inline__ vector unsigned int __ATTRS_o_ai
vec_lde(int __a,const unsigned int * __b)3875 vec_lde(int __a, const unsigned int *__b) {
3876 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
3877 }
3878
vec_lde(int __a,const float * __b)3879 static __inline__ vector float __ATTRS_o_ai vec_lde(int __a, const float *__b) {
3880 return (vector float)__builtin_altivec_lvewx(__a, __b);
3881 }
3882
3883 /* vec_lvebx */
3884
3885 static __inline__ vector signed char __ATTRS_o_ai
vec_lvebx(int __a,const signed char * __b)3886 vec_lvebx(int __a, const signed char *__b) {
3887 return (vector signed char)__builtin_altivec_lvebx(__a, __b);
3888 }
3889
3890 static __inline__ vector unsigned char __ATTRS_o_ai
vec_lvebx(int __a,const unsigned char * __b)3891 vec_lvebx(int __a, const unsigned char *__b) {
3892 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
3893 }
3894
3895 /* vec_lvehx */
3896
vec_lvehx(int __a,const short * __b)3897 static __inline__ vector short __ATTRS_o_ai vec_lvehx(int __a,
3898 const short *__b) {
3899 return (vector short)__builtin_altivec_lvehx(__a, __b);
3900 }
3901
3902 static __inline__ vector unsigned short __ATTRS_o_ai
vec_lvehx(int __a,const unsigned short * __b)3903 vec_lvehx(int __a, const unsigned short *__b) {
3904 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
3905 }
3906
3907 /* vec_lvewx */
3908
vec_lvewx(int __a,const int * __b)3909 static __inline__ vector int __ATTRS_o_ai vec_lvewx(int __a, const int *__b) {
3910 return (vector int)__builtin_altivec_lvewx(__a, __b);
3911 }
3912
3913 static __inline__ vector unsigned int __ATTRS_o_ai
vec_lvewx(int __a,const unsigned int * __b)3914 vec_lvewx(int __a, const unsigned int *__b) {
3915 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
3916 }
3917
vec_lvewx(int __a,const float * __b)3918 static __inline__ vector float __ATTRS_o_ai vec_lvewx(int __a,
3919 const float *__b) {
3920 return (vector float)__builtin_altivec_lvewx(__a, __b);
3921 }
3922
3923 /* vec_ldl */
3924
3925 static __inline__ vector signed char __ATTRS_o_ai
vec_ldl(int __a,const vector signed char * __b)3926 vec_ldl(int __a, const vector signed char *__b) {
3927 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
3928 }
3929
3930 static __inline__ vector signed char __ATTRS_o_ai
vec_ldl(int __a,const signed char * __b)3931 vec_ldl(int __a, const signed char *__b) {
3932 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
3933 }
3934
3935 static __inline__ vector unsigned char __ATTRS_o_ai
vec_ldl(int __a,const vector unsigned char * __b)3936 vec_ldl(int __a, const vector unsigned char *__b) {
3937 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
3938 }
3939
3940 static __inline__ vector unsigned char __ATTRS_o_ai
vec_ldl(int __a,const unsigned char * __b)3941 vec_ldl(int __a, const unsigned char *__b) {
3942 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
3943 }
3944
3945 static __inline__ vector bool char __ATTRS_o_ai
vec_ldl(int __a,const vector bool char * __b)3946 vec_ldl(int __a, const vector bool char *__b) {
3947 return (vector bool char)__builtin_altivec_lvxl(__a, __b);
3948 }
3949
vec_ldl(int __a,const vector short * __b)3950 static __inline__ vector short __ATTRS_o_ai vec_ldl(int __a,
3951 const vector short *__b) {
3952 return (vector short)__builtin_altivec_lvxl(__a, __b);
3953 }
3954
vec_ldl(int __a,const short * __b)3955 static __inline__ vector short __ATTRS_o_ai vec_ldl(int __a, const short *__b) {
3956 return (vector short)__builtin_altivec_lvxl(__a, __b);
3957 }
3958
3959 static __inline__ vector unsigned short __ATTRS_o_ai
vec_ldl(int __a,const vector unsigned short * __b)3960 vec_ldl(int __a, const vector unsigned short *__b) {
3961 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
3962 }
3963
3964 static __inline__ vector unsigned short __ATTRS_o_ai
vec_ldl(int __a,const unsigned short * __b)3965 vec_ldl(int __a, const unsigned short *__b) {
3966 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
3967 }
3968
3969 static __inline__ vector bool short __ATTRS_o_ai
vec_ldl(int __a,const vector bool short * __b)3970 vec_ldl(int __a, const vector bool short *__b) {
3971 return (vector bool short)__builtin_altivec_lvxl(__a, __b);
3972 }
3973
vec_ldl(int __a,const vector pixel * __b)3974 static __inline__ vector pixel __ATTRS_o_ai vec_ldl(int __a,
3975 const vector pixel *__b) {
3976 return (vector pixel short)__builtin_altivec_lvxl(__a, __b);
3977 }
3978
vec_ldl(int __a,const vector int * __b)3979 static __inline__ vector int __ATTRS_o_ai vec_ldl(int __a,
3980 const vector int *__b) {
3981 return (vector int)__builtin_altivec_lvxl(__a, __b);
3982 }
3983
vec_ldl(int __a,const int * __b)3984 static __inline__ vector int __ATTRS_o_ai vec_ldl(int __a, const int *__b) {
3985 return (vector int)__builtin_altivec_lvxl(__a, __b);
3986 }
3987
3988 static __inline__ vector unsigned int __ATTRS_o_ai
vec_ldl(int __a,const vector unsigned int * __b)3989 vec_ldl(int __a, const vector unsigned int *__b) {
3990 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
3991 }
3992
3993 static __inline__ vector unsigned int __ATTRS_o_ai
vec_ldl(int __a,const unsigned int * __b)3994 vec_ldl(int __a, const unsigned int *__b) {
3995 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
3996 }
3997
3998 static __inline__ vector bool int __ATTRS_o_ai
vec_ldl(int __a,const vector bool int * __b)3999 vec_ldl(int __a, const vector bool int *__b) {
4000 return (vector bool int)__builtin_altivec_lvxl(__a, __b);
4001 }
4002
vec_ldl(int __a,const vector float * __b)4003 static __inline__ vector float __ATTRS_o_ai vec_ldl(int __a,
4004 const vector float *__b) {
4005 return (vector float)__builtin_altivec_lvxl(__a, __b);
4006 }
4007
vec_ldl(int __a,const float * __b)4008 static __inline__ vector float __ATTRS_o_ai vec_ldl(int __a, const float *__b) {
4009 return (vector float)__builtin_altivec_lvxl(__a, __b);
4010 }
4011
4012 /* vec_lvxl */
4013
4014 static __inline__ vector signed char __ATTRS_o_ai
vec_lvxl(int __a,const vector signed char * __b)4015 vec_lvxl(int __a, const vector signed char *__b) {
4016 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
4017 }
4018
4019 static __inline__ vector signed char __ATTRS_o_ai
vec_lvxl(int __a,const signed char * __b)4020 vec_lvxl(int __a, const signed char *__b) {
4021 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
4022 }
4023
4024 static __inline__ vector unsigned char __ATTRS_o_ai
vec_lvxl(int __a,const vector unsigned char * __b)4025 vec_lvxl(int __a, const vector unsigned char *__b) {
4026 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
4027 }
4028
4029 static __inline__ vector unsigned char __ATTRS_o_ai
vec_lvxl(int __a,const unsigned char * __b)4030 vec_lvxl(int __a, const unsigned char *__b) {
4031 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
4032 }
4033
4034 static __inline__ vector bool char __ATTRS_o_ai
vec_lvxl(int __a,const vector bool char * __b)4035 vec_lvxl(int __a, const vector bool char *__b) {
4036 return (vector bool char)__builtin_altivec_lvxl(__a, __b);
4037 }
4038
vec_lvxl(int __a,const vector short * __b)4039 static __inline__ vector short __ATTRS_o_ai vec_lvxl(int __a,
4040 const vector short *__b) {
4041 return (vector short)__builtin_altivec_lvxl(__a, __b);
4042 }
4043
vec_lvxl(int __a,const short * __b)4044 static __inline__ vector short __ATTRS_o_ai vec_lvxl(int __a,
4045 const short *__b) {
4046 return (vector short)__builtin_altivec_lvxl(__a, __b);
4047 }
4048
4049 static __inline__ vector unsigned short __ATTRS_o_ai
vec_lvxl(int __a,const vector unsigned short * __b)4050 vec_lvxl(int __a, const vector unsigned short *__b) {
4051 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
4052 }
4053
4054 static __inline__ vector unsigned short __ATTRS_o_ai
vec_lvxl(int __a,const unsigned short * __b)4055 vec_lvxl(int __a, const unsigned short *__b) {
4056 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
4057 }
4058
4059 static __inline__ vector bool short __ATTRS_o_ai
vec_lvxl(int __a,const vector bool short * __b)4060 vec_lvxl(int __a, const vector bool short *__b) {
4061 return (vector bool short)__builtin_altivec_lvxl(__a, __b);
4062 }
4063
vec_lvxl(int __a,const vector pixel * __b)4064 static __inline__ vector pixel __ATTRS_o_ai vec_lvxl(int __a,
4065 const vector pixel *__b) {
4066 return (vector pixel)__builtin_altivec_lvxl(__a, __b);
4067 }
4068
vec_lvxl(int __a,const vector int * __b)4069 static __inline__ vector int __ATTRS_o_ai vec_lvxl(int __a,
4070 const vector int *__b) {
4071 return (vector int)__builtin_altivec_lvxl(__a, __b);
4072 }
4073
vec_lvxl(int __a,const int * __b)4074 static __inline__ vector int __ATTRS_o_ai vec_lvxl(int __a, const int *__b) {
4075 return (vector int)__builtin_altivec_lvxl(__a, __b);
4076 }
4077
4078 static __inline__ vector unsigned int __ATTRS_o_ai
vec_lvxl(int __a,const vector unsigned int * __b)4079 vec_lvxl(int __a, const vector unsigned int *__b) {
4080 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
4081 }
4082
4083 static __inline__ vector unsigned int __ATTRS_o_ai
vec_lvxl(int __a,const unsigned int * __b)4084 vec_lvxl(int __a, const unsigned int *__b) {
4085 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
4086 }
4087
4088 static __inline__ vector bool int __ATTRS_o_ai
vec_lvxl(int __a,const vector bool int * __b)4089 vec_lvxl(int __a, const vector bool int *__b) {
4090 return (vector bool int)__builtin_altivec_lvxl(__a, __b);
4091 }
4092
vec_lvxl(int __a,const vector float * __b)4093 static __inline__ vector float __ATTRS_o_ai vec_lvxl(int __a,
4094 const vector float *__b) {
4095 return (vector float)__builtin_altivec_lvxl(__a, __b);
4096 }
4097
vec_lvxl(int __a,const float * __b)4098 static __inline__ vector float __ATTRS_o_ai vec_lvxl(int __a,
4099 const float *__b) {
4100 return (vector float)__builtin_altivec_lvxl(__a, __b);
4101 }
4102
4103 /* vec_loge */
4104
4105 static __inline__ vector float __attribute__((__always_inline__))
vec_loge(vector float __a)4106 vec_loge(vector float __a) {
4107 return __builtin_altivec_vlogefp(__a);
4108 }
4109
4110 /* vec_vlogefp */
4111
4112 static __inline__ vector float __attribute__((__always_inline__))
vec_vlogefp(vector float __a)4113 vec_vlogefp(vector float __a) {
4114 return __builtin_altivec_vlogefp(__a);
4115 }
4116
4117 /* vec_lvsl */
4118
4119 #ifdef __LITTLE_ENDIAN__
4120 static __inline__ vector unsigned char __ATTRS_o_ai
4121 __attribute__((__deprecated__("use assignment for unaligned little endian \
vec_lvsl(int __a,const signed char * __b)4122 loads/stores"))) vec_lvsl(int __a, const signed char *__b) {
4123 vector unsigned char mask =
4124 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4125 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4126 7, 6, 5, 4, 3, 2, 1, 0};
4127 return vec_perm(mask, mask, reverse);
4128 }
4129 #else
4130 static __inline__ vector unsigned char __ATTRS_o_ai
vec_lvsl(int __a,const signed char * __b)4131 vec_lvsl(int __a, const signed char *__b) {
4132 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4133 }
4134 #endif
4135
4136 #ifdef __LITTLE_ENDIAN__
4137 static __inline__ vector unsigned char __ATTRS_o_ai
4138 __attribute__((__deprecated__("use assignment for unaligned little endian \
vec_lvsl(int __a,const unsigned char * __b)4139 loads/stores"))) vec_lvsl(int __a, const unsigned char *__b) {
4140 vector unsigned char mask =
4141 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4142 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4143 7, 6, 5, 4, 3, 2, 1, 0};
4144 return vec_perm(mask, mask, reverse);
4145 }
4146 #else
4147 static __inline__ vector unsigned char __ATTRS_o_ai
vec_lvsl(int __a,const unsigned char * __b)4148 vec_lvsl(int __a, const unsigned char *__b) {
4149 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4150 }
4151 #endif
4152
4153 #ifdef __LITTLE_ENDIAN__
4154 static __inline__ vector unsigned char __ATTRS_o_ai
4155 __attribute__((__deprecated__("use assignment for unaligned little endian \
vec_lvsl(int __a,const short * __b)4156 loads/stores"))) vec_lvsl(int __a, const short *__b) {
4157 vector unsigned char mask =
4158 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4159 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4160 7, 6, 5, 4, 3, 2, 1, 0};
4161 return vec_perm(mask, mask, reverse);
4162 }
4163 #else
vec_lvsl(int __a,const short * __b)4164 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
4165 const short *__b) {
4166 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4167 }
4168 #endif
4169
4170 #ifdef __LITTLE_ENDIAN__
4171 static __inline__ vector unsigned char __ATTRS_o_ai
4172 __attribute__((__deprecated__("use assignment for unaligned little endian \
vec_lvsl(int __a,const unsigned short * __b)4173 loads/stores"))) vec_lvsl(int __a, const unsigned short *__b) {
4174 vector unsigned char mask =
4175 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4176 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4177 7, 6, 5, 4, 3, 2, 1, 0};
4178 return vec_perm(mask, mask, reverse);
4179 }
4180 #else
4181 static __inline__ vector unsigned char __ATTRS_o_ai
vec_lvsl(int __a,const unsigned short * __b)4182 vec_lvsl(int __a, const unsigned short *__b) {
4183 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4184 }
4185 #endif
4186
4187 #ifdef __LITTLE_ENDIAN__
4188 static __inline__ vector unsigned char __ATTRS_o_ai
4189 __attribute__((__deprecated__("use assignment for unaligned little endian \
vec_lvsl(int __a,const int * __b)4190 loads/stores"))) vec_lvsl(int __a, const int *__b) {
4191 vector unsigned char mask =
4192 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4193 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4194 7, 6, 5, 4, 3, 2, 1, 0};
4195 return vec_perm(mask, mask, reverse);
4196 }
4197 #else
vec_lvsl(int __a,const int * __b)4198 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
4199 const int *__b) {
4200 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4201 }
4202 #endif
4203
4204 #ifdef __LITTLE_ENDIAN__
4205 static __inline__ vector unsigned char __ATTRS_o_ai
4206 __attribute__((__deprecated__("use assignment for unaligned little endian \
vec_lvsl(int __a,const unsigned int * __b)4207 loads/stores"))) vec_lvsl(int __a, const unsigned int *__b) {
4208 vector unsigned char mask =
4209 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4210 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4211 7, 6, 5, 4, 3, 2, 1, 0};
4212 return vec_perm(mask, mask, reverse);
4213 }
4214 #else
4215 static __inline__ vector unsigned char __ATTRS_o_ai
vec_lvsl(int __a,const unsigned int * __b)4216 vec_lvsl(int __a, const unsigned int *__b) {
4217 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4218 }
4219 #endif
4220
4221 #ifdef __LITTLE_ENDIAN__
4222 static __inline__ vector unsigned char __ATTRS_o_ai
4223 __attribute__((__deprecated__("use assignment for unaligned little endian \
vec_lvsl(int __a,const float * __b)4224 loads/stores"))) vec_lvsl(int __a, const float *__b) {
4225 vector unsigned char mask =
4226 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4227 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4228 7, 6, 5, 4, 3, 2, 1, 0};
4229 return vec_perm(mask, mask, reverse);
4230 }
4231 #else
vec_lvsl(int __a,const float * __b)4232 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
4233 const float *__b) {
4234 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4235 }
4236 #endif
4237
4238 /* vec_lvsr */
4239
4240 #ifdef __LITTLE_ENDIAN__
4241 static __inline__ vector unsigned char __ATTRS_o_ai
4242 __attribute__((__deprecated__("use assignment for unaligned little endian \
vec_lvsr(int __a,const signed char * __b)4243 loads/stores"))) vec_lvsr(int __a, const signed char *__b) {
4244 vector unsigned char mask =
4245 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4246 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4247 7, 6, 5, 4, 3, 2, 1, 0};
4248 return vec_perm(mask, mask, reverse);
4249 }
4250 #else
4251 static __inline__ vector unsigned char __ATTRS_o_ai
vec_lvsr(int __a,const signed char * __b)4252 vec_lvsr(int __a, const signed char *__b) {
4253 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4254 }
4255 #endif
4256
4257 #ifdef __LITTLE_ENDIAN__
4258 static __inline__ vector unsigned char __ATTRS_o_ai
4259 __attribute__((__deprecated__("use assignment for unaligned little endian \
vec_lvsr(int __a,const unsigned char * __b)4260 loads/stores"))) vec_lvsr(int __a, const unsigned char *__b) {
4261 vector unsigned char mask =
4262 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4263 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4264 7, 6, 5, 4, 3, 2, 1, 0};
4265 return vec_perm(mask, mask, reverse);
4266 }
4267 #else
4268 static __inline__ vector unsigned char __ATTRS_o_ai
vec_lvsr(int __a,const unsigned char * __b)4269 vec_lvsr(int __a, const unsigned char *__b) {
4270 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4271 }
4272 #endif
4273
4274 #ifdef __LITTLE_ENDIAN__
4275 static __inline__ vector unsigned char __ATTRS_o_ai
4276 __attribute__((__deprecated__("use assignment for unaligned little endian \
vec_lvsr(int __a,const short * __b)4277 loads/stores"))) vec_lvsr(int __a, const short *__b) {
4278 vector unsigned char mask =
4279 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4280 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4281 7, 6, 5, 4, 3, 2, 1, 0};
4282 return vec_perm(mask, mask, reverse);
4283 }
4284 #else
vec_lvsr(int __a,const short * __b)4285 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
4286 const short *__b) {
4287 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4288 }
4289 #endif
4290
4291 #ifdef __LITTLE_ENDIAN__
4292 static __inline__ vector unsigned char __ATTRS_o_ai
4293 __attribute__((__deprecated__("use assignment for unaligned little endian \
vec_lvsr(int __a,const unsigned short * __b)4294 loads/stores"))) vec_lvsr(int __a, const unsigned short *__b) {
4295 vector unsigned char mask =
4296 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4297 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4298 7, 6, 5, 4, 3, 2, 1, 0};
4299 return vec_perm(mask, mask, reverse);
4300 }
4301 #else
4302 static __inline__ vector unsigned char __ATTRS_o_ai
vec_lvsr(int __a,const unsigned short * __b)4303 vec_lvsr(int __a, const unsigned short *__b) {
4304 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4305 }
4306 #endif
4307
4308 #ifdef __LITTLE_ENDIAN__
4309 static __inline__ vector unsigned char __ATTRS_o_ai
4310 __attribute__((__deprecated__("use assignment for unaligned little endian \
vec_lvsr(int __a,const int * __b)4311 loads/stores"))) vec_lvsr(int __a, const int *__b) {
4312 vector unsigned char mask =
4313 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4314 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4315 7, 6, 5, 4, 3, 2, 1, 0};
4316 return vec_perm(mask, mask, reverse);
4317 }
4318 #else
vec_lvsr(int __a,const int * __b)4319 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
4320 const int *__b) {
4321 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4322 }
4323 #endif
4324
4325 #ifdef __LITTLE_ENDIAN__
4326 static __inline__ vector unsigned char __ATTRS_o_ai
4327 __attribute__((__deprecated__("use assignment for unaligned little endian \
vec_lvsr(int __a,const unsigned int * __b)4328 loads/stores"))) vec_lvsr(int __a, const unsigned int *__b) {
4329 vector unsigned char mask =
4330 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4331 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4332 7, 6, 5, 4, 3, 2, 1, 0};
4333 return vec_perm(mask, mask, reverse);
4334 }
4335 #else
4336 static __inline__ vector unsigned char __ATTRS_o_ai
vec_lvsr(int __a,const unsigned int * __b)4337 vec_lvsr(int __a, const unsigned int *__b) {
4338 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4339 }
4340 #endif
4341
4342 #ifdef __LITTLE_ENDIAN__
4343 static __inline__ vector unsigned char __ATTRS_o_ai
4344 __attribute__((__deprecated__("use assignment for unaligned little endian \
vec_lvsr(int __a,const float * __b)4345 loads/stores"))) vec_lvsr(int __a, const float *__b) {
4346 vector unsigned char mask =
4347 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4348 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4349 7, 6, 5, 4, 3, 2, 1, 0};
4350 return vec_perm(mask, mask, reverse);
4351 }
4352 #else
vec_lvsr(int __a,const float * __b)4353 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
4354 const float *__b) {
4355 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4356 }
4357 #endif
4358
4359 /* vec_madd */
4360 static __inline__ vector signed short __ATTRS_o_ai
4361 vec_mladd(vector signed short, vector signed short, vector signed short);
4362 static __inline__ vector signed short __ATTRS_o_ai
4363 vec_mladd(vector signed short, vector unsigned short, vector unsigned short);
4364 static __inline__ vector signed short __ATTRS_o_ai
4365 vec_mladd(vector unsigned short, vector signed short, vector signed short);
4366 static __inline__ vector unsigned short __ATTRS_o_ai
4367 vec_mladd(vector unsigned short, vector unsigned short, vector unsigned short);
4368
vec_madd(vector signed short __a,vector signed short __b,vector signed short __c)4369 static __inline__ vector signed short __ATTRS_o_ai vec_madd(
4370 vector signed short __a, vector signed short __b, vector signed short __c) {
4371 return vec_mladd(__a, __b, __c);
4372 }
4373
4374 static __inline__ vector signed short __ATTRS_o_ai
vec_madd(vector signed short __a,vector unsigned short __b,vector unsigned short __c)4375 vec_madd(vector signed short __a, vector unsigned short __b,
4376 vector unsigned short __c) {
4377 return vec_mladd(__a, __b, __c);
4378 }
4379
4380 static __inline__ vector signed short __ATTRS_o_ai
vec_madd(vector unsigned short __a,vector signed short __b,vector signed short __c)4381 vec_madd(vector unsigned short __a, vector signed short __b,
4382 vector signed short __c) {
4383 return vec_mladd(__a, __b, __c);
4384 }
4385
4386 static __inline__ vector unsigned short __ATTRS_o_ai
vec_madd(vector unsigned short __a,vector unsigned short __b,vector unsigned short __c)4387 vec_madd(vector unsigned short __a, vector unsigned short __b,
4388 vector unsigned short __c) {
4389 return vec_mladd(__a, __b, __c);
4390 }
4391
vec_madd(vector float __a,vector float __b,vector float __c)4392 static __inline__ vector float __ATTRS_o_ai vec_madd(vector float __a,
4393 vector float __b,
4394 vector float __c) {
4395 #ifdef __VSX__
4396 return __builtin_vsx_xvmaddasp(__a, __b, __c);
4397 #else
4398 return __builtin_altivec_vmaddfp(__a, __b, __c);
4399 #endif
4400 }
4401
4402 #ifdef __VSX__
vec_madd(vector double __a,vector double __b,vector double __c)4403 static __inline__ vector double __ATTRS_o_ai vec_madd(vector double __a,
4404 vector double __b,
4405 vector double __c) {
4406 return __builtin_vsx_xvmaddadp(__a, __b, __c);
4407 }
4408 #endif
4409
4410 /* vec_vmaddfp */
4411
4412 static __inline__ vector float __attribute__((__always_inline__))
vec_vmaddfp(vector float __a,vector float __b,vector float __c)4413 vec_vmaddfp(vector float __a, vector float __b, vector float __c) {
4414 return __builtin_altivec_vmaddfp(__a, __b, __c);
4415 }
4416
4417 /* vec_madds */
4418
4419 static __inline__ vector signed short __attribute__((__always_inline__))
vec_madds(vector signed short __a,vector signed short __b,vector signed short __c)4420 vec_madds(vector signed short __a, vector signed short __b,
4421 vector signed short __c) {
4422 return __builtin_altivec_vmhaddshs(__a, __b, __c);
4423 }
4424
4425 /* vec_vmhaddshs */
4426 static __inline__ vector signed short __attribute__((__always_inline__))
vec_vmhaddshs(vector signed short __a,vector signed short __b,vector signed short __c)4427 vec_vmhaddshs(vector signed short __a, vector signed short __b,
4428 vector signed short __c) {
4429 return __builtin_altivec_vmhaddshs(__a, __b, __c);
4430 }
4431
4432 /* vec_msub */
4433
4434 #ifdef __VSX__
vec_msub(vector float __a,vector float __b,vector float __c)4435 static __inline__ vector float __ATTRS_o_ai vec_msub(vector float __a,
4436 vector float __b,
4437 vector float __c) {
4438 return __builtin_vsx_xvmsubasp(__a, __b, __c);
4439 }
4440
vec_msub(vector double __a,vector double __b,vector double __c)4441 static __inline__ vector double __ATTRS_o_ai vec_msub(vector double __a,
4442 vector double __b,
4443 vector double __c) {
4444 return __builtin_vsx_xvmsubadp(__a, __b, __c);
4445 }
4446 #endif
4447
4448 /* vec_max */
4449
4450 static __inline__ vector signed char __ATTRS_o_ai
vec_max(vector signed char __a,vector signed char __b)4451 vec_max(vector signed char __a, vector signed char __b) {
4452 return __builtin_altivec_vmaxsb(__a, __b);
4453 }
4454
4455 static __inline__ vector signed char __ATTRS_o_ai
vec_max(vector bool char __a,vector signed char __b)4456 vec_max(vector bool char __a, vector signed char __b) {
4457 return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
4458 }
4459
4460 static __inline__ vector signed char __ATTRS_o_ai
vec_max(vector signed char __a,vector bool char __b)4461 vec_max(vector signed char __a, vector bool char __b) {
4462 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
4463 }
4464
4465 static __inline__ vector unsigned char __ATTRS_o_ai
vec_max(vector unsigned char __a,vector unsigned char __b)4466 vec_max(vector unsigned char __a, vector unsigned char __b) {
4467 return __builtin_altivec_vmaxub(__a, __b);
4468 }
4469
4470 static __inline__ vector unsigned char __ATTRS_o_ai
vec_max(vector bool char __a,vector unsigned char __b)4471 vec_max(vector bool char __a, vector unsigned char __b) {
4472 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
4473 }
4474
4475 static __inline__ vector unsigned char __ATTRS_o_ai
vec_max(vector unsigned char __a,vector bool char __b)4476 vec_max(vector unsigned char __a, vector bool char __b) {
4477 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
4478 }
4479
vec_max(vector short __a,vector short __b)4480 static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a,
4481 vector short __b) {
4482 return __builtin_altivec_vmaxsh(__a, __b);
4483 }
4484
vec_max(vector bool short __a,vector short __b)4485 static __inline__ vector short __ATTRS_o_ai vec_max(vector bool short __a,
4486 vector short __b) {
4487 return __builtin_altivec_vmaxsh((vector short)__a, __b);
4488 }
4489
vec_max(vector short __a,vector bool short __b)4490 static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a,
4491 vector bool short __b) {
4492 return __builtin_altivec_vmaxsh(__a, (vector short)__b);
4493 }
4494
4495 static __inline__ vector unsigned short __ATTRS_o_ai
vec_max(vector unsigned short __a,vector unsigned short __b)4496 vec_max(vector unsigned short __a, vector unsigned short __b) {
4497 return __builtin_altivec_vmaxuh(__a, __b);
4498 }
4499
4500 static __inline__ vector unsigned short __ATTRS_o_ai
vec_max(vector bool short __a,vector unsigned short __b)4501 vec_max(vector bool short __a, vector unsigned short __b) {
4502 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
4503 }
4504
4505 static __inline__ vector unsigned short __ATTRS_o_ai
vec_max(vector unsigned short __a,vector bool short __b)4506 vec_max(vector unsigned short __a, vector bool short __b) {
4507 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
4508 }
4509
vec_max(vector int __a,vector int __b)4510 static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a,
4511 vector int __b) {
4512 return __builtin_altivec_vmaxsw(__a, __b);
4513 }
4514
vec_max(vector bool int __a,vector int __b)4515 static __inline__ vector int __ATTRS_o_ai vec_max(vector bool int __a,
4516 vector int __b) {
4517 return __builtin_altivec_vmaxsw((vector int)__a, __b);
4518 }
4519
vec_max(vector int __a,vector bool int __b)4520 static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a,
4521 vector bool int __b) {
4522 return __builtin_altivec_vmaxsw(__a, (vector int)__b);
4523 }
4524
4525 static __inline__ vector unsigned int __ATTRS_o_ai
vec_max(vector unsigned int __a,vector unsigned int __b)4526 vec_max(vector unsigned int __a, vector unsigned int __b) {
4527 return __builtin_altivec_vmaxuw(__a, __b);
4528 }
4529
4530 static __inline__ vector unsigned int __ATTRS_o_ai
vec_max(vector bool int __a,vector unsigned int __b)4531 vec_max(vector bool int __a, vector unsigned int __b) {
4532 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
4533 }
4534
4535 static __inline__ vector unsigned int __ATTRS_o_ai
vec_max(vector unsigned int __a,vector bool int __b)4536 vec_max(vector unsigned int __a, vector bool int __b) {
4537 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
4538 }
4539
4540 #ifdef __POWER8_VECTOR__
4541 static __inline__ vector signed long long __ATTRS_o_ai
vec_max(vector signed long long __a,vector signed long long __b)4542 vec_max(vector signed long long __a, vector signed long long __b) {
4543 return __builtin_altivec_vmaxsd(__a, __b);
4544 }
4545
4546 static __inline__ vector signed long long __ATTRS_o_ai
vec_max(vector bool long long __a,vector signed long long __b)4547 vec_max(vector bool long long __a, vector signed long long __b) {
4548 return __builtin_altivec_vmaxsd((vector signed long long)__a, __b);
4549 }
4550
4551 static __inline__ vector signed long long __ATTRS_o_ai
vec_max(vector signed long long __a,vector bool long long __b)4552 vec_max(vector signed long long __a, vector bool long long __b) {
4553 return __builtin_altivec_vmaxsd(__a, (vector signed long long)__b);
4554 }
4555
4556 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_max(vector unsigned long long __a,vector unsigned long long __b)4557 vec_max(vector unsigned long long __a, vector unsigned long long __b) {
4558 return __builtin_altivec_vmaxud(__a, __b);
4559 }
4560
4561 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_max(vector bool long long __a,vector unsigned long long __b)4562 vec_max(vector bool long long __a, vector unsigned long long __b) {
4563 return __builtin_altivec_vmaxud((vector unsigned long long)__a, __b);
4564 }
4565
4566 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_max(vector unsigned long long __a,vector bool long long __b)4567 vec_max(vector unsigned long long __a, vector bool long long __b) {
4568 return __builtin_altivec_vmaxud(__a, (vector unsigned long long)__b);
4569 }
4570 #endif
4571
vec_max(vector float __a,vector float __b)4572 static __inline__ vector float __ATTRS_o_ai vec_max(vector float __a,
4573 vector float __b) {
4574 #ifdef __VSX__
4575 return __builtin_vsx_xvmaxsp(__a, __b);
4576 #else
4577 return __builtin_altivec_vmaxfp(__a, __b);
4578 #endif
4579 }
4580
4581 #ifdef __VSX__
vec_max(vector double __a,vector double __b)4582 static __inline__ vector double __ATTRS_o_ai vec_max(vector double __a,
4583 vector double __b) {
4584 return __builtin_vsx_xvmaxdp(__a, __b);
4585 }
4586 #endif
4587
4588 /* vec_vmaxsb */
4589
4590 static __inline__ vector signed char __ATTRS_o_ai
vec_vmaxsb(vector signed char __a,vector signed char __b)4591 vec_vmaxsb(vector signed char __a, vector signed char __b) {
4592 return __builtin_altivec_vmaxsb(__a, __b);
4593 }
4594
4595 static __inline__ vector signed char __ATTRS_o_ai
vec_vmaxsb(vector bool char __a,vector signed char __b)4596 vec_vmaxsb(vector bool char __a, vector signed char __b) {
4597 return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
4598 }
4599
4600 static __inline__ vector signed char __ATTRS_o_ai
vec_vmaxsb(vector signed char __a,vector bool char __b)4601 vec_vmaxsb(vector signed char __a, vector bool char __b) {
4602 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
4603 }
4604
4605 /* vec_vmaxub */
4606
4607 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vmaxub(vector unsigned char __a,vector unsigned char __b)4608 vec_vmaxub(vector unsigned char __a, vector unsigned char __b) {
4609 return __builtin_altivec_vmaxub(__a, __b);
4610 }
4611
4612 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vmaxub(vector bool char __a,vector unsigned char __b)4613 vec_vmaxub(vector bool char __a, vector unsigned char __b) {
4614 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
4615 }
4616
4617 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vmaxub(vector unsigned char __a,vector bool char __b)4618 vec_vmaxub(vector unsigned char __a, vector bool char __b) {
4619 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
4620 }
4621
4622 /* vec_vmaxsh */
4623
vec_vmaxsh(vector short __a,vector short __b)4624 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a,
4625 vector short __b) {
4626 return __builtin_altivec_vmaxsh(__a, __b);
4627 }
4628
vec_vmaxsh(vector bool short __a,vector short __b)4629 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector bool short __a,
4630 vector short __b) {
4631 return __builtin_altivec_vmaxsh((vector short)__a, __b);
4632 }
4633
vec_vmaxsh(vector short __a,vector bool short __b)4634 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a,
4635 vector bool short __b) {
4636 return __builtin_altivec_vmaxsh(__a, (vector short)__b);
4637 }
4638
4639 /* vec_vmaxuh */
4640
4641 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vmaxuh(vector unsigned short __a,vector unsigned short __b)4642 vec_vmaxuh(vector unsigned short __a, vector unsigned short __b) {
4643 return __builtin_altivec_vmaxuh(__a, __b);
4644 }
4645
4646 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vmaxuh(vector bool short __a,vector unsigned short __b)4647 vec_vmaxuh(vector bool short __a, vector unsigned short __b) {
4648 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
4649 }
4650
4651 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vmaxuh(vector unsigned short __a,vector bool short __b)4652 vec_vmaxuh(vector unsigned short __a, vector bool short __b) {
4653 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
4654 }
4655
4656 /* vec_vmaxsw */
4657
vec_vmaxsw(vector int __a,vector int __b)4658 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a,
4659 vector int __b) {
4660 return __builtin_altivec_vmaxsw(__a, __b);
4661 }
4662
vec_vmaxsw(vector bool int __a,vector int __b)4663 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector bool int __a,
4664 vector int __b) {
4665 return __builtin_altivec_vmaxsw((vector int)__a, __b);
4666 }
4667
vec_vmaxsw(vector int __a,vector bool int __b)4668 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a,
4669 vector bool int __b) {
4670 return __builtin_altivec_vmaxsw(__a, (vector int)__b);
4671 }
4672
4673 /* vec_vmaxuw */
4674
4675 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vmaxuw(vector unsigned int __a,vector unsigned int __b)4676 vec_vmaxuw(vector unsigned int __a, vector unsigned int __b) {
4677 return __builtin_altivec_vmaxuw(__a, __b);
4678 }
4679
4680 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vmaxuw(vector bool int __a,vector unsigned int __b)4681 vec_vmaxuw(vector bool int __a, vector unsigned int __b) {
4682 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
4683 }
4684
4685 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vmaxuw(vector unsigned int __a,vector bool int __b)4686 vec_vmaxuw(vector unsigned int __a, vector bool int __b) {
4687 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
4688 }
4689
4690 /* vec_vmaxfp */
4691
4692 static __inline__ vector float __attribute__((__always_inline__))
vec_vmaxfp(vector float __a,vector float __b)4693 vec_vmaxfp(vector float __a, vector float __b) {
4694 #ifdef __VSX__
4695 return __builtin_vsx_xvmaxsp(__a, __b);
4696 #else
4697 return __builtin_altivec_vmaxfp(__a, __b);
4698 #endif
4699 }
4700
4701 /* vec_mergeh */
4702
4703 static __inline__ vector signed char __ATTRS_o_ai
vec_mergeh(vector signed char __a,vector signed char __b)4704 vec_mergeh(vector signed char __a, vector signed char __b) {
4705 return vec_perm(__a, __b,
4706 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
4707 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
4708 0x06, 0x16, 0x07, 0x17));
4709 }
4710
4711 static __inline__ vector unsigned char __ATTRS_o_ai
vec_mergeh(vector unsigned char __a,vector unsigned char __b)4712 vec_mergeh(vector unsigned char __a, vector unsigned char __b) {
4713 return vec_perm(__a, __b,
4714 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
4715 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
4716 0x06, 0x16, 0x07, 0x17));
4717 }
4718
4719 static __inline__ vector bool char __ATTRS_o_ai
vec_mergeh(vector bool char __a,vector bool char __b)4720 vec_mergeh(vector bool char __a, vector bool char __b) {
4721 return vec_perm(__a, __b,
4722 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
4723 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
4724 0x06, 0x16, 0x07, 0x17));
4725 }
4726
vec_mergeh(vector short __a,vector short __b)4727 static __inline__ vector short __ATTRS_o_ai vec_mergeh(vector short __a,
4728 vector short __b) {
4729 return vec_perm(__a, __b,
4730 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4731 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4732 0x06, 0x07, 0x16, 0x17));
4733 }
4734
4735 static __inline__ vector unsigned short __ATTRS_o_ai
vec_mergeh(vector unsigned short __a,vector unsigned short __b)4736 vec_mergeh(vector unsigned short __a, vector unsigned short __b) {
4737 return vec_perm(__a, __b,
4738 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4739 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4740 0x06, 0x07, 0x16, 0x17));
4741 }
4742
4743 static __inline__ vector bool short __ATTRS_o_ai
vec_mergeh(vector bool short __a,vector bool short __b)4744 vec_mergeh(vector bool short __a, vector bool short __b) {
4745 return vec_perm(__a, __b,
4746 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4747 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4748 0x06, 0x07, 0x16, 0x17));
4749 }
4750
vec_mergeh(vector pixel __a,vector pixel __b)4751 static __inline__ vector pixel __ATTRS_o_ai vec_mergeh(vector pixel __a,
4752 vector pixel __b) {
4753 return vec_perm(__a, __b,
4754 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4755 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4756 0x06, 0x07, 0x16, 0x17));
4757 }
4758
vec_mergeh(vector int __a,vector int __b)4759 static __inline__ vector int __ATTRS_o_ai vec_mergeh(vector int __a,
4760 vector int __b) {
4761 return vec_perm(__a, __b,
4762 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4763 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4764 0x14, 0x15, 0x16, 0x17));
4765 }
4766
4767 static __inline__ vector unsigned int __ATTRS_o_ai
vec_mergeh(vector unsigned int __a,vector unsigned int __b)4768 vec_mergeh(vector unsigned int __a, vector unsigned int __b) {
4769 return vec_perm(__a, __b,
4770 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4771 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4772 0x14, 0x15, 0x16, 0x17));
4773 }
4774
vec_mergeh(vector bool int __a,vector bool int __b)4775 static __inline__ vector bool int __ATTRS_o_ai vec_mergeh(vector bool int __a,
4776 vector bool int __b) {
4777 return vec_perm(__a, __b,
4778 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4779 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4780 0x14, 0x15, 0x16, 0x17));
4781 }
4782
vec_mergeh(vector float __a,vector float __b)4783 static __inline__ vector float __ATTRS_o_ai vec_mergeh(vector float __a,
4784 vector float __b) {
4785 return vec_perm(__a, __b,
4786 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4787 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4788 0x14, 0x15, 0x16, 0x17));
4789 }
4790
4791 #ifdef __VSX__
4792 static __inline__ vector signed long long __ATTRS_o_ai
vec_mergeh(vector signed long long __a,vector signed long long __b)4793 vec_mergeh(vector signed long long __a, vector signed long long __b) {
4794 return vec_perm(__a, __b,
4795 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4796 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4797 0x14, 0x15, 0x16, 0x17));
4798 }
4799
4800 static __inline__ vector signed long long __ATTRS_o_ai
vec_mergeh(vector signed long long __a,vector bool long long __b)4801 vec_mergeh(vector signed long long __a, vector bool long long __b) {
4802 return vec_perm(__a, (vector signed long long)__b,
4803 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4804 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4805 0x14, 0x15, 0x16, 0x17));
4806 }
4807
4808 static __inline__ vector signed long long __ATTRS_o_ai
vec_mergeh(vector bool long long __a,vector signed long long __b)4809 vec_mergeh(vector bool long long __a, vector signed long long __b) {
4810 return vec_perm((vector signed long long)__a, __b,
4811 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4812 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4813 0x14, 0x15, 0x16, 0x17));
4814 }
4815
4816 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_mergeh(vector unsigned long long __a,vector unsigned long long __b)4817 vec_mergeh(vector unsigned long long __a, vector unsigned long long __b) {
4818 return vec_perm(__a, __b,
4819 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4820 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4821 0x14, 0x15, 0x16, 0x17));
4822 }
4823
4824 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_mergeh(vector unsigned long long __a,vector bool long long __b)4825 vec_mergeh(vector unsigned long long __a, vector bool long long __b) {
4826 return vec_perm(__a, (vector unsigned long long)__b,
4827 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4828 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4829 0x14, 0x15, 0x16, 0x17));
4830 }
4831
4832 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_mergeh(vector bool long long __a,vector unsigned long long __b)4833 vec_mergeh(vector bool long long __a, vector unsigned long long __b) {
4834 return vec_perm((vector unsigned long long)__a, __b,
4835 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4836 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4837 0x14, 0x15, 0x16, 0x17));
4838 }
4839
4840 static __inline__ vector bool long long __ATTRS_o_ai
vec_mergeh(vector bool long long __a,vector bool long long __b)4841 vec_mergeh(vector bool long long __a, vector bool long long __b) {
4842 return vec_perm(__a, __b,
4843 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4844 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4845 0x14, 0x15, 0x16, 0x17));
4846 }
4847
vec_mergeh(vector double __a,vector double __b)4848 static __inline__ vector double __ATTRS_o_ai vec_mergeh(vector double __a,
4849 vector double __b) {
4850 return vec_perm(__a, __b,
4851 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4852 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4853 0x14, 0x15, 0x16, 0x17));
4854 }
4855 static __inline__ vector double __ATTRS_o_ai
vec_mergeh(vector double __a,vector bool long long __b)4856 vec_mergeh(vector double __a, vector bool long long __b) {
4857 return vec_perm(__a, (vector double)__b,
4858 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4859 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4860 0x14, 0x15, 0x16, 0x17));
4861 }
4862 static __inline__ vector double __ATTRS_o_ai
vec_mergeh(vector bool long long __a,vector double __b)4863 vec_mergeh(vector bool long long __a, vector double __b) {
4864 return vec_perm((vector double)__a, __b,
4865 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4866 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4867 0x14, 0x15, 0x16, 0x17));
4868 }
4869 #endif
4870
4871 /* vec_vmrghb */
4872
4873 #define __builtin_altivec_vmrghb vec_vmrghb
4874
4875 static __inline__ vector signed char __ATTRS_o_ai
vec_vmrghb(vector signed char __a,vector signed char __b)4876 vec_vmrghb(vector signed char __a, vector signed char __b) {
4877 return vec_perm(__a, __b,
4878 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
4879 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
4880 0x06, 0x16, 0x07, 0x17));
4881 }
4882
4883 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vmrghb(vector unsigned char __a,vector unsigned char __b)4884 vec_vmrghb(vector unsigned char __a, vector unsigned char __b) {
4885 return vec_perm(__a, __b,
4886 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
4887 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
4888 0x06, 0x16, 0x07, 0x17));
4889 }
4890
4891 static __inline__ vector bool char __ATTRS_o_ai
vec_vmrghb(vector bool char __a,vector bool char __b)4892 vec_vmrghb(vector bool char __a, vector bool char __b) {
4893 return vec_perm(__a, __b,
4894 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
4895 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
4896 0x06, 0x16, 0x07, 0x17));
4897 }
4898
4899 /* vec_vmrghh */
4900
4901 #define __builtin_altivec_vmrghh vec_vmrghh
4902
vec_vmrghh(vector short __a,vector short __b)4903 static __inline__ vector short __ATTRS_o_ai vec_vmrghh(vector short __a,
4904 vector short __b) {
4905 return vec_perm(__a, __b,
4906 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4907 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4908 0x06, 0x07, 0x16, 0x17));
4909 }
4910
4911 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vmrghh(vector unsigned short __a,vector unsigned short __b)4912 vec_vmrghh(vector unsigned short __a, vector unsigned short __b) {
4913 return vec_perm(__a, __b,
4914 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4915 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4916 0x06, 0x07, 0x16, 0x17));
4917 }
4918
4919 static __inline__ vector bool short __ATTRS_o_ai
vec_vmrghh(vector bool short __a,vector bool short __b)4920 vec_vmrghh(vector bool short __a, vector bool short __b) {
4921 return vec_perm(__a, __b,
4922 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4923 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4924 0x06, 0x07, 0x16, 0x17));
4925 }
4926
vec_vmrghh(vector pixel __a,vector pixel __b)4927 static __inline__ vector pixel __ATTRS_o_ai vec_vmrghh(vector pixel __a,
4928 vector pixel __b) {
4929 return vec_perm(__a, __b,
4930 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4931 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4932 0x06, 0x07, 0x16, 0x17));
4933 }
4934
4935 /* vec_vmrghw */
4936
4937 #define __builtin_altivec_vmrghw vec_vmrghw
4938
vec_vmrghw(vector int __a,vector int __b)4939 static __inline__ vector int __ATTRS_o_ai vec_vmrghw(vector int __a,
4940 vector int __b) {
4941 return vec_perm(__a, __b,
4942 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4943 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4944 0x14, 0x15, 0x16, 0x17));
4945 }
4946
4947 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vmrghw(vector unsigned int __a,vector unsigned int __b)4948 vec_vmrghw(vector unsigned int __a, vector unsigned int __b) {
4949 return vec_perm(__a, __b,
4950 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4951 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4952 0x14, 0x15, 0x16, 0x17));
4953 }
4954
vec_vmrghw(vector bool int __a,vector bool int __b)4955 static __inline__ vector bool int __ATTRS_o_ai vec_vmrghw(vector bool int __a,
4956 vector bool int __b) {
4957 return vec_perm(__a, __b,
4958 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4959 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4960 0x14, 0x15, 0x16, 0x17));
4961 }
4962
vec_vmrghw(vector float __a,vector float __b)4963 static __inline__ vector float __ATTRS_o_ai vec_vmrghw(vector float __a,
4964 vector float __b) {
4965 return vec_perm(__a, __b,
4966 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4967 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4968 0x14, 0x15, 0x16, 0x17));
4969 }
4970
4971 /* vec_mergel */
4972
4973 static __inline__ vector signed char __ATTRS_o_ai
vec_mergel(vector signed char __a,vector signed char __b)4974 vec_mergel(vector signed char __a, vector signed char __b) {
4975 return vec_perm(__a, __b,
4976 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
4977 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
4978 0x0E, 0x1E, 0x0F, 0x1F));
4979 }
4980
4981 static __inline__ vector unsigned char __ATTRS_o_ai
vec_mergel(vector unsigned char __a,vector unsigned char __b)4982 vec_mergel(vector unsigned char __a, vector unsigned char __b) {
4983 return vec_perm(__a, __b,
4984 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
4985 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
4986 0x0E, 0x1E, 0x0F, 0x1F));
4987 }
4988
4989 static __inline__ vector bool char __ATTRS_o_ai
vec_mergel(vector bool char __a,vector bool char __b)4990 vec_mergel(vector bool char __a, vector bool char __b) {
4991 return vec_perm(__a, __b,
4992 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
4993 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
4994 0x0E, 0x1E, 0x0F, 0x1F));
4995 }
4996
vec_mergel(vector short __a,vector short __b)4997 static __inline__ vector short __ATTRS_o_ai vec_mergel(vector short __a,
4998 vector short __b) {
4999 return vec_perm(__a, __b,
5000 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
5001 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
5002 0x0E, 0x0F, 0x1E, 0x1F));
5003 }
5004
5005 static __inline__ vector unsigned short __ATTRS_o_ai
vec_mergel(vector unsigned short __a,vector unsigned short __b)5006 vec_mergel(vector unsigned short __a, vector unsigned short __b) {
5007 return vec_perm(__a, __b,
5008 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
5009 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
5010 0x0E, 0x0F, 0x1E, 0x1F));
5011 }
5012
5013 static __inline__ vector bool short __ATTRS_o_ai
vec_mergel(vector bool short __a,vector bool short __b)5014 vec_mergel(vector bool short __a, vector bool short __b) {
5015 return vec_perm(__a, __b,
5016 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
5017 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
5018 0x0E, 0x0F, 0x1E, 0x1F));
5019 }
5020
vec_mergel(vector pixel __a,vector pixel __b)5021 static __inline__ vector pixel __ATTRS_o_ai vec_mergel(vector pixel __a,
5022 vector pixel __b) {
5023 return vec_perm(__a, __b,
5024 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
5025 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
5026 0x0E, 0x0F, 0x1E, 0x1F));
5027 }
5028
vec_mergel(vector int __a,vector int __b)5029 static __inline__ vector int __ATTRS_o_ai vec_mergel(vector int __a,
5030 vector int __b) {
5031 return vec_perm(__a, __b,
5032 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5033 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5034 0x1C, 0x1D, 0x1E, 0x1F));
5035 }
5036
5037 static __inline__ vector unsigned int __ATTRS_o_ai
vec_mergel(vector unsigned int __a,vector unsigned int __b)5038 vec_mergel(vector unsigned int __a, vector unsigned int __b) {
5039 return vec_perm(__a, __b,
5040 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5041 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5042 0x1C, 0x1D, 0x1E, 0x1F));
5043 }
5044
vec_mergel(vector bool int __a,vector bool int __b)5045 static __inline__ vector bool int __ATTRS_o_ai vec_mergel(vector bool int __a,
5046 vector bool int __b) {
5047 return vec_perm(__a, __b,
5048 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5049 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5050 0x1C, 0x1D, 0x1E, 0x1F));
5051 }
5052
vec_mergel(vector float __a,vector float __b)5053 static __inline__ vector float __ATTRS_o_ai vec_mergel(vector float __a,
5054 vector float __b) {
5055 return vec_perm(__a, __b,
5056 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5057 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5058 0x1C, 0x1D, 0x1E, 0x1F));
5059 }
5060
5061 #ifdef __VSX__
5062 static __inline__ vector signed long long __ATTRS_o_ai
vec_mergel(vector signed long long __a,vector signed long long __b)5063 vec_mergel(vector signed long long __a, vector signed long long __b) {
5064 return vec_perm(__a, __b,
5065 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5066 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5067 0x1C, 0x1D, 0x1E, 0x1F));
5068 }
5069 static __inline__ vector signed long long __ATTRS_o_ai
vec_mergel(vector signed long long __a,vector bool long long __b)5070 vec_mergel(vector signed long long __a, vector bool long long __b) {
5071 return vec_perm(__a, (vector signed long long)__b,
5072 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5073 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5074 0x1C, 0x1D, 0x1E, 0x1F));
5075 }
5076 static __inline__ vector signed long long __ATTRS_o_ai
vec_mergel(vector bool long long __a,vector signed long long __b)5077 vec_mergel(vector bool long long __a, vector signed long long __b) {
5078 return vec_perm((vector signed long long)__a, __b,
5079 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5080 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5081 0x1C, 0x1D, 0x1E, 0x1F));
5082 }
5083 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_mergel(vector unsigned long long __a,vector unsigned long long __b)5084 vec_mergel(vector unsigned long long __a, vector unsigned long long __b) {
5085 return vec_perm(__a, __b,
5086 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5087 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5088 0x1C, 0x1D, 0x1E, 0x1F));
5089 }
5090 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_mergel(vector unsigned long long __a,vector bool long long __b)5091 vec_mergel(vector unsigned long long __a, vector bool long long __b) {
5092 return vec_perm(__a, (vector unsigned long long)__b,
5093 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5094 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5095 0x1C, 0x1D, 0x1E, 0x1F));
5096 }
5097 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_mergel(vector bool long long __a,vector unsigned long long __b)5098 vec_mergel(vector bool long long __a, vector unsigned long long __b) {
5099 return vec_perm((vector unsigned long long)__a, __b,
5100 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5101 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5102 0x1C, 0x1D, 0x1E, 0x1F));
5103 }
5104 static __inline__ vector bool long long __ATTRS_o_ai
vec_mergel(vector bool long long __a,vector bool long long __b)5105 vec_mergel(vector bool long long __a, vector bool long long __b) {
5106 return vec_perm(__a, __b,
5107 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5108 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5109 0x1C, 0x1D, 0x1E, 0x1F));
5110 }
vec_mergel(vector double __a,vector double __b)5111 static __inline__ vector double __ATTRS_o_ai vec_mergel(vector double __a,
5112 vector double __b) {
5113 return vec_perm(__a, __b,
5114 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5115 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5116 0x1C, 0x1D, 0x1E, 0x1F));
5117 }
5118 static __inline__ vector double __ATTRS_o_ai
vec_mergel(vector double __a,vector bool long long __b)5119 vec_mergel(vector double __a, vector bool long long __b) {
5120 return vec_perm(__a, (vector double)__b,
5121 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5122 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5123 0x1C, 0x1D, 0x1E, 0x1F));
5124 }
5125 static __inline__ vector double __ATTRS_o_ai
vec_mergel(vector bool long long __a,vector double __b)5126 vec_mergel(vector bool long long __a, vector double __b) {
5127 return vec_perm((vector double)__a, __b,
5128 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5129 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5130 0x1C, 0x1D, 0x1E, 0x1F));
5131 }
5132 #endif
5133
5134 /* vec_vmrglb */
5135
5136 #define __builtin_altivec_vmrglb vec_vmrglb
5137
5138 static __inline__ vector signed char __ATTRS_o_ai
vec_vmrglb(vector signed char __a,vector signed char __b)5139 vec_vmrglb(vector signed char __a, vector signed char __b) {
5140 return vec_perm(__a, __b,
5141 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
5142 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
5143 0x0E, 0x1E, 0x0F, 0x1F));
5144 }
5145
5146 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vmrglb(vector unsigned char __a,vector unsigned char __b)5147 vec_vmrglb(vector unsigned char __a, vector unsigned char __b) {
5148 return vec_perm(__a, __b,
5149 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
5150 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
5151 0x0E, 0x1E, 0x0F, 0x1F));
5152 }
5153
5154 static __inline__ vector bool char __ATTRS_o_ai
vec_vmrglb(vector bool char __a,vector bool char __b)5155 vec_vmrglb(vector bool char __a, vector bool char __b) {
5156 return vec_perm(__a, __b,
5157 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
5158 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
5159 0x0E, 0x1E, 0x0F, 0x1F));
5160 }
5161
5162 /* vec_vmrglh */
5163
5164 #define __builtin_altivec_vmrglh vec_vmrglh
5165
vec_vmrglh(vector short __a,vector short __b)5166 static __inline__ vector short __ATTRS_o_ai vec_vmrglh(vector short __a,
5167 vector short __b) {
5168 return vec_perm(__a, __b,
5169 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
5170 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
5171 0x0E, 0x0F, 0x1E, 0x1F));
5172 }
5173
5174 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vmrglh(vector unsigned short __a,vector unsigned short __b)5175 vec_vmrglh(vector unsigned short __a, vector unsigned short __b) {
5176 return vec_perm(__a, __b,
5177 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
5178 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
5179 0x0E, 0x0F, 0x1E, 0x1F));
5180 }
5181
5182 static __inline__ vector bool short __ATTRS_o_ai
vec_vmrglh(vector bool short __a,vector bool short __b)5183 vec_vmrglh(vector bool short __a, vector bool short __b) {
5184 return vec_perm(__a, __b,
5185 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
5186 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
5187 0x0E, 0x0F, 0x1E, 0x1F));
5188 }
5189
vec_vmrglh(vector pixel __a,vector pixel __b)5190 static __inline__ vector pixel __ATTRS_o_ai vec_vmrglh(vector pixel __a,
5191 vector pixel __b) {
5192 return vec_perm(__a, __b,
5193 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
5194 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
5195 0x0E, 0x0F, 0x1E, 0x1F));
5196 }
5197
5198 /* vec_vmrglw */
5199
5200 #define __builtin_altivec_vmrglw vec_vmrglw
5201
vec_vmrglw(vector int __a,vector int __b)5202 static __inline__ vector int __ATTRS_o_ai vec_vmrglw(vector int __a,
5203 vector int __b) {
5204 return vec_perm(__a, __b,
5205 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5206 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5207 0x1C, 0x1D, 0x1E, 0x1F));
5208 }
5209
5210 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vmrglw(vector unsigned int __a,vector unsigned int __b)5211 vec_vmrglw(vector unsigned int __a, vector unsigned int __b) {
5212 return vec_perm(__a, __b,
5213 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5214 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5215 0x1C, 0x1D, 0x1E, 0x1F));
5216 }
5217
vec_vmrglw(vector bool int __a,vector bool int __b)5218 static __inline__ vector bool int __ATTRS_o_ai vec_vmrglw(vector bool int __a,
5219 vector bool int __b) {
5220 return vec_perm(__a, __b,
5221 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5222 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5223 0x1C, 0x1D, 0x1E, 0x1F));
5224 }
5225
vec_vmrglw(vector float __a,vector float __b)5226 static __inline__ vector float __ATTRS_o_ai vec_vmrglw(vector float __a,
5227 vector float __b) {
5228 return vec_perm(__a, __b,
5229 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5230 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5231 0x1C, 0x1D, 0x1E, 0x1F));
5232 }
5233
5234 #ifdef __POWER8_VECTOR__
5235 /* vec_mergee */
5236
vec_mergee(vector bool int __a,vector bool int __b)5237 static __inline__ vector bool int __ATTRS_o_ai vec_mergee(vector bool int __a,
5238 vector bool int __b) {
5239 return vec_perm(__a, __b,
5240 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5241 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
5242 0x18, 0x19, 0x1A, 0x1B));
5243 }
5244
5245 static __inline__ vector signed int __ATTRS_o_ai
vec_mergee(vector signed int __a,vector signed int __b)5246 vec_mergee(vector signed int __a, vector signed int __b) {
5247 return vec_perm(__a, __b,
5248 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5249 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
5250 0x18, 0x19, 0x1A, 0x1B));
5251 }
5252
5253 static __inline__ vector unsigned int __ATTRS_o_ai
vec_mergee(vector unsigned int __a,vector unsigned int __b)5254 vec_mergee(vector unsigned int __a, vector unsigned int __b) {
5255 return vec_perm(__a, __b,
5256 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5257 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
5258 0x18, 0x19, 0x1A, 0x1B));
5259 }
5260
5261 static __inline__ vector bool long long __ATTRS_o_ai
vec_mergee(vector bool long long __a,vector bool long long __b)5262 vec_mergee(vector bool long long __a, vector bool long long __b) {
5263 return vec_mergeh(__a, __b);
5264 }
5265
5266 static __inline__ vector signed long long __ATTRS_o_ai
vec_mergee(vector signed long long __a,vector signed long long __b)5267 vec_mergee(vector signed long long __a, vector signed long long __b) {
5268 return vec_mergeh(__a, __b);
5269 }
5270
5271 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_mergee(vector unsigned long long __a,vector unsigned long long __b)5272 vec_mergee(vector unsigned long long __a, vector unsigned long long __b) {
5273 return vec_mergeh(__a, __b);
5274 }
5275
5276 static __inline__ vector float __ATTRS_o_ai
vec_mergee(vector float __a,vector float __b)5277 vec_mergee(vector float __a, vector float __b) {
5278 return vec_perm(__a, __b,
5279 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5280 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
5281 0x18, 0x19, 0x1A, 0x1B));
5282 }
5283
5284 static __inline__ vector double __ATTRS_o_ai
vec_mergee(vector double __a,vector double __b)5285 vec_mergee(vector double __a, vector double __b) {
5286 return vec_mergeh(__a, __b);
5287 }
5288
5289 /* vec_mergeo */
5290
vec_mergeo(vector bool int __a,vector bool int __b)5291 static __inline__ vector bool int __ATTRS_o_ai vec_mergeo(vector bool int __a,
5292 vector bool int __b) {
5293 return vec_perm(__a, __b,
5294 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
5295 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
5296 0x1C, 0x1D, 0x1E, 0x1F));
5297 }
5298
5299 static __inline__ vector signed int __ATTRS_o_ai
vec_mergeo(vector signed int __a,vector signed int __b)5300 vec_mergeo(vector signed int __a, vector signed int __b) {
5301 return vec_perm(__a, __b,
5302 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
5303 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
5304 0x1C, 0x1D, 0x1E, 0x1F));
5305 }
5306
5307 static __inline__ vector unsigned int __ATTRS_o_ai
vec_mergeo(vector unsigned int __a,vector unsigned int __b)5308 vec_mergeo(vector unsigned int __a, vector unsigned int __b) {
5309 return vec_perm(__a, __b,
5310 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
5311 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
5312 0x1C, 0x1D, 0x1E, 0x1F));
5313 }
5314
5315 static __inline__ vector bool long long __ATTRS_o_ai
vec_mergeo(vector bool long long __a,vector bool long long __b)5316 vec_mergeo(vector bool long long __a, vector bool long long __b) {
5317 return vec_mergel(__a, __b);
5318 }
5319
5320 static __inline__ vector signed long long __ATTRS_o_ai
vec_mergeo(vector signed long long __a,vector signed long long __b)5321 vec_mergeo(vector signed long long __a, vector signed long long __b) {
5322 return vec_mergel(__a, __b);
5323 }
5324
5325 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_mergeo(vector unsigned long long __a,vector unsigned long long __b)5326 vec_mergeo(vector unsigned long long __a, vector unsigned long long __b) {
5327 return vec_mergel(__a, __b);
5328 }
5329
5330 static __inline__ vector float __ATTRS_o_ai
vec_mergeo(vector float __a,vector float __b)5331 vec_mergeo(vector float __a, vector float __b) {
5332 return vec_perm(__a, __b,
5333 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
5334 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
5335 0x1C, 0x1D, 0x1E, 0x1F));
5336 }
5337
5338 static __inline__ vector double __ATTRS_o_ai
vec_mergeo(vector double __a,vector double __b)5339 vec_mergeo(vector double __a, vector double __b) {
5340 return vec_mergel(__a, __b);
5341 }
5342
5343 #endif
5344
5345 /* vec_mfvscr */
5346
5347 static __inline__ vector unsigned short __attribute__((__always_inline__))
vec_mfvscr(void)5348 vec_mfvscr(void) {
5349 return __builtin_altivec_mfvscr();
5350 }
5351
5352 /* vec_min */
5353
5354 static __inline__ vector signed char __ATTRS_o_ai
vec_min(vector signed char __a,vector signed char __b)5355 vec_min(vector signed char __a, vector signed char __b) {
5356 return __builtin_altivec_vminsb(__a, __b);
5357 }
5358
5359 static __inline__ vector signed char __ATTRS_o_ai
vec_min(vector bool char __a,vector signed char __b)5360 vec_min(vector bool char __a, vector signed char __b) {
5361 return __builtin_altivec_vminsb((vector signed char)__a, __b);
5362 }
5363
5364 static __inline__ vector signed char __ATTRS_o_ai
vec_min(vector signed char __a,vector bool char __b)5365 vec_min(vector signed char __a, vector bool char __b) {
5366 return __builtin_altivec_vminsb(__a, (vector signed char)__b);
5367 }
5368
5369 static __inline__ vector unsigned char __ATTRS_o_ai
vec_min(vector unsigned char __a,vector unsigned char __b)5370 vec_min(vector unsigned char __a, vector unsigned char __b) {
5371 return __builtin_altivec_vminub(__a, __b);
5372 }
5373
5374 static __inline__ vector unsigned char __ATTRS_o_ai
vec_min(vector bool char __a,vector unsigned char __b)5375 vec_min(vector bool char __a, vector unsigned char __b) {
5376 return __builtin_altivec_vminub((vector unsigned char)__a, __b);
5377 }
5378
5379 static __inline__ vector unsigned char __ATTRS_o_ai
vec_min(vector unsigned char __a,vector bool char __b)5380 vec_min(vector unsigned char __a, vector bool char __b) {
5381 return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
5382 }
5383
vec_min(vector short __a,vector short __b)5384 static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a,
5385 vector short __b) {
5386 return __builtin_altivec_vminsh(__a, __b);
5387 }
5388
vec_min(vector bool short __a,vector short __b)5389 static __inline__ vector short __ATTRS_o_ai vec_min(vector bool short __a,
5390 vector short __b) {
5391 return __builtin_altivec_vminsh((vector short)__a, __b);
5392 }
5393
vec_min(vector short __a,vector bool short __b)5394 static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a,
5395 vector bool short __b) {
5396 return __builtin_altivec_vminsh(__a, (vector short)__b);
5397 }
5398
5399 static __inline__ vector unsigned short __ATTRS_o_ai
vec_min(vector unsigned short __a,vector unsigned short __b)5400 vec_min(vector unsigned short __a, vector unsigned short __b) {
5401 return __builtin_altivec_vminuh(__a, __b);
5402 }
5403
5404 static __inline__ vector unsigned short __ATTRS_o_ai
vec_min(vector bool short __a,vector unsigned short __b)5405 vec_min(vector bool short __a, vector unsigned short __b) {
5406 return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
5407 }
5408
5409 static __inline__ vector unsigned short __ATTRS_o_ai
vec_min(vector unsigned short __a,vector bool short __b)5410 vec_min(vector unsigned short __a, vector bool short __b) {
5411 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
5412 }
5413
vec_min(vector int __a,vector int __b)5414 static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a,
5415 vector int __b) {
5416 return __builtin_altivec_vminsw(__a, __b);
5417 }
5418
vec_min(vector bool int __a,vector int __b)5419 static __inline__ vector int __ATTRS_o_ai vec_min(vector bool int __a,
5420 vector int __b) {
5421 return __builtin_altivec_vminsw((vector int)__a, __b);
5422 }
5423
vec_min(vector int __a,vector bool int __b)5424 static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a,
5425 vector bool int __b) {
5426 return __builtin_altivec_vminsw(__a, (vector int)__b);
5427 }
5428
5429 static __inline__ vector unsigned int __ATTRS_o_ai
vec_min(vector unsigned int __a,vector unsigned int __b)5430 vec_min(vector unsigned int __a, vector unsigned int __b) {
5431 return __builtin_altivec_vminuw(__a, __b);
5432 }
5433
5434 static __inline__ vector unsigned int __ATTRS_o_ai
vec_min(vector bool int __a,vector unsigned int __b)5435 vec_min(vector bool int __a, vector unsigned int __b) {
5436 return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
5437 }
5438
5439 static __inline__ vector unsigned int __ATTRS_o_ai
vec_min(vector unsigned int __a,vector bool int __b)5440 vec_min(vector unsigned int __a, vector bool int __b) {
5441 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
5442 }
5443
5444 #ifdef __POWER8_VECTOR__
5445 static __inline__ vector signed long long __ATTRS_o_ai
vec_min(vector signed long long __a,vector signed long long __b)5446 vec_min(vector signed long long __a, vector signed long long __b) {
5447 return __builtin_altivec_vminsd(__a, __b);
5448 }
5449
5450 static __inline__ vector signed long long __ATTRS_o_ai
vec_min(vector bool long long __a,vector signed long long __b)5451 vec_min(vector bool long long __a, vector signed long long __b) {
5452 return __builtin_altivec_vminsd((vector signed long long)__a, __b);
5453 }
5454
5455 static __inline__ vector signed long long __ATTRS_o_ai
vec_min(vector signed long long __a,vector bool long long __b)5456 vec_min(vector signed long long __a, vector bool long long __b) {
5457 return __builtin_altivec_vminsd(__a, (vector signed long long)__b);
5458 }
5459
5460 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_min(vector unsigned long long __a,vector unsigned long long __b)5461 vec_min(vector unsigned long long __a, vector unsigned long long __b) {
5462 return __builtin_altivec_vminud(__a, __b);
5463 }
5464
5465 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_min(vector bool long long __a,vector unsigned long long __b)5466 vec_min(vector bool long long __a, vector unsigned long long __b) {
5467 return __builtin_altivec_vminud((vector unsigned long long)__a, __b);
5468 }
5469
5470 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_min(vector unsigned long long __a,vector bool long long __b)5471 vec_min(vector unsigned long long __a, vector bool long long __b) {
5472 return __builtin_altivec_vminud(__a, (vector unsigned long long)__b);
5473 }
5474 #endif
5475
vec_min(vector float __a,vector float __b)5476 static __inline__ vector float __ATTRS_o_ai vec_min(vector float __a,
5477 vector float __b) {
5478 #ifdef __VSX__
5479 return __builtin_vsx_xvminsp(__a, __b);
5480 #else
5481 return __builtin_altivec_vminfp(__a, __b);
5482 #endif
5483 }
5484
5485 #ifdef __VSX__
vec_min(vector double __a,vector double __b)5486 static __inline__ vector double __ATTRS_o_ai vec_min(vector double __a,
5487 vector double __b) {
5488 return __builtin_vsx_xvmindp(__a, __b);
5489 }
5490 #endif
5491
5492 /* vec_vminsb */
5493
5494 static __inline__ vector signed char __ATTRS_o_ai
vec_vminsb(vector signed char __a,vector signed char __b)5495 vec_vminsb(vector signed char __a, vector signed char __b) {
5496 return __builtin_altivec_vminsb(__a, __b);
5497 }
5498
5499 static __inline__ vector signed char __ATTRS_o_ai
vec_vminsb(vector bool char __a,vector signed char __b)5500 vec_vminsb(vector bool char __a, vector signed char __b) {
5501 return __builtin_altivec_vminsb((vector signed char)__a, __b);
5502 }
5503
5504 static __inline__ vector signed char __ATTRS_o_ai
vec_vminsb(vector signed char __a,vector bool char __b)5505 vec_vminsb(vector signed char __a, vector bool char __b) {
5506 return __builtin_altivec_vminsb(__a, (vector signed char)__b);
5507 }
5508
5509 /* vec_vminub */
5510
5511 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vminub(vector unsigned char __a,vector unsigned char __b)5512 vec_vminub(vector unsigned char __a, vector unsigned char __b) {
5513 return __builtin_altivec_vminub(__a, __b);
5514 }
5515
5516 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vminub(vector bool char __a,vector unsigned char __b)5517 vec_vminub(vector bool char __a, vector unsigned char __b) {
5518 return __builtin_altivec_vminub((vector unsigned char)__a, __b);
5519 }
5520
5521 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vminub(vector unsigned char __a,vector bool char __b)5522 vec_vminub(vector unsigned char __a, vector bool char __b) {
5523 return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
5524 }
5525
5526 /* vec_vminsh */
5527
vec_vminsh(vector short __a,vector short __b)5528 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a,
5529 vector short __b) {
5530 return __builtin_altivec_vminsh(__a, __b);
5531 }
5532
vec_vminsh(vector bool short __a,vector short __b)5533 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector bool short __a,
5534 vector short __b) {
5535 return __builtin_altivec_vminsh((vector short)__a, __b);
5536 }
5537
vec_vminsh(vector short __a,vector bool short __b)5538 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a,
5539 vector bool short __b) {
5540 return __builtin_altivec_vminsh(__a, (vector short)__b);
5541 }
5542
5543 /* vec_vminuh */
5544
5545 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vminuh(vector unsigned short __a,vector unsigned short __b)5546 vec_vminuh(vector unsigned short __a, vector unsigned short __b) {
5547 return __builtin_altivec_vminuh(__a, __b);
5548 }
5549
5550 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vminuh(vector bool short __a,vector unsigned short __b)5551 vec_vminuh(vector bool short __a, vector unsigned short __b) {
5552 return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
5553 }
5554
5555 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vminuh(vector unsigned short __a,vector bool short __b)5556 vec_vminuh(vector unsigned short __a, vector bool short __b) {
5557 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
5558 }
5559
5560 /* vec_vminsw */
5561
vec_vminsw(vector int __a,vector int __b)5562 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a,
5563 vector int __b) {
5564 return __builtin_altivec_vminsw(__a, __b);
5565 }
5566
vec_vminsw(vector bool int __a,vector int __b)5567 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector bool int __a,
5568 vector int __b) {
5569 return __builtin_altivec_vminsw((vector int)__a, __b);
5570 }
5571
vec_vminsw(vector int __a,vector bool int __b)5572 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a,
5573 vector bool int __b) {
5574 return __builtin_altivec_vminsw(__a, (vector int)__b);
5575 }
5576
5577 /* vec_vminuw */
5578
5579 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vminuw(vector unsigned int __a,vector unsigned int __b)5580 vec_vminuw(vector unsigned int __a, vector unsigned int __b) {
5581 return __builtin_altivec_vminuw(__a, __b);
5582 }
5583
5584 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vminuw(vector bool int __a,vector unsigned int __b)5585 vec_vminuw(vector bool int __a, vector unsigned int __b) {
5586 return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
5587 }
5588
5589 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vminuw(vector unsigned int __a,vector bool int __b)5590 vec_vminuw(vector unsigned int __a, vector bool int __b) {
5591 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
5592 }
5593
5594 /* vec_vminfp */
5595
5596 static __inline__ vector float __attribute__((__always_inline__))
vec_vminfp(vector float __a,vector float __b)5597 vec_vminfp(vector float __a, vector float __b) {
5598 #ifdef __VSX__
5599 return __builtin_vsx_xvminsp(__a, __b);
5600 #else
5601 return __builtin_altivec_vminfp(__a, __b);
5602 #endif
5603 }
5604
5605 /* vec_mladd */
5606
5607 #define __builtin_altivec_vmladduhm vec_mladd
5608
vec_mladd(vector short __a,vector short __b,vector short __c)5609 static __inline__ vector short __ATTRS_o_ai vec_mladd(vector short __a,
5610 vector short __b,
5611 vector short __c) {
5612 return __a * __b + __c;
5613 }
5614
vec_mladd(vector short __a,vector unsigned short __b,vector unsigned short __c)5615 static __inline__ vector short __ATTRS_o_ai vec_mladd(
5616 vector short __a, vector unsigned short __b, vector unsigned short __c) {
5617 return __a * (vector short)__b + (vector short)__c;
5618 }
5619
vec_mladd(vector unsigned short __a,vector short __b,vector short __c)5620 static __inline__ vector short __ATTRS_o_ai vec_mladd(vector unsigned short __a,
5621 vector short __b,
5622 vector short __c) {
5623 return (vector short)__a * __b + __c;
5624 }
5625
5626 static __inline__ vector unsigned short __ATTRS_o_ai
vec_mladd(vector unsigned short __a,vector unsigned short __b,vector unsigned short __c)5627 vec_mladd(vector unsigned short __a, vector unsigned short __b,
5628 vector unsigned short __c) {
5629 return __a * __b + __c;
5630 }
5631
5632 /* vec_vmladduhm */
5633
vec_vmladduhm(vector short __a,vector short __b,vector short __c)5634 static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(vector short __a,
5635 vector short __b,
5636 vector short __c) {
5637 return __a * __b + __c;
5638 }
5639
vec_vmladduhm(vector short __a,vector unsigned short __b,vector unsigned short __c)5640 static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(
5641 vector short __a, vector unsigned short __b, vector unsigned short __c) {
5642 return __a * (vector short)__b + (vector short)__c;
5643 }
5644
5645 static __inline__ vector short __ATTRS_o_ai
vec_vmladduhm(vector unsigned short __a,vector short __b,vector short __c)5646 vec_vmladduhm(vector unsigned short __a, vector short __b, vector short __c) {
5647 return (vector short)__a * __b + __c;
5648 }
5649
5650 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vmladduhm(vector unsigned short __a,vector unsigned short __b,vector unsigned short __c)5651 vec_vmladduhm(vector unsigned short __a, vector unsigned short __b,
5652 vector unsigned short __c) {
5653 return __a * __b + __c;
5654 }
5655
5656 /* vec_mradds */
5657
5658 static __inline__ vector short __attribute__((__always_inline__))
vec_mradds(vector short __a,vector short __b,vector short __c)5659 vec_mradds(vector short __a, vector short __b, vector short __c) {
5660 return __builtin_altivec_vmhraddshs(__a, __b, __c);
5661 }
5662
5663 /* vec_vmhraddshs */
5664
5665 static __inline__ vector short __attribute__((__always_inline__))
vec_vmhraddshs(vector short __a,vector short __b,vector short __c)5666 vec_vmhraddshs(vector short __a, vector short __b, vector short __c) {
5667 return __builtin_altivec_vmhraddshs(__a, __b, __c);
5668 }
5669
5670 /* vec_msum */
5671
vec_msum(vector signed char __a,vector unsigned char __b,vector int __c)5672 static __inline__ vector int __ATTRS_o_ai vec_msum(vector signed char __a,
5673 vector unsigned char __b,
5674 vector int __c) {
5675 return __builtin_altivec_vmsummbm(__a, __b, __c);
5676 }
5677
5678 static __inline__ vector unsigned int __ATTRS_o_ai
vec_msum(vector unsigned char __a,vector unsigned char __b,vector unsigned int __c)5679 vec_msum(vector unsigned char __a, vector unsigned char __b,
5680 vector unsigned int __c) {
5681 return __builtin_altivec_vmsumubm(__a, __b, __c);
5682 }
5683
vec_msum(vector short __a,vector short __b,vector int __c)5684 static __inline__ vector int __ATTRS_o_ai vec_msum(vector short __a,
5685 vector short __b,
5686 vector int __c) {
5687 return __builtin_altivec_vmsumshm(__a, __b, __c);
5688 }
5689
5690 static __inline__ vector unsigned int __ATTRS_o_ai
vec_msum(vector unsigned short __a,vector unsigned short __b,vector unsigned int __c)5691 vec_msum(vector unsigned short __a, vector unsigned short __b,
5692 vector unsigned int __c) {
5693 return __builtin_altivec_vmsumuhm(__a, __b, __c);
5694 }
5695
5696 /* vec_msumc */
5697
5698 #ifdef __POWER10_VECTOR__
5699 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_msumc(vector unsigned long long __a,vector unsigned long long __b,vector unsigned __int128 __c)5700 vec_msumc(vector unsigned long long __a, vector unsigned long long __b,
5701 vector unsigned __int128 __c) {
5702 return __builtin_altivec_vmsumcud(__a, __b, __c);
5703 }
5704 #endif
5705
5706 /* vec_vmsummbm */
5707
5708 static __inline__ vector int __attribute__((__always_inline__))
vec_vmsummbm(vector signed char __a,vector unsigned char __b,vector int __c)5709 vec_vmsummbm(vector signed char __a, vector unsigned char __b, vector int __c) {
5710 return __builtin_altivec_vmsummbm(__a, __b, __c);
5711 }
5712
5713 /* vec_vmsumubm */
5714
5715 static __inline__ vector unsigned int __attribute__((__always_inline__))
vec_vmsumubm(vector unsigned char __a,vector unsigned char __b,vector unsigned int __c)5716 vec_vmsumubm(vector unsigned char __a, vector unsigned char __b,
5717 vector unsigned int __c) {
5718 return __builtin_altivec_vmsumubm(__a, __b, __c);
5719 }
5720
5721 /* vec_vmsumshm */
5722
5723 static __inline__ vector int __attribute__((__always_inline__))
vec_vmsumshm(vector short __a,vector short __b,vector int __c)5724 vec_vmsumshm(vector short __a, vector short __b, vector int __c) {
5725 return __builtin_altivec_vmsumshm(__a, __b, __c);
5726 }
5727
5728 /* vec_vmsumuhm */
5729
5730 static __inline__ vector unsigned int __attribute__((__always_inline__))
vec_vmsumuhm(vector unsigned short __a,vector unsigned short __b,vector unsigned int __c)5731 vec_vmsumuhm(vector unsigned short __a, vector unsigned short __b,
5732 vector unsigned int __c) {
5733 return __builtin_altivec_vmsumuhm(__a, __b, __c);
5734 }
5735
5736 /* vec_msums */
5737
vec_msums(vector short __a,vector short __b,vector int __c)5738 static __inline__ vector int __ATTRS_o_ai vec_msums(vector short __a,
5739 vector short __b,
5740 vector int __c) {
5741 return __builtin_altivec_vmsumshs(__a, __b, __c);
5742 }
5743
5744 static __inline__ vector unsigned int __ATTRS_o_ai
vec_msums(vector unsigned short __a,vector unsigned short __b,vector unsigned int __c)5745 vec_msums(vector unsigned short __a, vector unsigned short __b,
5746 vector unsigned int __c) {
5747 return __builtin_altivec_vmsumuhs(__a, __b, __c);
5748 }
5749
5750 /* vec_vmsumshs */
5751
5752 static __inline__ vector int __attribute__((__always_inline__))
vec_vmsumshs(vector short __a,vector short __b,vector int __c)5753 vec_vmsumshs(vector short __a, vector short __b, vector int __c) {
5754 return __builtin_altivec_vmsumshs(__a, __b, __c);
5755 }
5756
5757 /* vec_vmsumuhs */
5758
5759 static __inline__ vector unsigned int __attribute__((__always_inline__))
vec_vmsumuhs(vector unsigned short __a,vector unsigned short __b,vector unsigned int __c)5760 vec_vmsumuhs(vector unsigned short __a, vector unsigned short __b,
5761 vector unsigned int __c) {
5762 return __builtin_altivec_vmsumuhs(__a, __b, __c);
5763 }
5764
5765 /* vec_mtvscr */
5766
vec_mtvscr(vector signed char __a)5767 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector signed char __a) {
5768 __builtin_altivec_mtvscr((vector int)__a);
5769 }
5770
vec_mtvscr(vector unsigned char __a)5771 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned char __a) {
5772 __builtin_altivec_mtvscr((vector int)__a);
5773 }
5774
vec_mtvscr(vector bool char __a)5775 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool char __a) {
5776 __builtin_altivec_mtvscr((vector int)__a);
5777 }
5778
vec_mtvscr(vector short __a)5779 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector short __a) {
5780 __builtin_altivec_mtvscr((vector int)__a);
5781 }
5782
vec_mtvscr(vector unsigned short __a)5783 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned short __a) {
5784 __builtin_altivec_mtvscr((vector int)__a);
5785 }
5786
vec_mtvscr(vector bool short __a)5787 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool short __a) {
5788 __builtin_altivec_mtvscr((vector int)__a);
5789 }
5790
vec_mtvscr(vector pixel __a)5791 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector pixel __a) {
5792 __builtin_altivec_mtvscr((vector int)__a);
5793 }
5794
vec_mtvscr(vector int __a)5795 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector int __a) {
5796 __builtin_altivec_mtvscr((vector int)__a);
5797 }
5798
vec_mtvscr(vector unsigned int __a)5799 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned int __a) {
5800 __builtin_altivec_mtvscr((vector int)__a);
5801 }
5802
vec_mtvscr(vector bool int __a)5803 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool int __a) {
5804 __builtin_altivec_mtvscr((vector int)__a);
5805 }
5806
vec_mtvscr(vector float __a)5807 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector float __a) {
5808 __builtin_altivec_mtvscr((vector int)__a);
5809 }
5810
5811 /* vec_mul */
5812
5813 /* Integer vector multiplication will involve multiplication of the odd/even
5814 elements separately, then truncating the results and moving to the
5815 result vector.
5816 */
5817 static __inline__ vector signed char __ATTRS_o_ai
vec_mul(vector signed char __a,vector signed char __b)5818 vec_mul(vector signed char __a, vector signed char __b) {
5819 return __a * __b;
5820 }
5821
5822 static __inline__ vector unsigned char __ATTRS_o_ai
vec_mul(vector unsigned char __a,vector unsigned char __b)5823 vec_mul(vector unsigned char __a, vector unsigned char __b) {
5824 return __a * __b;
5825 }
5826
5827 static __inline__ vector signed short __ATTRS_o_ai
vec_mul(vector signed short __a,vector signed short __b)5828 vec_mul(vector signed short __a, vector signed short __b) {
5829 return __a * __b;
5830 }
5831
5832 static __inline__ vector unsigned short __ATTRS_o_ai
vec_mul(vector unsigned short __a,vector unsigned short __b)5833 vec_mul(vector unsigned short __a, vector unsigned short __b) {
5834 return __a * __b;
5835 }
5836
5837 static __inline__ vector signed int __ATTRS_o_ai
vec_mul(vector signed int __a,vector signed int __b)5838 vec_mul(vector signed int __a, vector signed int __b) {
5839 return __a * __b;
5840 }
5841
5842 static __inline__ vector unsigned int __ATTRS_o_ai
vec_mul(vector unsigned int __a,vector unsigned int __b)5843 vec_mul(vector unsigned int __a, vector unsigned int __b) {
5844 return __a * __b;
5845 }
5846
5847 #ifdef __VSX__
5848 static __inline__ vector signed long long __ATTRS_o_ai
vec_mul(vector signed long long __a,vector signed long long __b)5849 vec_mul(vector signed long long __a, vector signed long long __b) {
5850 return __a * __b;
5851 }
5852
5853 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_mul(vector unsigned long long __a,vector unsigned long long __b)5854 vec_mul(vector unsigned long long __a, vector unsigned long long __b) {
5855 return __a * __b;
5856 }
5857 #endif
5858
vec_mul(vector float __a,vector float __b)5859 static __inline__ vector float __ATTRS_o_ai vec_mul(vector float __a,
5860 vector float __b) {
5861 return __a * __b;
5862 }
5863
5864 #ifdef __VSX__
vec_mul(vector double __a,vector double __b)5865 static __inline__ vector double __ATTRS_o_ai vec_mul(vector double __a,
5866 vector double __b) {
5867 return __a * __b;
5868 }
5869 #endif
5870
5871 /* The vmulos* and vmules* instructions have a big endian bias, so
5872 we must reverse the meaning of "even" and "odd" for little endian. */
5873
5874 /* vec_mule */
5875
vec_mule(vector signed char __a,vector signed char __b)5876 static __inline__ vector short __ATTRS_o_ai vec_mule(vector signed char __a,
5877 vector signed char __b) {
5878 #ifdef __LITTLE_ENDIAN__
5879 return __builtin_altivec_vmulosb(__a, __b);
5880 #else
5881 return __builtin_altivec_vmulesb(__a, __b);
5882 #endif
5883 }
5884
5885 static __inline__ vector unsigned short __ATTRS_o_ai
vec_mule(vector unsigned char __a,vector unsigned char __b)5886 vec_mule(vector unsigned char __a, vector unsigned char __b) {
5887 #ifdef __LITTLE_ENDIAN__
5888 return __builtin_altivec_vmuloub(__a, __b);
5889 #else
5890 return __builtin_altivec_vmuleub(__a, __b);
5891 #endif
5892 }
5893
vec_mule(vector short __a,vector short __b)5894 static __inline__ vector int __ATTRS_o_ai vec_mule(vector short __a,
5895 vector short __b) {
5896 #ifdef __LITTLE_ENDIAN__
5897 return __builtin_altivec_vmulosh(__a, __b);
5898 #else
5899 return __builtin_altivec_vmulesh(__a, __b);
5900 #endif
5901 }
5902
5903 static __inline__ vector unsigned int __ATTRS_o_ai
vec_mule(vector unsigned short __a,vector unsigned short __b)5904 vec_mule(vector unsigned short __a, vector unsigned short __b) {
5905 #ifdef __LITTLE_ENDIAN__
5906 return __builtin_altivec_vmulouh(__a, __b);
5907 #else
5908 return __builtin_altivec_vmuleuh(__a, __b);
5909 #endif
5910 }
5911
5912 #ifdef __POWER8_VECTOR__
5913 static __inline__ vector signed long long __ATTRS_o_ai
vec_mule(vector signed int __a,vector signed int __b)5914 vec_mule(vector signed int __a, vector signed int __b) {
5915 #ifdef __LITTLE_ENDIAN__
5916 return __builtin_altivec_vmulosw(__a, __b);
5917 #else
5918 return __builtin_altivec_vmulesw(__a, __b);
5919 #endif
5920 }
5921
5922 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_mule(vector unsigned int __a,vector unsigned int __b)5923 vec_mule(vector unsigned int __a, vector unsigned int __b) {
5924 #ifdef __LITTLE_ENDIAN__
5925 return __builtin_altivec_vmulouw(__a, __b);
5926 #else
5927 return __builtin_altivec_vmuleuw(__a, __b);
5928 #endif
5929 }
5930 #endif
5931
5932 #ifdef __POWER10_VECTOR__
5933 static __inline__ vector signed __int128 __ATTRS_o_ai
vec_mule(vector signed long long __a,vector signed long long __b)5934 vec_mule(vector signed long long __a, vector signed long long __b) {
5935 #ifdef __LITTLE_ENDIAN__
5936 return __builtin_altivec_vmulosd(__a, __b);
5937 #else
5938 return __builtin_altivec_vmulesd(__a, __b);
5939 #endif
5940 }
5941
5942 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_mule(vector unsigned long long __a,vector unsigned long long __b)5943 vec_mule(vector unsigned long long __a, vector unsigned long long __b) {
5944 #ifdef __LITTLE_ENDIAN__
5945 return __builtin_altivec_vmuloud(__a, __b);
5946 #else
5947 return __builtin_altivec_vmuleud(__a, __b);
5948 #endif
5949 }
5950 #endif
5951
5952 /* vec_vmulesb */
5953
5954 static __inline__ vector short __attribute__((__always_inline__))
vec_vmulesb(vector signed char __a,vector signed char __b)5955 vec_vmulesb(vector signed char __a, vector signed char __b) {
5956 #ifdef __LITTLE_ENDIAN__
5957 return __builtin_altivec_vmulosb(__a, __b);
5958 #else
5959 return __builtin_altivec_vmulesb(__a, __b);
5960 #endif
5961 }
5962
5963 /* vec_vmuleub */
5964
5965 static __inline__ vector unsigned short __attribute__((__always_inline__))
vec_vmuleub(vector unsigned char __a,vector unsigned char __b)5966 vec_vmuleub(vector unsigned char __a, vector unsigned char __b) {
5967 #ifdef __LITTLE_ENDIAN__
5968 return __builtin_altivec_vmuloub(__a, __b);
5969 #else
5970 return __builtin_altivec_vmuleub(__a, __b);
5971 #endif
5972 }
5973
5974 /* vec_vmulesh */
5975
5976 static __inline__ vector int __attribute__((__always_inline__))
vec_vmulesh(vector short __a,vector short __b)5977 vec_vmulesh(vector short __a, vector short __b) {
5978 #ifdef __LITTLE_ENDIAN__
5979 return __builtin_altivec_vmulosh(__a, __b);
5980 #else
5981 return __builtin_altivec_vmulesh(__a, __b);
5982 #endif
5983 }
5984
5985 /* vec_vmuleuh */
5986
5987 static __inline__ vector unsigned int __attribute__((__always_inline__))
vec_vmuleuh(vector unsigned short __a,vector unsigned short __b)5988 vec_vmuleuh(vector unsigned short __a, vector unsigned short __b) {
5989 #ifdef __LITTLE_ENDIAN__
5990 return __builtin_altivec_vmulouh(__a, __b);
5991 #else
5992 return __builtin_altivec_vmuleuh(__a, __b);
5993 #endif
5994 }
5995
5996 /* vec_mulh */
5997
5998 #ifdef __POWER10_VECTOR__
5999 static __inline__ vector signed int __ATTRS_o_ai
vec_mulh(vector signed int __a,vector signed int __b)6000 vec_mulh(vector signed int __a, vector signed int __b) {
6001 return __builtin_altivec_vmulhsw(__a, __b);
6002 }
6003
6004 static __inline__ vector unsigned int __ATTRS_o_ai
vec_mulh(vector unsigned int __a,vector unsigned int __b)6005 vec_mulh(vector unsigned int __a, vector unsigned int __b) {
6006 return __builtin_altivec_vmulhuw(__a, __b);
6007 }
6008
6009 static __inline__ vector signed long long __ATTRS_o_ai
vec_mulh(vector signed long long __a,vector signed long long __b)6010 vec_mulh(vector signed long long __a, vector signed long long __b) {
6011 return __builtin_altivec_vmulhsd(__a, __b);
6012 }
6013
6014 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_mulh(vector unsigned long long __a,vector unsigned long long __b)6015 vec_mulh(vector unsigned long long __a, vector unsigned long long __b) {
6016 return __builtin_altivec_vmulhud(__a, __b);
6017 }
6018 #endif
6019
6020 /* vec_mulo */
6021
vec_mulo(vector signed char __a,vector signed char __b)6022 static __inline__ vector short __ATTRS_o_ai vec_mulo(vector signed char __a,
6023 vector signed char __b) {
6024 #ifdef __LITTLE_ENDIAN__
6025 return __builtin_altivec_vmulesb(__a, __b);
6026 #else
6027 return __builtin_altivec_vmulosb(__a, __b);
6028 #endif
6029 }
6030
6031 static __inline__ vector unsigned short __ATTRS_o_ai
vec_mulo(vector unsigned char __a,vector unsigned char __b)6032 vec_mulo(vector unsigned char __a, vector unsigned char __b) {
6033 #ifdef __LITTLE_ENDIAN__
6034 return __builtin_altivec_vmuleub(__a, __b);
6035 #else
6036 return __builtin_altivec_vmuloub(__a, __b);
6037 #endif
6038 }
6039
vec_mulo(vector short __a,vector short __b)6040 static __inline__ vector int __ATTRS_o_ai vec_mulo(vector short __a,
6041 vector short __b) {
6042 #ifdef __LITTLE_ENDIAN__
6043 return __builtin_altivec_vmulesh(__a, __b);
6044 #else
6045 return __builtin_altivec_vmulosh(__a, __b);
6046 #endif
6047 }
6048
6049 static __inline__ vector unsigned int __ATTRS_o_ai
vec_mulo(vector unsigned short __a,vector unsigned short __b)6050 vec_mulo(vector unsigned short __a, vector unsigned short __b) {
6051 #ifdef __LITTLE_ENDIAN__
6052 return __builtin_altivec_vmuleuh(__a, __b);
6053 #else
6054 return __builtin_altivec_vmulouh(__a, __b);
6055 #endif
6056 }
6057
6058 #ifdef __POWER8_VECTOR__
6059 static __inline__ vector signed long long __ATTRS_o_ai
vec_mulo(vector signed int __a,vector signed int __b)6060 vec_mulo(vector signed int __a, vector signed int __b) {
6061 #ifdef __LITTLE_ENDIAN__
6062 return __builtin_altivec_vmulesw(__a, __b);
6063 #else
6064 return __builtin_altivec_vmulosw(__a, __b);
6065 #endif
6066 }
6067
6068 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_mulo(vector unsigned int __a,vector unsigned int __b)6069 vec_mulo(vector unsigned int __a, vector unsigned int __b) {
6070 #ifdef __LITTLE_ENDIAN__
6071 return __builtin_altivec_vmuleuw(__a, __b);
6072 #else
6073 return __builtin_altivec_vmulouw(__a, __b);
6074 #endif
6075 }
6076 #endif
6077
6078 #ifdef __POWER10_VECTOR__
6079 static __inline__ vector signed __int128 __ATTRS_o_ai
vec_mulo(vector signed long long __a,vector signed long long __b)6080 vec_mulo(vector signed long long __a, vector signed long long __b) {
6081 #ifdef __LITTLE_ENDIAN__
6082 return __builtin_altivec_vmulesd(__a, __b);
6083 #else
6084 return __builtin_altivec_vmulosd(__a, __b);
6085 #endif
6086 }
6087
6088 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_mulo(vector unsigned long long __a,vector unsigned long long __b)6089 vec_mulo(vector unsigned long long __a, vector unsigned long long __b) {
6090 #ifdef __LITTLE_ENDIAN__
6091 return __builtin_altivec_vmuleud(__a, __b);
6092 #else
6093 return __builtin_altivec_vmuloud(__a, __b);
6094 #endif
6095 }
6096 #endif
6097
6098 /* vec_vmulosb */
6099
6100 static __inline__ vector short __attribute__((__always_inline__))
vec_vmulosb(vector signed char __a,vector signed char __b)6101 vec_vmulosb(vector signed char __a, vector signed char __b) {
6102 #ifdef __LITTLE_ENDIAN__
6103 return __builtin_altivec_vmulesb(__a, __b);
6104 #else
6105 return __builtin_altivec_vmulosb(__a, __b);
6106 #endif
6107 }
6108
6109 /* vec_vmuloub */
6110
6111 static __inline__ vector unsigned short __attribute__((__always_inline__))
vec_vmuloub(vector unsigned char __a,vector unsigned char __b)6112 vec_vmuloub(vector unsigned char __a, vector unsigned char __b) {
6113 #ifdef __LITTLE_ENDIAN__
6114 return __builtin_altivec_vmuleub(__a, __b);
6115 #else
6116 return __builtin_altivec_vmuloub(__a, __b);
6117 #endif
6118 }
6119
6120 /* vec_vmulosh */
6121
6122 static __inline__ vector int __attribute__((__always_inline__))
vec_vmulosh(vector short __a,vector short __b)6123 vec_vmulosh(vector short __a, vector short __b) {
6124 #ifdef __LITTLE_ENDIAN__
6125 return __builtin_altivec_vmulesh(__a, __b);
6126 #else
6127 return __builtin_altivec_vmulosh(__a, __b);
6128 #endif
6129 }
6130
6131 /* vec_vmulouh */
6132
6133 static __inline__ vector unsigned int __attribute__((__always_inline__))
vec_vmulouh(vector unsigned short __a,vector unsigned short __b)6134 vec_vmulouh(vector unsigned short __a, vector unsigned short __b) {
6135 #ifdef __LITTLE_ENDIAN__
6136 return __builtin_altivec_vmuleuh(__a, __b);
6137 #else
6138 return __builtin_altivec_vmulouh(__a, __b);
6139 #endif
6140 }
6141
6142 /* vec_nand */
6143
6144 #ifdef __POWER8_VECTOR__
6145 static __inline__ vector signed char __ATTRS_o_ai
vec_nand(vector signed char __a,vector signed char __b)6146 vec_nand(vector signed char __a, vector signed char __b) {
6147 return ~(__a & __b);
6148 }
6149
6150 static __inline__ vector signed char __ATTRS_o_ai
vec_nand(vector signed char __a,vector bool char __b)6151 vec_nand(vector signed char __a, vector bool char __b) {
6152 return ~(__a & __b);
6153 }
6154
6155 static __inline__ vector signed char __ATTRS_o_ai
vec_nand(vector bool char __a,vector signed char __b)6156 vec_nand(vector bool char __a, vector signed char __b) {
6157 return ~(__a & __b);
6158 }
6159
6160 static __inline__ vector unsigned char __ATTRS_o_ai
vec_nand(vector unsigned char __a,vector unsigned char __b)6161 vec_nand(vector unsigned char __a, vector unsigned char __b) {
6162 return ~(__a & __b);
6163 }
6164
6165 static __inline__ vector unsigned char __ATTRS_o_ai
vec_nand(vector unsigned char __a,vector bool char __b)6166 vec_nand(vector unsigned char __a, vector bool char __b) {
6167 return ~(__a & __b);
6168 }
6169
6170 static __inline__ vector unsigned char __ATTRS_o_ai
vec_nand(vector bool char __a,vector unsigned char __b)6171 vec_nand(vector bool char __a, vector unsigned char __b) {
6172 return ~(__a & __b);
6173 }
6174
vec_nand(vector bool char __a,vector bool char __b)6175 static __inline__ vector bool char __ATTRS_o_ai vec_nand(vector bool char __a,
6176 vector bool char __b) {
6177 return ~(__a & __b);
6178 }
6179
6180 static __inline__ vector signed short __ATTRS_o_ai
vec_nand(vector signed short __a,vector signed short __b)6181 vec_nand(vector signed short __a, vector signed short __b) {
6182 return ~(__a & __b);
6183 }
6184
6185 static __inline__ vector signed short __ATTRS_o_ai
vec_nand(vector signed short __a,vector bool short __b)6186 vec_nand(vector signed short __a, vector bool short __b) {
6187 return ~(__a & __b);
6188 }
6189
6190 static __inline__ vector signed short __ATTRS_o_ai
vec_nand(vector bool short __a,vector signed short __b)6191 vec_nand(vector bool short __a, vector signed short __b) {
6192 return ~(__a & __b);
6193 }
6194
6195 static __inline__ vector unsigned short __ATTRS_o_ai
vec_nand(vector unsigned short __a,vector unsigned short __b)6196 vec_nand(vector unsigned short __a, vector unsigned short __b) {
6197 return ~(__a & __b);
6198 }
6199
6200 static __inline__ vector unsigned short __ATTRS_o_ai
vec_nand(vector unsigned short __a,vector bool short __b)6201 vec_nand(vector unsigned short __a, vector bool short __b) {
6202 return ~(__a & __b);
6203 }
6204
6205 static __inline__ vector bool short __ATTRS_o_ai
vec_nand(vector bool short __a,vector bool short __b)6206 vec_nand(vector bool short __a, vector bool short __b) {
6207 return ~(__a & __b);
6208 }
6209
6210 static __inline__ vector signed int __ATTRS_o_ai
vec_nand(vector signed int __a,vector signed int __b)6211 vec_nand(vector signed int __a, vector signed int __b) {
6212 return ~(__a & __b);
6213 }
6214
vec_nand(vector signed int __a,vector bool int __b)6215 static __inline__ vector signed int __ATTRS_o_ai vec_nand(vector signed int __a,
6216 vector bool int __b) {
6217 return ~(__a & __b);
6218 }
6219
6220 static __inline__ vector signed int __ATTRS_o_ai
vec_nand(vector bool int __a,vector signed int __b)6221 vec_nand(vector bool int __a, vector signed int __b) {
6222 return ~(__a & __b);
6223 }
6224
6225 static __inline__ vector unsigned int __ATTRS_o_ai
vec_nand(vector unsigned int __a,vector unsigned int __b)6226 vec_nand(vector unsigned int __a, vector unsigned int __b) {
6227 return ~(__a & __b);
6228 }
6229
6230 static __inline__ vector unsigned int __ATTRS_o_ai
vec_nand(vector unsigned int __a,vector bool int __b)6231 vec_nand(vector unsigned int __a, vector bool int __b) {
6232 return ~(__a & __b);
6233 }
6234
6235 static __inline__ vector unsigned int __ATTRS_o_ai
vec_nand(vector bool int __a,vector unsigned int __b)6236 vec_nand(vector bool int __a, vector unsigned int __b) {
6237 return ~(__a & __b);
6238 }
6239
vec_nand(vector bool int __a,vector bool int __b)6240 static __inline__ vector bool int __ATTRS_o_ai vec_nand(vector bool int __a,
6241 vector bool int __b) {
6242 return ~(__a & __b);
6243 }
6244
6245 static __inline__ vector float __ATTRS_o_ai
vec_nand(vector float __a,vector float __b)6246 vec_nand(vector float __a, vector float __b) {
6247 return (vector float)(~((vector unsigned int)__a &
6248 (vector unsigned int)__b));
6249 }
6250
6251 static __inline__ vector signed long long __ATTRS_o_ai
vec_nand(vector signed long long __a,vector signed long long __b)6252 vec_nand(vector signed long long __a, vector signed long long __b) {
6253 return ~(__a & __b);
6254 }
6255
6256 static __inline__ vector signed long long __ATTRS_o_ai
vec_nand(vector signed long long __a,vector bool long long __b)6257 vec_nand(vector signed long long __a, vector bool long long __b) {
6258 return ~(__a & __b);
6259 }
6260
6261 static __inline__ vector signed long long __ATTRS_o_ai
vec_nand(vector bool long long __a,vector signed long long __b)6262 vec_nand(vector bool long long __a, vector signed long long __b) {
6263 return ~(__a & __b);
6264 }
6265
6266 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_nand(vector unsigned long long __a,vector unsigned long long __b)6267 vec_nand(vector unsigned long long __a, vector unsigned long long __b) {
6268 return ~(__a & __b);
6269 }
6270
6271 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_nand(vector unsigned long long __a,vector bool long long __b)6272 vec_nand(vector unsigned long long __a, vector bool long long __b) {
6273 return ~(__a & __b);
6274 }
6275
6276 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_nand(vector bool long long __a,vector unsigned long long __b)6277 vec_nand(vector bool long long __a, vector unsigned long long __b) {
6278 return ~(__a & __b);
6279 }
6280
6281 static __inline__ vector bool long long __ATTRS_o_ai
vec_nand(vector bool long long __a,vector bool long long __b)6282 vec_nand(vector bool long long __a, vector bool long long __b) {
6283 return ~(__a & __b);
6284 }
6285
6286 static __inline__ vector double __ATTRS_o_ai
vec_nand(vector double __a,vector double __b)6287 vec_nand(vector double __a, vector double __b) {
6288 return (vector double)(~((vector unsigned long long)__a &
6289 (vector unsigned long long)__b));
6290 }
6291
6292 #endif
6293
6294 /* vec_nmadd */
6295
6296 #ifdef __VSX__
vec_nmadd(vector float __a,vector float __b,vector float __c)6297 static __inline__ vector float __ATTRS_o_ai vec_nmadd(vector float __a,
6298 vector float __b,
6299 vector float __c) {
6300 return __builtin_vsx_xvnmaddasp(__a, __b, __c);
6301 }
6302
vec_nmadd(vector double __a,vector double __b,vector double __c)6303 static __inline__ vector double __ATTRS_o_ai vec_nmadd(vector double __a,
6304 vector double __b,
6305 vector double __c) {
6306 return __builtin_vsx_xvnmaddadp(__a, __b, __c);
6307 }
6308 #endif
6309
6310 /* vec_nmsub */
6311
vec_nmsub(vector float __a,vector float __b,vector float __c)6312 static __inline__ vector float __ATTRS_o_ai vec_nmsub(vector float __a,
6313 vector float __b,
6314 vector float __c) {
6315 #ifdef __VSX__
6316 return __builtin_vsx_xvnmsubasp(__a, __b, __c);
6317 #else
6318 return __builtin_altivec_vnmsubfp(__a, __b, __c);
6319 #endif
6320 }
6321
6322 #ifdef __VSX__
vec_nmsub(vector double __a,vector double __b,vector double __c)6323 static __inline__ vector double __ATTRS_o_ai vec_nmsub(vector double __a,
6324 vector double __b,
6325 vector double __c) {
6326 return __builtin_vsx_xvnmsubadp(__a, __b, __c);
6327 }
6328 #endif
6329
6330 /* vec_vnmsubfp */
6331
6332 static __inline__ vector float __attribute__((__always_inline__))
vec_vnmsubfp(vector float __a,vector float __b,vector float __c)6333 vec_vnmsubfp(vector float __a, vector float __b, vector float __c) {
6334 return __builtin_altivec_vnmsubfp(__a, __b, __c);
6335 }
6336
6337 /* vec_nor */
6338
6339 #define __builtin_altivec_vnor vec_nor
6340
6341 static __inline__ vector signed char __ATTRS_o_ai
vec_nor(vector signed char __a,vector signed char __b)6342 vec_nor(vector signed char __a, vector signed char __b) {
6343 return ~(__a | __b);
6344 }
6345
6346 static __inline__ vector unsigned char __ATTRS_o_ai
vec_nor(vector unsigned char __a,vector unsigned char __b)6347 vec_nor(vector unsigned char __a, vector unsigned char __b) {
6348 return ~(__a | __b);
6349 }
6350
vec_nor(vector bool char __a,vector bool char __b)6351 static __inline__ vector bool char __ATTRS_o_ai vec_nor(vector bool char __a,
6352 vector bool char __b) {
6353 return ~(__a | __b);
6354 }
6355
vec_nor(vector short __a,vector short __b)6356 static __inline__ vector short __ATTRS_o_ai vec_nor(vector short __a,
6357 vector short __b) {
6358 return ~(__a | __b);
6359 }
6360
6361 static __inline__ vector unsigned short __ATTRS_o_ai
vec_nor(vector unsigned short __a,vector unsigned short __b)6362 vec_nor(vector unsigned short __a, vector unsigned short __b) {
6363 return ~(__a | __b);
6364 }
6365
6366 static __inline__ vector bool short __ATTRS_o_ai
vec_nor(vector bool short __a,vector bool short __b)6367 vec_nor(vector bool short __a, vector bool short __b) {
6368 return ~(__a | __b);
6369 }
6370
vec_nor(vector int __a,vector int __b)6371 static __inline__ vector int __ATTRS_o_ai vec_nor(vector int __a,
6372 vector int __b) {
6373 return ~(__a | __b);
6374 }
6375
6376 static __inline__ vector unsigned int __ATTRS_o_ai
vec_nor(vector unsigned int __a,vector unsigned int __b)6377 vec_nor(vector unsigned int __a, vector unsigned int __b) {
6378 return ~(__a | __b);
6379 }
6380
vec_nor(vector bool int __a,vector bool int __b)6381 static __inline__ vector bool int __ATTRS_o_ai vec_nor(vector bool int __a,
6382 vector bool int __b) {
6383 return ~(__a | __b);
6384 }
6385
vec_nor(vector float __a,vector float __b)6386 static __inline__ vector float __ATTRS_o_ai vec_nor(vector float __a,
6387 vector float __b) {
6388 vector unsigned int __res =
6389 ~((vector unsigned int)__a | (vector unsigned int)__b);
6390 return (vector float)__res;
6391 }
6392
6393 #ifdef __VSX__
vec_nor(vector double __a,vector double __b)6394 static __inline__ vector double __ATTRS_o_ai vec_nor(vector double __a,
6395 vector double __b) {
6396 vector unsigned long long __res =
6397 ~((vector unsigned long long)__a | (vector unsigned long long)__b);
6398 return (vector double)__res;
6399 }
6400 #endif
6401
6402 /* vec_vnor */
6403
6404 static __inline__ vector signed char __ATTRS_o_ai
vec_vnor(vector signed char __a,vector signed char __b)6405 vec_vnor(vector signed char __a, vector signed char __b) {
6406 return ~(__a | __b);
6407 }
6408
6409 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vnor(vector unsigned char __a,vector unsigned char __b)6410 vec_vnor(vector unsigned char __a, vector unsigned char __b) {
6411 return ~(__a | __b);
6412 }
6413
vec_vnor(vector bool char __a,vector bool char __b)6414 static __inline__ vector bool char __ATTRS_o_ai vec_vnor(vector bool char __a,
6415 vector bool char __b) {
6416 return ~(__a | __b);
6417 }
6418
vec_vnor(vector short __a,vector short __b)6419 static __inline__ vector short __ATTRS_o_ai vec_vnor(vector short __a,
6420 vector short __b) {
6421 return ~(__a | __b);
6422 }
6423
6424 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vnor(vector unsigned short __a,vector unsigned short __b)6425 vec_vnor(vector unsigned short __a, vector unsigned short __b) {
6426 return ~(__a | __b);
6427 }
6428
6429 static __inline__ vector bool short __ATTRS_o_ai
vec_vnor(vector bool short __a,vector bool short __b)6430 vec_vnor(vector bool short __a, vector bool short __b) {
6431 return ~(__a | __b);
6432 }
6433
vec_vnor(vector int __a,vector int __b)6434 static __inline__ vector int __ATTRS_o_ai vec_vnor(vector int __a,
6435 vector int __b) {
6436 return ~(__a | __b);
6437 }
6438
6439 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vnor(vector unsigned int __a,vector unsigned int __b)6440 vec_vnor(vector unsigned int __a, vector unsigned int __b) {
6441 return ~(__a | __b);
6442 }
6443
vec_vnor(vector bool int __a,vector bool int __b)6444 static __inline__ vector bool int __ATTRS_o_ai vec_vnor(vector bool int __a,
6445 vector bool int __b) {
6446 return ~(__a | __b);
6447 }
6448
vec_vnor(vector float __a,vector float __b)6449 static __inline__ vector float __ATTRS_o_ai vec_vnor(vector float __a,
6450 vector float __b) {
6451 vector unsigned int __res =
6452 ~((vector unsigned int)__a | (vector unsigned int)__b);
6453 return (vector float)__res;
6454 }
6455
6456 #ifdef __VSX__
6457 static __inline__ vector signed long long __ATTRS_o_ai
vec_nor(vector signed long long __a,vector signed long long __b)6458 vec_nor(vector signed long long __a, vector signed long long __b) {
6459 return ~(__a | __b);
6460 }
6461
6462 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_nor(vector unsigned long long __a,vector unsigned long long __b)6463 vec_nor(vector unsigned long long __a, vector unsigned long long __b) {
6464 return ~(__a | __b);
6465 }
6466
6467 static __inline__ vector bool long long __ATTRS_o_ai
vec_nor(vector bool long long __a,vector bool long long __b)6468 vec_nor(vector bool long long __a, vector bool long long __b) {
6469 return ~(__a | __b);
6470 }
6471 #endif
6472
6473 /* vec_or */
6474
6475 #define __builtin_altivec_vor vec_or
6476
6477 static __inline__ vector signed char __ATTRS_o_ai
vec_or(vector signed char __a,vector signed char __b)6478 vec_or(vector signed char __a, vector signed char __b) {
6479 return __a | __b;
6480 }
6481
6482 static __inline__ vector signed char __ATTRS_o_ai
vec_or(vector bool char __a,vector signed char __b)6483 vec_or(vector bool char __a, vector signed char __b) {
6484 return (vector signed char)__a | __b;
6485 }
6486
vec_or(vector signed char __a,vector bool char __b)6487 static __inline__ vector signed char __ATTRS_o_ai vec_or(vector signed char __a,
6488 vector bool char __b) {
6489 return __a | (vector signed char)__b;
6490 }
6491
6492 static __inline__ vector unsigned char __ATTRS_o_ai
vec_or(vector unsigned char __a,vector unsigned char __b)6493 vec_or(vector unsigned char __a, vector unsigned char __b) {
6494 return __a | __b;
6495 }
6496
6497 static __inline__ vector unsigned char __ATTRS_o_ai
vec_or(vector bool char __a,vector unsigned char __b)6498 vec_or(vector bool char __a, vector unsigned char __b) {
6499 return (vector unsigned char)__a | __b;
6500 }
6501
6502 static __inline__ vector unsigned char __ATTRS_o_ai
vec_or(vector unsigned char __a,vector bool char __b)6503 vec_or(vector unsigned char __a, vector bool char __b) {
6504 return __a | (vector unsigned char)__b;
6505 }
6506
vec_or(vector bool char __a,vector bool char __b)6507 static __inline__ vector bool char __ATTRS_o_ai vec_or(vector bool char __a,
6508 vector bool char __b) {
6509 return __a | __b;
6510 }
6511
vec_or(vector short __a,vector short __b)6512 static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a,
6513 vector short __b) {
6514 return __a | __b;
6515 }
6516
vec_or(vector bool short __a,vector short __b)6517 static __inline__ vector short __ATTRS_o_ai vec_or(vector bool short __a,
6518 vector short __b) {
6519 return (vector short)__a | __b;
6520 }
6521
vec_or(vector short __a,vector bool short __b)6522 static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a,
6523 vector bool short __b) {
6524 return __a | (vector short)__b;
6525 }
6526
6527 static __inline__ vector unsigned short __ATTRS_o_ai
vec_or(vector unsigned short __a,vector unsigned short __b)6528 vec_or(vector unsigned short __a, vector unsigned short __b) {
6529 return __a | __b;
6530 }
6531
6532 static __inline__ vector unsigned short __ATTRS_o_ai
vec_or(vector bool short __a,vector unsigned short __b)6533 vec_or(vector bool short __a, vector unsigned short __b) {
6534 return (vector unsigned short)__a | __b;
6535 }
6536
6537 static __inline__ vector unsigned short __ATTRS_o_ai
vec_or(vector unsigned short __a,vector bool short __b)6538 vec_or(vector unsigned short __a, vector bool short __b) {
6539 return __a | (vector unsigned short)__b;
6540 }
6541
vec_or(vector bool short __a,vector bool short __b)6542 static __inline__ vector bool short __ATTRS_o_ai vec_or(vector bool short __a,
6543 vector bool short __b) {
6544 return __a | __b;
6545 }
6546
vec_or(vector int __a,vector int __b)6547 static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a,
6548 vector int __b) {
6549 return __a | __b;
6550 }
6551
vec_or(vector bool int __a,vector int __b)6552 static __inline__ vector int __ATTRS_o_ai vec_or(vector bool int __a,
6553 vector int __b) {
6554 return (vector int)__a | __b;
6555 }
6556
vec_or(vector int __a,vector bool int __b)6557 static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a,
6558 vector bool int __b) {
6559 return __a | (vector int)__b;
6560 }
6561
6562 static __inline__ vector unsigned int __ATTRS_o_ai
vec_or(vector unsigned int __a,vector unsigned int __b)6563 vec_or(vector unsigned int __a, vector unsigned int __b) {
6564 return __a | __b;
6565 }
6566
6567 static __inline__ vector unsigned int __ATTRS_o_ai
vec_or(vector bool int __a,vector unsigned int __b)6568 vec_or(vector bool int __a, vector unsigned int __b) {
6569 return (vector unsigned int)__a | __b;
6570 }
6571
6572 static __inline__ vector unsigned int __ATTRS_o_ai
vec_or(vector unsigned int __a,vector bool int __b)6573 vec_or(vector unsigned int __a, vector bool int __b) {
6574 return __a | (vector unsigned int)__b;
6575 }
6576
vec_or(vector bool int __a,vector bool int __b)6577 static __inline__ vector bool int __ATTRS_o_ai vec_or(vector bool int __a,
6578 vector bool int __b) {
6579 return __a | __b;
6580 }
6581
vec_or(vector float __a,vector float __b)6582 static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a,
6583 vector float __b) {
6584 vector unsigned int __res =
6585 (vector unsigned int)__a | (vector unsigned int)__b;
6586 return (vector float)__res;
6587 }
6588
vec_or(vector bool int __a,vector float __b)6589 static __inline__ vector float __ATTRS_o_ai vec_or(vector bool int __a,
6590 vector float __b) {
6591 vector unsigned int __res =
6592 (vector unsigned int)__a | (vector unsigned int)__b;
6593 return (vector float)__res;
6594 }
6595
vec_or(vector float __a,vector bool int __b)6596 static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a,
6597 vector bool int __b) {
6598 vector unsigned int __res =
6599 (vector unsigned int)__a | (vector unsigned int)__b;
6600 return (vector float)__res;
6601 }
6602
6603 #ifdef __VSX__
vec_or(vector bool long long __a,vector double __b)6604 static __inline__ vector double __ATTRS_o_ai vec_or(vector bool long long __a,
6605 vector double __b) {
6606 return (vector double)((vector unsigned long long)__a |
6607 (vector unsigned long long)__b);
6608 }
6609
vec_or(vector double __a,vector bool long long __b)6610 static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a,
6611 vector bool long long __b) {
6612 return (vector double)((vector unsigned long long)__a |
6613 (vector unsigned long long)__b);
6614 }
6615
vec_or(vector double __a,vector double __b)6616 static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a,
6617 vector double __b) {
6618 return (vector double)((vector unsigned long long)__a |
6619 (vector unsigned long long)__b);
6620 }
6621
6622 static __inline__ vector signed long long __ATTRS_o_ai
vec_or(vector signed long long __a,vector signed long long __b)6623 vec_or(vector signed long long __a, vector signed long long __b) {
6624 return __a | __b;
6625 }
6626
6627 static __inline__ vector signed long long __ATTRS_o_ai
vec_or(vector bool long long __a,vector signed long long __b)6628 vec_or(vector bool long long __a, vector signed long long __b) {
6629 return (vector signed long long)__a | __b;
6630 }
6631
6632 static __inline__ vector signed long long __ATTRS_o_ai
vec_or(vector signed long long __a,vector bool long long __b)6633 vec_or(vector signed long long __a, vector bool long long __b) {
6634 return __a | (vector signed long long)__b;
6635 }
6636
6637 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_or(vector unsigned long long __a,vector unsigned long long __b)6638 vec_or(vector unsigned long long __a, vector unsigned long long __b) {
6639 return __a | __b;
6640 }
6641
6642 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_or(vector bool long long __a,vector unsigned long long __b)6643 vec_or(vector bool long long __a, vector unsigned long long __b) {
6644 return (vector unsigned long long)__a | __b;
6645 }
6646
6647 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_or(vector unsigned long long __a,vector bool long long __b)6648 vec_or(vector unsigned long long __a, vector bool long long __b) {
6649 return __a | (vector unsigned long long)__b;
6650 }
6651
6652 static __inline__ vector bool long long __ATTRS_o_ai
vec_or(vector bool long long __a,vector bool long long __b)6653 vec_or(vector bool long long __a, vector bool long long __b) {
6654 return __a | __b;
6655 }
6656 #endif
6657
6658 #ifdef __POWER8_VECTOR__
6659 static __inline__ vector signed char __ATTRS_o_ai
vec_orc(vector signed char __a,vector signed char __b)6660 vec_orc(vector signed char __a, vector signed char __b) {
6661 return __a | ~__b;
6662 }
6663
6664 static __inline__ vector signed char __ATTRS_o_ai
vec_orc(vector signed char __a,vector bool char __b)6665 vec_orc(vector signed char __a, vector bool char __b) {
6666 return __a | ~__b;
6667 }
6668
6669 static __inline__ vector signed char __ATTRS_o_ai
vec_orc(vector bool char __a,vector signed char __b)6670 vec_orc(vector bool char __a, vector signed char __b) {
6671 return __a | ~__b;
6672 }
6673
6674 static __inline__ vector unsigned char __ATTRS_o_ai
vec_orc(vector unsigned char __a,vector unsigned char __b)6675 vec_orc(vector unsigned char __a, vector unsigned char __b) {
6676 return __a | ~__b;
6677 }
6678
6679 static __inline__ vector unsigned char __ATTRS_o_ai
vec_orc(vector unsigned char __a,vector bool char __b)6680 vec_orc(vector unsigned char __a, vector bool char __b) {
6681 return __a | ~__b;
6682 }
6683
6684 static __inline__ vector unsigned char __ATTRS_o_ai
vec_orc(vector bool char __a,vector unsigned char __b)6685 vec_orc(vector bool char __a, vector unsigned char __b) {
6686 return __a | ~__b;
6687 }
6688
vec_orc(vector bool char __a,vector bool char __b)6689 static __inline__ vector bool char __ATTRS_o_ai vec_orc(vector bool char __a,
6690 vector bool char __b) {
6691 return __a | ~__b;
6692 }
6693
6694 static __inline__ vector signed short __ATTRS_o_ai
vec_orc(vector signed short __a,vector signed short __b)6695 vec_orc(vector signed short __a, vector signed short __b) {
6696 return __a | ~__b;
6697 }
6698
6699 static __inline__ vector signed short __ATTRS_o_ai
vec_orc(vector signed short __a,vector bool short __b)6700 vec_orc(vector signed short __a, vector bool short __b) {
6701 return __a | ~__b;
6702 }
6703
6704 static __inline__ vector signed short __ATTRS_o_ai
vec_orc(vector bool short __a,vector signed short __b)6705 vec_orc(vector bool short __a, vector signed short __b) {
6706 return __a | ~__b;
6707 }
6708
6709 static __inline__ vector unsigned short __ATTRS_o_ai
vec_orc(vector unsigned short __a,vector unsigned short __b)6710 vec_orc(vector unsigned short __a, vector unsigned short __b) {
6711 return __a | ~__b;
6712 }
6713
6714 static __inline__ vector unsigned short __ATTRS_o_ai
vec_orc(vector unsigned short __a,vector bool short __b)6715 vec_orc(vector unsigned short __a, vector bool short __b) {
6716 return __a | ~__b;
6717 }
6718
6719 static __inline__ vector unsigned short __ATTRS_o_ai
vec_orc(vector bool short __a,vector unsigned short __b)6720 vec_orc(vector bool short __a, vector unsigned short __b) {
6721 return __a | ~__b;
6722 }
6723
6724 static __inline__ vector bool short __ATTRS_o_ai
vec_orc(vector bool short __a,vector bool short __b)6725 vec_orc(vector bool short __a, vector bool short __b) {
6726 return __a | ~__b;
6727 }
6728
6729 static __inline__ vector signed int __ATTRS_o_ai
vec_orc(vector signed int __a,vector signed int __b)6730 vec_orc(vector signed int __a, vector signed int __b) {
6731 return __a | ~__b;
6732 }
6733
vec_orc(vector signed int __a,vector bool int __b)6734 static __inline__ vector signed int __ATTRS_o_ai vec_orc(vector signed int __a,
6735 vector bool int __b) {
6736 return __a | ~__b;
6737 }
6738
6739 static __inline__ vector signed int __ATTRS_o_ai
vec_orc(vector bool int __a,vector signed int __b)6740 vec_orc(vector bool int __a, vector signed int __b) {
6741 return __a | ~__b;
6742 }
6743
6744 static __inline__ vector unsigned int __ATTRS_o_ai
vec_orc(vector unsigned int __a,vector unsigned int __b)6745 vec_orc(vector unsigned int __a, vector unsigned int __b) {
6746 return __a | ~__b;
6747 }
6748
6749 static __inline__ vector unsigned int __ATTRS_o_ai
vec_orc(vector unsigned int __a,vector bool int __b)6750 vec_orc(vector unsigned int __a, vector bool int __b) {
6751 return __a | ~__b;
6752 }
6753
6754 static __inline__ vector unsigned int __ATTRS_o_ai
vec_orc(vector bool int __a,vector unsigned int __b)6755 vec_orc(vector bool int __a, vector unsigned int __b) {
6756 return __a | ~__b;
6757 }
6758
vec_orc(vector bool int __a,vector bool int __b)6759 static __inline__ vector bool int __ATTRS_o_ai vec_orc(vector bool int __a,
6760 vector bool int __b) {
6761 return __a | ~__b;
6762 }
6763
6764 static __inline__ vector float __ATTRS_o_ai
vec_orc(vector bool int __a,vector float __b)6765 vec_orc(vector bool int __a, vector float __b) {
6766 return (vector float)(__a | ~(vector unsigned int)__b);
6767 }
6768
6769 static __inline__ vector float __ATTRS_o_ai
vec_orc(vector float __a,vector bool int __b)6770 vec_orc(vector float __a, vector bool int __b) {
6771 return (vector float)((vector unsigned int)__a | ~__b);
6772 }
6773
6774 static __inline__ vector signed long long __ATTRS_o_ai
vec_orc(vector signed long long __a,vector signed long long __b)6775 vec_orc(vector signed long long __a, vector signed long long __b) {
6776 return __a | ~__b;
6777 }
6778
6779 static __inline__ vector signed long long __ATTRS_o_ai
vec_orc(vector signed long long __a,vector bool long long __b)6780 vec_orc(vector signed long long __a, vector bool long long __b) {
6781 return __a | ~__b;
6782 }
6783
6784 static __inline__ vector signed long long __ATTRS_o_ai
vec_orc(vector bool long long __a,vector signed long long __b)6785 vec_orc(vector bool long long __a, vector signed long long __b) {
6786 return __a | ~__b;
6787 }
6788
6789 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_orc(vector unsigned long long __a,vector unsigned long long __b)6790 vec_orc(vector unsigned long long __a, vector unsigned long long __b) {
6791 return __a | ~__b;
6792 }
6793
6794 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_orc(vector unsigned long long __a,vector bool long long __b)6795 vec_orc(vector unsigned long long __a, vector bool long long __b) {
6796 return __a | ~__b;
6797 }
6798
6799 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_orc(vector bool long long __a,vector unsigned long long __b)6800 vec_orc(vector bool long long __a, vector unsigned long long __b) {
6801 return __a | ~__b;
6802 }
6803
6804 static __inline__ vector bool long long __ATTRS_o_ai
vec_orc(vector bool long long __a,vector bool long long __b)6805 vec_orc(vector bool long long __a, vector bool long long __b) {
6806 return __a | ~__b;
6807 }
6808
6809 static __inline__ vector double __ATTRS_o_ai
vec_orc(vector double __a,vector bool long long __b)6810 vec_orc(vector double __a, vector bool long long __b) {
6811 return (vector double)((vector unsigned long long)__a | ~__b);
6812 }
6813
6814 static __inline__ vector double __ATTRS_o_ai
vec_orc(vector bool long long __a,vector double __b)6815 vec_orc(vector bool long long __a, vector double __b) {
6816 return (vector double)(__a | ~(vector unsigned long long)__b);
6817 }
6818 #endif
6819
6820 /* vec_vor */
6821
6822 static __inline__ vector signed char __ATTRS_o_ai
vec_vor(vector signed char __a,vector signed char __b)6823 vec_vor(vector signed char __a, vector signed char __b) {
6824 return __a | __b;
6825 }
6826
6827 static __inline__ vector signed char __ATTRS_o_ai
vec_vor(vector bool char __a,vector signed char __b)6828 vec_vor(vector bool char __a, vector signed char __b) {
6829 return (vector signed char)__a | __b;
6830 }
6831
6832 static __inline__ vector signed char __ATTRS_o_ai
vec_vor(vector signed char __a,vector bool char __b)6833 vec_vor(vector signed char __a, vector bool char __b) {
6834 return __a | (vector signed char)__b;
6835 }
6836
6837 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vor(vector unsigned char __a,vector unsigned char __b)6838 vec_vor(vector unsigned char __a, vector unsigned char __b) {
6839 return __a | __b;
6840 }
6841
6842 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vor(vector bool char __a,vector unsigned char __b)6843 vec_vor(vector bool char __a, vector unsigned char __b) {
6844 return (vector unsigned char)__a | __b;
6845 }
6846
6847 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vor(vector unsigned char __a,vector bool char __b)6848 vec_vor(vector unsigned char __a, vector bool char __b) {
6849 return __a | (vector unsigned char)__b;
6850 }
6851
vec_vor(vector bool char __a,vector bool char __b)6852 static __inline__ vector bool char __ATTRS_o_ai vec_vor(vector bool char __a,
6853 vector bool char __b) {
6854 return __a | __b;
6855 }
6856
vec_vor(vector short __a,vector short __b)6857 static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a,
6858 vector short __b) {
6859 return __a | __b;
6860 }
6861
vec_vor(vector bool short __a,vector short __b)6862 static __inline__ vector short __ATTRS_o_ai vec_vor(vector bool short __a,
6863 vector short __b) {
6864 return (vector short)__a | __b;
6865 }
6866
vec_vor(vector short __a,vector bool short __b)6867 static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a,
6868 vector bool short __b) {
6869 return __a | (vector short)__b;
6870 }
6871
6872 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vor(vector unsigned short __a,vector unsigned short __b)6873 vec_vor(vector unsigned short __a, vector unsigned short __b) {
6874 return __a | __b;
6875 }
6876
6877 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vor(vector bool short __a,vector unsigned short __b)6878 vec_vor(vector bool short __a, vector unsigned short __b) {
6879 return (vector unsigned short)__a | __b;
6880 }
6881
6882 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vor(vector unsigned short __a,vector bool short __b)6883 vec_vor(vector unsigned short __a, vector bool short __b) {
6884 return __a | (vector unsigned short)__b;
6885 }
6886
6887 static __inline__ vector bool short __ATTRS_o_ai
vec_vor(vector bool short __a,vector bool short __b)6888 vec_vor(vector bool short __a, vector bool short __b) {
6889 return __a | __b;
6890 }
6891
vec_vor(vector int __a,vector int __b)6892 static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a,
6893 vector int __b) {
6894 return __a | __b;
6895 }
6896
vec_vor(vector bool int __a,vector int __b)6897 static __inline__ vector int __ATTRS_o_ai vec_vor(vector bool int __a,
6898 vector int __b) {
6899 return (vector int)__a | __b;
6900 }
6901
vec_vor(vector int __a,vector bool int __b)6902 static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a,
6903 vector bool int __b) {
6904 return __a | (vector int)__b;
6905 }
6906
6907 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vor(vector unsigned int __a,vector unsigned int __b)6908 vec_vor(vector unsigned int __a, vector unsigned int __b) {
6909 return __a | __b;
6910 }
6911
6912 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vor(vector bool int __a,vector unsigned int __b)6913 vec_vor(vector bool int __a, vector unsigned int __b) {
6914 return (vector unsigned int)__a | __b;
6915 }
6916
6917 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vor(vector unsigned int __a,vector bool int __b)6918 vec_vor(vector unsigned int __a, vector bool int __b) {
6919 return __a | (vector unsigned int)__b;
6920 }
6921
vec_vor(vector bool int __a,vector bool int __b)6922 static __inline__ vector bool int __ATTRS_o_ai vec_vor(vector bool int __a,
6923 vector bool int __b) {
6924 return __a | __b;
6925 }
6926
vec_vor(vector float __a,vector float __b)6927 static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a,
6928 vector float __b) {
6929 vector unsigned int __res =
6930 (vector unsigned int)__a | (vector unsigned int)__b;
6931 return (vector float)__res;
6932 }
6933
vec_vor(vector bool int __a,vector float __b)6934 static __inline__ vector float __ATTRS_o_ai vec_vor(vector bool int __a,
6935 vector float __b) {
6936 vector unsigned int __res =
6937 (vector unsigned int)__a | (vector unsigned int)__b;
6938 return (vector float)__res;
6939 }
6940
vec_vor(vector float __a,vector bool int __b)6941 static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a,
6942 vector bool int __b) {
6943 vector unsigned int __res =
6944 (vector unsigned int)__a | (vector unsigned int)__b;
6945 return (vector float)__res;
6946 }
6947
6948 #ifdef __VSX__
6949 static __inline__ vector signed long long __ATTRS_o_ai
vec_vor(vector signed long long __a,vector signed long long __b)6950 vec_vor(vector signed long long __a, vector signed long long __b) {
6951 return __a | __b;
6952 }
6953
6954 static __inline__ vector signed long long __ATTRS_o_ai
vec_vor(vector bool long long __a,vector signed long long __b)6955 vec_vor(vector bool long long __a, vector signed long long __b) {
6956 return (vector signed long long)__a | __b;
6957 }
6958
6959 static __inline__ vector signed long long __ATTRS_o_ai
vec_vor(vector signed long long __a,vector bool long long __b)6960 vec_vor(vector signed long long __a, vector bool long long __b) {
6961 return __a | (vector signed long long)__b;
6962 }
6963
6964 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_vor(vector unsigned long long __a,vector unsigned long long __b)6965 vec_vor(vector unsigned long long __a, vector unsigned long long __b) {
6966 return __a | __b;
6967 }
6968
6969 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_vor(vector bool long long __a,vector unsigned long long __b)6970 vec_vor(vector bool long long __a, vector unsigned long long __b) {
6971 return (vector unsigned long long)__a | __b;
6972 }
6973
6974 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_vor(vector unsigned long long __a,vector bool long long __b)6975 vec_vor(vector unsigned long long __a, vector bool long long __b) {
6976 return __a | (vector unsigned long long)__b;
6977 }
6978
6979 static __inline__ vector bool long long __ATTRS_o_ai
vec_vor(vector bool long long __a,vector bool long long __b)6980 vec_vor(vector bool long long __a, vector bool long long __b) {
6981 return __a | __b;
6982 }
6983 #endif
6984
6985 /* vec_pack */
6986
6987 /* The various vector pack instructions have a big-endian bias, so for
6988 little endian we must handle reversed element numbering. */
6989
6990 static __inline__ vector signed char __ATTRS_o_ai
vec_pack(vector signed short __a,vector signed short __b)6991 vec_pack(vector signed short __a, vector signed short __b) {
6992 #ifdef __LITTLE_ENDIAN__
6993 return (vector signed char)vec_perm(
6994 __a, __b,
6995 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
6996 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
6997 #else
6998 return (vector signed char)vec_perm(
6999 __a, __b,
7000 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
7001 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
7002 #endif
7003 }
7004
7005 static __inline__ vector unsigned char __ATTRS_o_ai
vec_pack(vector unsigned short __a,vector unsigned short __b)7006 vec_pack(vector unsigned short __a, vector unsigned short __b) {
7007 #ifdef __LITTLE_ENDIAN__
7008 return (vector unsigned char)vec_perm(
7009 __a, __b,
7010 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
7011 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
7012 #else
7013 return (vector unsigned char)vec_perm(
7014 __a, __b,
7015 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
7016 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
7017 #endif
7018 }
7019
7020 static __inline__ vector bool char __ATTRS_o_ai
vec_pack(vector bool short __a,vector bool short __b)7021 vec_pack(vector bool short __a, vector bool short __b) {
7022 #ifdef __LITTLE_ENDIAN__
7023 return (vector bool char)vec_perm(
7024 __a, __b,
7025 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
7026 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
7027 #else
7028 return (vector bool char)vec_perm(
7029 __a, __b,
7030 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
7031 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
7032 #endif
7033 }
7034
vec_pack(vector int __a,vector int __b)7035 static __inline__ vector short __ATTRS_o_ai vec_pack(vector int __a,
7036 vector int __b) {
7037 #ifdef __LITTLE_ENDIAN__
7038 return (vector short)vec_perm(
7039 __a, __b,
7040 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
7041 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
7042 #else
7043 return (vector short)vec_perm(
7044 __a, __b,
7045 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
7046 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
7047 #endif
7048 }
7049
7050 static __inline__ vector unsigned short __ATTRS_o_ai
vec_pack(vector unsigned int __a,vector unsigned int __b)7051 vec_pack(vector unsigned int __a, vector unsigned int __b) {
7052 #ifdef __LITTLE_ENDIAN__
7053 return (vector unsigned short)vec_perm(
7054 __a, __b,
7055 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
7056 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
7057 #else
7058 return (vector unsigned short)vec_perm(
7059 __a, __b,
7060 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
7061 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
7062 #endif
7063 }
7064
vec_pack(vector bool int __a,vector bool int __b)7065 static __inline__ vector bool short __ATTRS_o_ai vec_pack(vector bool int __a,
7066 vector bool int __b) {
7067 #ifdef __LITTLE_ENDIAN__
7068 return (vector bool short)vec_perm(
7069 __a, __b,
7070 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
7071 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
7072 #else
7073 return (vector bool short)vec_perm(
7074 __a, __b,
7075 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
7076 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
7077 #endif
7078 }
7079
7080 #ifdef __VSX__
7081 static __inline__ vector signed int __ATTRS_o_ai
vec_pack(vector signed long long __a,vector signed long long __b)7082 vec_pack(vector signed long long __a, vector signed long long __b) {
7083 #ifdef __LITTLE_ENDIAN__
7084 return (vector signed int)vec_perm(
7085 __a, __b,
7086 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
7087 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
7088 #else
7089 return (vector signed int)vec_perm(
7090 __a, __b,
7091 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
7092 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
7093 #endif
7094 }
7095 static __inline__ vector unsigned int __ATTRS_o_ai
vec_pack(vector unsigned long long __a,vector unsigned long long __b)7096 vec_pack(vector unsigned long long __a, vector unsigned long long __b) {
7097 #ifdef __LITTLE_ENDIAN__
7098 return (vector unsigned int)vec_perm(
7099 __a, __b,
7100 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
7101 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
7102 #else
7103 return (vector unsigned int)vec_perm(
7104 __a, __b,
7105 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
7106 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
7107 #endif
7108 }
7109
7110 static __inline__ vector bool int __ATTRS_o_ai
vec_pack(vector bool long long __a,vector bool long long __b)7111 vec_pack(vector bool long long __a, vector bool long long __b) {
7112 #ifdef __LITTLE_ENDIAN__
7113 return (vector bool int)vec_perm(
7114 __a, __b,
7115 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
7116 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
7117 #else
7118 return (vector bool int)vec_perm(
7119 __a, __b,
7120 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
7121 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
7122 #endif
7123 }
7124
7125 static __inline__ vector float __ATTRS_o_ai
vec_pack(vector double __a,vector double __b)7126 vec_pack(vector double __a, vector double __b) {
7127 return (vector float) (__a[0], __a[1], __b[0], __b[1]);
7128 }
7129 #endif
7130
7131 #ifdef __POWER9_VECTOR__
7132 static __inline__ vector unsigned short __ATTRS_o_ai
vec_pack_to_short_fp32(vector float __a,vector float __b)7133 vec_pack_to_short_fp32(vector float __a, vector float __b) {
7134 vector float __resa = __builtin_vsx_xvcvsphp(__a);
7135 vector float __resb = __builtin_vsx_xvcvsphp(__b);
7136 #ifdef __LITTLE_ENDIAN__
7137 return (vector unsigned short)vec_mergee(__resa, __resb);
7138 #else
7139 return (vector unsigned short)vec_mergeo(__resa, __resb);
7140 #endif
7141 }
7142
7143 #endif
7144 /* vec_vpkuhum */
7145
7146 #define __builtin_altivec_vpkuhum vec_vpkuhum
7147
7148 static __inline__ vector signed char __ATTRS_o_ai
vec_vpkuhum(vector signed short __a,vector signed short __b)7149 vec_vpkuhum(vector signed short __a, vector signed short __b) {
7150 #ifdef __LITTLE_ENDIAN__
7151 return (vector signed char)vec_perm(
7152 __a, __b,
7153 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
7154 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
7155 #else
7156 return (vector signed char)vec_perm(
7157 __a, __b,
7158 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
7159 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
7160 #endif
7161 }
7162
7163 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vpkuhum(vector unsigned short __a,vector unsigned short __b)7164 vec_vpkuhum(vector unsigned short __a, vector unsigned short __b) {
7165 #ifdef __LITTLE_ENDIAN__
7166 return (vector unsigned char)vec_perm(
7167 __a, __b,
7168 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
7169 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
7170 #else
7171 return (vector unsigned char)vec_perm(
7172 __a, __b,
7173 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
7174 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
7175 #endif
7176 }
7177
7178 static __inline__ vector bool char __ATTRS_o_ai
vec_vpkuhum(vector bool short __a,vector bool short __b)7179 vec_vpkuhum(vector bool short __a, vector bool short __b) {
7180 #ifdef __LITTLE_ENDIAN__
7181 return (vector bool char)vec_perm(
7182 __a, __b,
7183 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
7184 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
7185 #else
7186 return (vector bool char)vec_perm(
7187 __a, __b,
7188 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
7189 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
7190 #endif
7191 }
7192
7193 /* vec_vpkuwum */
7194
7195 #define __builtin_altivec_vpkuwum vec_vpkuwum
7196
vec_vpkuwum(vector int __a,vector int __b)7197 static __inline__ vector short __ATTRS_o_ai vec_vpkuwum(vector int __a,
7198 vector int __b) {
7199 #ifdef __LITTLE_ENDIAN__
7200 return (vector short)vec_perm(
7201 __a, __b,
7202 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
7203 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
7204 #else
7205 return (vector short)vec_perm(
7206 __a, __b,
7207 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
7208 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
7209 #endif
7210 }
7211
7212 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vpkuwum(vector unsigned int __a,vector unsigned int __b)7213 vec_vpkuwum(vector unsigned int __a, vector unsigned int __b) {
7214 #ifdef __LITTLE_ENDIAN__
7215 return (vector unsigned short)vec_perm(
7216 __a, __b,
7217 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
7218 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
7219 #else
7220 return (vector unsigned short)vec_perm(
7221 __a, __b,
7222 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
7223 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
7224 #endif
7225 }
7226
7227 static __inline__ vector bool short __ATTRS_o_ai
vec_vpkuwum(vector bool int __a,vector bool int __b)7228 vec_vpkuwum(vector bool int __a, vector bool int __b) {
7229 #ifdef __LITTLE_ENDIAN__
7230 return (vector bool short)vec_perm(
7231 __a, __b,
7232 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
7233 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
7234 #else
7235 return (vector bool short)vec_perm(
7236 __a, __b,
7237 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
7238 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
7239 #endif
7240 }
7241
7242 /* vec_vpkudum */
7243
7244 #ifdef __POWER8_VECTOR__
7245 #define __builtin_altivec_vpkudum vec_vpkudum
7246
vec_vpkudum(vector long long __a,vector long long __b)7247 static __inline__ vector int __ATTRS_o_ai vec_vpkudum(vector long long __a,
7248 vector long long __b) {
7249 #ifdef __LITTLE_ENDIAN__
7250 return (vector int)vec_perm(
7251 __a, __b,
7252 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
7253 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
7254 #else
7255 return (vector int)vec_perm(
7256 __a, __b,
7257 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
7258 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
7259 #endif
7260 }
7261
7262 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vpkudum(vector unsigned long long __a,vector unsigned long long __b)7263 vec_vpkudum(vector unsigned long long __a, vector unsigned long long __b) {
7264 #ifdef __LITTLE_ENDIAN__
7265 return (vector unsigned int)vec_perm(
7266 __a, __b,
7267 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
7268 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
7269 #else
7270 return (vector unsigned int)vec_perm(
7271 __a, __b,
7272 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
7273 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
7274 #endif
7275 }
7276
7277 static __inline__ vector bool int __ATTRS_o_ai
vec_vpkudum(vector bool long long __a,vector bool long long __b)7278 vec_vpkudum(vector bool long long __a, vector bool long long __b) {
7279 #ifdef __LITTLE_ENDIAN__
7280 return (vector bool int)vec_perm(
7281 (vector long long)__a, (vector long long)__b,
7282 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
7283 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
7284 #else
7285 return (vector bool int)vec_perm(
7286 (vector long long)__a, (vector long long)__b,
7287 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
7288 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
7289 #endif
7290 }
7291 #endif
7292
7293 /* vec_packpx */
7294
7295 static __inline__ vector pixel __attribute__((__always_inline__))
vec_packpx(vector unsigned int __a,vector unsigned int __b)7296 vec_packpx(vector unsigned int __a, vector unsigned int __b) {
7297 #ifdef __LITTLE_ENDIAN__
7298 return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
7299 #else
7300 return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
7301 #endif
7302 }
7303
7304 /* vec_vpkpx */
7305
7306 static __inline__ vector pixel __attribute__((__always_inline__))
vec_vpkpx(vector unsigned int __a,vector unsigned int __b)7307 vec_vpkpx(vector unsigned int __a, vector unsigned int __b) {
7308 #ifdef __LITTLE_ENDIAN__
7309 return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
7310 #else
7311 return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
7312 #endif
7313 }
7314
7315 /* vec_packs */
7316
vec_packs(vector short __a,vector short __b)7317 static __inline__ vector signed char __ATTRS_o_ai vec_packs(vector short __a,
7318 vector short __b) {
7319 #ifdef __LITTLE_ENDIAN__
7320 return __builtin_altivec_vpkshss(__b, __a);
7321 #else
7322 return __builtin_altivec_vpkshss(__a, __b);
7323 #endif
7324 }
7325
7326 static __inline__ vector unsigned char __ATTRS_o_ai
vec_packs(vector unsigned short __a,vector unsigned short __b)7327 vec_packs(vector unsigned short __a, vector unsigned short __b) {
7328 #ifdef __LITTLE_ENDIAN__
7329 return __builtin_altivec_vpkuhus(__b, __a);
7330 #else
7331 return __builtin_altivec_vpkuhus(__a, __b);
7332 #endif
7333 }
7334
vec_packs(vector int __a,vector int __b)7335 static __inline__ vector signed short __ATTRS_o_ai vec_packs(vector int __a,
7336 vector int __b) {
7337 #ifdef __LITTLE_ENDIAN__
7338 return __builtin_altivec_vpkswss(__b, __a);
7339 #else
7340 return __builtin_altivec_vpkswss(__a, __b);
7341 #endif
7342 }
7343
7344 static __inline__ vector unsigned short __ATTRS_o_ai
vec_packs(vector unsigned int __a,vector unsigned int __b)7345 vec_packs(vector unsigned int __a, vector unsigned int __b) {
7346 #ifdef __LITTLE_ENDIAN__
7347 return __builtin_altivec_vpkuwus(__b, __a);
7348 #else
7349 return __builtin_altivec_vpkuwus(__a, __b);
7350 #endif
7351 }
7352
7353 #ifdef __POWER8_VECTOR__
vec_packs(vector long long __a,vector long long __b)7354 static __inline__ vector int __ATTRS_o_ai vec_packs(vector long long __a,
7355 vector long long __b) {
7356 #ifdef __LITTLE_ENDIAN__
7357 return __builtin_altivec_vpksdss(__b, __a);
7358 #else
7359 return __builtin_altivec_vpksdss(__a, __b);
7360 #endif
7361 }
7362
7363 static __inline__ vector unsigned int __ATTRS_o_ai
vec_packs(vector unsigned long long __a,vector unsigned long long __b)7364 vec_packs(vector unsigned long long __a, vector unsigned long long __b) {
7365 #ifdef __LITTLE_ENDIAN__
7366 return __builtin_altivec_vpkudus(__b, __a);
7367 #else
7368 return __builtin_altivec_vpkudus(__a, __b);
7369 #endif
7370 }
7371 #endif
7372
7373 /* vec_vpkshss */
7374
7375 static __inline__ vector signed char __attribute__((__always_inline__))
vec_vpkshss(vector short __a,vector short __b)7376 vec_vpkshss(vector short __a, vector short __b) {
7377 #ifdef __LITTLE_ENDIAN__
7378 return __builtin_altivec_vpkshss(__b, __a);
7379 #else
7380 return __builtin_altivec_vpkshss(__a, __b);
7381 #endif
7382 }
7383
7384 /* vec_vpksdss */
7385
7386 #ifdef __POWER8_VECTOR__
vec_vpksdss(vector long long __a,vector long long __b)7387 static __inline__ vector int __ATTRS_o_ai vec_vpksdss(vector long long __a,
7388 vector long long __b) {
7389 #ifdef __LITTLE_ENDIAN__
7390 return __builtin_altivec_vpksdss(__b, __a);
7391 #else
7392 return __builtin_altivec_vpksdss(__a, __b);
7393 #endif
7394 }
7395 #endif
7396
7397 /* vec_vpkuhus */
7398
7399 static __inline__ vector unsigned char __attribute__((__always_inline__))
vec_vpkuhus(vector unsigned short __a,vector unsigned short __b)7400 vec_vpkuhus(vector unsigned short __a, vector unsigned short __b) {
7401 #ifdef __LITTLE_ENDIAN__
7402 return __builtin_altivec_vpkuhus(__b, __a);
7403 #else
7404 return __builtin_altivec_vpkuhus(__a, __b);
7405 #endif
7406 }
7407
7408 /* vec_vpkudus */
7409
7410 #ifdef __POWER8_VECTOR__
7411 static __inline__ vector unsigned int __attribute__((__always_inline__))
vec_vpkudus(vector unsigned long long __a,vector unsigned long long __b)7412 vec_vpkudus(vector unsigned long long __a, vector unsigned long long __b) {
7413 #ifdef __LITTLE_ENDIAN__
7414 return __builtin_altivec_vpkudus(__b, __a);
7415 #else
7416 return __builtin_altivec_vpkudus(__a, __b);
7417 #endif
7418 }
7419 #endif
7420
7421 /* vec_vpkswss */
7422
7423 static __inline__ vector signed short __attribute__((__always_inline__))
vec_vpkswss(vector int __a,vector int __b)7424 vec_vpkswss(vector int __a, vector int __b) {
7425 #ifdef __LITTLE_ENDIAN__
7426 return __builtin_altivec_vpkswss(__b, __a);
7427 #else
7428 return __builtin_altivec_vpkswss(__a, __b);
7429 #endif
7430 }
7431
7432 /* vec_vpkuwus */
7433
7434 static __inline__ vector unsigned short __attribute__((__always_inline__))
vec_vpkuwus(vector unsigned int __a,vector unsigned int __b)7435 vec_vpkuwus(vector unsigned int __a, vector unsigned int __b) {
7436 #ifdef __LITTLE_ENDIAN__
7437 return __builtin_altivec_vpkuwus(__b, __a);
7438 #else
7439 return __builtin_altivec_vpkuwus(__a, __b);
7440 #endif
7441 }
7442
7443 /* vec_packsu */
7444
7445 static __inline__ vector unsigned char __ATTRS_o_ai
vec_packsu(vector short __a,vector short __b)7446 vec_packsu(vector short __a, vector short __b) {
7447 #ifdef __LITTLE_ENDIAN__
7448 return __builtin_altivec_vpkshus(__b, __a);
7449 #else
7450 return __builtin_altivec_vpkshus(__a, __b);
7451 #endif
7452 }
7453
7454 static __inline__ vector unsigned char __ATTRS_o_ai
vec_packsu(vector unsigned short __a,vector unsigned short __b)7455 vec_packsu(vector unsigned short __a, vector unsigned short __b) {
7456 #ifdef __LITTLE_ENDIAN__
7457 return __builtin_altivec_vpkuhus(__b, __a);
7458 #else
7459 return __builtin_altivec_vpkuhus(__a, __b);
7460 #endif
7461 }
7462
7463 static __inline__ vector unsigned short __ATTRS_o_ai
vec_packsu(vector int __a,vector int __b)7464 vec_packsu(vector int __a, vector int __b) {
7465 #ifdef __LITTLE_ENDIAN__
7466 return __builtin_altivec_vpkswus(__b, __a);
7467 #else
7468 return __builtin_altivec_vpkswus(__a, __b);
7469 #endif
7470 }
7471
7472 static __inline__ vector unsigned short __ATTRS_o_ai
vec_packsu(vector unsigned int __a,vector unsigned int __b)7473 vec_packsu(vector unsigned int __a, vector unsigned int __b) {
7474 #ifdef __LITTLE_ENDIAN__
7475 return __builtin_altivec_vpkuwus(__b, __a);
7476 #else
7477 return __builtin_altivec_vpkuwus(__a, __b);
7478 #endif
7479 }
7480
7481 #ifdef __POWER8_VECTOR__
7482 static __inline__ vector unsigned int __ATTRS_o_ai
vec_packsu(vector long long __a,vector long long __b)7483 vec_packsu(vector long long __a, vector long long __b) {
7484 #ifdef __LITTLE_ENDIAN__
7485 return __builtin_altivec_vpksdus(__b, __a);
7486 #else
7487 return __builtin_altivec_vpksdus(__a, __b);
7488 #endif
7489 }
7490
7491 static __inline__ vector unsigned int __ATTRS_o_ai
vec_packsu(vector unsigned long long __a,vector unsigned long long __b)7492 vec_packsu(vector unsigned long long __a, vector unsigned long long __b) {
7493 #ifdef __LITTLE_ENDIAN__
7494 return __builtin_altivec_vpkudus(__b, __a);
7495 #else
7496 return __builtin_altivec_vpkudus(__a, __b);
7497 #endif
7498 }
7499 #endif
7500
7501 /* vec_vpkshus */
7502
7503 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vpkshus(vector short __a,vector short __b)7504 vec_vpkshus(vector short __a, vector short __b) {
7505 #ifdef __LITTLE_ENDIAN__
7506 return __builtin_altivec_vpkshus(__b, __a);
7507 #else
7508 return __builtin_altivec_vpkshus(__a, __b);
7509 #endif
7510 }
7511
7512 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vpkshus(vector unsigned short __a,vector unsigned short __b)7513 vec_vpkshus(vector unsigned short __a, vector unsigned short __b) {
7514 #ifdef __LITTLE_ENDIAN__
7515 return __builtin_altivec_vpkuhus(__b, __a);
7516 #else
7517 return __builtin_altivec_vpkuhus(__a, __b);
7518 #endif
7519 }
7520
7521 /* vec_vpkswus */
7522
7523 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vpkswus(vector int __a,vector int __b)7524 vec_vpkswus(vector int __a, vector int __b) {
7525 #ifdef __LITTLE_ENDIAN__
7526 return __builtin_altivec_vpkswus(__b, __a);
7527 #else
7528 return __builtin_altivec_vpkswus(__a, __b);
7529 #endif
7530 }
7531
7532 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vpkswus(vector unsigned int __a,vector unsigned int __b)7533 vec_vpkswus(vector unsigned int __a, vector unsigned int __b) {
7534 #ifdef __LITTLE_ENDIAN__
7535 return __builtin_altivec_vpkuwus(__b, __a);
7536 #else
7537 return __builtin_altivec_vpkuwus(__a, __b);
7538 #endif
7539 }
7540
7541 /* vec_vpksdus */
7542
7543 #ifdef __POWER8_VECTOR__
7544 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vpksdus(vector long long __a,vector long long __b)7545 vec_vpksdus(vector long long __a, vector long long __b) {
7546 #ifdef __LITTLE_ENDIAN__
7547 return __builtin_altivec_vpksdus(__b, __a);
7548 #else
7549 return __builtin_altivec_vpksdus(__a, __b);
7550 #endif
7551 }
7552 #endif
7553
7554 /* vec_perm */
7555
7556 // The vperm instruction is defined architecturally with a big-endian bias.
7557 // For little endian, we swap the input operands and invert the permute
7558 // control vector. Only the rightmost 5 bits matter, so we could use
7559 // a vector of all 31s instead of all 255s to perform the inversion.
7560 // However, when the PCV is not a constant, using 255 has an advantage
7561 // in that the vec_xor can be recognized as a vec_nor (and for P8 and
7562 // later, possibly a vec_nand).
7563
vec_perm(vector signed char __a,vector signed char __b,vector unsigned char __c)7564 static __inline__ vector signed char __ATTRS_o_ai vec_perm(
7565 vector signed char __a, vector signed char __b, vector unsigned char __c) {
7566 #ifdef __LITTLE_ENDIAN__
7567 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7568 255, 255, 255, 255, 255, 255, 255, 255};
7569 __d = vec_xor(__c, __d);
7570 return (vector signed char)__builtin_altivec_vperm_4si((vector int)__b,
7571 (vector int)__a, __d);
7572 #else
7573 return (vector signed char)__builtin_altivec_vperm_4si((vector int)__a,
7574 (vector int)__b, __c);
7575 #endif
7576 }
7577
7578 static __inline__ vector unsigned char __ATTRS_o_ai
vec_perm(vector unsigned char __a,vector unsigned char __b,vector unsigned char __c)7579 vec_perm(vector unsigned char __a, vector unsigned char __b,
7580 vector unsigned char __c) {
7581 #ifdef __LITTLE_ENDIAN__
7582 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7583 255, 255, 255, 255, 255, 255, 255, 255};
7584 __d = vec_xor(__c, __d);
7585 return (vector unsigned char)__builtin_altivec_vperm_4si(
7586 (vector int)__b, (vector int)__a, __d);
7587 #else
7588 return (vector unsigned char)__builtin_altivec_vperm_4si(
7589 (vector int)__a, (vector int)__b, __c);
7590 #endif
7591 }
7592
7593 static __inline__ vector bool char __ATTRS_o_ai
vec_perm(vector bool char __a,vector bool char __b,vector unsigned char __c)7594 vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c) {
7595 #ifdef __LITTLE_ENDIAN__
7596 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7597 255, 255, 255, 255, 255, 255, 255, 255};
7598 __d = vec_xor(__c, __d);
7599 return (vector bool char)__builtin_altivec_vperm_4si((vector int)__b,
7600 (vector int)__a, __d);
7601 #else
7602 return (vector bool char)__builtin_altivec_vperm_4si((vector int)__a,
7603 (vector int)__b, __c);
7604 #endif
7605 }
7606
vec_perm(vector signed short __a,vector signed short __b,vector unsigned char __c)7607 static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a,
7608 vector signed short __b,
7609 vector unsigned char __c) {
7610 #ifdef __LITTLE_ENDIAN__
7611 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7612 255, 255, 255, 255, 255, 255, 255, 255};
7613 __d = vec_xor(__c, __d);
7614 return (vector signed short)__builtin_altivec_vperm_4si((vector int)__b,
7615 (vector int)__a, __d);
7616 #else
7617 return (vector signed short)__builtin_altivec_vperm_4si((vector int)__a,
7618 (vector int)__b, __c);
7619 #endif
7620 }
7621
7622 static __inline__ vector unsigned short __ATTRS_o_ai
vec_perm(vector unsigned short __a,vector unsigned short __b,vector unsigned char __c)7623 vec_perm(vector unsigned short __a, vector unsigned short __b,
7624 vector unsigned char __c) {
7625 #ifdef __LITTLE_ENDIAN__
7626 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7627 255, 255, 255, 255, 255, 255, 255, 255};
7628 __d = vec_xor(__c, __d);
7629 return (vector unsigned short)__builtin_altivec_vperm_4si(
7630 (vector int)__b, (vector int)__a, __d);
7631 #else
7632 return (vector unsigned short)__builtin_altivec_vperm_4si(
7633 (vector int)__a, (vector int)__b, __c);
7634 #endif
7635 }
7636
vec_perm(vector bool short __a,vector bool short __b,vector unsigned char __c)7637 static __inline__ vector bool short __ATTRS_o_ai vec_perm(
7638 vector bool short __a, vector bool short __b, vector unsigned char __c) {
7639 #ifdef __LITTLE_ENDIAN__
7640 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7641 255, 255, 255, 255, 255, 255, 255, 255};
7642 __d = vec_xor(__c, __d);
7643 return (vector bool short)__builtin_altivec_vperm_4si((vector int)__b,
7644 (vector int)__a, __d);
7645 #else
7646 return (vector bool short)__builtin_altivec_vperm_4si((vector int)__a,
7647 (vector int)__b, __c);
7648 #endif
7649 }
7650
vec_perm(vector pixel __a,vector pixel __b,vector unsigned char __c)7651 static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a,
7652 vector pixel __b,
7653 vector unsigned char __c) {
7654 #ifdef __LITTLE_ENDIAN__
7655 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7656 255, 255, 255, 255, 255, 255, 255, 255};
7657 __d = vec_xor(__c, __d);
7658 return (vector pixel)__builtin_altivec_vperm_4si((vector int)__b,
7659 (vector int)__a, __d);
7660 #else
7661 return (vector pixel)__builtin_altivec_vperm_4si((vector int)__a,
7662 (vector int)__b, __c);
7663 #endif
7664 }
7665
vec_perm(vector signed int __a,vector signed int __b,vector unsigned char __c)7666 static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a,
7667 vector signed int __b,
7668 vector unsigned char __c) {
7669 #ifdef __LITTLE_ENDIAN__
7670 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7671 255, 255, 255, 255, 255, 255, 255, 255};
7672 __d = vec_xor(__c, __d);
7673 return (vector signed int)__builtin_altivec_vperm_4si(__b, __a, __d);
7674 #else
7675 return (vector signed int)__builtin_altivec_vperm_4si(__a, __b, __c);
7676 #endif
7677 }
7678
7679 static __inline__ vector unsigned int __ATTRS_o_ai
vec_perm(vector unsigned int __a,vector unsigned int __b,vector unsigned char __c)7680 vec_perm(vector unsigned int __a, vector unsigned int __b,
7681 vector unsigned char __c) {
7682 #ifdef __LITTLE_ENDIAN__
7683 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7684 255, 255, 255, 255, 255, 255, 255, 255};
7685 __d = vec_xor(__c, __d);
7686 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__b,
7687 (vector int)__a, __d);
7688 #else
7689 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__a,
7690 (vector int)__b, __c);
7691 #endif
7692 }
7693
7694 static __inline__ vector bool int __ATTRS_o_ai
vec_perm(vector bool int __a,vector bool int __b,vector unsigned char __c)7695 vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c) {
7696 #ifdef __LITTLE_ENDIAN__
7697 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7698 255, 255, 255, 255, 255, 255, 255, 255};
7699 __d = vec_xor(__c, __d);
7700 return (vector bool int)__builtin_altivec_vperm_4si((vector int)__b,
7701 (vector int)__a, __d);
7702 #else
7703 return (vector bool int)__builtin_altivec_vperm_4si((vector int)__a,
7704 (vector int)__b, __c);
7705 #endif
7706 }
7707
vec_perm(vector float __a,vector float __b,vector unsigned char __c)7708 static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a,
7709 vector float __b,
7710 vector unsigned char __c) {
7711 #ifdef __LITTLE_ENDIAN__
7712 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7713 255, 255, 255, 255, 255, 255, 255, 255};
7714 __d = vec_xor(__c, __d);
7715 return (vector float)__builtin_altivec_vperm_4si((vector int)__b,
7716 (vector int)__a, __d);
7717 #else
7718 return (vector float)__builtin_altivec_vperm_4si((vector int)__a,
7719 (vector int)__b, __c);
7720 #endif
7721 }
7722
7723 #ifdef __VSX__
7724 static __inline__ vector long long __ATTRS_o_ai
vec_perm(vector signed long long __a,vector signed long long __b,vector unsigned char __c)7725 vec_perm(vector signed long long __a, vector signed long long __b,
7726 vector unsigned char __c) {
7727 #ifdef __LITTLE_ENDIAN__
7728 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7729 255, 255, 255, 255, 255, 255, 255, 255};
7730 __d = vec_xor(__c, __d);
7731 return (vector signed long long)__builtin_altivec_vperm_4si(
7732 (vector int)__b, (vector int)__a, __d);
7733 #else
7734 return (vector signed long long)__builtin_altivec_vperm_4si(
7735 (vector int)__a, (vector int)__b, __c);
7736 #endif
7737 }
7738
7739 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_perm(vector unsigned long long __a,vector unsigned long long __b,vector unsigned char __c)7740 vec_perm(vector unsigned long long __a, vector unsigned long long __b,
7741 vector unsigned char __c) {
7742 #ifdef __LITTLE_ENDIAN__
7743 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7744 255, 255, 255, 255, 255, 255, 255, 255};
7745 __d = vec_xor(__c, __d);
7746 return (vector unsigned long long)__builtin_altivec_vperm_4si(
7747 (vector int)__b, (vector int)__a, __d);
7748 #else
7749 return (vector unsigned long long)__builtin_altivec_vperm_4si(
7750 (vector int)__a, (vector int)__b, __c);
7751 #endif
7752 }
7753
7754 static __inline__ vector bool long long __ATTRS_o_ai
vec_perm(vector bool long long __a,vector bool long long __b,vector unsigned char __c)7755 vec_perm(vector bool long long __a, vector bool long long __b,
7756 vector unsigned char __c) {
7757 #ifdef __LITTLE_ENDIAN__
7758 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7759 255, 255, 255, 255, 255, 255, 255, 255};
7760 __d = vec_xor(__c, __d);
7761 return (vector bool long long)__builtin_altivec_vperm_4si(
7762 (vector int)__b, (vector int)__a, __d);
7763 #else
7764 return (vector bool long long)__builtin_altivec_vperm_4si(
7765 (vector int)__a, (vector int)__b, __c);
7766 #endif
7767 }
7768
7769 static __inline__ vector double __ATTRS_o_ai
vec_perm(vector double __a,vector double __b,vector unsigned char __c)7770 vec_perm(vector double __a, vector double __b, vector unsigned char __c) {
7771 #ifdef __LITTLE_ENDIAN__
7772 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7773 255, 255, 255, 255, 255, 255, 255, 255};
7774 __d = vec_xor(__c, __d);
7775 return (vector double)__builtin_altivec_vperm_4si((vector int)__b,
7776 (vector int)__a, __d);
7777 #else
7778 return (vector double)__builtin_altivec_vperm_4si((vector int)__a,
7779 (vector int)__b, __c);
7780 #endif
7781 }
7782 #endif
7783
7784 /* vec_vperm */
7785
vec_vperm(vector signed char __a,vector signed char __b,vector unsigned char __c)7786 static __inline__ vector signed char __ATTRS_o_ai vec_vperm(
7787 vector signed char __a, vector signed char __b, vector unsigned char __c) {
7788 return vec_perm(__a, __b, __c);
7789 }
7790
7791 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vperm(vector unsigned char __a,vector unsigned char __b,vector unsigned char __c)7792 vec_vperm(vector unsigned char __a, vector unsigned char __b,
7793 vector unsigned char __c) {
7794 return vec_perm(__a, __b, __c);
7795 }
7796
vec_vperm(vector bool char __a,vector bool char __b,vector unsigned char __c)7797 static __inline__ vector bool char __ATTRS_o_ai vec_vperm(
7798 vector bool char __a, vector bool char __b, vector unsigned char __c) {
7799 return vec_perm(__a, __b, __c);
7800 }
7801
7802 static __inline__ vector short __ATTRS_o_ai
vec_vperm(vector short __a,vector short __b,vector unsigned char __c)7803 vec_vperm(vector short __a, vector short __b, vector unsigned char __c) {
7804 return vec_perm(__a, __b, __c);
7805 }
7806
7807 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vperm(vector unsigned short __a,vector unsigned short __b,vector unsigned char __c)7808 vec_vperm(vector unsigned short __a, vector unsigned short __b,
7809 vector unsigned char __c) {
7810 return vec_perm(__a, __b, __c);
7811 }
7812
vec_vperm(vector bool short __a,vector bool short __b,vector unsigned char __c)7813 static __inline__ vector bool short __ATTRS_o_ai vec_vperm(
7814 vector bool short __a, vector bool short __b, vector unsigned char __c) {
7815 return vec_perm(__a, __b, __c);
7816 }
7817
7818 static __inline__ vector pixel __ATTRS_o_ai
vec_vperm(vector pixel __a,vector pixel __b,vector unsigned char __c)7819 vec_vperm(vector pixel __a, vector pixel __b, vector unsigned char __c) {
7820 return vec_perm(__a, __b, __c);
7821 }
7822
vec_vperm(vector int __a,vector int __b,vector unsigned char __c)7823 static __inline__ vector int __ATTRS_o_ai vec_vperm(vector int __a,
7824 vector int __b,
7825 vector unsigned char __c) {
7826 return vec_perm(__a, __b, __c);
7827 }
7828
7829 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vperm(vector unsigned int __a,vector unsigned int __b,vector unsigned char __c)7830 vec_vperm(vector unsigned int __a, vector unsigned int __b,
7831 vector unsigned char __c) {
7832 return vec_perm(__a, __b, __c);
7833 }
7834
7835 static __inline__ vector bool int __ATTRS_o_ai
vec_vperm(vector bool int __a,vector bool int __b,vector unsigned char __c)7836 vec_vperm(vector bool int __a, vector bool int __b, vector unsigned char __c) {
7837 return vec_perm(__a, __b, __c);
7838 }
7839
7840 static __inline__ vector float __ATTRS_o_ai
vec_vperm(vector float __a,vector float __b,vector unsigned char __c)7841 vec_vperm(vector float __a, vector float __b, vector unsigned char __c) {
7842 return vec_perm(__a, __b, __c);
7843 }
7844
7845 #ifdef __VSX__
vec_vperm(vector long long __a,vector long long __b,vector unsigned char __c)7846 static __inline__ vector long long __ATTRS_o_ai vec_vperm(
7847 vector long long __a, vector long long __b, vector unsigned char __c) {
7848 return vec_perm(__a, __b, __c);
7849 }
7850
7851 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_vperm(vector unsigned long long __a,vector unsigned long long __b,vector unsigned char __c)7852 vec_vperm(vector unsigned long long __a, vector unsigned long long __b,
7853 vector unsigned char __c) {
7854 return vec_perm(__a, __b, __c);
7855 }
7856
7857 static __inline__ vector double __ATTRS_o_ai
vec_vperm(vector double __a,vector double __b,vector unsigned char __c)7858 vec_vperm(vector double __a, vector double __b, vector unsigned char __c) {
7859 return vec_perm(__a, __b, __c);
7860 }
7861 #endif
7862
7863 /* vec_re */
7864
vec_re(vector float __a)7865 static __inline__ vector float __ATTRS_o_ai vec_re(vector float __a) {
7866 #ifdef __VSX__
7867 return __builtin_vsx_xvresp(__a);
7868 #else
7869 return __builtin_altivec_vrefp(__a);
7870 #endif
7871 }
7872
7873 #ifdef __VSX__
vec_re(vector double __a)7874 static __inline__ vector double __ATTRS_o_ai vec_re(vector double __a) {
7875 return __builtin_vsx_xvredp(__a);
7876 }
7877 #endif
7878
7879 /* vec_vrefp */
7880
7881 static __inline__ vector float __attribute__((__always_inline__))
vec_vrefp(vector float __a)7882 vec_vrefp(vector float __a) {
7883 return __builtin_altivec_vrefp(__a);
7884 }
7885
7886 /* vec_rl */
7887
7888 static __inline__ vector signed char __ATTRS_o_ai
vec_rl(vector signed char __a,vector unsigned char __b)7889 vec_rl(vector signed char __a, vector unsigned char __b) {
7890 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
7891 }
7892
7893 static __inline__ vector unsigned char __ATTRS_o_ai
vec_rl(vector unsigned char __a,vector unsigned char __b)7894 vec_rl(vector unsigned char __a, vector unsigned char __b) {
7895 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
7896 }
7897
vec_rl(vector short __a,vector unsigned short __b)7898 static __inline__ vector short __ATTRS_o_ai vec_rl(vector short __a,
7899 vector unsigned short __b) {
7900 return __builtin_altivec_vrlh(__a, __b);
7901 }
7902
7903 static __inline__ vector unsigned short __ATTRS_o_ai
vec_rl(vector unsigned short __a,vector unsigned short __b)7904 vec_rl(vector unsigned short __a, vector unsigned short __b) {
7905 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
7906 }
7907
vec_rl(vector int __a,vector unsigned int __b)7908 static __inline__ vector int __ATTRS_o_ai vec_rl(vector int __a,
7909 vector unsigned int __b) {
7910 return __builtin_altivec_vrlw(__a, __b);
7911 }
7912
7913 static __inline__ vector unsigned int __ATTRS_o_ai
vec_rl(vector unsigned int __a,vector unsigned int __b)7914 vec_rl(vector unsigned int __a, vector unsigned int __b) {
7915 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
7916 }
7917
7918 #ifdef __POWER8_VECTOR__
7919 static __inline__ vector signed long long __ATTRS_o_ai
vec_rl(vector signed long long __a,vector unsigned long long __b)7920 vec_rl(vector signed long long __a, vector unsigned long long __b) {
7921 return __builtin_altivec_vrld(__a, __b);
7922 }
7923
7924 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_rl(vector unsigned long long __a,vector unsigned long long __b)7925 vec_rl(vector unsigned long long __a, vector unsigned long long __b) {
7926 return __builtin_altivec_vrld(__a, __b);
7927 }
7928 #endif
7929
7930 #ifdef __POWER10_VECTOR__
7931 static __inline__ vector signed __int128 __ATTRS_o_ai
vec_rl(vector signed __int128 __a,vector unsigned __int128 __b)7932 vec_rl(vector signed __int128 __a, vector unsigned __int128 __b) {
7933 return (__b << __a)|(__b >> ((__CHAR_BIT__ * sizeof(vector signed __int128)) - __a));
7934 }
7935
7936 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_rl(vector unsigned __int128 __a,vector unsigned __int128 __b)7937 vec_rl(vector unsigned __int128 __a, vector unsigned __int128 __b) {
7938 return (__b << __a)|(__b >> ((__CHAR_BIT__ * sizeof(vector unsigned __int128)) - __a));
7939 }
7940 #endif
7941
7942 /* vec_rlmi */
7943 #ifdef __POWER9_VECTOR__
7944 static __inline__ vector unsigned int __ATTRS_o_ai
vec_rlmi(vector unsigned int __a,vector unsigned int __b,vector unsigned int __c)7945 vec_rlmi(vector unsigned int __a, vector unsigned int __b,
7946 vector unsigned int __c) {
7947 return __builtin_altivec_vrlwmi(__a, __c, __b);
7948 }
7949
7950 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_rlmi(vector unsigned long long __a,vector unsigned long long __b,vector unsigned long long __c)7951 vec_rlmi(vector unsigned long long __a, vector unsigned long long __b,
7952 vector unsigned long long __c) {
7953 return __builtin_altivec_vrldmi(__a, __c, __b);
7954 }
7955 #endif
7956
7957 #ifdef __POWER10_VECTOR__
7958 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_rlmi(vector unsigned __int128 __a,vector unsigned __int128 __b,vector unsigned __int128 __c)7959 vec_rlmi(vector unsigned __int128 __a, vector unsigned __int128 __b,
7960 vector unsigned __int128 __c) {
7961 return __builtin_altivec_vrlqmi(__a, __c, __b);
7962 }
7963
7964 static __inline__ vector signed __int128 __ATTRS_o_ai
vec_rlmi(vector signed __int128 __a,vector signed __int128 __b,vector signed __int128 __c)7965 vec_rlmi(vector signed __int128 __a, vector signed __int128 __b,
7966 vector signed __int128 __c) {
7967 return __builtin_altivec_vrlqmi(__a, __c, __b);
7968 }
7969 #endif
7970
7971 /* vec_rlnm */
7972 #ifdef __POWER9_VECTOR__
7973 static __inline__ vector unsigned int __ATTRS_o_ai
vec_rlnm(vector unsigned int __a,vector unsigned int __b,vector unsigned int __c)7974 vec_rlnm(vector unsigned int __a, vector unsigned int __b,
7975 vector unsigned int __c) {
7976 vector unsigned int OneByte = { 0x8, 0x8, 0x8, 0x8 };
7977 return __builtin_altivec_vrlwnm(__a, ((__c << OneByte) | __b));
7978 }
7979
7980 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_rlnm(vector unsigned long long __a,vector unsigned long long __b,vector unsigned long long __c)7981 vec_rlnm(vector unsigned long long __a, vector unsigned long long __b,
7982 vector unsigned long long __c) {
7983 vector unsigned long long OneByte = { 0x8, 0x8 };
7984 return __builtin_altivec_vrldnm(__a, ((__c << OneByte) | __b));
7985 }
7986 #endif
7987
7988 #ifdef __POWER10_VECTOR__
7989 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_rlnm(vector unsigned __int128 __a,vector unsigned __int128 __b,vector unsigned __int128 __c)7990 vec_rlnm(vector unsigned __int128 __a, vector unsigned __int128 __b,
7991 vector unsigned __int128 __c) {
7992 // Merge __b and __c using an appropriate shuffle.
7993 vector unsigned char TmpB = (vector unsigned char)__b;
7994 vector unsigned char TmpC = (vector unsigned char)__c;
7995 vector unsigned char MaskAndShift =
7996 #ifdef __LITTLE_ENDIAN__
7997 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, -1, -1, -1, 16, 0,
7998 1, -1, -1, -1, -1, -1);
7999 #else
8000 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, 31, 30, 15, -1,
8001 -1, -1, -1, -1, -1, -1, -1);
8002 #endif
8003 return __builtin_altivec_vrlqnm(__a, (vector unsigned __int128) MaskAndShift);
8004 }
8005
8006 static __inline__ vector signed __int128 __ATTRS_o_ai
vec_rlnm(vector signed __int128 __a,vector signed __int128 __b,vector signed __int128 __c)8007 vec_rlnm(vector signed __int128 __a, vector signed __int128 __b,
8008 vector signed __int128 __c) {
8009 // Merge __b and __c using an appropriate shuffle.
8010 vector unsigned char TmpB = (vector unsigned char)__b;
8011 vector unsigned char TmpC = (vector unsigned char)__c;
8012 vector unsigned char MaskAndShift =
8013 #ifdef __LITTLE_ENDIAN__
8014 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, -1, -1, -1, 16, 0,
8015 1, -1, -1, -1, -1, -1);
8016 #else
8017 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, 31, 30, 15, -1,
8018 -1, -1, -1, -1, -1, -1, -1);
8019 #endif
8020 return __builtin_altivec_vrlqnm(__a, (vector unsigned __int128) MaskAndShift);
8021 }
8022 #endif
8023
8024 /* vec_vrlb */
8025
8026 static __inline__ vector signed char __ATTRS_o_ai
vec_vrlb(vector signed char __a,vector unsigned char __b)8027 vec_vrlb(vector signed char __a, vector unsigned char __b) {
8028 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
8029 }
8030
8031 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vrlb(vector unsigned char __a,vector unsigned char __b)8032 vec_vrlb(vector unsigned char __a, vector unsigned char __b) {
8033 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
8034 }
8035
8036 /* vec_vrlh */
8037
8038 static __inline__ vector short __ATTRS_o_ai
vec_vrlh(vector short __a,vector unsigned short __b)8039 vec_vrlh(vector short __a, vector unsigned short __b) {
8040 return __builtin_altivec_vrlh(__a, __b);
8041 }
8042
8043 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vrlh(vector unsigned short __a,vector unsigned short __b)8044 vec_vrlh(vector unsigned short __a, vector unsigned short __b) {
8045 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
8046 }
8047
8048 /* vec_vrlw */
8049
vec_vrlw(vector int __a,vector unsigned int __b)8050 static __inline__ vector int __ATTRS_o_ai vec_vrlw(vector int __a,
8051 vector unsigned int __b) {
8052 return __builtin_altivec_vrlw(__a, __b);
8053 }
8054
8055 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vrlw(vector unsigned int __a,vector unsigned int __b)8056 vec_vrlw(vector unsigned int __a, vector unsigned int __b) {
8057 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
8058 }
8059
8060 /* vec_round */
8061
vec_round(vector float __a)8062 static __inline__ vector float __ATTRS_o_ai vec_round(vector float __a) {
8063 #ifdef __VSX__
8064 return __builtin_vsx_xvrspi(__a);
8065 #else
8066 return __builtin_altivec_vrfin(__a);
8067 #endif
8068 }
8069
8070 #ifdef __VSX__
vec_round(vector double __a)8071 static __inline__ vector double __ATTRS_o_ai vec_round(vector double __a) {
8072 return __builtin_vsx_xvrdpi(__a);
8073 }
8074
8075 /* vec_rint */
8076
vec_rint(vector float __a)8077 static __inline__ vector float __ATTRS_o_ai vec_rint(vector float __a) {
8078 return __builtin_vsx_xvrspic(__a);
8079 }
8080
vec_rint(vector double __a)8081 static __inline__ vector double __ATTRS_o_ai vec_rint(vector double __a) {
8082 return __builtin_vsx_xvrdpic(__a);
8083 }
8084
8085 /* vec_nearbyint */
8086
vec_nearbyint(vector float __a)8087 static __inline__ vector float __ATTRS_o_ai vec_nearbyint(vector float __a) {
8088 return __builtin_vsx_xvrspi(__a);
8089 }
8090
vec_nearbyint(vector double __a)8091 static __inline__ vector double __ATTRS_o_ai vec_nearbyint(vector double __a) {
8092 return __builtin_vsx_xvrdpi(__a);
8093 }
8094 #endif
8095
8096 /* vec_vrfin */
8097
8098 static __inline__ vector float __attribute__((__always_inline__))
vec_vrfin(vector float __a)8099 vec_vrfin(vector float __a) {
8100 return __builtin_altivec_vrfin(__a);
8101 }
8102
8103 /* vec_sqrt */
8104
8105 #ifdef __VSX__
vec_sqrt(vector float __a)8106 static __inline__ vector float __ATTRS_o_ai vec_sqrt(vector float __a) {
8107 return __builtin_vsx_xvsqrtsp(__a);
8108 }
8109
vec_sqrt(vector double __a)8110 static __inline__ vector double __ATTRS_o_ai vec_sqrt(vector double __a) {
8111 return __builtin_vsx_xvsqrtdp(__a);
8112 }
8113 #endif
8114
8115 /* vec_rsqrte */
8116
vec_rsqrte(vector float __a)8117 static __inline__ vector float __ATTRS_o_ai vec_rsqrte(vector float __a) {
8118 #ifdef __VSX__
8119 return __builtin_vsx_xvrsqrtesp(__a);
8120 #else
8121 return __builtin_altivec_vrsqrtefp(__a);
8122 #endif
8123 }
8124
8125 #ifdef __VSX__
vec_rsqrte(vector double __a)8126 static __inline__ vector double __ATTRS_o_ai vec_rsqrte(vector double __a) {
8127 return __builtin_vsx_xvrsqrtedp(__a);
8128 }
8129 #endif
8130
8131 /* vec_vrsqrtefp */
8132
8133 static __inline__ __vector float __attribute__((__always_inline__))
vec_vrsqrtefp(vector float __a)8134 vec_vrsqrtefp(vector float __a) {
8135 return __builtin_altivec_vrsqrtefp(__a);
8136 }
8137
8138 /* vec_xvtsqrt */
8139
8140 #ifdef __VSX__
vec_test_swsqrt(vector double __a)8141 static __inline__ int __ATTRS_o_ai vec_test_swsqrt(vector double __a) {
8142 return __builtin_vsx_xvtsqrtdp(__a);
8143 }
8144
vec_test_swsqrts(vector float __a)8145 static __inline__ int __ATTRS_o_ai vec_test_swsqrts(vector float __a) {
8146 return __builtin_vsx_xvtsqrtsp(__a);
8147 }
8148 #endif
8149
8150 /* vec_sel */
8151
8152 #define __builtin_altivec_vsel_4si vec_sel
8153
vec_sel(vector signed char __a,vector signed char __b,vector unsigned char __c)8154 static __inline__ vector signed char __ATTRS_o_ai vec_sel(
8155 vector signed char __a, vector signed char __b, vector unsigned char __c) {
8156 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
8157 }
8158
8159 static __inline__ vector signed char __ATTRS_o_ai
vec_sel(vector signed char __a,vector signed char __b,vector bool char __c)8160 vec_sel(vector signed char __a, vector signed char __b, vector bool char __c) {
8161 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
8162 }
8163
8164 static __inline__ vector unsigned char __ATTRS_o_ai
vec_sel(vector unsigned char __a,vector unsigned char __b,vector unsigned char __c)8165 vec_sel(vector unsigned char __a, vector unsigned char __b,
8166 vector unsigned char __c) {
8167 return (__a & ~__c) | (__b & __c);
8168 }
8169
vec_sel(vector unsigned char __a,vector unsigned char __b,vector bool char __c)8170 static __inline__ vector unsigned char __ATTRS_o_ai vec_sel(
8171 vector unsigned char __a, vector unsigned char __b, vector bool char __c) {
8172 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
8173 }
8174
8175 static __inline__ vector bool char __ATTRS_o_ai
vec_sel(vector bool char __a,vector bool char __b,vector unsigned char __c)8176 vec_sel(vector bool char __a, vector bool char __b, vector unsigned char __c) {
8177 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
8178 }
8179
vec_sel(vector bool char __a,vector bool char __b,vector bool char __c)8180 static __inline__ vector bool char __ATTRS_o_ai vec_sel(vector bool char __a,
8181 vector bool char __b,
8182 vector bool char __c) {
8183 return (__a & ~__c) | (__b & __c);
8184 }
8185
vec_sel(vector short __a,vector short __b,vector unsigned short __c)8186 static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a,
8187 vector short __b,
8188 vector unsigned short __c) {
8189 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
8190 }
8191
vec_sel(vector short __a,vector short __b,vector bool short __c)8192 static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a,
8193 vector short __b,
8194 vector bool short __c) {
8195 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
8196 }
8197
8198 static __inline__ vector unsigned short __ATTRS_o_ai
vec_sel(vector unsigned short __a,vector unsigned short __b,vector unsigned short __c)8199 vec_sel(vector unsigned short __a, vector unsigned short __b,
8200 vector unsigned short __c) {
8201 return (__a & ~__c) | (__b & __c);
8202 }
8203
8204 static __inline__ vector unsigned short __ATTRS_o_ai
vec_sel(vector unsigned short __a,vector unsigned short __b,vector bool short __c)8205 vec_sel(vector unsigned short __a, vector unsigned short __b,
8206 vector bool short __c) {
8207 return (__a & ~(vector unsigned short)__c) |
8208 (__b & (vector unsigned short)__c);
8209 }
8210
vec_sel(vector bool short __a,vector bool short __b,vector unsigned short __c)8211 static __inline__ vector bool short __ATTRS_o_ai vec_sel(
8212 vector bool short __a, vector bool short __b, vector unsigned short __c) {
8213 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
8214 }
8215
8216 static __inline__ vector bool short __ATTRS_o_ai
vec_sel(vector bool short __a,vector bool short __b,vector bool short __c)8217 vec_sel(vector bool short __a, vector bool short __b, vector bool short __c) {
8218 return (__a & ~__c) | (__b & __c);
8219 }
8220
vec_sel(vector int __a,vector int __b,vector unsigned int __c)8221 static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a,
8222 vector int __b,
8223 vector unsigned int __c) {
8224 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
8225 }
8226
vec_sel(vector int __a,vector int __b,vector bool int __c)8227 static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a,
8228 vector int __b,
8229 vector bool int __c) {
8230 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
8231 }
8232
vec_sel(vector unsigned int __a,vector unsigned int __b,vector unsigned int __c)8233 static __inline__ vector unsigned int __ATTRS_o_ai vec_sel(
8234 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
8235 return (__a & ~__c) | (__b & __c);
8236 }
8237
8238 static __inline__ vector unsigned int __ATTRS_o_ai
vec_sel(vector unsigned int __a,vector unsigned int __b,vector bool int __c)8239 vec_sel(vector unsigned int __a, vector unsigned int __b, vector bool int __c) {
8240 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
8241 }
8242
8243 static __inline__ vector bool int __ATTRS_o_ai
vec_sel(vector bool int __a,vector bool int __b,vector unsigned int __c)8244 vec_sel(vector bool int __a, vector bool int __b, vector unsigned int __c) {
8245 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
8246 }
8247
vec_sel(vector bool int __a,vector bool int __b,vector bool int __c)8248 static __inline__ vector bool int __ATTRS_o_ai vec_sel(vector bool int __a,
8249 vector bool int __b,
8250 vector bool int __c) {
8251 return (__a & ~__c) | (__b & __c);
8252 }
8253
vec_sel(vector float __a,vector float __b,vector unsigned int __c)8254 static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a,
8255 vector float __b,
8256 vector unsigned int __c) {
8257 vector int __res = ((vector int)__a & ~(vector int)__c) |
8258 ((vector int)__b & (vector int)__c);
8259 return (vector float)__res;
8260 }
8261
vec_sel(vector float __a,vector float __b,vector bool int __c)8262 static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a,
8263 vector float __b,
8264 vector bool int __c) {
8265 vector int __res = ((vector int)__a & ~(vector int)__c) |
8266 ((vector int)__b & (vector int)__c);
8267 return (vector float)__res;
8268 }
8269
8270 #ifdef __VSX__
8271 static __inline__ vector double __ATTRS_o_ai
vec_sel(vector double __a,vector double __b,vector bool long long __c)8272 vec_sel(vector double __a, vector double __b, vector bool long long __c) {
8273 vector long long __res = ((vector long long)__a & ~(vector long long)__c) |
8274 ((vector long long)__b & (vector long long)__c);
8275 return (vector double)__res;
8276 }
8277
8278 static __inline__ vector double __ATTRS_o_ai
vec_sel(vector double __a,vector double __b,vector unsigned long long __c)8279 vec_sel(vector double __a, vector double __b, vector unsigned long long __c) {
8280 vector long long __res = ((vector long long)__a & ~(vector long long)__c) |
8281 ((vector long long)__b & (vector long long)__c);
8282 return (vector double)__res;
8283 }
8284 #endif
8285
8286 /* vec_vsel */
8287
vec_vsel(vector signed char __a,vector signed char __b,vector unsigned char __c)8288 static __inline__ vector signed char __ATTRS_o_ai vec_vsel(
8289 vector signed char __a, vector signed char __b, vector unsigned char __c) {
8290 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
8291 }
8292
8293 static __inline__ vector signed char __ATTRS_o_ai
vec_vsel(vector signed char __a,vector signed char __b,vector bool char __c)8294 vec_vsel(vector signed char __a, vector signed char __b, vector bool char __c) {
8295 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
8296 }
8297
8298 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vsel(vector unsigned char __a,vector unsigned char __b,vector unsigned char __c)8299 vec_vsel(vector unsigned char __a, vector unsigned char __b,
8300 vector unsigned char __c) {
8301 return (__a & ~__c) | (__b & __c);
8302 }
8303
vec_vsel(vector unsigned char __a,vector unsigned char __b,vector bool char __c)8304 static __inline__ vector unsigned char __ATTRS_o_ai vec_vsel(
8305 vector unsigned char __a, vector unsigned char __b, vector bool char __c) {
8306 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
8307 }
8308
8309 static __inline__ vector bool char __ATTRS_o_ai
vec_vsel(vector bool char __a,vector bool char __b,vector unsigned char __c)8310 vec_vsel(vector bool char __a, vector bool char __b, vector unsigned char __c) {
8311 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
8312 }
8313
vec_vsel(vector bool char __a,vector bool char __b,vector bool char __c)8314 static __inline__ vector bool char __ATTRS_o_ai vec_vsel(vector bool char __a,
8315 vector bool char __b,
8316 vector bool char __c) {
8317 return (__a & ~__c) | (__b & __c);
8318 }
8319
8320 static __inline__ vector short __ATTRS_o_ai
vec_vsel(vector short __a,vector short __b,vector unsigned short __c)8321 vec_vsel(vector short __a, vector short __b, vector unsigned short __c) {
8322 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
8323 }
8324
vec_vsel(vector short __a,vector short __b,vector bool short __c)8325 static __inline__ vector short __ATTRS_o_ai vec_vsel(vector short __a,
8326 vector short __b,
8327 vector bool short __c) {
8328 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
8329 }
8330
8331 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vsel(vector unsigned short __a,vector unsigned short __b,vector unsigned short __c)8332 vec_vsel(vector unsigned short __a, vector unsigned short __b,
8333 vector unsigned short __c) {
8334 return (__a & ~__c) | (__b & __c);
8335 }
8336
8337 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vsel(vector unsigned short __a,vector unsigned short __b,vector bool short __c)8338 vec_vsel(vector unsigned short __a, vector unsigned short __b,
8339 vector bool short __c) {
8340 return (__a & ~(vector unsigned short)__c) |
8341 (__b & (vector unsigned short)__c);
8342 }
8343
vec_vsel(vector bool short __a,vector bool short __b,vector unsigned short __c)8344 static __inline__ vector bool short __ATTRS_o_ai vec_vsel(
8345 vector bool short __a, vector bool short __b, vector unsigned short __c) {
8346 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
8347 }
8348
8349 static __inline__ vector bool short __ATTRS_o_ai
vec_vsel(vector bool short __a,vector bool short __b,vector bool short __c)8350 vec_vsel(vector bool short __a, vector bool short __b, vector bool short __c) {
8351 return (__a & ~__c) | (__b & __c);
8352 }
8353
vec_vsel(vector int __a,vector int __b,vector unsigned int __c)8354 static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a,
8355 vector int __b,
8356 vector unsigned int __c) {
8357 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
8358 }
8359
vec_vsel(vector int __a,vector int __b,vector bool int __c)8360 static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a,
8361 vector int __b,
8362 vector bool int __c) {
8363 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
8364 }
8365
vec_vsel(vector unsigned int __a,vector unsigned int __b,vector unsigned int __c)8366 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel(
8367 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
8368 return (__a & ~__c) | (__b & __c);
8369 }
8370
vec_vsel(vector unsigned int __a,vector unsigned int __b,vector bool int __c)8371 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel(
8372 vector unsigned int __a, vector unsigned int __b, vector bool int __c) {
8373 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
8374 }
8375
8376 static __inline__ vector bool int __ATTRS_o_ai
vec_vsel(vector bool int __a,vector bool int __b,vector unsigned int __c)8377 vec_vsel(vector bool int __a, vector bool int __b, vector unsigned int __c) {
8378 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
8379 }
8380
vec_vsel(vector bool int __a,vector bool int __b,vector bool int __c)8381 static __inline__ vector bool int __ATTRS_o_ai vec_vsel(vector bool int __a,
8382 vector bool int __b,
8383 vector bool int __c) {
8384 return (__a & ~__c) | (__b & __c);
8385 }
8386
vec_vsel(vector float __a,vector float __b,vector unsigned int __c)8387 static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a,
8388 vector float __b,
8389 vector unsigned int __c) {
8390 vector int __res = ((vector int)__a & ~(vector int)__c) |
8391 ((vector int)__b & (vector int)__c);
8392 return (vector float)__res;
8393 }
8394
vec_vsel(vector float __a,vector float __b,vector bool int __c)8395 static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a,
8396 vector float __b,
8397 vector bool int __c) {
8398 vector int __res = ((vector int)__a & ~(vector int)__c) |
8399 ((vector int)__b & (vector int)__c);
8400 return (vector float)__res;
8401 }
8402
8403 /* vec_sl */
8404
8405 // vec_sl does modulo arithmetic on __b first, so __b is allowed to be more
8406 // than the length of __a.
8407 static __inline__ vector unsigned char __ATTRS_o_ai
vec_sl(vector unsigned char __a,vector unsigned char __b)8408 vec_sl(vector unsigned char __a, vector unsigned char __b) {
8409 return __a << (__b %
8410 (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__));
8411 }
8412
8413 static __inline__ vector signed char __ATTRS_o_ai
vec_sl(vector signed char __a,vector unsigned char __b)8414 vec_sl(vector signed char __a, vector unsigned char __b) {
8415 return (vector signed char)vec_sl((vector unsigned char)__a, __b);
8416 }
8417
8418 static __inline__ vector unsigned short __ATTRS_o_ai
vec_sl(vector unsigned short __a,vector unsigned short __b)8419 vec_sl(vector unsigned short __a, vector unsigned short __b) {
8420 return __a << (__b % (vector unsigned short)(sizeof(unsigned short) *
8421 __CHAR_BIT__));
8422 }
8423
vec_sl(vector short __a,vector unsigned short __b)8424 static __inline__ vector short __ATTRS_o_ai vec_sl(vector short __a,
8425 vector unsigned short __b) {
8426 return (vector short)vec_sl((vector unsigned short)__a, __b);
8427 }
8428
8429 static __inline__ vector unsigned int __ATTRS_o_ai
vec_sl(vector unsigned int __a,vector unsigned int __b)8430 vec_sl(vector unsigned int __a, vector unsigned int __b) {
8431 return __a << (__b %
8432 (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__));
8433 }
8434
vec_sl(vector int __a,vector unsigned int __b)8435 static __inline__ vector int __ATTRS_o_ai vec_sl(vector int __a,
8436 vector unsigned int __b) {
8437 return (vector int)vec_sl((vector unsigned int)__a, __b);
8438 }
8439
8440 #ifdef __POWER8_VECTOR__
8441 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_sl(vector unsigned long long __a,vector unsigned long long __b)8442 vec_sl(vector unsigned long long __a, vector unsigned long long __b) {
8443 return __a << (__b % (vector unsigned long long)(sizeof(unsigned long long) *
8444 __CHAR_BIT__));
8445 }
8446
8447 static __inline__ vector long long __ATTRS_o_ai
vec_sl(vector long long __a,vector unsigned long long __b)8448 vec_sl(vector long long __a, vector unsigned long long __b) {
8449 return (vector long long)vec_sl((vector unsigned long long)__a, __b);
8450 }
8451 #endif
8452
8453 /* vec_vslb */
8454
8455 #define __builtin_altivec_vslb vec_vslb
8456
8457 static __inline__ vector signed char __ATTRS_o_ai
vec_vslb(vector signed char __a,vector unsigned char __b)8458 vec_vslb(vector signed char __a, vector unsigned char __b) {
8459 return vec_sl(__a, __b);
8460 }
8461
8462 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vslb(vector unsigned char __a,vector unsigned char __b)8463 vec_vslb(vector unsigned char __a, vector unsigned char __b) {
8464 return vec_sl(__a, __b);
8465 }
8466
8467 /* vec_vslh */
8468
8469 #define __builtin_altivec_vslh vec_vslh
8470
8471 static __inline__ vector short __ATTRS_o_ai
vec_vslh(vector short __a,vector unsigned short __b)8472 vec_vslh(vector short __a, vector unsigned short __b) {
8473 return vec_sl(__a, __b);
8474 }
8475
8476 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vslh(vector unsigned short __a,vector unsigned short __b)8477 vec_vslh(vector unsigned short __a, vector unsigned short __b) {
8478 return vec_sl(__a, __b);
8479 }
8480
8481 /* vec_vslw */
8482
8483 #define __builtin_altivec_vslw vec_vslw
8484
vec_vslw(vector int __a,vector unsigned int __b)8485 static __inline__ vector int __ATTRS_o_ai vec_vslw(vector int __a,
8486 vector unsigned int __b) {
8487 return vec_sl(__a, __b);
8488 }
8489
8490 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vslw(vector unsigned int __a,vector unsigned int __b)8491 vec_vslw(vector unsigned int __a, vector unsigned int __b) {
8492 return vec_sl(__a, __b);
8493 }
8494
8495 /* vec_sld */
8496
8497 #define __builtin_altivec_vsldoi_4si vec_sld
8498
vec_sld(vector signed char __a,vector signed char __b,unsigned const int __c)8499 static __inline__ vector signed char __ATTRS_o_ai vec_sld(
8500 vector signed char __a, vector signed char __b, unsigned const int __c) {
8501 unsigned char __d = __c & 0x0F;
8502 #ifdef __LITTLE_ENDIAN__
8503 return vec_perm(
8504 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8505 20 - __d, 21 - __d, 22 - __d, 23 - __d,
8506 24 - __d, 25 - __d, 26 - __d, 27 - __d,
8507 28 - __d, 29 - __d, 30 - __d, 31 - __d));
8508 #else
8509 return vec_perm(
8510 __a, __b,
8511 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8512 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8513 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8514 #endif
8515 }
8516
8517 static __inline__ vector unsigned char __ATTRS_o_ai
vec_sld(vector unsigned char __a,vector unsigned char __b,unsigned const int __c)8518 vec_sld(vector unsigned char __a, vector unsigned char __b,
8519 unsigned const int __c) {
8520 unsigned char __d = __c & 0x0F;
8521 #ifdef __LITTLE_ENDIAN__
8522 return vec_perm(
8523 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8524 20 - __d, 21 - __d, 22 - __d, 23 - __d,
8525 24 - __d, 25 - __d, 26 - __d, 27 - __d,
8526 28 - __d, 29 - __d, 30 - __d, 31 - __d));
8527 #else
8528 return vec_perm(
8529 __a, __b,
8530 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8531 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8532 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8533 #endif
8534 }
8535
8536 static __inline__ vector bool char __ATTRS_o_ai
vec_sld(vector bool char __a,vector bool char __b,unsigned const int __c)8537 vec_sld(vector bool char __a, vector bool char __b, unsigned const int __c) {
8538 unsigned char __d = __c & 0x0F;
8539 #ifdef __LITTLE_ENDIAN__
8540 return vec_perm(
8541 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8542 20 - __d, 21 - __d, 22 - __d, 23 - __d,
8543 24 - __d, 25 - __d, 26 - __d, 27 - __d,
8544 28 - __d, 29 - __d, 30 - __d, 31 - __d));
8545 #else
8546 return vec_perm(
8547 __a, __b,
8548 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8549 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8550 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8551 #endif
8552 }
8553
vec_sld(vector signed short __a,vector signed short __b,unsigned const int __c)8554 static __inline__ vector signed short __ATTRS_o_ai vec_sld(
8555 vector signed short __a, vector signed short __b, unsigned const int __c) {
8556 unsigned char __d = __c & 0x0F;
8557 #ifdef __LITTLE_ENDIAN__
8558 return vec_perm(
8559 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8560 20 - __d, 21 - __d, 22 - __d, 23 - __d,
8561 24 - __d, 25 - __d, 26 - __d, 27 - __d,
8562 28 - __d, 29 - __d, 30 - __d, 31 - __d));
8563 #else
8564 return vec_perm(
8565 __a, __b,
8566 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8567 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8568 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8569 #endif
8570 }
8571
8572 static __inline__ vector unsigned short __ATTRS_o_ai
vec_sld(vector unsigned short __a,vector unsigned short __b,unsigned const int __c)8573 vec_sld(vector unsigned short __a, vector unsigned short __b,
8574 unsigned const int __c) {
8575 unsigned char __d = __c & 0x0F;
8576 #ifdef __LITTLE_ENDIAN__
8577 return vec_perm(
8578 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8579 20 - __d, 21 - __d, 22 - __d, 23 - __d,
8580 24 - __d, 25 - __d, 26 - __d, 27 - __d,
8581 28 - __d, 29 - __d, 30 - __d, 31 - __d));
8582 #else
8583 return vec_perm(
8584 __a, __b,
8585 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8586 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8587 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8588 #endif
8589 }
8590
8591 static __inline__ vector bool short __ATTRS_o_ai
vec_sld(vector bool short __a,vector bool short __b,unsigned const int __c)8592 vec_sld(vector bool short __a, vector bool short __b, unsigned const int __c) {
8593 unsigned char __d = __c & 0x0F;
8594 #ifdef __LITTLE_ENDIAN__
8595 return vec_perm(
8596 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8597 20 - __d, 21 - __d, 22 - __d, 23 - __d,
8598 24 - __d, 25 - __d, 26 - __d, 27 - __d,
8599 28 - __d, 29 - __d, 30 - __d, 31 - __d));
8600 #else
8601 return vec_perm(
8602 __a, __b,
8603 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8604 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8605 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8606 #endif
8607 }
8608
vec_sld(vector pixel __a,vector pixel __b,unsigned const int __c)8609 static __inline__ vector pixel __ATTRS_o_ai vec_sld(vector pixel __a,
8610 vector pixel __b,
8611 unsigned const int __c) {
8612 unsigned char __d = __c & 0x0F;
8613 #ifdef __LITTLE_ENDIAN__
8614 return vec_perm(
8615 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8616 20 - __d, 21 - __d, 22 - __d, 23 - __d,
8617 24 - __d, 25 - __d, 26 - __d, 27 - __d,
8618 28 - __d, 29 - __d, 30 - __d, 31 - __d));
8619 #else
8620 return vec_perm(
8621 __a, __b,
8622 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8623 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8624 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8625 #endif
8626 }
8627
8628 static __inline__ vector signed int __ATTRS_o_ai
vec_sld(vector signed int __a,vector signed int __b,unsigned const int __c)8629 vec_sld(vector signed int __a, vector signed int __b, unsigned const int __c) {
8630 unsigned char __d = __c & 0x0F;
8631 #ifdef __LITTLE_ENDIAN__
8632 return vec_perm(
8633 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8634 20 - __d, 21 - __d, 22 - __d, 23 - __d,
8635 24 - __d, 25 - __d, 26 - __d, 27 - __d,
8636 28 - __d, 29 - __d, 30 - __d, 31 - __d));
8637 #else
8638 return vec_perm(
8639 __a, __b,
8640 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8641 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8642 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8643 #endif
8644 }
8645
vec_sld(vector unsigned int __a,vector unsigned int __b,unsigned const int __c)8646 static __inline__ vector unsigned int __ATTRS_o_ai vec_sld(
8647 vector unsigned int __a, vector unsigned int __b, unsigned const int __c) {
8648 unsigned char __d = __c & 0x0F;
8649 #ifdef __LITTLE_ENDIAN__
8650 return vec_perm(
8651 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8652 20 - __d, 21 - __d, 22 - __d, 23 - __d,
8653 24 - __d, 25 - __d, 26 - __d, 27 - __d,
8654 28 - __d, 29 - __d, 30 - __d, 31 - __d));
8655 #else
8656 return vec_perm(
8657 __a, __b,
8658 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8659 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8660 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8661 #endif
8662 }
8663
vec_sld(vector bool int __a,vector bool int __b,unsigned const int __c)8664 static __inline__ vector bool int __ATTRS_o_ai vec_sld(vector bool int __a,
8665 vector bool int __b,
8666 unsigned const int __c) {
8667 unsigned char __d = __c & 0x0F;
8668 #ifdef __LITTLE_ENDIAN__
8669 return vec_perm(
8670 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8671 20 - __d, 21 - __d, 22 - __d, 23 - __d,
8672 24 - __d, 25 - __d, 26 - __d, 27 - __d,
8673 28 - __d, 29 - __d, 30 - __d, 31 - __d));
8674 #else
8675 return vec_perm(
8676 __a, __b,
8677 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8678 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8679 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8680 #endif
8681 }
8682
vec_sld(vector float __a,vector float __b,unsigned const int __c)8683 static __inline__ vector float __ATTRS_o_ai vec_sld(vector float __a,
8684 vector float __b,
8685 unsigned const int __c) {
8686 unsigned char __d = __c & 0x0F;
8687 #ifdef __LITTLE_ENDIAN__
8688 return vec_perm(
8689 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8690 20 - __d, 21 - __d, 22 - __d, 23 - __d,
8691 24 - __d, 25 - __d, 26 - __d, 27 - __d,
8692 28 - __d, 29 - __d, 30 - __d, 31 - __d));
8693 #else
8694 return vec_perm(
8695 __a, __b,
8696 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8697 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8698 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8699 #endif
8700 }
8701
8702 #ifdef __VSX__
8703 static __inline__ vector bool long long __ATTRS_o_ai
vec_sld(vector bool long long __a,vector bool long long __b,unsigned const int __c)8704 vec_sld(vector bool long long __a, vector bool long long __b,
8705 unsigned const int __c) {
8706 unsigned char __d = __c & 0x0F;
8707 #ifdef __LITTLE_ENDIAN__
8708 return vec_perm(
8709 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8710 20 - __d, 21 - __d, 22 - __d, 23 - __d,
8711 24 - __d, 25 - __d, 26 - __d, 27 - __d,
8712 28 - __d, 29 - __d, 30 - __d, 31 - __d));
8713 #else
8714 return vec_perm(
8715 __a, __b,
8716 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8717 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8718 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8719 #endif
8720 }
8721
8722 static __inline__ vector signed long long __ATTRS_o_ai
vec_sld(vector signed long long __a,vector signed long long __b,unsigned const int __c)8723 vec_sld(vector signed long long __a, vector signed long long __b,
8724 unsigned const int __c) {
8725 unsigned char __d = __c & 0x0F;
8726 #ifdef __LITTLE_ENDIAN__
8727 return vec_perm(
8728 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8729 20 - __d, 21 - __d, 22 - __d, 23 - __d,
8730 24 - __d, 25 - __d, 26 - __d, 27 - __d,
8731 28 - __d, 29 - __d, 30 - __d, 31 - __d));
8732 #else
8733 return vec_perm(
8734 __a, __b,
8735 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8736 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8737 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8738 #endif
8739 }
8740
8741 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_sld(vector unsigned long long __a,vector unsigned long long __b,unsigned const int __c)8742 vec_sld(vector unsigned long long __a, vector unsigned long long __b,
8743 unsigned const int __c) {
8744 unsigned char __d = __c & 0x0F;
8745 #ifdef __LITTLE_ENDIAN__
8746 return vec_perm(
8747 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8748 20 - __d, 21 - __d, 22 - __d, 23 - __d,
8749 24 - __d, 25 - __d, 26 - __d, 27 - __d,
8750 28 - __d, 29 - __d, 30 - __d, 31 - __d));
8751 #else
8752 return vec_perm(
8753 __a, __b,
8754 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8755 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8756 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8757 #endif
8758 }
8759
vec_sld(vector double __a,vector double __b,unsigned const int __c)8760 static __inline__ vector double __ATTRS_o_ai vec_sld(vector double __a,
8761 vector double __b,
8762 unsigned const int __c) {
8763 unsigned char __d = __c & 0x0F;
8764 #ifdef __LITTLE_ENDIAN__
8765 return vec_perm(
8766 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8767 20 - __d, 21 - __d, 22 - __d, 23 - __d,
8768 24 - __d, 25 - __d, 26 - __d, 27 - __d,
8769 28 - __d, 29 - __d, 30 - __d, 31 - __d));
8770 #else
8771 return vec_perm(
8772 __a, __b,
8773 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8774 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8775 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8776 #endif
8777 }
8778 #endif
8779
8780 /* vec_sldw */
vec_sldw(vector signed char __a,vector signed char __b,unsigned const int __c)8781 static __inline__ vector signed char __ATTRS_o_ai vec_sldw(
8782 vector signed char __a, vector signed char __b, unsigned const int __c) {
8783 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8784 }
8785
8786 static __inline__ vector unsigned char __ATTRS_o_ai
vec_sldw(vector unsigned char __a,vector unsigned char __b,unsigned const int __c)8787 vec_sldw(vector unsigned char __a, vector unsigned char __b,
8788 unsigned const int __c) {
8789 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8790 }
8791
vec_sldw(vector signed short __a,vector signed short __b,unsigned const int __c)8792 static __inline__ vector signed short __ATTRS_o_ai vec_sldw(
8793 vector signed short __a, vector signed short __b, unsigned const int __c) {
8794 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8795 }
8796
8797 static __inline__ vector unsigned short __ATTRS_o_ai
vec_sldw(vector unsigned short __a,vector unsigned short __b,unsigned const int __c)8798 vec_sldw(vector unsigned short __a, vector unsigned short __b,
8799 unsigned const int __c) {
8800 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8801 }
8802
8803 static __inline__ vector signed int __ATTRS_o_ai
vec_sldw(vector signed int __a,vector signed int __b,unsigned const int __c)8804 vec_sldw(vector signed int __a, vector signed int __b, unsigned const int __c) {
8805 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8806 }
8807
vec_sldw(vector unsigned int __a,vector unsigned int __b,unsigned const int __c)8808 static __inline__ vector unsigned int __ATTRS_o_ai vec_sldw(
8809 vector unsigned int __a, vector unsigned int __b, unsigned const int __c) {
8810 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8811 }
8812
8813 #ifdef __VSX__
8814 static __inline__ vector signed long long __ATTRS_o_ai
vec_sldw(vector signed long long __a,vector signed long long __b,unsigned const int __c)8815 vec_sldw(vector signed long long __a, vector signed long long __b,
8816 unsigned const int __c) {
8817 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8818 }
8819
8820 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_sldw(vector unsigned long long __a,vector unsigned long long __b,unsigned const int __c)8821 vec_sldw(vector unsigned long long __a, vector unsigned long long __b,
8822 unsigned const int __c) {
8823 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8824 }
8825 #endif
8826
8827 #ifdef __POWER9_VECTOR__
8828 /* vec_slv */
8829 static __inline__ vector unsigned char __ATTRS_o_ai
vec_slv(vector unsigned char __a,vector unsigned char __b)8830 vec_slv(vector unsigned char __a, vector unsigned char __b) {
8831 return __builtin_altivec_vslv(__a, __b);
8832 }
8833
8834 /* vec_srv */
8835 static __inline__ vector unsigned char __ATTRS_o_ai
vec_srv(vector unsigned char __a,vector unsigned char __b)8836 vec_srv(vector unsigned char __a, vector unsigned char __b) {
8837 return __builtin_altivec_vsrv(__a, __b);
8838 }
8839 #endif
8840
8841 /* vec_vsldoi */
8842
8843 static __inline__ vector signed char __ATTRS_o_ai
vec_vsldoi(vector signed char __a,vector signed char __b,unsigned char __c)8844 vec_vsldoi(vector signed char __a, vector signed char __b, unsigned char __c) {
8845 unsigned char __d = __c & 0x0F;
8846 #ifdef __LITTLE_ENDIAN__
8847 return vec_perm(
8848 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8849 20 - __d, 21 - __d, 22 - __d, 23 - __d,
8850 24 - __d, 25 - __d, 26 - __d, 27 - __d,
8851 28 - __d, 29 - __d, 30 - __d, 31 - __d));
8852 #else
8853 return vec_perm(
8854 __a, __b,
8855 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8856 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8857 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8858 #endif
8859 }
8860
vec_vsldoi(vector unsigned char __a,vector unsigned char __b,unsigned char __c)8861 static __inline__ vector unsigned char __ATTRS_o_ai vec_vsldoi(
8862 vector unsigned char __a, vector unsigned char __b, unsigned char __c) {
8863 unsigned char __d = __c & 0x0F;
8864 #ifdef __LITTLE_ENDIAN__
8865 return vec_perm(
8866 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8867 20 - __d, 21 - __d, 22 - __d, 23 - __d,
8868 24 - __d, 25 - __d, 26 - __d, 27 - __d,
8869 28 - __d, 29 - __d, 30 - __d, 31 - __d));
8870 #else
8871 return vec_perm(
8872 __a, __b,
8873 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8874 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8875 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8876 #endif
8877 }
8878
vec_vsldoi(vector short __a,vector short __b,unsigned char __c)8879 static __inline__ vector short __ATTRS_o_ai vec_vsldoi(vector short __a,
8880 vector short __b,
8881 unsigned char __c) {
8882 unsigned char __d = __c & 0x0F;
8883 #ifdef __LITTLE_ENDIAN__
8884 return vec_perm(
8885 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8886 20 - __d, 21 - __d, 22 - __d, 23 - __d,
8887 24 - __d, 25 - __d, 26 - __d, 27 - __d,
8888 28 - __d, 29 - __d, 30 - __d, 31 - __d));
8889 #else
8890 return vec_perm(
8891 __a, __b,
8892 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8893 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8894 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8895 #endif
8896 }
8897
vec_vsldoi(vector unsigned short __a,vector unsigned short __b,unsigned char __c)8898 static __inline__ vector unsigned short __ATTRS_o_ai vec_vsldoi(
8899 vector unsigned short __a, vector unsigned short __b, unsigned char __c) {
8900 unsigned char __d = __c & 0x0F;
8901 #ifdef __LITTLE_ENDIAN__
8902 return vec_perm(
8903 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8904 20 - __d, 21 - __d, 22 - __d, 23 - __d,
8905 24 - __d, 25 - __d, 26 - __d, 27 - __d,
8906 28 - __d, 29 - __d, 30 - __d, 31 - __d));
8907 #else
8908 return vec_perm(
8909 __a, __b,
8910 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8911 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8912 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8913 #endif
8914 }
8915
vec_vsldoi(vector pixel __a,vector pixel __b,unsigned char __c)8916 static __inline__ vector pixel __ATTRS_o_ai vec_vsldoi(vector pixel __a,
8917 vector pixel __b,
8918 unsigned char __c) {
8919 unsigned char __d = __c & 0x0F;
8920 #ifdef __LITTLE_ENDIAN__
8921 return vec_perm(
8922 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8923 20 - __d, 21 - __d, 22 - __d, 23 - __d,
8924 24 - __d, 25 - __d, 26 - __d, 27 - __d,
8925 28 - __d, 29 - __d, 30 - __d, 31 - __d));
8926 #else
8927 return vec_perm(
8928 __a, __b,
8929 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8930 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8931 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8932 #endif
8933 }
8934
vec_vsldoi(vector int __a,vector int __b,unsigned char __c)8935 static __inline__ vector int __ATTRS_o_ai vec_vsldoi(vector int __a,
8936 vector int __b,
8937 unsigned char __c) {
8938 unsigned char __d = __c & 0x0F;
8939 #ifdef __LITTLE_ENDIAN__
8940 return vec_perm(
8941 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8942 20 - __d, 21 - __d, 22 - __d, 23 - __d,
8943 24 - __d, 25 - __d, 26 - __d, 27 - __d,
8944 28 - __d, 29 - __d, 30 - __d, 31 - __d));
8945 #else
8946 return vec_perm(
8947 __a, __b,
8948 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8949 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8950 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8951 #endif
8952 }
8953
vec_vsldoi(vector unsigned int __a,vector unsigned int __b,unsigned char __c)8954 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsldoi(
8955 vector unsigned int __a, vector unsigned int __b, unsigned char __c) {
8956 unsigned char __d = __c & 0x0F;
8957 #ifdef __LITTLE_ENDIAN__
8958 return vec_perm(
8959 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8960 20 - __d, 21 - __d, 22 - __d, 23 - __d,
8961 24 - __d, 25 - __d, 26 - __d, 27 - __d,
8962 28 - __d, 29 - __d, 30 - __d, 31 - __d));
8963 #else
8964 return vec_perm(
8965 __a, __b,
8966 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8967 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8968 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8969 #endif
8970 }
8971
vec_vsldoi(vector float __a,vector float __b,unsigned char __c)8972 static __inline__ vector float __ATTRS_o_ai vec_vsldoi(vector float __a,
8973 vector float __b,
8974 unsigned char __c) {
8975 unsigned char __d = __c & 0x0F;
8976 #ifdef __LITTLE_ENDIAN__
8977 return vec_perm(
8978 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8979 20 - __d, 21 - __d, 22 - __d, 23 - __d,
8980 24 - __d, 25 - __d, 26 - __d, 27 - __d,
8981 28 - __d, 29 - __d, 30 - __d, 31 - __d));
8982 #else
8983 return vec_perm(
8984 __a, __b,
8985 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8986 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8987 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8988 #endif
8989 }
8990
8991 /* vec_sll */
8992
8993 static __inline__ vector signed char __ATTRS_o_ai
vec_sll(vector signed char __a,vector unsigned char __b)8994 vec_sll(vector signed char __a, vector unsigned char __b) {
8995 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8996 (vector int)__b);
8997 }
8998
8999 static __inline__ vector signed char __ATTRS_o_ai
vec_sll(vector signed char __a,vector unsigned short __b)9000 vec_sll(vector signed char __a, vector unsigned short __b) {
9001 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
9002 (vector int)__b);
9003 }
9004
9005 static __inline__ vector signed char __ATTRS_o_ai
vec_sll(vector signed char __a,vector unsigned int __b)9006 vec_sll(vector signed char __a, vector unsigned int __b) {
9007 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
9008 (vector int)__b);
9009 }
9010
9011 static __inline__ vector unsigned char __ATTRS_o_ai
vec_sll(vector unsigned char __a,vector unsigned char __b)9012 vec_sll(vector unsigned char __a, vector unsigned char __b) {
9013 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
9014 (vector int)__b);
9015 }
9016
9017 static __inline__ vector unsigned char __ATTRS_o_ai
vec_sll(vector unsigned char __a,vector unsigned short __b)9018 vec_sll(vector unsigned char __a, vector unsigned short __b) {
9019 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
9020 (vector int)__b);
9021 }
9022
9023 static __inline__ vector unsigned char __ATTRS_o_ai
vec_sll(vector unsigned char __a,vector unsigned int __b)9024 vec_sll(vector unsigned char __a, vector unsigned int __b) {
9025 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
9026 (vector int)__b);
9027 }
9028
9029 static __inline__ vector bool char __ATTRS_o_ai
vec_sll(vector bool char __a,vector unsigned char __b)9030 vec_sll(vector bool char __a, vector unsigned char __b) {
9031 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
9032 (vector int)__b);
9033 }
9034
9035 static __inline__ vector bool char __ATTRS_o_ai
vec_sll(vector bool char __a,vector unsigned short __b)9036 vec_sll(vector bool char __a, vector unsigned short __b) {
9037 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
9038 (vector int)__b);
9039 }
9040
9041 static __inline__ vector bool char __ATTRS_o_ai
vec_sll(vector bool char __a,vector unsigned int __b)9042 vec_sll(vector bool char __a, vector unsigned int __b) {
9043 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
9044 (vector int)__b);
9045 }
9046
vec_sll(vector short __a,vector unsigned char __b)9047 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
9048 vector unsigned char __b) {
9049 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9050 }
9051
vec_sll(vector short __a,vector unsigned short __b)9052 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
9053 vector unsigned short __b) {
9054 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9055 }
9056
vec_sll(vector short __a,vector unsigned int __b)9057 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
9058 vector unsigned int __b) {
9059 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9060 }
9061
9062 static __inline__ vector unsigned short __ATTRS_o_ai
vec_sll(vector unsigned short __a,vector unsigned char __b)9063 vec_sll(vector unsigned short __a, vector unsigned char __b) {
9064 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
9065 (vector int)__b);
9066 }
9067
9068 static __inline__ vector unsigned short __ATTRS_o_ai
vec_sll(vector unsigned short __a,vector unsigned short __b)9069 vec_sll(vector unsigned short __a, vector unsigned short __b) {
9070 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
9071 (vector int)__b);
9072 }
9073
9074 static __inline__ vector unsigned short __ATTRS_o_ai
vec_sll(vector unsigned short __a,vector unsigned int __b)9075 vec_sll(vector unsigned short __a, vector unsigned int __b) {
9076 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
9077 (vector int)__b);
9078 }
9079
9080 static __inline__ vector bool short __ATTRS_o_ai
vec_sll(vector bool short __a,vector unsigned char __b)9081 vec_sll(vector bool short __a, vector unsigned char __b) {
9082 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
9083 (vector int)__b);
9084 }
9085
9086 static __inline__ vector bool short __ATTRS_o_ai
vec_sll(vector bool short __a,vector unsigned short __b)9087 vec_sll(vector bool short __a, vector unsigned short __b) {
9088 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
9089 (vector int)__b);
9090 }
9091
9092 static __inline__ vector bool short __ATTRS_o_ai
vec_sll(vector bool short __a,vector unsigned int __b)9093 vec_sll(vector bool short __a, vector unsigned int __b) {
9094 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
9095 (vector int)__b);
9096 }
9097
vec_sll(vector pixel __a,vector unsigned char __b)9098 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
9099 vector unsigned char __b) {
9100 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9101 }
9102
vec_sll(vector pixel __a,vector unsigned short __b)9103 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
9104 vector unsigned short __b) {
9105 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9106 }
9107
vec_sll(vector pixel __a,vector unsigned int __b)9108 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
9109 vector unsigned int __b) {
9110 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9111 }
9112
vec_sll(vector int __a,vector unsigned char __b)9113 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
9114 vector unsigned char __b) {
9115 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
9116 }
9117
vec_sll(vector int __a,vector unsigned short __b)9118 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
9119 vector unsigned short __b) {
9120 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
9121 }
9122
vec_sll(vector int __a,vector unsigned int __b)9123 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
9124 vector unsigned int __b) {
9125 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
9126 }
9127
9128 static __inline__ vector unsigned int __ATTRS_o_ai
vec_sll(vector unsigned int __a,vector unsigned char __b)9129 vec_sll(vector unsigned int __a, vector unsigned char __b) {
9130 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
9131 (vector int)__b);
9132 }
9133
9134 static __inline__ vector unsigned int __ATTRS_o_ai
vec_sll(vector unsigned int __a,vector unsigned short __b)9135 vec_sll(vector unsigned int __a, vector unsigned short __b) {
9136 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
9137 (vector int)__b);
9138 }
9139
9140 static __inline__ vector unsigned int __ATTRS_o_ai
vec_sll(vector unsigned int __a,vector unsigned int __b)9141 vec_sll(vector unsigned int __a, vector unsigned int __b) {
9142 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
9143 (vector int)__b);
9144 }
9145
9146 static __inline__ vector bool int __ATTRS_o_ai
vec_sll(vector bool int __a,vector unsigned char __b)9147 vec_sll(vector bool int __a, vector unsigned char __b) {
9148 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
9149 (vector int)__b);
9150 }
9151
9152 static __inline__ vector bool int __ATTRS_o_ai
vec_sll(vector bool int __a,vector unsigned short __b)9153 vec_sll(vector bool int __a, vector unsigned short __b) {
9154 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
9155 (vector int)__b);
9156 }
9157
9158 static __inline__ vector bool int __ATTRS_o_ai
vec_sll(vector bool int __a,vector unsigned int __b)9159 vec_sll(vector bool int __a, vector unsigned int __b) {
9160 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
9161 (vector int)__b);
9162 }
9163
9164 #ifdef __VSX__
9165 static __inline__ vector signed long long __ATTRS_o_ai
vec_sll(vector signed long long __a,vector unsigned char __b)9166 vec_sll(vector signed long long __a, vector unsigned char __b) {
9167 return (vector signed long long)__builtin_altivec_vsl((vector int)__a,
9168 (vector int)__b);
9169 }
9170
9171 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_sll(vector unsigned long long __a,vector unsigned char __b)9172 vec_sll(vector unsigned long long __a, vector unsigned char __b) {
9173 return (vector unsigned long long)__builtin_altivec_vsl((vector int)__a,
9174 (vector int)__b);
9175 }
9176 #endif
9177
9178 /* vec_vsl */
9179
9180 static __inline__ vector signed char __ATTRS_o_ai
vec_vsl(vector signed char __a,vector unsigned char __b)9181 vec_vsl(vector signed char __a, vector unsigned char __b) {
9182 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
9183 (vector int)__b);
9184 }
9185
9186 static __inline__ vector signed char __ATTRS_o_ai
vec_vsl(vector signed char __a,vector unsigned short __b)9187 vec_vsl(vector signed char __a, vector unsigned short __b) {
9188 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
9189 (vector int)__b);
9190 }
9191
9192 static __inline__ vector signed char __ATTRS_o_ai
vec_vsl(vector signed char __a,vector unsigned int __b)9193 vec_vsl(vector signed char __a, vector unsigned int __b) {
9194 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
9195 (vector int)__b);
9196 }
9197
9198 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vsl(vector unsigned char __a,vector unsigned char __b)9199 vec_vsl(vector unsigned char __a, vector unsigned char __b) {
9200 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
9201 (vector int)__b);
9202 }
9203
9204 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vsl(vector unsigned char __a,vector unsigned short __b)9205 vec_vsl(vector unsigned char __a, vector unsigned short __b) {
9206 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
9207 (vector int)__b);
9208 }
9209
9210 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vsl(vector unsigned char __a,vector unsigned int __b)9211 vec_vsl(vector unsigned char __a, vector unsigned int __b) {
9212 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
9213 (vector int)__b);
9214 }
9215
9216 static __inline__ vector bool char __ATTRS_o_ai
vec_vsl(vector bool char __a,vector unsigned char __b)9217 vec_vsl(vector bool char __a, vector unsigned char __b) {
9218 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
9219 (vector int)__b);
9220 }
9221
9222 static __inline__ vector bool char __ATTRS_o_ai
vec_vsl(vector bool char __a,vector unsigned short __b)9223 vec_vsl(vector bool char __a, vector unsigned short __b) {
9224 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
9225 (vector int)__b);
9226 }
9227
9228 static __inline__ vector bool char __ATTRS_o_ai
vec_vsl(vector bool char __a,vector unsigned int __b)9229 vec_vsl(vector bool char __a, vector unsigned int __b) {
9230 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
9231 (vector int)__b);
9232 }
9233
vec_vsl(vector short __a,vector unsigned char __b)9234 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
9235 vector unsigned char __b) {
9236 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9237 }
9238
vec_vsl(vector short __a,vector unsigned short __b)9239 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
9240 vector unsigned short __b) {
9241 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9242 }
9243
vec_vsl(vector short __a,vector unsigned int __b)9244 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
9245 vector unsigned int __b) {
9246 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9247 }
9248
9249 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vsl(vector unsigned short __a,vector unsigned char __b)9250 vec_vsl(vector unsigned short __a, vector unsigned char __b) {
9251 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
9252 (vector int)__b);
9253 }
9254
9255 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vsl(vector unsigned short __a,vector unsigned short __b)9256 vec_vsl(vector unsigned short __a, vector unsigned short __b) {
9257 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
9258 (vector int)__b);
9259 }
9260
9261 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vsl(vector unsigned short __a,vector unsigned int __b)9262 vec_vsl(vector unsigned short __a, vector unsigned int __b) {
9263 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
9264 (vector int)__b);
9265 }
9266
9267 static __inline__ vector bool short __ATTRS_o_ai
vec_vsl(vector bool short __a,vector unsigned char __b)9268 vec_vsl(vector bool short __a, vector unsigned char __b) {
9269 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
9270 (vector int)__b);
9271 }
9272
9273 static __inline__ vector bool short __ATTRS_o_ai
vec_vsl(vector bool short __a,vector unsigned short __b)9274 vec_vsl(vector bool short __a, vector unsigned short __b) {
9275 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
9276 (vector int)__b);
9277 }
9278
9279 static __inline__ vector bool short __ATTRS_o_ai
vec_vsl(vector bool short __a,vector unsigned int __b)9280 vec_vsl(vector bool short __a, vector unsigned int __b) {
9281 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
9282 (vector int)__b);
9283 }
9284
vec_vsl(vector pixel __a,vector unsigned char __b)9285 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
9286 vector unsigned char __b) {
9287 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9288 }
9289
vec_vsl(vector pixel __a,vector unsigned short __b)9290 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
9291 vector unsigned short __b) {
9292 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9293 }
9294
vec_vsl(vector pixel __a,vector unsigned int __b)9295 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
9296 vector unsigned int __b) {
9297 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9298 }
9299
vec_vsl(vector int __a,vector unsigned char __b)9300 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
9301 vector unsigned char __b) {
9302 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
9303 }
9304
vec_vsl(vector int __a,vector unsigned short __b)9305 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
9306 vector unsigned short __b) {
9307 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
9308 }
9309
vec_vsl(vector int __a,vector unsigned int __b)9310 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
9311 vector unsigned int __b) {
9312 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
9313 }
9314
9315 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vsl(vector unsigned int __a,vector unsigned char __b)9316 vec_vsl(vector unsigned int __a, vector unsigned char __b) {
9317 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
9318 (vector int)__b);
9319 }
9320
9321 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vsl(vector unsigned int __a,vector unsigned short __b)9322 vec_vsl(vector unsigned int __a, vector unsigned short __b) {
9323 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
9324 (vector int)__b);
9325 }
9326
9327 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vsl(vector unsigned int __a,vector unsigned int __b)9328 vec_vsl(vector unsigned int __a, vector unsigned int __b) {
9329 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
9330 (vector int)__b);
9331 }
9332
9333 static __inline__ vector bool int __ATTRS_o_ai
vec_vsl(vector bool int __a,vector unsigned char __b)9334 vec_vsl(vector bool int __a, vector unsigned char __b) {
9335 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
9336 (vector int)__b);
9337 }
9338
9339 static __inline__ vector bool int __ATTRS_o_ai
vec_vsl(vector bool int __a,vector unsigned short __b)9340 vec_vsl(vector bool int __a, vector unsigned short __b) {
9341 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
9342 (vector int)__b);
9343 }
9344
9345 static __inline__ vector bool int __ATTRS_o_ai
vec_vsl(vector bool int __a,vector unsigned int __b)9346 vec_vsl(vector bool int __a, vector unsigned int __b) {
9347 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
9348 (vector int)__b);
9349 }
9350
9351 /* vec_slo */
9352
9353 static __inline__ vector signed char __ATTRS_o_ai
vec_slo(vector signed char __a,vector signed char __b)9354 vec_slo(vector signed char __a, vector signed char __b) {
9355 return (vector signed char)__builtin_altivec_vslo((vector int)__a,
9356 (vector int)__b);
9357 }
9358
9359 static __inline__ vector signed char __ATTRS_o_ai
vec_slo(vector signed char __a,vector unsigned char __b)9360 vec_slo(vector signed char __a, vector unsigned char __b) {
9361 return (vector signed char)__builtin_altivec_vslo((vector int)__a,
9362 (vector int)__b);
9363 }
9364
9365 static __inline__ vector unsigned char __ATTRS_o_ai
vec_slo(vector unsigned char __a,vector signed char __b)9366 vec_slo(vector unsigned char __a, vector signed char __b) {
9367 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
9368 (vector int)__b);
9369 }
9370
9371 static __inline__ vector unsigned char __ATTRS_o_ai
vec_slo(vector unsigned char __a,vector unsigned char __b)9372 vec_slo(vector unsigned char __a, vector unsigned char __b) {
9373 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
9374 (vector int)__b);
9375 }
9376
vec_slo(vector short __a,vector signed char __b)9377 static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a,
9378 vector signed char __b) {
9379 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9380 }
9381
vec_slo(vector short __a,vector unsigned char __b)9382 static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a,
9383 vector unsigned char __b) {
9384 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9385 }
9386
9387 static __inline__ vector unsigned short __ATTRS_o_ai
vec_slo(vector unsigned short __a,vector signed char __b)9388 vec_slo(vector unsigned short __a, vector signed char __b) {
9389 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9390 (vector int)__b);
9391 }
9392
9393 static __inline__ vector unsigned short __ATTRS_o_ai
vec_slo(vector unsigned short __a,vector unsigned char __b)9394 vec_slo(vector unsigned short __a, vector unsigned char __b) {
9395 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9396 (vector int)__b);
9397 }
9398
vec_slo(vector pixel __a,vector signed char __b)9399 static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
9400 vector signed char __b) {
9401 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9402 }
9403
vec_slo(vector pixel __a,vector unsigned char __b)9404 static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
9405 vector unsigned char __b) {
9406 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9407 }
9408
vec_slo(vector int __a,vector signed char __b)9409 static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a,
9410 vector signed char __b) {
9411 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9412 }
9413
vec_slo(vector int __a,vector unsigned char __b)9414 static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a,
9415 vector unsigned char __b) {
9416 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9417 }
9418
9419 static __inline__ vector unsigned int __ATTRS_o_ai
vec_slo(vector unsigned int __a,vector signed char __b)9420 vec_slo(vector unsigned int __a, vector signed char __b) {
9421 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9422 (vector int)__b);
9423 }
9424
9425 static __inline__ vector unsigned int __ATTRS_o_ai
vec_slo(vector unsigned int __a,vector unsigned char __b)9426 vec_slo(vector unsigned int __a, vector unsigned char __b) {
9427 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9428 (vector int)__b);
9429 }
9430
vec_slo(vector float __a,vector signed char __b)9431 static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a,
9432 vector signed char __b) {
9433 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9434 }
9435
vec_slo(vector float __a,vector unsigned char __b)9436 static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a,
9437 vector unsigned char __b) {
9438 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9439 }
9440
9441 #ifdef __VSX__
9442 static __inline__ vector signed long long __ATTRS_o_ai
vec_slo(vector signed long long __a,vector signed char __b)9443 vec_slo(vector signed long long __a, vector signed char __b) {
9444 return (vector signed long long)__builtin_altivec_vslo((vector int)__a,
9445 (vector int)__b);
9446 }
9447
9448 static __inline__ vector signed long long __ATTRS_o_ai
vec_slo(vector signed long long __a,vector unsigned char __b)9449 vec_slo(vector signed long long __a, vector unsigned char __b) {
9450 return (vector signed long long)__builtin_altivec_vslo((vector int)__a,
9451 (vector int)__b);
9452 }
9453
9454 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_slo(vector unsigned long long __a,vector signed char __b)9455 vec_slo(vector unsigned long long __a, vector signed char __b) {
9456 return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a,
9457 (vector int)__b);
9458 }
9459
9460 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_slo(vector unsigned long long __a,vector unsigned char __b)9461 vec_slo(vector unsigned long long __a, vector unsigned char __b) {
9462 return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a,
9463 (vector int)__b);
9464 }
9465 #endif
9466
9467 /* vec_vslo */
9468
9469 static __inline__ vector signed char __ATTRS_o_ai
vec_vslo(vector signed char __a,vector signed char __b)9470 vec_vslo(vector signed char __a, vector signed char __b) {
9471 return (vector signed char)__builtin_altivec_vslo((vector int)__a,
9472 (vector int)__b);
9473 }
9474
9475 static __inline__ vector signed char __ATTRS_o_ai
vec_vslo(vector signed char __a,vector unsigned char __b)9476 vec_vslo(vector signed char __a, vector unsigned char __b) {
9477 return (vector signed char)__builtin_altivec_vslo((vector int)__a,
9478 (vector int)__b);
9479 }
9480
9481 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vslo(vector unsigned char __a,vector signed char __b)9482 vec_vslo(vector unsigned char __a, vector signed char __b) {
9483 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
9484 (vector int)__b);
9485 }
9486
9487 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vslo(vector unsigned char __a,vector unsigned char __b)9488 vec_vslo(vector unsigned char __a, vector unsigned char __b) {
9489 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
9490 (vector int)__b);
9491 }
9492
vec_vslo(vector short __a,vector signed char __b)9493 static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a,
9494 vector signed char __b) {
9495 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9496 }
9497
vec_vslo(vector short __a,vector unsigned char __b)9498 static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a,
9499 vector unsigned char __b) {
9500 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9501 }
9502
9503 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vslo(vector unsigned short __a,vector signed char __b)9504 vec_vslo(vector unsigned short __a, vector signed char __b) {
9505 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9506 (vector int)__b);
9507 }
9508
9509 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vslo(vector unsigned short __a,vector unsigned char __b)9510 vec_vslo(vector unsigned short __a, vector unsigned char __b) {
9511 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9512 (vector int)__b);
9513 }
9514
vec_vslo(vector pixel __a,vector signed char __b)9515 static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
9516 vector signed char __b) {
9517 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9518 }
9519
vec_vslo(vector pixel __a,vector unsigned char __b)9520 static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
9521 vector unsigned char __b) {
9522 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9523 }
9524
vec_vslo(vector int __a,vector signed char __b)9525 static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a,
9526 vector signed char __b) {
9527 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9528 }
9529
vec_vslo(vector int __a,vector unsigned char __b)9530 static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a,
9531 vector unsigned char __b) {
9532 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9533 }
9534
9535 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vslo(vector unsigned int __a,vector signed char __b)9536 vec_vslo(vector unsigned int __a, vector signed char __b) {
9537 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9538 (vector int)__b);
9539 }
9540
9541 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vslo(vector unsigned int __a,vector unsigned char __b)9542 vec_vslo(vector unsigned int __a, vector unsigned char __b) {
9543 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9544 (vector int)__b);
9545 }
9546
vec_vslo(vector float __a,vector signed char __b)9547 static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a,
9548 vector signed char __b) {
9549 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9550 }
9551
vec_vslo(vector float __a,vector unsigned char __b)9552 static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a,
9553 vector unsigned char __b) {
9554 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9555 }
9556
9557 /* vec_splat */
9558
9559 static __inline__ vector signed char __ATTRS_o_ai
vec_splat(vector signed char __a,unsigned const int __b)9560 vec_splat(vector signed char __a, unsigned const int __b) {
9561 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
9562 }
9563
9564 static __inline__ vector unsigned char __ATTRS_o_ai
vec_splat(vector unsigned char __a,unsigned const int __b)9565 vec_splat(vector unsigned char __a, unsigned const int __b) {
9566 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
9567 }
9568
9569 static __inline__ vector bool char __ATTRS_o_ai
vec_splat(vector bool char __a,unsigned const int __b)9570 vec_splat(vector bool char __a, unsigned const int __b) {
9571 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
9572 }
9573
9574 static __inline__ vector signed short __ATTRS_o_ai
vec_splat(vector signed short __a,unsigned const int __b)9575 vec_splat(vector signed short __a, unsigned const int __b) {
9576 unsigned char b0 = (__b & 0x07) * 2;
9577 unsigned char b1 = b0 + 1;
9578 return vec_perm(__a, __a,
9579 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
9580 b0, b1, b0, b1, b0, b1));
9581 }
9582
9583 static __inline__ vector unsigned short __ATTRS_o_ai
vec_splat(vector unsigned short __a,unsigned const int __b)9584 vec_splat(vector unsigned short __a, unsigned const int __b) {
9585 unsigned char b0 = (__b & 0x07) * 2;
9586 unsigned char b1 = b0 + 1;
9587 return vec_perm(__a, __a,
9588 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
9589 b0, b1, b0, b1, b0, b1));
9590 }
9591
9592 static __inline__ vector bool short __ATTRS_o_ai
vec_splat(vector bool short __a,unsigned const int __b)9593 vec_splat(vector bool short __a, unsigned const int __b) {
9594 unsigned char b0 = (__b & 0x07) * 2;
9595 unsigned char b1 = b0 + 1;
9596 return vec_perm(__a, __a,
9597 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
9598 b0, b1, b0, b1, b0, b1));
9599 }
9600
vec_splat(vector pixel __a,unsigned const int __b)9601 static __inline__ vector pixel __ATTRS_o_ai vec_splat(vector pixel __a,
9602 unsigned const int __b) {
9603 unsigned char b0 = (__b & 0x07) * 2;
9604 unsigned char b1 = b0 + 1;
9605 return vec_perm(__a, __a,
9606 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
9607 b0, b1, b0, b1, b0, b1));
9608 }
9609
9610 static __inline__ vector signed int __ATTRS_o_ai
vec_splat(vector signed int __a,unsigned const int __b)9611 vec_splat(vector signed int __a, unsigned const int __b) {
9612 unsigned char b0 = (__b & 0x03) * 4;
9613 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
9614 return vec_perm(__a, __a,
9615 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
9616 b2, b3, b0, b1, b2, b3));
9617 }
9618
9619 static __inline__ vector unsigned int __ATTRS_o_ai
vec_splat(vector unsigned int __a,unsigned const int __b)9620 vec_splat(vector unsigned int __a, unsigned const int __b) {
9621 unsigned char b0 = (__b & 0x03) * 4;
9622 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
9623 return vec_perm(__a, __a,
9624 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
9625 b2, b3, b0, b1, b2, b3));
9626 }
9627
9628 static __inline__ vector bool int __ATTRS_o_ai
vec_splat(vector bool int __a,unsigned const int __b)9629 vec_splat(vector bool int __a, unsigned const int __b) {
9630 unsigned char b0 = (__b & 0x03) * 4;
9631 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
9632 return vec_perm(__a, __a,
9633 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
9634 b2, b3, b0, b1, b2, b3));
9635 }
9636
vec_splat(vector float __a,unsigned const int __b)9637 static __inline__ vector float __ATTRS_o_ai vec_splat(vector float __a,
9638 unsigned const int __b) {
9639 unsigned char b0 = (__b & 0x03) * 4;
9640 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
9641 return vec_perm(__a, __a,
9642 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
9643 b2, b3, b0, b1, b2, b3));
9644 }
9645
9646 #ifdef __VSX__
vec_splat(vector double __a,unsigned const int __b)9647 static __inline__ vector double __ATTRS_o_ai vec_splat(vector double __a,
9648 unsigned const int __b) {
9649 unsigned char b0 = (__b & 0x01) * 8;
9650 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
9651 b6 = b0 + 6, b7 = b0 + 7;
9652 return vec_perm(__a, __a,
9653 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
9654 b2, b3, b4, b5, b6, b7));
9655 }
9656 static __inline__ vector bool long long __ATTRS_o_ai
vec_splat(vector bool long long __a,unsigned const int __b)9657 vec_splat(vector bool long long __a, unsigned const int __b) {
9658 unsigned char b0 = (__b & 0x01) * 8;
9659 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
9660 b6 = b0 + 6, b7 = b0 + 7;
9661 return vec_perm(__a, __a,
9662 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
9663 b2, b3, b4, b5, b6, b7));
9664 }
9665 static __inline__ vector signed long long __ATTRS_o_ai
vec_splat(vector signed long long __a,unsigned const int __b)9666 vec_splat(vector signed long long __a, unsigned const int __b) {
9667 unsigned char b0 = (__b & 0x01) * 8;
9668 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
9669 b6 = b0 + 6, b7 = b0 + 7;
9670 return vec_perm(__a, __a,
9671 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
9672 b2, b3, b4, b5, b6, b7));
9673 }
9674 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_splat(vector unsigned long long __a,unsigned const int __b)9675 vec_splat(vector unsigned long long __a, unsigned const int __b) {
9676 unsigned char b0 = (__b & 0x01) * 8;
9677 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
9678 b6 = b0 + 6, b7 = b0 + 7;
9679 return vec_perm(__a, __a,
9680 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
9681 b2, b3, b4, b5, b6, b7));
9682 }
9683 #endif
9684
9685 /* vec_vspltb */
9686
9687 #define __builtin_altivec_vspltb vec_vspltb
9688
9689 static __inline__ vector signed char __ATTRS_o_ai
vec_vspltb(vector signed char __a,unsigned char __b)9690 vec_vspltb(vector signed char __a, unsigned char __b) {
9691 return vec_perm(__a, __a, (vector unsigned char)(__b));
9692 }
9693
9694 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vspltb(vector unsigned char __a,unsigned char __b)9695 vec_vspltb(vector unsigned char __a, unsigned char __b) {
9696 return vec_perm(__a, __a, (vector unsigned char)(__b));
9697 }
9698
vec_vspltb(vector bool char __a,unsigned char __b)9699 static __inline__ vector bool char __ATTRS_o_ai vec_vspltb(vector bool char __a,
9700 unsigned char __b) {
9701 return vec_perm(__a, __a, (vector unsigned char)(__b));
9702 }
9703
9704 /* vec_vsplth */
9705
9706 #define __builtin_altivec_vsplth vec_vsplth
9707
vec_vsplth(vector short __a,unsigned char __b)9708 static __inline__ vector short __ATTRS_o_ai vec_vsplth(vector short __a,
9709 unsigned char __b) {
9710 __b *= 2;
9711 unsigned char b1 = __b + 1;
9712 return vec_perm(__a, __a,
9713 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
9714 __b, b1, __b, b1, __b, b1, __b, b1));
9715 }
9716
9717 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vsplth(vector unsigned short __a,unsigned char __b)9718 vec_vsplth(vector unsigned short __a, unsigned char __b) {
9719 __b *= 2;
9720 unsigned char b1 = __b + 1;
9721 return vec_perm(__a, __a,
9722 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
9723 __b, b1, __b, b1, __b, b1, __b, b1));
9724 }
9725
9726 static __inline__ vector bool short __ATTRS_o_ai
vec_vsplth(vector bool short __a,unsigned char __b)9727 vec_vsplth(vector bool short __a, unsigned char __b) {
9728 __b *= 2;
9729 unsigned char b1 = __b + 1;
9730 return vec_perm(__a, __a,
9731 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
9732 __b, b1, __b, b1, __b, b1, __b, b1));
9733 }
9734
vec_vsplth(vector pixel __a,unsigned char __b)9735 static __inline__ vector pixel __ATTRS_o_ai vec_vsplth(vector pixel __a,
9736 unsigned char __b) {
9737 __b *= 2;
9738 unsigned char b1 = __b + 1;
9739 return vec_perm(__a, __a,
9740 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
9741 __b, b1, __b, b1, __b, b1, __b, b1));
9742 }
9743
9744 /* vec_vspltw */
9745
9746 #define __builtin_altivec_vspltw vec_vspltw
9747
vec_vspltw(vector int __a,unsigned char __b)9748 static __inline__ vector int __ATTRS_o_ai vec_vspltw(vector int __a,
9749 unsigned char __b) {
9750 __b *= 4;
9751 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
9752 return vec_perm(__a, __a,
9753 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
9754 b1, b2, b3, __b, b1, b2, b3));
9755 }
9756
9757 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vspltw(vector unsigned int __a,unsigned char __b)9758 vec_vspltw(vector unsigned int __a, unsigned char __b) {
9759 __b *= 4;
9760 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
9761 return vec_perm(__a, __a,
9762 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
9763 b1, b2, b3, __b, b1, b2, b3));
9764 }
9765
vec_vspltw(vector bool int __a,unsigned char __b)9766 static __inline__ vector bool int __ATTRS_o_ai vec_vspltw(vector bool int __a,
9767 unsigned char __b) {
9768 __b *= 4;
9769 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
9770 return vec_perm(__a, __a,
9771 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
9772 b1, b2, b3, __b, b1, b2, b3));
9773 }
9774
vec_vspltw(vector float __a,unsigned char __b)9775 static __inline__ vector float __ATTRS_o_ai vec_vspltw(vector float __a,
9776 unsigned char __b) {
9777 __b *= 4;
9778 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
9779 return vec_perm(__a, __a,
9780 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
9781 b1, b2, b3, __b, b1, b2, b3));
9782 }
9783
9784 /* vec_splat_s8 */
9785
9786 #define __builtin_altivec_vspltisb vec_splat_s8
9787
9788 // FIXME: parameter should be treated as 5-bit signed literal
9789 static __inline__ vector signed char __ATTRS_o_ai
vec_splat_s8(signed char __a)9790 vec_splat_s8(signed char __a) {
9791 return (vector signed char)(__a);
9792 }
9793
9794 /* vec_vspltisb */
9795
9796 // FIXME: parameter should be treated as 5-bit signed literal
9797 static __inline__ vector signed char __ATTRS_o_ai
vec_vspltisb(signed char __a)9798 vec_vspltisb(signed char __a) {
9799 return (vector signed char)(__a);
9800 }
9801
9802 /* vec_splat_s16 */
9803
9804 #define __builtin_altivec_vspltish vec_splat_s16
9805
9806 // FIXME: parameter should be treated as 5-bit signed literal
vec_splat_s16(signed char __a)9807 static __inline__ vector short __ATTRS_o_ai vec_splat_s16(signed char __a) {
9808 return (vector short)(__a);
9809 }
9810
9811 /* vec_vspltish */
9812
9813 // FIXME: parameter should be treated as 5-bit signed literal
vec_vspltish(signed char __a)9814 static __inline__ vector short __ATTRS_o_ai vec_vspltish(signed char __a) {
9815 return (vector short)(__a);
9816 }
9817
9818 /* vec_splat_s32 */
9819
9820 #define __builtin_altivec_vspltisw vec_splat_s32
9821
9822 // FIXME: parameter should be treated as 5-bit signed literal
vec_splat_s32(signed char __a)9823 static __inline__ vector int __ATTRS_o_ai vec_splat_s32(signed char __a) {
9824 return (vector int)(__a);
9825 }
9826
9827 /* vec_vspltisw */
9828
9829 // FIXME: parameter should be treated as 5-bit signed literal
vec_vspltisw(signed char __a)9830 static __inline__ vector int __ATTRS_o_ai vec_vspltisw(signed char __a) {
9831 return (vector int)(__a);
9832 }
9833
9834 /* vec_splat_u8 */
9835
9836 // FIXME: parameter should be treated as 5-bit signed literal
9837 static __inline__ vector unsigned char __ATTRS_o_ai
vec_splat_u8(unsigned char __a)9838 vec_splat_u8(unsigned char __a) {
9839 return (vector unsigned char)(__a);
9840 }
9841
9842 /* vec_splat_u16 */
9843
9844 // FIXME: parameter should be treated as 5-bit signed literal
9845 static __inline__ vector unsigned short __ATTRS_o_ai
vec_splat_u16(signed char __a)9846 vec_splat_u16(signed char __a) {
9847 return (vector unsigned short)(__a);
9848 }
9849
9850 /* vec_splat_u32 */
9851
9852 // FIXME: parameter should be treated as 5-bit signed literal
9853 static __inline__ vector unsigned int __ATTRS_o_ai
vec_splat_u32(signed char __a)9854 vec_splat_u32(signed char __a) {
9855 return (vector unsigned int)(__a);
9856 }
9857
9858 /* vec_sr */
9859
9860 // vec_sr does modulo arithmetic on __b first, so __b is allowed to be more
9861 // than the length of __a.
9862 static __inline__ vector unsigned char __ATTRS_o_ai
vec_sr(vector unsigned char __a,vector unsigned char __b)9863 vec_sr(vector unsigned char __a, vector unsigned char __b) {
9864 return __a >>
9865 (__b % (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__));
9866 }
9867
9868 static __inline__ vector signed char __ATTRS_o_ai
vec_sr(vector signed char __a,vector unsigned char __b)9869 vec_sr(vector signed char __a, vector unsigned char __b) {
9870 return (vector signed char)vec_sr((vector unsigned char)__a, __b);
9871 }
9872
9873 static __inline__ vector unsigned short __ATTRS_o_ai
vec_sr(vector unsigned short __a,vector unsigned short __b)9874 vec_sr(vector unsigned short __a, vector unsigned short __b) {
9875 return __a >>
9876 (__b % (vector unsigned short)(sizeof(unsigned short) * __CHAR_BIT__));
9877 }
9878
vec_sr(vector short __a,vector unsigned short __b)9879 static __inline__ vector short __ATTRS_o_ai vec_sr(vector short __a,
9880 vector unsigned short __b) {
9881 return (vector short)vec_sr((vector unsigned short)__a, __b);
9882 }
9883
9884 static __inline__ vector unsigned int __ATTRS_o_ai
vec_sr(vector unsigned int __a,vector unsigned int __b)9885 vec_sr(vector unsigned int __a, vector unsigned int __b) {
9886 return __a >>
9887 (__b % (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__));
9888 }
9889
vec_sr(vector int __a,vector unsigned int __b)9890 static __inline__ vector int __ATTRS_o_ai vec_sr(vector int __a,
9891 vector unsigned int __b) {
9892 return (vector int)vec_sr((vector unsigned int)__a, __b);
9893 }
9894
9895 #ifdef __POWER8_VECTOR__
9896 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_sr(vector unsigned long long __a,vector unsigned long long __b)9897 vec_sr(vector unsigned long long __a, vector unsigned long long __b) {
9898 return __a >> (__b % (vector unsigned long long)(sizeof(unsigned long long) *
9899 __CHAR_BIT__));
9900 }
9901
9902 static __inline__ vector long long __ATTRS_o_ai
vec_sr(vector long long __a,vector unsigned long long __b)9903 vec_sr(vector long long __a, vector unsigned long long __b) {
9904 return (vector long long)vec_sr((vector unsigned long long)__a, __b);
9905 }
9906 #endif
9907
9908 /* vec_vsrb */
9909
9910 #define __builtin_altivec_vsrb vec_vsrb
9911
9912 static __inline__ vector signed char __ATTRS_o_ai
vec_vsrb(vector signed char __a,vector unsigned char __b)9913 vec_vsrb(vector signed char __a, vector unsigned char __b) {
9914 return vec_sr(__a, __b);
9915 }
9916
9917 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vsrb(vector unsigned char __a,vector unsigned char __b)9918 vec_vsrb(vector unsigned char __a, vector unsigned char __b) {
9919 return vec_sr(__a, __b);
9920 }
9921
9922 /* vec_vsrh */
9923
9924 #define __builtin_altivec_vsrh vec_vsrh
9925
9926 static __inline__ vector short __ATTRS_o_ai
vec_vsrh(vector short __a,vector unsigned short __b)9927 vec_vsrh(vector short __a, vector unsigned short __b) {
9928 return vec_sr(__a, __b);
9929 }
9930
9931 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vsrh(vector unsigned short __a,vector unsigned short __b)9932 vec_vsrh(vector unsigned short __a, vector unsigned short __b) {
9933 return vec_sr(__a, __b);
9934 }
9935
9936 /* vec_vsrw */
9937
9938 #define __builtin_altivec_vsrw vec_vsrw
9939
vec_vsrw(vector int __a,vector unsigned int __b)9940 static __inline__ vector int __ATTRS_o_ai vec_vsrw(vector int __a,
9941 vector unsigned int __b) {
9942 return vec_sr(__a, __b);
9943 }
9944
9945 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vsrw(vector unsigned int __a,vector unsigned int __b)9946 vec_vsrw(vector unsigned int __a, vector unsigned int __b) {
9947 return vec_sr(__a, __b);
9948 }
9949
9950 /* vec_sra */
9951
9952 static __inline__ vector signed char __ATTRS_o_ai
vec_sra(vector signed char __a,vector unsigned char __b)9953 vec_sra(vector signed char __a, vector unsigned char __b) {
9954 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
9955 }
9956
9957 static __inline__ vector unsigned char __ATTRS_o_ai
vec_sra(vector unsigned char __a,vector unsigned char __b)9958 vec_sra(vector unsigned char __a, vector unsigned char __b) {
9959 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
9960 }
9961
vec_sra(vector short __a,vector unsigned short __b)9962 static __inline__ vector short __ATTRS_o_ai vec_sra(vector short __a,
9963 vector unsigned short __b) {
9964 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
9965 }
9966
9967 static __inline__ vector unsigned short __ATTRS_o_ai
vec_sra(vector unsigned short __a,vector unsigned short __b)9968 vec_sra(vector unsigned short __a, vector unsigned short __b) {
9969 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
9970 }
9971
vec_sra(vector int __a,vector unsigned int __b)9972 static __inline__ vector int __ATTRS_o_ai vec_sra(vector int __a,
9973 vector unsigned int __b) {
9974 return __builtin_altivec_vsraw(__a, __b);
9975 }
9976
9977 static __inline__ vector unsigned int __ATTRS_o_ai
vec_sra(vector unsigned int __a,vector unsigned int __b)9978 vec_sra(vector unsigned int __a, vector unsigned int __b) {
9979 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
9980 }
9981
9982 #ifdef __POWER8_VECTOR__
9983 static __inline__ vector signed long long __ATTRS_o_ai
vec_sra(vector signed long long __a,vector unsigned long long __b)9984 vec_sra(vector signed long long __a, vector unsigned long long __b) {
9985 return __a >> __b;
9986 }
9987
9988 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_sra(vector unsigned long long __a,vector unsigned long long __b)9989 vec_sra(vector unsigned long long __a, vector unsigned long long __b) {
9990 return (vector unsigned long long)((vector signed long long)__a >> __b);
9991 }
9992 #endif
9993
9994 /* vec_vsrab */
9995
9996 static __inline__ vector signed char __ATTRS_o_ai
vec_vsrab(vector signed char __a,vector unsigned char __b)9997 vec_vsrab(vector signed char __a, vector unsigned char __b) {
9998 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
9999 }
10000
10001 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vsrab(vector unsigned char __a,vector unsigned char __b)10002 vec_vsrab(vector unsigned char __a, vector unsigned char __b) {
10003 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
10004 }
10005
10006 /* vec_vsrah */
10007
10008 static __inline__ vector short __ATTRS_o_ai
vec_vsrah(vector short __a,vector unsigned short __b)10009 vec_vsrah(vector short __a, vector unsigned short __b) {
10010 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
10011 }
10012
10013 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vsrah(vector unsigned short __a,vector unsigned short __b)10014 vec_vsrah(vector unsigned short __a, vector unsigned short __b) {
10015 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
10016 }
10017
10018 /* vec_vsraw */
10019
vec_vsraw(vector int __a,vector unsigned int __b)10020 static __inline__ vector int __ATTRS_o_ai vec_vsraw(vector int __a,
10021 vector unsigned int __b) {
10022 return __builtin_altivec_vsraw(__a, __b);
10023 }
10024
10025 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vsraw(vector unsigned int __a,vector unsigned int __b)10026 vec_vsraw(vector unsigned int __a, vector unsigned int __b) {
10027 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
10028 }
10029
10030 /* vec_srl */
10031
10032 static __inline__ vector signed char __ATTRS_o_ai
vec_srl(vector signed char __a,vector unsigned char __b)10033 vec_srl(vector signed char __a, vector unsigned char __b) {
10034 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
10035 (vector int)__b);
10036 }
10037
10038 static __inline__ vector signed char __ATTRS_o_ai
vec_srl(vector signed char __a,vector unsigned short __b)10039 vec_srl(vector signed char __a, vector unsigned short __b) {
10040 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
10041 (vector int)__b);
10042 }
10043
10044 static __inline__ vector signed char __ATTRS_o_ai
vec_srl(vector signed char __a,vector unsigned int __b)10045 vec_srl(vector signed char __a, vector unsigned int __b) {
10046 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
10047 (vector int)__b);
10048 }
10049
10050 static __inline__ vector unsigned char __ATTRS_o_ai
vec_srl(vector unsigned char __a,vector unsigned char __b)10051 vec_srl(vector unsigned char __a, vector unsigned char __b) {
10052 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
10053 (vector int)__b);
10054 }
10055
10056 static __inline__ vector unsigned char __ATTRS_o_ai
vec_srl(vector unsigned char __a,vector unsigned short __b)10057 vec_srl(vector unsigned char __a, vector unsigned short __b) {
10058 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
10059 (vector int)__b);
10060 }
10061
10062 static __inline__ vector unsigned char __ATTRS_o_ai
vec_srl(vector unsigned char __a,vector unsigned int __b)10063 vec_srl(vector unsigned char __a, vector unsigned int __b) {
10064 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
10065 (vector int)__b);
10066 }
10067
10068 static __inline__ vector bool char __ATTRS_o_ai
vec_srl(vector bool char __a,vector unsigned char __b)10069 vec_srl(vector bool char __a, vector unsigned char __b) {
10070 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
10071 (vector int)__b);
10072 }
10073
10074 static __inline__ vector bool char __ATTRS_o_ai
vec_srl(vector bool char __a,vector unsigned short __b)10075 vec_srl(vector bool char __a, vector unsigned short __b) {
10076 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
10077 (vector int)__b);
10078 }
10079
10080 static __inline__ vector bool char __ATTRS_o_ai
vec_srl(vector bool char __a,vector unsigned int __b)10081 vec_srl(vector bool char __a, vector unsigned int __b) {
10082 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
10083 (vector int)__b);
10084 }
10085
vec_srl(vector short __a,vector unsigned char __b)10086 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
10087 vector unsigned char __b) {
10088 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10089 }
10090
vec_srl(vector short __a,vector unsigned short __b)10091 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
10092 vector unsigned short __b) {
10093 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10094 }
10095
vec_srl(vector short __a,vector unsigned int __b)10096 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
10097 vector unsigned int __b) {
10098 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10099 }
10100
10101 static __inline__ vector unsigned short __ATTRS_o_ai
vec_srl(vector unsigned short __a,vector unsigned char __b)10102 vec_srl(vector unsigned short __a, vector unsigned char __b) {
10103 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
10104 (vector int)__b);
10105 }
10106
10107 static __inline__ vector unsigned short __ATTRS_o_ai
vec_srl(vector unsigned short __a,vector unsigned short __b)10108 vec_srl(vector unsigned short __a, vector unsigned short __b) {
10109 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
10110 (vector int)__b);
10111 }
10112
10113 static __inline__ vector unsigned short __ATTRS_o_ai
vec_srl(vector unsigned short __a,vector unsigned int __b)10114 vec_srl(vector unsigned short __a, vector unsigned int __b) {
10115 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
10116 (vector int)__b);
10117 }
10118
10119 static __inline__ vector bool short __ATTRS_o_ai
vec_srl(vector bool short __a,vector unsigned char __b)10120 vec_srl(vector bool short __a, vector unsigned char __b) {
10121 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
10122 (vector int)__b);
10123 }
10124
10125 static __inline__ vector bool short __ATTRS_o_ai
vec_srl(vector bool short __a,vector unsigned short __b)10126 vec_srl(vector bool short __a, vector unsigned short __b) {
10127 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
10128 (vector int)__b);
10129 }
10130
10131 static __inline__ vector bool short __ATTRS_o_ai
vec_srl(vector bool short __a,vector unsigned int __b)10132 vec_srl(vector bool short __a, vector unsigned int __b) {
10133 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
10134 (vector int)__b);
10135 }
10136
vec_srl(vector pixel __a,vector unsigned char __b)10137 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
10138 vector unsigned char __b) {
10139 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10140 }
10141
vec_srl(vector pixel __a,vector unsigned short __b)10142 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
10143 vector unsigned short __b) {
10144 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10145 }
10146
vec_srl(vector pixel __a,vector unsigned int __b)10147 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
10148 vector unsigned int __b) {
10149 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10150 }
10151
vec_srl(vector int __a,vector unsigned char __b)10152 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
10153 vector unsigned char __b) {
10154 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
10155 }
10156
vec_srl(vector int __a,vector unsigned short __b)10157 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
10158 vector unsigned short __b) {
10159 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
10160 }
10161
vec_srl(vector int __a,vector unsigned int __b)10162 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
10163 vector unsigned int __b) {
10164 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
10165 }
10166
10167 static __inline__ vector unsigned int __ATTRS_o_ai
vec_srl(vector unsigned int __a,vector unsigned char __b)10168 vec_srl(vector unsigned int __a, vector unsigned char __b) {
10169 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
10170 (vector int)__b);
10171 }
10172
10173 static __inline__ vector unsigned int __ATTRS_o_ai
vec_srl(vector unsigned int __a,vector unsigned short __b)10174 vec_srl(vector unsigned int __a, vector unsigned short __b) {
10175 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
10176 (vector int)__b);
10177 }
10178
10179 static __inline__ vector unsigned int __ATTRS_o_ai
vec_srl(vector unsigned int __a,vector unsigned int __b)10180 vec_srl(vector unsigned int __a, vector unsigned int __b) {
10181 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
10182 (vector int)__b);
10183 }
10184
10185 static __inline__ vector bool int __ATTRS_o_ai
vec_srl(vector bool int __a,vector unsigned char __b)10186 vec_srl(vector bool int __a, vector unsigned char __b) {
10187 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10188 (vector int)__b);
10189 }
10190
10191 static __inline__ vector bool int __ATTRS_o_ai
vec_srl(vector bool int __a,vector unsigned short __b)10192 vec_srl(vector bool int __a, vector unsigned short __b) {
10193 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10194 (vector int)__b);
10195 }
10196
10197 static __inline__ vector bool int __ATTRS_o_ai
vec_srl(vector bool int __a,vector unsigned int __b)10198 vec_srl(vector bool int __a, vector unsigned int __b) {
10199 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10200 (vector int)__b);
10201 }
10202
10203 #ifdef __VSX__
10204 static __inline__ vector signed long long __ATTRS_o_ai
vec_srl(vector signed long long __a,vector unsigned char __b)10205 vec_srl(vector signed long long __a, vector unsigned char __b) {
10206 return (vector signed long long)__builtin_altivec_vsr((vector int)__a,
10207 (vector int)__b);
10208 }
10209
10210 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_srl(vector unsigned long long __a,vector unsigned char __b)10211 vec_srl(vector unsigned long long __a, vector unsigned char __b) {
10212 return (vector unsigned long long)__builtin_altivec_vsr((vector int)__a,
10213 (vector int)__b);
10214 }
10215 #endif
10216
10217 /* vec_vsr */
10218
10219 static __inline__ vector signed char __ATTRS_o_ai
vec_vsr(vector signed char __a,vector unsigned char __b)10220 vec_vsr(vector signed char __a, vector unsigned char __b) {
10221 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
10222 (vector int)__b);
10223 }
10224
10225 static __inline__ vector signed char __ATTRS_o_ai
vec_vsr(vector signed char __a,vector unsigned short __b)10226 vec_vsr(vector signed char __a, vector unsigned short __b) {
10227 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
10228 (vector int)__b);
10229 }
10230
10231 static __inline__ vector signed char __ATTRS_o_ai
vec_vsr(vector signed char __a,vector unsigned int __b)10232 vec_vsr(vector signed char __a, vector unsigned int __b) {
10233 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
10234 (vector int)__b);
10235 }
10236
10237 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vsr(vector unsigned char __a,vector unsigned char __b)10238 vec_vsr(vector unsigned char __a, vector unsigned char __b) {
10239 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
10240 (vector int)__b);
10241 }
10242
10243 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vsr(vector unsigned char __a,vector unsigned short __b)10244 vec_vsr(vector unsigned char __a, vector unsigned short __b) {
10245 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
10246 (vector int)__b);
10247 }
10248
10249 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vsr(vector unsigned char __a,vector unsigned int __b)10250 vec_vsr(vector unsigned char __a, vector unsigned int __b) {
10251 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
10252 (vector int)__b);
10253 }
10254
10255 static __inline__ vector bool char __ATTRS_o_ai
vec_vsr(vector bool char __a,vector unsigned char __b)10256 vec_vsr(vector bool char __a, vector unsigned char __b) {
10257 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
10258 (vector int)__b);
10259 }
10260
10261 static __inline__ vector bool char __ATTRS_o_ai
vec_vsr(vector bool char __a,vector unsigned short __b)10262 vec_vsr(vector bool char __a, vector unsigned short __b) {
10263 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
10264 (vector int)__b);
10265 }
10266
10267 static __inline__ vector bool char __ATTRS_o_ai
vec_vsr(vector bool char __a,vector unsigned int __b)10268 vec_vsr(vector bool char __a, vector unsigned int __b) {
10269 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
10270 (vector int)__b);
10271 }
10272
vec_vsr(vector short __a,vector unsigned char __b)10273 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
10274 vector unsigned char __b) {
10275 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10276 }
10277
vec_vsr(vector short __a,vector unsigned short __b)10278 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
10279 vector unsigned short __b) {
10280 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10281 }
10282
vec_vsr(vector short __a,vector unsigned int __b)10283 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
10284 vector unsigned int __b) {
10285 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10286 }
10287
10288 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vsr(vector unsigned short __a,vector unsigned char __b)10289 vec_vsr(vector unsigned short __a, vector unsigned char __b) {
10290 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
10291 (vector int)__b);
10292 }
10293
10294 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vsr(vector unsigned short __a,vector unsigned short __b)10295 vec_vsr(vector unsigned short __a, vector unsigned short __b) {
10296 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
10297 (vector int)__b);
10298 }
10299
10300 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vsr(vector unsigned short __a,vector unsigned int __b)10301 vec_vsr(vector unsigned short __a, vector unsigned int __b) {
10302 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
10303 (vector int)__b);
10304 }
10305
10306 static __inline__ vector bool short __ATTRS_o_ai
vec_vsr(vector bool short __a,vector unsigned char __b)10307 vec_vsr(vector bool short __a, vector unsigned char __b) {
10308 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
10309 (vector int)__b);
10310 }
10311
10312 static __inline__ vector bool short __ATTRS_o_ai
vec_vsr(vector bool short __a,vector unsigned short __b)10313 vec_vsr(vector bool short __a, vector unsigned short __b) {
10314 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
10315 (vector int)__b);
10316 }
10317
10318 static __inline__ vector bool short __ATTRS_o_ai
vec_vsr(vector bool short __a,vector unsigned int __b)10319 vec_vsr(vector bool short __a, vector unsigned int __b) {
10320 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
10321 (vector int)__b);
10322 }
10323
vec_vsr(vector pixel __a,vector unsigned char __b)10324 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
10325 vector unsigned char __b) {
10326 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10327 }
10328
vec_vsr(vector pixel __a,vector unsigned short __b)10329 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
10330 vector unsigned short __b) {
10331 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10332 }
10333
vec_vsr(vector pixel __a,vector unsigned int __b)10334 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
10335 vector unsigned int __b) {
10336 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10337 }
10338
vec_vsr(vector int __a,vector unsigned char __b)10339 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
10340 vector unsigned char __b) {
10341 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
10342 }
10343
vec_vsr(vector int __a,vector unsigned short __b)10344 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
10345 vector unsigned short __b) {
10346 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
10347 }
10348
vec_vsr(vector int __a,vector unsigned int __b)10349 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
10350 vector unsigned int __b) {
10351 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
10352 }
10353
10354 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vsr(vector unsigned int __a,vector unsigned char __b)10355 vec_vsr(vector unsigned int __a, vector unsigned char __b) {
10356 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
10357 (vector int)__b);
10358 }
10359
10360 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vsr(vector unsigned int __a,vector unsigned short __b)10361 vec_vsr(vector unsigned int __a, vector unsigned short __b) {
10362 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
10363 (vector int)__b);
10364 }
10365
10366 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vsr(vector unsigned int __a,vector unsigned int __b)10367 vec_vsr(vector unsigned int __a, vector unsigned int __b) {
10368 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
10369 (vector int)__b);
10370 }
10371
10372 static __inline__ vector bool int __ATTRS_o_ai
vec_vsr(vector bool int __a,vector unsigned char __b)10373 vec_vsr(vector bool int __a, vector unsigned char __b) {
10374 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10375 (vector int)__b);
10376 }
10377
10378 static __inline__ vector bool int __ATTRS_o_ai
vec_vsr(vector bool int __a,vector unsigned short __b)10379 vec_vsr(vector bool int __a, vector unsigned short __b) {
10380 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10381 (vector int)__b);
10382 }
10383
10384 static __inline__ vector bool int __ATTRS_o_ai
vec_vsr(vector bool int __a,vector unsigned int __b)10385 vec_vsr(vector bool int __a, vector unsigned int __b) {
10386 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10387 (vector int)__b);
10388 }
10389
10390 /* vec_sro */
10391
10392 static __inline__ vector signed char __ATTRS_o_ai
vec_sro(vector signed char __a,vector signed char __b)10393 vec_sro(vector signed char __a, vector signed char __b) {
10394 return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10395 (vector int)__b);
10396 }
10397
10398 static __inline__ vector signed char __ATTRS_o_ai
vec_sro(vector signed char __a,vector unsigned char __b)10399 vec_sro(vector signed char __a, vector unsigned char __b) {
10400 return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10401 (vector int)__b);
10402 }
10403
10404 static __inline__ vector unsigned char __ATTRS_o_ai
vec_sro(vector unsigned char __a,vector signed char __b)10405 vec_sro(vector unsigned char __a, vector signed char __b) {
10406 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
10407 (vector int)__b);
10408 }
10409
10410 static __inline__ vector unsigned char __ATTRS_o_ai
vec_sro(vector unsigned char __a,vector unsigned char __b)10411 vec_sro(vector unsigned char __a, vector unsigned char __b) {
10412 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
10413 (vector int)__b);
10414 }
10415
vec_sro(vector short __a,vector signed char __b)10416 static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a,
10417 vector signed char __b) {
10418 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10419 }
10420
vec_sro(vector short __a,vector unsigned char __b)10421 static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a,
10422 vector unsigned char __b) {
10423 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10424 }
10425
10426 static __inline__ vector unsigned short __ATTRS_o_ai
vec_sro(vector unsigned short __a,vector signed char __b)10427 vec_sro(vector unsigned short __a, vector signed char __b) {
10428 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
10429 (vector int)__b);
10430 }
10431
10432 static __inline__ vector unsigned short __ATTRS_o_ai
vec_sro(vector unsigned short __a,vector unsigned char __b)10433 vec_sro(vector unsigned short __a, vector unsigned char __b) {
10434 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
10435 (vector int)__b);
10436 }
10437
vec_sro(vector pixel __a,vector signed char __b)10438 static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
10439 vector signed char __b) {
10440 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10441 }
10442
vec_sro(vector pixel __a,vector unsigned char __b)10443 static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
10444 vector unsigned char __b) {
10445 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10446 }
10447
vec_sro(vector int __a,vector signed char __b)10448 static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a,
10449 vector signed char __b) {
10450 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
10451 }
10452
vec_sro(vector int __a,vector unsigned char __b)10453 static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a,
10454 vector unsigned char __b) {
10455 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
10456 }
10457
10458 static __inline__ vector unsigned int __ATTRS_o_ai
vec_sro(vector unsigned int __a,vector signed char __b)10459 vec_sro(vector unsigned int __a, vector signed char __b) {
10460 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
10461 (vector int)__b);
10462 }
10463
10464 static __inline__ vector unsigned int __ATTRS_o_ai
vec_sro(vector unsigned int __a,vector unsigned char __b)10465 vec_sro(vector unsigned int __a, vector unsigned char __b) {
10466 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
10467 (vector int)__b);
10468 }
10469
vec_sro(vector float __a,vector signed char __b)10470 static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a,
10471 vector signed char __b) {
10472 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10473 }
10474
vec_sro(vector float __a,vector unsigned char __b)10475 static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a,
10476 vector unsigned char __b) {
10477 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10478 }
10479
10480 #ifdef __VSX__
10481 static __inline__ vector signed long long __ATTRS_o_ai
vec_sro(vector signed long long __a,vector signed char __b)10482 vec_sro(vector signed long long __a, vector signed char __b) {
10483 return (vector signed long long)__builtin_altivec_vsro((vector int)__a,
10484 (vector int)__b);
10485 }
10486
10487 static __inline__ vector signed long long __ATTRS_o_ai
vec_sro(vector signed long long __a,vector unsigned char __b)10488 vec_sro(vector signed long long __a, vector unsigned char __b) {
10489 return (vector signed long long)__builtin_altivec_vsro((vector int)__a,
10490 (vector int)__b);
10491 }
10492
10493 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_sro(vector unsigned long long __a,vector signed char __b)10494 vec_sro(vector unsigned long long __a, vector signed char __b) {
10495 return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a,
10496 (vector int)__b);
10497 }
10498
10499 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_sro(vector unsigned long long __a,vector unsigned char __b)10500 vec_sro(vector unsigned long long __a, vector unsigned char __b) {
10501 return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a,
10502 (vector int)__b);
10503 }
10504 #endif
10505
10506 /* vec_vsro */
10507
10508 static __inline__ vector signed char __ATTRS_o_ai
vec_vsro(vector signed char __a,vector signed char __b)10509 vec_vsro(vector signed char __a, vector signed char __b) {
10510 return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10511 (vector int)__b);
10512 }
10513
10514 static __inline__ vector signed char __ATTRS_o_ai
vec_vsro(vector signed char __a,vector unsigned char __b)10515 vec_vsro(vector signed char __a, vector unsigned char __b) {
10516 return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10517 (vector int)__b);
10518 }
10519
10520 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vsro(vector unsigned char __a,vector signed char __b)10521 vec_vsro(vector unsigned char __a, vector signed char __b) {
10522 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
10523 (vector int)__b);
10524 }
10525
10526 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vsro(vector unsigned char __a,vector unsigned char __b)10527 vec_vsro(vector unsigned char __a, vector unsigned char __b) {
10528 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
10529 (vector int)__b);
10530 }
10531
vec_vsro(vector short __a,vector signed char __b)10532 static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a,
10533 vector signed char __b) {
10534 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10535 }
10536
vec_vsro(vector short __a,vector unsigned char __b)10537 static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a,
10538 vector unsigned char __b) {
10539 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10540 }
10541
10542 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vsro(vector unsigned short __a,vector signed char __b)10543 vec_vsro(vector unsigned short __a, vector signed char __b) {
10544 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
10545 (vector int)__b);
10546 }
10547
10548 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vsro(vector unsigned short __a,vector unsigned char __b)10549 vec_vsro(vector unsigned short __a, vector unsigned char __b) {
10550 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
10551 (vector int)__b);
10552 }
10553
vec_vsro(vector pixel __a,vector signed char __b)10554 static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
10555 vector signed char __b) {
10556 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10557 }
10558
vec_vsro(vector pixel __a,vector unsigned char __b)10559 static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
10560 vector unsigned char __b) {
10561 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10562 }
10563
vec_vsro(vector int __a,vector signed char __b)10564 static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a,
10565 vector signed char __b) {
10566 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
10567 }
10568
vec_vsro(vector int __a,vector unsigned char __b)10569 static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a,
10570 vector unsigned char __b) {
10571 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
10572 }
10573
10574 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vsro(vector unsigned int __a,vector signed char __b)10575 vec_vsro(vector unsigned int __a, vector signed char __b) {
10576 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
10577 (vector int)__b);
10578 }
10579
10580 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vsro(vector unsigned int __a,vector unsigned char __b)10581 vec_vsro(vector unsigned int __a, vector unsigned char __b) {
10582 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
10583 (vector int)__b);
10584 }
10585
vec_vsro(vector float __a,vector signed char __b)10586 static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a,
10587 vector signed char __b) {
10588 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10589 }
10590
vec_vsro(vector float __a,vector unsigned char __b)10591 static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a,
10592 vector unsigned char __b) {
10593 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10594 }
10595
10596 /* vec_st */
10597
vec_st(vector signed char __a,int __b,vector signed char * __c)10598 static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, int __b,
10599 vector signed char *__c) {
10600 __builtin_altivec_stvx((vector int)__a, __b, __c);
10601 }
10602
vec_st(vector signed char __a,int __b,signed char * __c)10603 static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, int __b,
10604 signed char *__c) {
10605 __builtin_altivec_stvx((vector int)__a, __b, __c);
10606 }
10607
vec_st(vector unsigned char __a,int __b,vector unsigned char * __c)10608 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b,
10609 vector unsigned char *__c) {
10610 __builtin_altivec_stvx((vector int)__a, __b, __c);
10611 }
10612
vec_st(vector unsigned char __a,int __b,unsigned char * __c)10613 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b,
10614 unsigned char *__c) {
10615 __builtin_altivec_stvx((vector int)__a, __b, __c);
10616 }
10617
vec_st(vector bool char __a,int __b,signed char * __c)10618 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
10619 signed char *__c) {
10620 __builtin_altivec_stvx((vector int)__a, __b, __c);
10621 }
10622
vec_st(vector bool char __a,int __b,unsigned char * __c)10623 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
10624 unsigned char *__c) {
10625 __builtin_altivec_stvx((vector int)__a, __b, __c);
10626 }
10627
vec_st(vector bool char __a,int __b,vector bool char * __c)10628 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
10629 vector bool char *__c) {
10630 __builtin_altivec_stvx((vector int)__a, __b, __c);
10631 }
10632
vec_st(vector short __a,int __b,vector short * __c)10633 static __inline__ void __ATTRS_o_ai vec_st(vector short __a, int __b,
10634 vector short *__c) {
10635 __builtin_altivec_stvx((vector int)__a, __b, __c);
10636 }
10637
vec_st(vector short __a,int __b,short * __c)10638 static __inline__ void __ATTRS_o_ai vec_st(vector short __a, int __b,
10639 short *__c) {
10640 __builtin_altivec_stvx((vector int)__a, __b, __c);
10641 }
10642
vec_st(vector unsigned short __a,int __b,vector unsigned short * __c)10643 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b,
10644 vector unsigned short *__c) {
10645 __builtin_altivec_stvx((vector int)__a, __b, __c);
10646 }
10647
vec_st(vector unsigned short __a,int __b,unsigned short * __c)10648 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b,
10649 unsigned short *__c) {
10650 __builtin_altivec_stvx((vector int)__a, __b, __c);
10651 }
10652
vec_st(vector bool short __a,int __b,short * __c)10653 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
10654 short *__c) {
10655 __builtin_altivec_stvx((vector int)__a, __b, __c);
10656 }
10657
vec_st(vector bool short __a,int __b,unsigned short * __c)10658 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
10659 unsigned short *__c) {
10660 __builtin_altivec_stvx((vector int)__a, __b, __c);
10661 }
10662
vec_st(vector bool short __a,int __b,vector bool short * __c)10663 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
10664 vector bool short *__c) {
10665 __builtin_altivec_stvx((vector int)__a, __b, __c);
10666 }
10667
vec_st(vector pixel __a,int __b,short * __c)10668 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
10669 short *__c) {
10670 __builtin_altivec_stvx((vector int)__a, __b, __c);
10671 }
10672
vec_st(vector pixel __a,int __b,unsigned short * __c)10673 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
10674 unsigned short *__c) {
10675 __builtin_altivec_stvx((vector int)__a, __b, __c);
10676 }
10677
vec_st(vector pixel __a,int __b,vector pixel * __c)10678 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
10679 vector pixel *__c) {
10680 __builtin_altivec_stvx((vector int)__a, __b, __c);
10681 }
10682
vec_st(vector int __a,int __b,vector int * __c)10683 static __inline__ void __ATTRS_o_ai vec_st(vector int __a, int __b,
10684 vector int *__c) {
10685 __builtin_altivec_stvx(__a, __b, __c);
10686 }
10687
vec_st(vector int __a,int __b,int * __c)10688 static __inline__ void __ATTRS_o_ai vec_st(vector int __a, int __b, int *__c) {
10689 __builtin_altivec_stvx(__a, __b, __c);
10690 }
10691
vec_st(vector unsigned int __a,int __b,vector unsigned int * __c)10692 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b,
10693 vector unsigned int *__c) {
10694 __builtin_altivec_stvx((vector int)__a, __b, __c);
10695 }
10696
vec_st(vector unsigned int __a,int __b,unsigned int * __c)10697 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b,
10698 unsigned int *__c) {
10699 __builtin_altivec_stvx((vector int)__a, __b, __c);
10700 }
10701
vec_st(vector bool int __a,int __b,int * __c)10702 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
10703 int *__c) {
10704 __builtin_altivec_stvx((vector int)__a, __b, __c);
10705 }
10706
vec_st(vector bool int __a,int __b,unsigned int * __c)10707 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
10708 unsigned int *__c) {
10709 __builtin_altivec_stvx((vector int)__a, __b, __c);
10710 }
10711
vec_st(vector bool int __a,int __b,vector bool int * __c)10712 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
10713 vector bool int *__c) {
10714 __builtin_altivec_stvx((vector int)__a, __b, __c);
10715 }
10716
vec_st(vector float __a,int __b,vector float * __c)10717 static __inline__ void __ATTRS_o_ai vec_st(vector float __a, int __b,
10718 vector float *__c) {
10719 __builtin_altivec_stvx((vector int)__a, __b, __c);
10720 }
10721
vec_st(vector float __a,int __b,float * __c)10722 static __inline__ void __ATTRS_o_ai vec_st(vector float __a, int __b,
10723 float *__c) {
10724 __builtin_altivec_stvx((vector int)__a, __b, __c);
10725 }
10726
10727 /* vec_stvx */
10728
vec_stvx(vector signed char __a,int __b,vector signed char * __c)10729 static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b,
10730 vector signed char *__c) {
10731 __builtin_altivec_stvx((vector int)__a, __b, __c);
10732 }
10733
vec_stvx(vector signed char __a,int __b,signed char * __c)10734 static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b,
10735 signed char *__c) {
10736 __builtin_altivec_stvx((vector int)__a, __b, __c);
10737 }
10738
vec_stvx(vector unsigned char __a,int __b,vector unsigned char * __c)10739 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b,
10740 vector unsigned char *__c) {
10741 __builtin_altivec_stvx((vector int)__a, __b, __c);
10742 }
10743
vec_stvx(vector unsigned char __a,int __b,unsigned char * __c)10744 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b,
10745 unsigned char *__c) {
10746 __builtin_altivec_stvx((vector int)__a, __b, __c);
10747 }
10748
vec_stvx(vector bool char __a,int __b,signed char * __c)10749 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
10750 signed char *__c) {
10751 __builtin_altivec_stvx((vector int)__a, __b, __c);
10752 }
10753
vec_stvx(vector bool char __a,int __b,unsigned char * __c)10754 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
10755 unsigned char *__c) {
10756 __builtin_altivec_stvx((vector int)__a, __b, __c);
10757 }
10758
vec_stvx(vector bool char __a,int __b,vector bool char * __c)10759 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
10760 vector bool char *__c) {
10761 __builtin_altivec_stvx((vector int)__a, __b, __c);
10762 }
10763
vec_stvx(vector short __a,int __b,vector short * __c)10764 static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, int __b,
10765 vector short *__c) {
10766 __builtin_altivec_stvx((vector int)__a, __b, __c);
10767 }
10768
vec_stvx(vector short __a,int __b,short * __c)10769 static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, int __b,
10770 short *__c) {
10771 __builtin_altivec_stvx((vector int)__a, __b, __c);
10772 }
10773
vec_stvx(vector unsigned short __a,int __b,vector unsigned short * __c)10774 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b,
10775 vector unsigned short *__c) {
10776 __builtin_altivec_stvx((vector int)__a, __b, __c);
10777 }
10778
vec_stvx(vector unsigned short __a,int __b,unsigned short * __c)10779 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b,
10780 unsigned short *__c) {
10781 __builtin_altivec_stvx((vector int)__a, __b, __c);
10782 }
10783
vec_stvx(vector bool short __a,int __b,short * __c)10784 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
10785 short *__c) {
10786 __builtin_altivec_stvx((vector int)__a, __b, __c);
10787 }
10788
vec_stvx(vector bool short __a,int __b,unsigned short * __c)10789 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
10790 unsigned short *__c) {
10791 __builtin_altivec_stvx((vector int)__a, __b, __c);
10792 }
10793
vec_stvx(vector bool short __a,int __b,vector bool short * __c)10794 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
10795 vector bool short *__c) {
10796 __builtin_altivec_stvx((vector int)__a, __b, __c);
10797 }
10798
vec_stvx(vector pixel __a,int __b,short * __c)10799 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
10800 short *__c) {
10801 __builtin_altivec_stvx((vector int)__a, __b, __c);
10802 }
10803
vec_stvx(vector pixel __a,int __b,unsigned short * __c)10804 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
10805 unsigned short *__c) {
10806 __builtin_altivec_stvx((vector int)__a, __b, __c);
10807 }
10808
vec_stvx(vector pixel __a,int __b,vector pixel * __c)10809 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
10810 vector pixel *__c) {
10811 __builtin_altivec_stvx((vector int)__a, __b, __c);
10812 }
10813
vec_stvx(vector int __a,int __b,vector int * __c)10814 static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, int __b,
10815 vector int *__c) {
10816 __builtin_altivec_stvx(__a, __b, __c);
10817 }
10818
vec_stvx(vector int __a,int __b,int * __c)10819 static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, int __b,
10820 int *__c) {
10821 __builtin_altivec_stvx(__a, __b, __c);
10822 }
10823
vec_stvx(vector unsigned int __a,int __b,vector unsigned int * __c)10824 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b,
10825 vector unsigned int *__c) {
10826 __builtin_altivec_stvx((vector int)__a, __b, __c);
10827 }
10828
vec_stvx(vector unsigned int __a,int __b,unsigned int * __c)10829 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b,
10830 unsigned int *__c) {
10831 __builtin_altivec_stvx((vector int)__a, __b, __c);
10832 }
10833
vec_stvx(vector bool int __a,int __b,int * __c)10834 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
10835 int *__c) {
10836 __builtin_altivec_stvx((vector int)__a, __b, __c);
10837 }
10838
vec_stvx(vector bool int __a,int __b,unsigned int * __c)10839 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
10840 unsigned int *__c) {
10841 __builtin_altivec_stvx((vector int)__a, __b, __c);
10842 }
10843
vec_stvx(vector bool int __a,int __b,vector bool int * __c)10844 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
10845 vector bool int *__c) {
10846 __builtin_altivec_stvx((vector int)__a, __b, __c);
10847 }
10848
vec_stvx(vector float __a,int __b,vector float * __c)10849 static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, int __b,
10850 vector float *__c) {
10851 __builtin_altivec_stvx((vector int)__a, __b, __c);
10852 }
10853
vec_stvx(vector float __a,int __b,float * __c)10854 static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, int __b,
10855 float *__c) {
10856 __builtin_altivec_stvx((vector int)__a, __b, __c);
10857 }
10858
10859 /* vec_ste */
10860
vec_ste(vector signed char __a,int __b,signed char * __c)10861 static __inline__ void __ATTRS_o_ai vec_ste(vector signed char __a, int __b,
10862 signed char *__c) {
10863 __builtin_altivec_stvebx((vector char)__a, __b, __c);
10864 }
10865
vec_ste(vector unsigned char __a,int __b,unsigned char * __c)10866 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned char __a, int __b,
10867 unsigned char *__c) {
10868 __builtin_altivec_stvebx((vector char)__a, __b, __c);
10869 }
10870
vec_ste(vector bool char __a,int __b,signed char * __c)10871 static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, int __b,
10872 signed char *__c) {
10873 __builtin_altivec_stvebx((vector char)__a, __b, __c);
10874 }
10875
vec_ste(vector bool char __a,int __b,unsigned char * __c)10876 static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, int __b,
10877 unsigned char *__c) {
10878 __builtin_altivec_stvebx((vector char)__a, __b, __c);
10879 }
10880
vec_ste(vector short __a,int __b,short * __c)10881 static __inline__ void __ATTRS_o_ai vec_ste(vector short __a, int __b,
10882 short *__c) {
10883 __builtin_altivec_stvehx(__a, __b, __c);
10884 }
10885
vec_ste(vector unsigned short __a,int __b,unsigned short * __c)10886 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned short __a, int __b,
10887 unsigned short *__c) {
10888 __builtin_altivec_stvehx((vector short)__a, __b, __c);
10889 }
10890
vec_ste(vector bool short __a,int __b,short * __c)10891 static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, int __b,
10892 short *__c) {
10893 __builtin_altivec_stvehx((vector short)__a, __b, __c);
10894 }
10895
vec_ste(vector bool short __a,int __b,unsigned short * __c)10896 static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, int __b,
10897 unsigned short *__c) {
10898 __builtin_altivec_stvehx((vector short)__a, __b, __c);
10899 }
10900
vec_ste(vector pixel __a,int __b,short * __c)10901 static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, int __b,
10902 short *__c) {
10903 __builtin_altivec_stvehx((vector short)__a, __b, __c);
10904 }
10905
vec_ste(vector pixel __a,int __b,unsigned short * __c)10906 static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, int __b,
10907 unsigned short *__c) {
10908 __builtin_altivec_stvehx((vector short)__a, __b, __c);
10909 }
10910
vec_ste(vector int __a,int __b,int * __c)10911 static __inline__ void __ATTRS_o_ai vec_ste(vector int __a, int __b, int *__c) {
10912 __builtin_altivec_stvewx(__a, __b, __c);
10913 }
10914
vec_ste(vector unsigned int __a,int __b,unsigned int * __c)10915 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned int __a, int __b,
10916 unsigned int *__c) {
10917 __builtin_altivec_stvewx((vector int)__a, __b, __c);
10918 }
10919
vec_ste(vector bool int __a,int __b,int * __c)10920 static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, int __b,
10921 int *__c) {
10922 __builtin_altivec_stvewx((vector int)__a, __b, __c);
10923 }
10924
vec_ste(vector bool int __a,int __b,unsigned int * __c)10925 static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, int __b,
10926 unsigned int *__c) {
10927 __builtin_altivec_stvewx((vector int)__a, __b, __c);
10928 }
10929
vec_ste(vector float __a,int __b,float * __c)10930 static __inline__ void __ATTRS_o_ai vec_ste(vector float __a, int __b,
10931 float *__c) {
10932 __builtin_altivec_stvewx((vector int)__a, __b, __c);
10933 }
10934
10935 /* vec_stvebx */
10936
vec_stvebx(vector signed char __a,int __b,signed char * __c)10937 static __inline__ void __ATTRS_o_ai vec_stvebx(vector signed char __a, int __b,
10938 signed char *__c) {
10939 __builtin_altivec_stvebx((vector char)__a, __b, __c);
10940 }
10941
vec_stvebx(vector unsigned char __a,int __b,unsigned char * __c)10942 static __inline__ void __ATTRS_o_ai vec_stvebx(vector unsigned char __a,
10943 int __b, unsigned char *__c) {
10944 __builtin_altivec_stvebx((vector char)__a, __b, __c);
10945 }
10946
vec_stvebx(vector bool char __a,int __b,signed char * __c)10947 static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b,
10948 signed char *__c) {
10949 __builtin_altivec_stvebx((vector char)__a, __b, __c);
10950 }
10951
vec_stvebx(vector bool char __a,int __b,unsigned char * __c)10952 static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b,
10953 unsigned char *__c) {
10954 __builtin_altivec_stvebx((vector char)__a, __b, __c);
10955 }
10956
10957 /* vec_stvehx */
10958
vec_stvehx(vector short __a,int __b,short * __c)10959 static __inline__ void __ATTRS_o_ai vec_stvehx(vector short __a, int __b,
10960 short *__c) {
10961 __builtin_altivec_stvehx(__a, __b, __c);
10962 }
10963
vec_stvehx(vector unsigned short __a,int __b,unsigned short * __c)10964 static __inline__ void __ATTRS_o_ai vec_stvehx(vector unsigned short __a,
10965 int __b, unsigned short *__c) {
10966 __builtin_altivec_stvehx((vector short)__a, __b, __c);
10967 }
10968
vec_stvehx(vector bool short __a,int __b,short * __c)10969 static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b,
10970 short *__c) {
10971 __builtin_altivec_stvehx((vector short)__a, __b, __c);
10972 }
10973
vec_stvehx(vector bool short __a,int __b,unsigned short * __c)10974 static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b,
10975 unsigned short *__c) {
10976 __builtin_altivec_stvehx((vector short)__a, __b, __c);
10977 }
10978
vec_stvehx(vector pixel __a,int __b,short * __c)10979 static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b,
10980 short *__c) {
10981 __builtin_altivec_stvehx((vector short)__a, __b, __c);
10982 }
10983
vec_stvehx(vector pixel __a,int __b,unsigned short * __c)10984 static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b,
10985 unsigned short *__c) {
10986 __builtin_altivec_stvehx((vector short)__a, __b, __c);
10987 }
10988
10989 /* vec_stvewx */
10990
vec_stvewx(vector int __a,int __b,int * __c)10991 static __inline__ void __ATTRS_o_ai vec_stvewx(vector int __a, int __b,
10992 int *__c) {
10993 __builtin_altivec_stvewx(__a, __b, __c);
10994 }
10995
vec_stvewx(vector unsigned int __a,int __b,unsigned int * __c)10996 static __inline__ void __ATTRS_o_ai vec_stvewx(vector unsigned int __a, int __b,
10997 unsigned int *__c) {
10998 __builtin_altivec_stvewx((vector int)__a, __b, __c);
10999 }
11000
vec_stvewx(vector bool int __a,int __b,int * __c)11001 static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b,
11002 int *__c) {
11003 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11004 }
11005
vec_stvewx(vector bool int __a,int __b,unsigned int * __c)11006 static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b,
11007 unsigned int *__c) {
11008 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11009 }
11010
vec_stvewx(vector float __a,int __b,float * __c)11011 static __inline__ void __ATTRS_o_ai vec_stvewx(vector float __a, int __b,
11012 float *__c) {
11013 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11014 }
11015
11016 /* vec_stl */
11017
vec_stl(vector signed char __a,int __b,vector signed char * __c)11018 static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
11019 vector signed char *__c) {
11020 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11021 }
11022
vec_stl(vector signed char __a,int __b,signed char * __c)11023 static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
11024 signed char *__c) {
11025 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11026 }
11027
vec_stl(vector unsigned char __a,int __b,vector unsigned char * __c)11028 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
11029 vector unsigned char *__c) {
11030 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11031 }
11032
vec_stl(vector unsigned char __a,int __b,unsigned char * __c)11033 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
11034 unsigned char *__c) {
11035 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11036 }
11037
vec_stl(vector bool char __a,int __b,signed char * __c)11038 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
11039 signed char *__c) {
11040 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11041 }
11042
vec_stl(vector bool char __a,int __b,unsigned char * __c)11043 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
11044 unsigned char *__c) {
11045 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11046 }
11047
vec_stl(vector bool char __a,int __b,vector bool char * __c)11048 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
11049 vector bool char *__c) {
11050 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11051 }
11052
vec_stl(vector short __a,int __b,vector short * __c)11053 static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b,
11054 vector short *__c) {
11055 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11056 }
11057
vec_stl(vector short __a,int __b,short * __c)11058 static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b,
11059 short *__c) {
11060 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11061 }
11062
vec_stl(vector unsigned short __a,int __b,vector unsigned short * __c)11063 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
11064 vector unsigned short *__c) {
11065 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11066 }
11067
vec_stl(vector unsigned short __a,int __b,unsigned short * __c)11068 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
11069 unsigned short *__c) {
11070 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11071 }
11072
vec_stl(vector bool short __a,int __b,short * __c)11073 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
11074 short *__c) {
11075 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11076 }
11077
vec_stl(vector bool short __a,int __b,unsigned short * __c)11078 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
11079 unsigned short *__c) {
11080 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11081 }
11082
vec_stl(vector bool short __a,int __b,vector bool short * __c)11083 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
11084 vector bool short *__c) {
11085 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11086 }
11087
vec_stl(vector pixel __a,int __b,short * __c)11088 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
11089 short *__c) {
11090 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11091 }
11092
vec_stl(vector pixel __a,int __b,unsigned short * __c)11093 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
11094 unsigned short *__c) {
11095 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11096 }
11097
vec_stl(vector pixel __a,int __b,vector pixel * __c)11098 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
11099 vector pixel *__c) {
11100 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11101 }
11102
vec_stl(vector int __a,int __b,vector int * __c)11103 static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b,
11104 vector int *__c) {
11105 __builtin_altivec_stvxl(__a, __b, __c);
11106 }
11107
vec_stl(vector int __a,int __b,int * __c)11108 static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b, int *__c) {
11109 __builtin_altivec_stvxl(__a, __b, __c);
11110 }
11111
vec_stl(vector unsigned int __a,int __b,vector unsigned int * __c)11112 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
11113 vector unsigned int *__c) {
11114 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11115 }
11116
vec_stl(vector unsigned int __a,int __b,unsigned int * __c)11117 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
11118 unsigned int *__c) {
11119 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11120 }
11121
vec_stl(vector bool int __a,int __b,int * __c)11122 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
11123 int *__c) {
11124 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11125 }
11126
vec_stl(vector bool int __a,int __b,unsigned int * __c)11127 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
11128 unsigned int *__c) {
11129 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11130 }
11131
vec_stl(vector bool int __a,int __b,vector bool int * __c)11132 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
11133 vector bool int *__c) {
11134 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11135 }
11136
vec_stl(vector float __a,int __b,vector float * __c)11137 static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b,
11138 vector float *__c) {
11139 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11140 }
11141
vec_stl(vector float __a,int __b,float * __c)11142 static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b,
11143 float *__c) {
11144 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11145 }
11146
11147 /* vec_stvxl */
11148
vec_stvxl(vector signed char __a,int __b,vector signed char * __c)11149 static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
11150 vector signed char *__c) {
11151 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11152 }
11153
vec_stvxl(vector signed char __a,int __b,signed char * __c)11154 static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
11155 signed char *__c) {
11156 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11157 }
11158
vec_stvxl(vector unsigned char __a,int __b,vector unsigned char * __c)11159 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
11160 vector unsigned char *__c) {
11161 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11162 }
11163
vec_stvxl(vector unsigned char __a,int __b,unsigned char * __c)11164 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
11165 unsigned char *__c) {
11166 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11167 }
11168
vec_stvxl(vector bool char __a,int __b,signed char * __c)11169 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
11170 signed char *__c) {
11171 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11172 }
11173
vec_stvxl(vector bool char __a,int __b,unsigned char * __c)11174 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
11175 unsigned char *__c) {
11176 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11177 }
11178
vec_stvxl(vector bool char __a,int __b,vector bool char * __c)11179 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
11180 vector bool char *__c) {
11181 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11182 }
11183
vec_stvxl(vector short __a,int __b,vector short * __c)11184 static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
11185 vector short *__c) {
11186 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11187 }
11188
vec_stvxl(vector short __a,int __b,short * __c)11189 static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
11190 short *__c) {
11191 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11192 }
11193
vec_stvxl(vector unsigned short __a,int __b,vector unsigned short * __c)11194 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a,
11195 int __b,
11196 vector unsigned short *__c) {
11197 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11198 }
11199
vec_stvxl(vector unsigned short __a,int __b,unsigned short * __c)11200 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a,
11201 int __b, unsigned short *__c) {
11202 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11203 }
11204
vec_stvxl(vector bool short __a,int __b,short * __c)11205 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
11206 short *__c) {
11207 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11208 }
11209
vec_stvxl(vector bool short __a,int __b,unsigned short * __c)11210 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
11211 unsigned short *__c) {
11212 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11213 }
11214
vec_stvxl(vector bool short __a,int __b,vector bool short * __c)11215 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
11216 vector bool short *__c) {
11217 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11218 }
11219
vec_stvxl(vector pixel __a,int __b,short * __c)11220 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
11221 short *__c) {
11222 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11223 }
11224
vec_stvxl(vector pixel __a,int __b,unsigned short * __c)11225 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
11226 unsigned short *__c) {
11227 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11228 }
11229
vec_stvxl(vector pixel __a,int __b,vector pixel * __c)11230 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
11231 vector pixel *__c) {
11232 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11233 }
11234
vec_stvxl(vector int __a,int __b,vector int * __c)11235 static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b,
11236 vector int *__c) {
11237 __builtin_altivec_stvxl(__a, __b, __c);
11238 }
11239
vec_stvxl(vector int __a,int __b,int * __c)11240 static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b,
11241 int *__c) {
11242 __builtin_altivec_stvxl(__a, __b, __c);
11243 }
11244
vec_stvxl(vector unsigned int __a,int __b,vector unsigned int * __c)11245 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
11246 vector unsigned int *__c) {
11247 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11248 }
11249
vec_stvxl(vector unsigned int __a,int __b,unsigned int * __c)11250 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
11251 unsigned int *__c) {
11252 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11253 }
11254
vec_stvxl(vector bool int __a,int __b,int * __c)11255 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
11256 int *__c) {
11257 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11258 }
11259
vec_stvxl(vector bool int __a,int __b,unsigned int * __c)11260 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
11261 unsigned int *__c) {
11262 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11263 }
11264
vec_stvxl(vector bool int __a,int __b,vector bool int * __c)11265 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
11266 vector bool int *__c) {
11267 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11268 }
11269
vec_stvxl(vector float __a,int __b,vector float * __c)11270 static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
11271 vector float *__c) {
11272 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11273 }
11274
vec_stvxl(vector float __a,int __b,float * __c)11275 static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
11276 float *__c) {
11277 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11278 }
11279
11280 /* vec_sub */
11281
11282 static __inline__ vector signed char __ATTRS_o_ai
vec_sub(vector signed char __a,vector signed char __b)11283 vec_sub(vector signed char __a, vector signed char __b) {
11284 return __a - __b;
11285 }
11286
11287 static __inline__ vector signed char __ATTRS_o_ai
vec_sub(vector bool char __a,vector signed char __b)11288 vec_sub(vector bool char __a, vector signed char __b) {
11289 return (vector signed char)__a - __b;
11290 }
11291
11292 static __inline__ vector signed char __ATTRS_o_ai
vec_sub(vector signed char __a,vector bool char __b)11293 vec_sub(vector signed char __a, vector bool char __b) {
11294 return __a - (vector signed char)__b;
11295 }
11296
11297 static __inline__ vector unsigned char __ATTRS_o_ai
vec_sub(vector unsigned char __a,vector unsigned char __b)11298 vec_sub(vector unsigned char __a, vector unsigned char __b) {
11299 return __a - __b;
11300 }
11301
11302 static __inline__ vector unsigned char __ATTRS_o_ai
vec_sub(vector bool char __a,vector unsigned char __b)11303 vec_sub(vector bool char __a, vector unsigned char __b) {
11304 return (vector unsigned char)__a - __b;
11305 }
11306
11307 static __inline__ vector unsigned char __ATTRS_o_ai
vec_sub(vector unsigned char __a,vector bool char __b)11308 vec_sub(vector unsigned char __a, vector bool char __b) {
11309 return __a - (vector unsigned char)__b;
11310 }
11311
vec_sub(vector short __a,vector short __b)11312 static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a,
11313 vector short __b) {
11314 return __a - __b;
11315 }
11316
vec_sub(vector bool short __a,vector short __b)11317 static __inline__ vector short __ATTRS_o_ai vec_sub(vector bool short __a,
11318 vector short __b) {
11319 return (vector short)__a - __b;
11320 }
11321
vec_sub(vector short __a,vector bool short __b)11322 static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a,
11323 vector bool short __b) {
11324 return __a - (vector short)__b;
11325 }
11326
11327 static __inline__ vector unsigned short __ATTRS_o_ai
vec_sub(vector unsigned short __a,vector unsigned short __b)11328 vec_sub(vector unsigned short __a, vector unsigned short __b) {
11329 return __a - __b;
11330 }
11331
11332 static __inline__ vector unsigned short __ATTRS_o_ai
vec_sub(vector bool short __a,vector unsigned short __b)11333 vec_sub(vector bool short __a, vector unsigned short __b) {
11334 return (vector unsigned short)__a - __b;
11335 }
11336
11337 static __inline__ vector unsigned short __ATTRS_o_ai
vec_sub(vector unsigned short __a,vector bool short __b)11338 vec_sub(vector unsigned short __a, vector bool short __b) {
11339 return __a - (vector unsigned short)__b;
11340 }
11341
vec_sub(vector int __a,vector int __b)11342 static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a,
11343 vector int __b) {
11344 return __a - __b;
11345 }
11346
vec_sub(vector bool int __a,vector int __b)11347 static __inline__ vector int __ATTRS_o_ai vec_sub(vector bool int __a,
11348 vector int __b) {
11349 return (vector int)__a - __b;
11350 }
11351
vec_sub(vector int __a,vector bool int __b)11352 static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a,
11353 vector bool int __b) {
11354 return __a - (vector int)__b;
11355 }
11356
11357 static __inline__ vector unsigned int __ATTRS_o_ai
vec_sub(vector unsigned int __a,vector unsigned int __b)11358 vec_sub(vector unsigned int __a, vector unsigned int __b) {
11359 return __a - __b;
11360 }
11361
11362 static __inline__ vector unsigned int __ATTRS_o_ai
vec_sub(vector bool int __a,vector unsigned int __b)11363 vec_sub(vector bool int __a, vector unsigned int __b) {
11364 return (vector unsigned int)__a - __b;
11365 }
11366
11367 static __inline__ vector unsigned int __ATTRS_o_ai
vec_sub(vector unsigned int __a,vector bool int __b)11368 vec_sub(vector unsigned int __a, vector bool int __b) {
11369 return __a - (vector unsigned int)__b;
11370 }
11371
11372 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11373 static __inline__ vector signed __int128 __ATTRS_o_ai
vec_sub(vector signed __int128 __a,vector signed __int128 __b)11374 vec_sub(vector signed __int128 __a, vector signed __int128 __b) {
11375 return __a - __b;
11376 }
11377
11378 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_sub(vector unsigned __int128 __a,vector unsigned __int128 __b)11379 vec_sub(vector unsigned __int128 __a, vector unsigned __int128 __b) {
11380 return __a - __b;
11381 }
11382 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11383
11384 #ifdef __VSX__
11385 static __inline__ vector signed long long __ATTRS_o_ai
vec_sub(vector signed long long __a,vector signed long long __b)11386 vec_sub(vector signed long long __a, vector signed long long __b) {
11387 return __a - __b;
11388 }
11389
11390 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_sub(vector unsigned long long __a,vector unsigned long long __b)11391 vec_sub(vector unsigned long long __a, vector unsigned long long __b) {
11392 return __a - __b;
11393 }
11394
vec_sub(vector double __a,vector double __b)11395 static __inline__ vector double __ATTRS_o_ai vec_sub(vector double __a,
11396 vector double __b) {
11397 return __a - __b;
11398 }
11399 #endif
11400
vec_sub(vector float __a,vector float __b)11401 static __inline__ vector float __ATTRS_o_ai vec_sub(vector float __a,
11402 vector float __b) {
11403 return __a - __b;
11404 }
11405
11406 /* vec_vsububm */
11407
11408 #define __builtin_altivec_vsububm vec_vsububm
11409
11410 static __inline__ vector signed char __ATTRS_o_ai
vec_vsububm(vector signed char __a,vector signed char __b)11411 vec_vsububm(vector signed char __a, vector signed char __b) {
11412 return __a - __b;
11413 }
11414
11415 static __inline__ vector signed char __ATTRS_o_ai
vec_vsububm(vector bool char __a,vector signed char __b)11416 vec_vsububm(vector bool char __a, vector signed char __b) {
11417 return (vector signed char)__a - __b;
11418 }
11419
11420 static __inline__ vector signed char __ATTRS_o_ai
vec_vsububm(vector signed char __a,vector bool char __b)11421 vec_vsububm(vector signed char __a, vector bool char __b) {
11422 return __a - (vector signed char)__b;
11423 }
11424
11425 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vsububm(vector unsigned char __a,vector unsigned char __b)11426 vec_vsububm(vector unsigned char __a, vector unsigned char __b) {
11427 return __a - __b;
11428 }
11429
11430 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vsububm(vector bool char __a,vector unsigned char __b)11431 vec_vsububm(vector bool char __a, vector unsigned char __b) {
11432 return (vector unsigned char)__a - __b;
11433 }
11434
11435 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vsububm(vector unsigned char __a,vector bool char __b)11436 vec_vsububm(vector unsigned char __a, vector bool char __b) {
11437 return __a - (vector unsigned char)__b;
11438 }
11439
11440 /* vec_vsubuhm */
11441
11442 #define __builtin_altivec_vsubuhm vec_vsubuhm
11443
vec_vsubuhm(vector short __a,vector short __b)11444 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
11445 vector short __b) {
11446 return __a - __b;
11447 }
11448
vec_vsubuhm(vector bool short __a,vector short __b)11449 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector bool short __a,
11450 vector short __b) {
11451 return (vector short)__a - __b;
11452 }
11453
vec_vsubuhm(vector short __a,vector bool short __b)11454 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
11455 vector bool short __b) {
11456 return __a - (vector short)__b;
11457 }
11458
11459 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vsubuhm(vector unsigned short __a,vector unsigned short __b)11460 vec_vsubuhm(vector unsigned short __a, vector unsigned short __b) {
11461 return __a - __b;
11462 }
11463
11464 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vsubuhm(vector bool short __a,vector unsigned short __b)11465 vec_vsubuhm(vector bool short __a, vector unsigned short __b) {
11466 return (vector unsigned short)__a - __b;
11467 }
11468
11469 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vsubuhm(vector unsigned short __a,vector bool short __b)11470 vec_vsubuhm(vector unsigned short __a, vector bool short __b) {
11471 return __a - (vector unsigned short)__b;
11472 }
11473
11474 /* vec_vsubuwm */
11475
11476 #define __builtin_altivec_vsubuwm vec_vsubuwm
11477
vec_vsubuwm(vector int __a,vector int __b)11478 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
11479 vector int __b) {
11480 return __a - __b;
11481 }
11482
vec_vsubuwm(vector bool int __a,vector int __b)11483 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector bool int __a,
11484 vector int __b) {
11485 return (vector int)__a - __b;
11486 }
11487
vec_vsubuwm(vector int __a,vector bool int __b)11488 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
11489 vector bool int __b) {
11490 return __a - (vector int)__b;
11491 }
11492
11493 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vsubuwm(vector unsigned int __a,vector unsigned int __b)11494 vec_vsubuwm(vector unsigned int __a, vector unsigned int __b) {
11495 return __a - __b;
11496 }
11497
11498 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vsubuwm(vector bool int __a,vector unsigned int __b)11499 vec_vsubuwm(vector bool int __a, vector unsigned int __b) {
11500 return (vector unsigned int)__a - __b;
11501 }
11502
11503 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vsubuwm(vector unsigned int __a,vector bool int __b)11504 vec_vsubuwm(vector unsigned int __a, vector bool int __b) {
11505 return __a - (vector unsigned int)__b;
11506 }
11507
11508 /* vec_vsubfp */
11509
11510 #define __builtin_altivec_vsubfp vec_vsubfp
11511
11512 static __inline__ vector float __attribute__((__always_inline__))
vec_vsubfp(vector float __a,vector float __b)11513 vec_vsubfp(vector float __a, vector float __b) {
11514 return __a - __b;
11515 }
11516
11517 /* vec_subc */
11518
11519 static __inline__ vector signed int __ATTRS_o_ai
vec_subc(vector signed int __a,vector signed int __b)11520 vec_subc(vector signed int __a, vector signed int __b) {
11521 return (vector signed int)__builtin_altivec_vsubcuw((vector unsigned int)__a,
11522 (vector unsigned int) __b);
11523 }
11524
11525 static __inline__ vector unsigned int __ATTRS_o_ai
vec_subc(vector unsigned int __a,vector unsigned int __b)11526 vec_subc(vector unsigned int __a, vector unsigned int __b) {
11527 return __builtin_altivec_vsubcuw(__a, __b);
11528 }
11529
11530 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11531 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_subc(vector unsigned __int128 __a,vector unsigned __int128 __b)11532 vec_subc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
11533 return __builtin_altivec_vsubcuq(__a, __b);
11534 }
11535
11536 static __inline__ vector signed __int128 __ATTRS_o_ai
vec_subc(vector signed __int128 __a,vector signed __int128 __b)11537 vec_subc(vector signed __int128 __a, vector signed __int128 __b) {
11538 return __builtin_altivec_vsubcuq(__a, __b);
11539 }
11540 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11541
11542 /* vec_vsubcuw */
11543
11544 static __inline__ vector unsigned int __attribute__((__always_inline__))
vec_vsubcuw(vector unsigned int __a,vector unsigned int __b)11545 vec_vsubcuw(vector unsigned int __a, vector unsigned int __b) {
11546 return __builtin_altivec_vsubcuw(__a, __b);
11547 }
11548
11549 /* vec_subs */
11550
11551 static __inline__ vector signed char __ATTRS_o_ai
vec_subs(vector signed char __a,vector signed char __b)11552 vec_subs(vector signed char __a, vector signed char __b) {
11553 return __builtin_altivec_vsubsbs(__a, __b);
11554 }
11555
11556 static __inline__ vector signed char __ATTRS_o_ai
vec_subs(vector bool char __a,vector signed char __b)11557 vec_subs(vector bool char __a, vector signed char __b) {
11558 return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
11559 }
11560
11561 static __inline__ vector signed char __ATTRS_o_ai
vec_subs(vector signed char __a,vector bool char __b)11562 vec_subs(vector signed char __a, vector bool char __b) {
11563 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
11564 }
11565
11566 static __inline__ vector unsigned char __ATTRS_o_ai
vec_subs(vector unsigned char __a,vector unsigned char __b)11567 vec_subs(vector unsigned char __a, vector unsigned char __b) {
11568 return __builtin_altivec_vsububs(__a, __b);
11569 }
11570
11571 static __inline__ vector unsigned char __ATTRS_o_ai
vec_subs(vector bool char __a,vector unsigned char __b)11572 vec_subs(vector bool char __a, vector unsigned char __b) {
11573 return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
11574 }
11575
11576 static __inline__ vector unsigned char __ATTRS_o_ai
vec_subs(vector unsigned char __a,vector bool char __b)11577 vec_subs(vector unsigned char __a, vector bool char __b) {
11578 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
11579 }
11580
vec_subs(vector short __a,vector short __b)11581 static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a,
11582 vector short __b) {
11583 return __builtin_altivec_vsubshs(__a, __b);
11584 }
11585
vec_subs(vector bool short __a,vector short __b)11586 static __inline__ vector short __ATTRS_o_ai vec_subs(vector bool short __a,
11587 vector short __b) {
11588 return __builtin_altivec_vsubshs((vector short)__a, __b);
11589 }
11590
vec_subs(vector short __a,vector bool short __b)11591 static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a,
11592 vector bool short __b) {
11593 return __builtin_altivec_vsubshs(__a, (vector short)__b);
11594 }
11595
11596 static __inline__ vector unsigned short __ATTRS_o_ai
vec_subs(vector unsigned short __a,vector unsigned short __b)11597 vec_subs(vector unsigned short __a, vector unsigned short __b) {
11598 return __builtin_altivec_vsubuhs(__a, __b);
11599 }
11600
11601 static __inline__ vector unsigned short __ATTRS_o_ai
vec_subs(vector bool short __a,vector unsigned short __b)11602 vec_subs(vector bool short __a, vector unsigned short __b) {
11603 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
11604 }
11605
11606 static __inline__ vector unsigned short __ATTRS_o_ai
vec_subs(vector unsigned short __a,vector bool short __b)11607 vec_subs(vector unsigned short __a, vector bool short __b) {
11608 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
11609 }
11610
vec_subs(vector int __a,vector int __b)11611 static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a,
11612 vector int __b) {
11613 return __builtin_altivec_vsubsws(__a, __b);
11614 }
11615
vec_subs(vector bool int __a,vector int __b)11616 static __inline__ vector int __ATTRS_o_ai vec_subs(vector bool int __a,
11617 vector int __b) {
11618 return __builtin_altivec_vsubsws((vector int)__a, __b);
11619 }
11620
vec_subs(vector int __a,vector bool int __b)11621 static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a,
11622 vector bool int __b) {
11623 return __builtin_altivec_vsubsws(__a, (vector int)__b);
11624 }
11625
11626 static __inline__ vector unsigned int __ATTRS_o_ai
vec_subs(vector unsigned int __a,vector unsigned int __b)11627 vec_subs(vector unsigned int __a, vector unsigned int __b) {
11628 return __builtin_altivec_vsubuws(__a, __b);
11629 }
11630
11631 static __inline__ vector unsigned int __ATTRS_o_ai
vec_subs(vector bool int __a,vector unsigned int __b)11632 vec_subs(vector bool int __a, vector unsigned int __b) {
11633 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
11634 }
11635
11636 static __inline__ vector unsigned int __ATTRS_o_ai
vec_subs(vector unsigned int __a,vector bool int __b)11637 vec_subs(vector unsigned int __a, vector bool int __b) {
11638 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
11639 }
11640
11641 /* vec_vsubsbs */
11642
11643 static __inline__ vector signed char __ATTRS_o_ai
vec_vsubsbs(vector signed char __a,vector signed char __b)11644 vec_vsubsbs(vector signed char __a, vector signed char __b) {
11645 return __builtin_altivec_vsubsbs(__a, __b);
11646 }
11647
11648 static __inline__ vector signed char __ATTRS_o_ai
vec_vsubsbs(vector bool char __a,vector signed char __b)11649 vec_vsubsbs(vector bool char __a, vector signed char __b) {
11650 return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
11651 }
11652
11653 static __inline__ vector signed char __ATTRS_o_ai
vec_vsubsbs(vector signed char __a,vector bool char __b)11654 vec_vsubsbs(vector signed char __a, vector bool char __b) {
11655 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
11656 }
11657
11658 /* vec_vsububs */
11659
11660 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vsububs(vector unsigned char __a,vector unsigned char __b)11661 vec_vsububs(vector unsigned char __a, vector unsigned char __b) {
11662 return __builtin_altivec_vsububs(__a, __b);
11663 }
11664
11665 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vsububs(vector bool char __a,vector unsigned char __b)11666 vec_vsububs(vector bool char __a, vector unsigned char __b) {
11667 return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
11668 }
11669
11670 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vsububs(vector unsigned char __a,vector bool char __b)11671 vec_vsububs(vector unsigned char __a, vector bool char __b) {
11672 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
11673 }
11674
11675 /* vec_vsubshs */
11676
vec_vsubshs(vector short __a,vector short __b)11677 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
11678 vector short __b) {
11679 return __builtin_altivec_vsubshs(__a, __b);
11680 }
11681
vec_vsubshs(vector bool short __a,vector short __b)11682 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector bool short __a,
11683 vector short __b) {
11684 return __builtin_altivec_vsubshs((vector short)__a, __b);
11685 }
11686
vec_vsubshs(vector short __a,vector bool short __b)11687 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
11688 vector bool short __b) {
11689 return __builtin_altivec_vsubshs(__a, (vector short)__b);
11690 }
11691
11692 /* vec_vsubuhs */
11693
11694 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vsubuhs(vector unsigned short __a,vector unsigned short __b)11695 vec_vsubuhs(vector unsigned short __a, vector unsigned short __b) {
11696 return __builtin_altivec_vsubuhs(__a, __b);
11697 }
11698
11699 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vsubuhs(vector bool short __a,vector unsigned short __b)11700 vec_vsubuhs(vector bool short __a, vector unsigned short __b) {
11701 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
11702 }
11703
11704 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vsubuhs(vector unsigned short __a,vector bool short __b)11705 vec_vsubuhs(vector unsigned short __a, vector bool short __b) {
11706 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
11707 }
11708
11709 /* vec_vsubsws */
11710
vec_vsubsws(vector int __a,vector int __b)11711 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
11712 vector int __b) {
11713 return __builtin_altivec_vsubsws(__a, __b);
11714 }
11715
vec_vsubsws(vector bool int __a,vector int __b)11716 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector bool int __a,
11717 vector int __b) {
11718 return __builtin_altivec_vsubsws((vector int)__a, __b);
11719 }
11720
vec_vsubsws(vector int __a,vector bool int __b)11721 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
11722 vector bool int __b) {
11723 return __builtin_altivec_vsubsws(__a, (vector int)__b);
11724 }
11725
11726 /* vec_vsubuws */
11727
11728 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vsubuws(vector unsigned int __a,vector unsigned int __b)11729 vec_vsubuws(vector unsigned int __a, vector unsigned int __b) {
11730 return __builtin_altivec_vsubuws(__a, __b);
11731 }
11732
11733 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vsubuws(vector bool int __a,vector unsigned int __b)11734 vec_vsubuws(vector bool int __a, vector unsigned int __b) {
11735 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
11736 }
11737
11738 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vsubuws(vector unsigned int __a,vector bool int __b)11739 vec_vsubuws(vector unsigned int __a, vector bool int __b) {
11740 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
11741 }
11742
11743 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11744 /* vec_vsubuqm */
11745
11746 static __inline__ vector signed __int128 __ATTRS_o_ai
vec_vsubuqm(vector signed __int128 __a,vector signed __int128 __b)11747 vec_vsubuqm(vector signed __int128 __a, vector signed __int128 __b) {
11748 return __a - __b;
11749 }
11750
11751 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_vsubuqm(vector unsigned __int128 __a,vector unsigned __int128 __b)11752 vec_vsubuqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
11753 return __a - __b;
11754 }
11755
11756 /* vec_vsubeuqm */
11757
11758
11759 static __inline__ vector signed __int128 __ATTRS_o_ai
vec_vsubeuqm(vector signed __int128 __a,vector signed __int128 __b,vector signed __int128 __c)11760 vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b,
11761 vector signed __int128 __c) {
11762 return __builtin_altivec_vsubeuqm(__a, __b, __c);
11763 }
11764
11765 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_vsubeuqm(vector unsigned __int128 __a,vector unsigned __int128 __b,vector unsigned __int128 __c)11766 vec_vsubeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
11767 vector unsigned __int128 __c) {
11768 return __builtin_altivec_vsubeuqm(__a, __b, __c);
11769 }
11770
11771 static __inline__ vector signed __int128 __ATTRS_o_ai
vec_sube(vector signed __int128 __a,vector signed __int128 __b,vector signed __int128 __c)11772 vec_sube(vector signed __int128 __a, vector signed __int128 __b,
11773 vector signed __int128 __c) {
11774 return __builtin_altivec_vsubeuqm(__a, __b, __c);
11775 }
11776
11777 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_sube(vector unsigned __int128 __a,vector unsigned __int128 __b,vector unsigned __int128 __c)11778 vec_sube(vector unsigned __int128 __a, vector unsigned __int128 __b,
11779 vector unsigned __int128 __c) {
11780 return __builtin_altivec_vsubeuqm(__a, __b, __c);
11781 }
11782
11783 /* vec_vsubcuq */
11784
11785 static __inline__ vector signed __int128 __ATTRS_o_ai
vec_vsubcuq(vector signed __int128 __a,vector signed __int128 __b)11786 vec_vsubcuq(vector signed __int128 __a, vector signed __int128 __b) {
11787 return __builtin_altivec_vsubcuq(__a, __b);
11788 }
11789
11790 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_vsubcuq(vector unsigned __int128 __a,vector unsigned __int128 __b)11791 vec_vsubcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
11792 return __builtin_altivec_vsubcuq(__a, __b);
11793 }
11794
11795 /* vec_vsubecuq */
11796
11797 static __inline__ vector signed __int128 __ATTRS_o_ai
vec_vsubecuq(vector signed __int128 __a,vector signed __int128 __b,vector signed __int128 __c)11798 vec_vsubecuq(vector signed __int128 __a, vector signed __int128 __b,
11799 vector signed __int128 __c) {
11800 return __builtin_altivec_vsubecuq(__a, __b, __c);
11801 }
11802
11803 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_vsubecuq(vector unsigned __int128 __a,vector unsigned __int128 __b,vector unsigned __int128 __c)11804 vec_vsubecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
11805 vector unsigned __int128 __c) {
11806 return __builtin_altivec_vsubecuq(__a, __b, __c);
11807 }
11808
11809 static __inline__ vector signed int __ATTRS_o_ai
vec_subec(vector signed int __a,vector signed int __b,vector signed int __c)11810 vec_subec(vector signed int __a, vector signed int __b,
11811 vector signed int __c) {
11812 return vec_addec(__a, ~__b, __c);
11813 }
11814
11815 static __inline__ vector unsigned int __ATTRS_o_ai
vec_subec(vector unsigned int __a,vector unsigned int __b,vector unsigned int __c)11816 vec_subec(vector unsigned int __a, vector unsigned int __b,
11817 vector unsigned int __c) {
11818 return vec_addec(__a, ~__b, __c);
11819 }
11820
11821 static __inline__ vector signed __int128 __ATTRS_o_ai
vec_subec(vector signed __int128 __a,vector signed __int128 __b,vector signed __int128 __c)11822 vec_subec(vector signed __int128 __a, vector signed __int128 __b,
11823 vector signed __int128 __c) {
11824 return __builtin_altivec_vsubecuq(__a, __b, __c);
11825 }
11826
11827 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_subec(vector unsigned __int128 __a,vector unsigned __int128 __b,vector unsigned __int128 __c)11828 vec_subec(vector unsigned __int128 __a, vector unsigned __int128 __b,
11829 vector unsigned __int128 __c) {
11830 return __builtin_altivec_vsubecuq(__a, __b, __c);
11831 }
11832 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11833
11834 static __inline__ vector signed int __ATTRS_o_ai
vec_sube(vector signed int __a,vector signed int __b,vector signed int __c)11835 vec_sube(vector signed int __a, vector signed int __b,
11836 vector signed int __c) {
11837 vector signed int __mask = {1, 1, 1, 1};
11838 vector signed int __carry = __c & __mask;
11839 return vec_adde(__a, ~__b, __carry);
11840 }
11841
11842 static __inline__ vector unsigned int __ATTRS_o_ai
vec_sube(vector unsigned int __a,vector unsigned int __b,vector unsigned int __c)11843 vec_sube(vector unsigned int __a, vector unsigned int __b,
11844 vector unsigned int __c) {
11845 vector unsigned int __mask = {1, 1, 1, 1};
11846 vector unsigned int __carry = __c & __mask;
11847 return vec_adde(__a, ~__b, __carry);
11848 }
11849 /* vec_sum4s */
11850
vec_sum4s(vector signed char __a,vector int __b)11851 static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed char __a,
11852 vector int __b) {
11853 return __builtin_altivec_vsum4sbs(__a, __b);
11854 }
11855
11856 static __inline__ vector unsigned int __ATTRS_o_ai
vec_sum4s(vector unsigned char __a,vector unsigned int __b)11857 vec_sum4s(vector unsigned char __a, vector unsigned int __b) {
11858 return __builtin_altivec_vsum4ubs(__a, __b);
11859 }
11860
vec_sum4s(vector signed short __a,vector int __b)11861 static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed short __a,
11862 vector int __b) {
11863 return __builtin_altivec_vsum4shs(__a, __b);
11864 }
11865
11866 /* vec_vsum4sbs */
11867
11868 static __inline__ vector int __attribute__((__always_inline__))
vec_vsum4sbs(vector signed char __a,vector int __b)11869 vec_vsum4sbs(vector signed char __a, vector int __b) {
11870 return __builtin_altivec_vsum4sbs(__a, __b);
11871 }
11872
11873 /* vec_vsum4ubs */
11874
11875 static __inline__ vector unsigned int __attribute__((__always_inline__))
vec_vsum4ubs(vector unsigned char __a,vector unsigned int __b)11876 vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b) {
11877 return __builtin_altivec_vsum4ubs(__a, __b);
11878 }
11879
11880 /* vec_vsum4shs */
11881
11882 static __inline__ vector int __attribute__((__always_inline__))
vec_vsum4shs(vector signed short __a,vector int __b)11883 vec_vsum4shs(vector signed short __a, vector int __b) {
11884 return __builtin_altivec_vsum4shs(__a, __b);
11885 }
11886
11887 /* vec_sum2s */
11888
11889 /* The vsum2sws instruction has a big-endian bias, so that the second
11890 input vector and the result always reference big-endian elements
11891 1 and 3 (little-endian element 0 and 2). For ease of porting the
11892 programmer wants elements 1 and 3 in both cases, so for little
11893 endian we must perform some permutes. */
11894
11895 static __inline__ vector signed int __attribute__((__always_inline__))
vec_sum2s(vector int __a,vector int __b)11896 vec_sum2s(vector int __a, vector int __b) {
11897 #ifdef __LITTLE_ENDIAN__
11898 vector int __c = (vector signed int)vec_perm(
11899 __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
11900 8, 9, 10, 11));
11901 __c = __builtin_altivec_vsum2sws(__a, __c);
11902 return (vector signed int)vec_perm(
11903 __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
11904 8, 9, 10, 11));
11905 #else
11906 return __builtin_altivec_vsum2sws(__a, __b);
11907 #endif
11908 }
11909
11910 /* vec_vsum2sws */
11911
11912 static __inline__ vector signed int __attribute__((__always_inline__))
vec_vsum2sws(vector int __a,vector int __b)11913 vec_vsum2sws(vector int __a, vector int __b) {
11914 #ifdef __LITTLE_ENDIAN__
11915 vector int __c = (vector signed int)vec_perm(
11916 __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
11917 8, 9, 10, 11));
11918 __c = __builtin_altivec_vsum2sws(__a, __c);
11919 return (vector signed int)vec_perm(
11920 __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
11921 8, 9, 10, 11));
11922 #else
11923 return __builtin_altivec_vsum2sws(__a, __b);
11924 #endif
11925 }
11926
11927 /* vec_sums */
11928
11929 /* The vsumsws instruction has a big-endian bias, so that the second
11930 input vector and the result always reference big-endian element 3
11931 (little-endian element 0). For ease of porting the programmer
11932 wants element 3 in both cases, so for little endian we must perform
11933 some permutes. */
11934
11935 static __inline__ vector signed int __attribute__((__always_inline__))
vec_sums(vector signed int __a,vector signed int __b)11936 vec_sums(vector signed int __a, vector signed int __b) {
11937 #ifdef __LITTLE_ENDIAN__
11938 __b = (vector signed int)vec_splat(__b, 3);
11939 __b = __builtin_altivec_vsumsws(__a, __b);
11940 return (vector signed int)(0, 0, 0, __b[0]);
11941 #else
11942 return __builtin_altivec_vsumsws(__a, __b);
11943 #endif
11944 }
11945
11946 /* vec_vsumsws */
11947
11948 static __inline__ vector signed int __attribute__((__always_inline__))
vec_vsumsws(vector signed int __a,vector signed int __b)11949 vec_vsumsws(vector signed int __a, vector signed int __b) {
11950 #ifdef __LITTLE_ENDIAN__
11951 __b = (vector signed int)vec_splat(__b, 3);
11952 __b = __builtin_altivec_vsumsws(__a, __b);
11953 return (vector signed int)(0, 0, 0, __b[0]);
11954 #else
11955 return __builtin_altivec_vsumsws(__a, __b);
11956 #endif
11957 }
11958
11959 /* vec_trunc */
11960
vec_trunc(vector float __a)11961 static __inline__ vector float __ATTRS_o_ai vec_trunc(vector float __a) {
11962 #ifdef __VSX__
11963 return __builtin_vsx_xvrspiz(__a);
11964 #else
11965 return __builtin_altivec_vrfiz(__a);
11966 #endif
11967 }
11968
11969 #ifdef __VSX__
vec_trunc(vector double __a)11970 static __inline__ vector double __ATTRS_o_ai vec_trunc(vector double __a) {
11971 return __builtin_vsx_xvrdpiz(__a);
11972 }
11973 #endif
11974
11975 /* vec_vrfiz */
11976
11977 static __inline__ vector float __attribute__((__always_inline__))
vec_vrfiz(vector float __a)11978 vec_vrfiz(vector float __a) {
11979 return __builtin_altivec_vrfiz(__a);
11980 }
11981
11982 /* vec_unpackh */
11983
11984 /* The vector unpack instructions all have a big-endian bias, so for
11985 little endian we must reverse the meanings of "high" and "low." */
11986
11987 static __inline__ vector short __ATTRS_o_ai
vec_unpackh(vector signed char __a)11988 vec_unpackh(vector signed char __a) {
11989 #ifdef __LITTLE_ENDIAN__
11990 return __builtin_altivec_vupklsb((vector char)__a);
11991 #else
11992 return __builtin_altivec_vupkhsb((vector char)__a);
11993 #endif
11994 }
11995
11996 static __inline__ vector bool short __ATTRS_o_ai
vec_unpackh(vector bool char __a)11997 vec_unpackh(vector bool char __a) {
11998 #ifdef __LITTLE_ENDIAN__
11999 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
12000 #else
12001 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
12002 #endif
12003 }
12004
vec_unpackh(vector short __a)12005 static __inline__ vector int __ATTRS_o_ai vec_unpackh(vector short __a) {
12006 #ifdef __LITTLE_ENDIAN__
12007 return __builtin_altivec_vupklsh(__a);
12008 #else
12009 return __builtin_altivec_vupkhsh(__a);
12010 #endif
12011 }
12012
12013 static __inline__ vector bool int __ATTRS_o_ai
vec_unpackh(vector bool short __a)12014 vec_unpackh(vector bool short __a) {
12015 #ifdef __LITTLE_ENDIAN__
12016 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
12017 #else
12018 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
12019 #endif
12020 }
12021
12022 static __inline__ vector unsigned int __ATTRS_o_ai
vec_unpackh(vector pixel __a)12023 vec_unpackh(vector pixel __a) {
12024 #ifdef __LITTLE_ENDIAN__
12025 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
12026 #else
12027 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
12028 #endif
12029 }
12030
12031 #ifdef __POWER8_VECTOR__
vec_unpackh(vector int __a)12032 static __inline__ vector long long __ATTRS_o_ai vec_unpackh(vector int __a) {
12033 #ifdef __LITTLE_ENDIAN__
12034 return __builtin_altivec_vupklsw(__a);
12035 #else
12036 return __builtin_altivec_vupkhsw(__a);
12037 #endif
12038 }
12039
12040 static __inline__ vector bool long long __ATTRS_o_ai
vec_unpackh(vector bool int __a)12041 vec_unpackh(vector bool int __a) {
12042 #ifdef __LITTLE_ENDIAN__
12043 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
12044 #else
12045 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
12046 #endif
12047 }
12048
12049 static __inline__ vector double __ATTRS_o_ai
vec_unpackh(vector float __a)12050 vec_unpackh(vector float __a) {
12051 return (vector double)(__a[0], __a[1]);
12052 }
12053 #endif
12054
12055 /* vec_vupkhsb */
12056
12057 static __inline__ vector short __ATTRS_o_ai
vec_vupkhsb(vector signed char __a)12058 vec_vupkhsb(vector signed char __a) {
12059 #ifdef __LITTLE_ENDIAN__
12060 return __builtin_altivec_vupklsb((vector char)__a);
12061 #else
12062 return __builtin_altivec_vupkhsb((vector char)__a);
12063 #endif
12064 }
12065
12066 static __inline__ vector bool short __ATTRS_o_ai
vec_vupkhsb(vector bool char __a)12067 vec_vupkhsb(vector bool char __a) {
12068 #ifdef __LITTLE_ENDIAN__
12069 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
12070 #else
12071 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
12072 #endif
12073 }
12074
12075 /* vec_vupkhsh */
12076
vec_vupkhsh(vector short __a)12077 static __inline__ vector int __ATTRS_o_ai vec_vupkhsh(vector short __a) {
12078 #ifdef __LITTLE_ENDIAN__
12079 return __builtin_altivec_vupklsh(__a);
12080 #else
12081 return __builtin_altivec_vupkhsh(__a);
12082 #endif
12083 }
12084
12085 static __inline__ vector bool int __ATTRS_o_ai
vec_vupkhsh(vector bool short __a)12086 vec_vupkhsh(vector bool short __a) {
12087 #ifdef __LITTLE_ENDIAN__
12088 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
12089 #else
12090 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
12091 #endif
12092 }
12093
12094 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vupkhsh(vector pixel __a)12095 vec_vupkhsh(vector pixel __a) {
12096 #ifdef __LITTLE_ENDIAN__
12097 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
12098 #else
12099 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
12100 #endif
12101 }
12102
12103 /* vec_vupkhsw */
12104
12105 #ifdef __POWER8_VECTOR__
vec_vupkhsw(vector int __a)12106 static __inline__ vector long long __ATTRS_o_ai vec_vupkhsw(vector int __a) {
12107 #ifdef __LITTLE_ENDIAN__
12108 return __builtin_altivec_vupklsw(__a);
12109 #else
12110 return __builtin_altivec_vupkhsw(__a);
12111 #endif
12112 }
12113
12114 static __inline__ vector bool long long __ATTRS_o_ai
vec_vupkhsw(vector bool int __a)12115 vec_vupkhsw(vector bool int __a) {
12116 #ifdef __LITTLE_ENDIAN__
12117 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
12118 #else
12119 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
12120 #endif
12121 }
12122 #endif
12123
12124 /* vec_unpackl */
12125
12126 static __inline__ vector short __ATTRS_o_ai
vec_unpackl(vector signed char __a)12127 vec_unpackl(vector signed char __a) {
12128 #ifdef __LITTLE_ENDIAN__
12129 return __builtin_altivec_vupkhsb((vector char)__a);
12130 #else
12131 return __builtin_altivec_vupklsb((vector char)__a);
12132 #endif
12133 }
12134
12135 static __inline__ vector bool short __ATTRS_o_ai
vec_unpackl(vector bool char __a)12136 vec_unpackl(vector bool char __a) {
12137 #ifdef __LITTLE_ENDIAN__
12138 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
12139 #else
12140 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
12141 #endif
12142 }
12143
vec_unpackl(vector short __a)12144 static __inline__ vector int __ATTRS_o_ai vec_unpackl(vector short __a) {
12145 #ifdef __LITTLE_ENDIAN__
12146 return __builtin_altivec_vupkhsh(__a);
12147 #else
12148 return __builtin_altivec_vupklsh(__a);
12149 #endif
12150 }
12151
12152 static __inline__ vector bool int __ATTRS_o_ai
vec_unpackl(vector bool short __a)12153 vec_unpackl(vector bool short __a) {
12154 #ifdef __LITTLE_ENDIAN__
12155 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
12156 #else
12157 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
12158 #endif
12159 }
12160
12161 static __inline__ vector unsigned int __ATTRS_o_ai
vec_unpackl(vector pixel __a)12162 vec_unpackl(vector pixel __a) {
12163 #ifdef __LITTLE_ENDIAN__
12164 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
12165 #else
12166 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
12167 #endif
12168 }
12169
12170 #ifdef __POWER8_VECTOR__
vec_unpackl(vector int __a)12171 static __inline__ vector long long __ATTRS_o_ai vec_unpackl(vector int __a) {
12172 #ifdef __LITTLE_ENDIAN__
12173 return __builtin_altivec_vupkhsw(__a);
12174 #else
12175 return __builtin_altivec_vupklsw(__a);
12176 #endif
12177 }
12178
12179 static __inline__ vector bool long long __ATTRS_o_ai
vec_unpackl(vector bool int __a)12180 vec_unpackl(vector bool int __a) {
12181 #ifdef __LITTLE_ENDIAN__
12182 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
12183 #else
12184 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
12185 #endif
12186 }
12187
12188 static __inline__ vector double __ATTRS_o_ai
vec_unpackl(vector float __a)12189 vec_unpackl(vector float __a) {
12190 return (vector double)(__a[2], __a[3]);
12191 }
12192 #endif
12193
12194 /* vec_vupklsb */
12195
12196 static __inline__ vector short __ATTRS_o_ai
vec_vupklsb(vector signed char __a)12197 vec_vupklsb(vector signed char __a) {
12198 #ifdef __LITTLE_ENDIAN__
12199 return __builtin_altivec_vupkhsb((vector char)__a);
12200 #else
12201 return __builtin_altivec_vupklsb((vector char)__a);
12202 #endif
12203 }
12204
12205 static __inline__ vector bool short __ATTRS_o_ai
vec_vupklsb(vector bool char __a)12206 vec_vupklsb(vector bool char __a) {
12207 #ifdef __LITTLE_ENDIAN__
12208 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
12209 #else
12210 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
12211 #endif
12212 }
12213
12214 /* vec_vupklsh */
12215
vec_vupklsh(vector short __a)12216 static __inline__ vector int __ATTRS_o_ai vec_vupklsh(vector short __a) {
12217 #ifdef __LITTLE_ENDIAN__
12218 return __builtin_altivec_vupkhsh(__a);
12219 #else
12220 return __builtin_altivec_vupklsh(__a);
12221 #endif
12222 }
12223
12224 static __inline__ vector bool int __ATTRS_o_ai
vec_vupklsh(vector bool short __a)12225 vec_vupklsh(vector bool short __a) {
12226 #ifdef __LITTLE_ENDIAN__
12227 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
12228 #else
12229 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
12230 #endif
12231 }
12232
12233 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vupklsh(vector pixel __a)12234 vec_vupklsh(vector pixel __a) {
12235 #ifdef __LITTLE_ENDIAN__
12236 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
12237 #else
12238 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
12239 #endif
12240 }
12241
12242 /* vec_vupklsw */
12243
12244 #ifdef __POWER8_VECTOR__
vec_vupklsw(vector int __a)12245 static __inline__ vector long long __ATTRS_o_ai vec_vupklsw(vector int __a) {
12246 #ifdef __LITTLE_ENDIAN__
12247 return __builtin_altivec_vupkhsw(__a);
12248 #else
12249 return __builtin_altivec_vupklsw(__a);
12250 #endif
12251 }
12252
12253 static __inline__ vector bool long long __ATTRS_o_ai
vec_vupklsw(vector bool int __a)12254 vec_vupklsw(vector bool int __a) {
12255 #ifdef __LITTLE_ENDIAN__
12256 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
12257 #else
12258 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
12259 #endif
12260 }
12261 #endif
12262
12263 /* vec_vsx_ld */
12264
12265 #ifdef __VSX__
12266
12267 static __inline__ vector bool int __ATTRS_o_ai
vec_vsx_ld(int __a,const vector bool int * __b)12268 vec_vsx_ld(int __a, const vector bool int *__b) {
12269 return (vector bool int)__builtin_vsx_lxvw4x(__a, __b);
12270 }
12271
12272 static __inline__ vector signed int __ATTRS_o_ai
vec_vsx_ld(int __a,const vector signed int * __b)12273 vec_vsx_ld(int __a, const vector signed int *__b) {
12274 return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
12275 }
12276
12277 static __inline__ vector signed int __ATTRS_o_ai
vec_vsx_ld(int __a,const signed int * __b)12278 vec_vsx_ld(int __a, const signed int *__b) {
12279 return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
12280 }
12281
12282 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vsx_ld(int __a,const vector unsigned int * __b)12283 vec_vsx_ld(int __a, const vector unsigned int *__b) {
12284 return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
12285 }
12286
12287 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vsx_ld(int __a,const unsigned int * __b)12288 vec_vsx_ld(int __a, const unsigned int *__b) {
12289 return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
12290 }
12291
12292 static __inline__ vector float __ATTRS_o_ai
vec_vsx_ld(int __a,const vector float * __b)12293 vec_vsx_ld(int __a, const vector float *__b) {
12294 return (vector float)__builtin_vsx_lxvw4x(__a, __b);
12295 }
12296
vec_vsx_ld(int __a,const float * __b)12297 static __inline__ vector float __ATTRS_o_ai vec_vsx_ld(int __a,
12298 const float *__b) {
12299 return (vector float)__builtin_vsx_lxvw4x(__a, __b);
12300 }
12301
12302 static __inline__ vector signed long long __ATTRS_o_ai
vec_vsx_ld(int __a,const vector signed long long * __b)12303 vec_vsx_ld(int __a, const vector signed long long *__b) {
12304 return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b);
12305 }
12306
12307 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_vsx_ld(int __a,const vector unsigned long long * __b)12308 vec_vsx_ld(int __a, const vector unsigned long long *__b) {
12309 return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b);
12310 }
12311
12312 static __inline__ vector double __ATTRS_o_ai
vec_vsx_ld(int __a,const vector double * __b)12313 vec_vsx_ld(int __a, const vector double *__b) {
12314 return (vector double)__builtin_vsx_lxvd2x(__a, __b);
12315 }
12316
12317 static __inline__ vector double __ATTRS_o_ai
vec_vsx_ld(int __a,const double * __b)12318 vec_vsx_ld(int __a, const double *__b) {
12319 return (vector double)__builtin_vsx_lxvd2x(__a, __b);
12320 }
12321
12322 static __inline__ vector bool short __ATTRS_o_ai
vec_vsx_ld(int __a,const vector bool short * __b)12323 vec_vsx_ld(int __a, const vector bool short *__b) {
12324 return (vector bool short)__builtin_vsx_lxvw4x(__a, __b);
12325 }
12326
12327 static __inline__ vector signed short __ATTRS_o_ai
vec_vsx_ld(int __a,const vector signed short * __b)12328 vec_vsx_ld(int __a, const vector signed short *__b) {
12329 return (vector signed short)__builtin_vsx_lxvw4x(__a, __b);
12330 }
12331
12332 static __inline__ vector signed short __ATTRS_o_ai
vec_vsx_ld(int __a,const signed short * __b)12333 vec_vsx_ld(int __a, const signed short *__b) {
12334 return (vector signed short)__builtin_vsx_lxvw4x(__a, __b);
12335 }
12336
12337 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vsx_ld(int __a,const vector unsigned short * __b)12338 vec_vsx_ld(int __a, const vector unsigned short *__b) {
12339 return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b);
12340 }
12341
12342 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vsx_ld(int __a,const unsigned short * __b)12343 vec_vsx_ld(int __a, const unsigned short *__b) {
12344 return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b);
12345 }
12346
12347 static __inline__ vector bool char __ATTRS_o_ai
vec_vsx_ld(int __a,const vector bool char * __b)12348 vec_vsx_ld(int __a, const vector bool char *__b) {
12349 return (vector bool char)__builtin_vsx_lxvw4x(__a, __b);
12350 }
12351
12352 static __inline__ vector signed char __ATTRS_o_ai
vec_vsx_ld(int __a,const vector signed char * __b)12353 vec_vsx_ld(int __a, const vector signed char *__b) {
12354 return (vector signed char)__builtin_vsx_lxvw4x(__a, __b);
12355 }
12356
12357 static __inline__ vector signed char __ATTRS_o_ai
vec_vsx_ld(int __a,const signed char * __b)12358 vec_vsx_ld(int __a, const signed char *__b) {
12359 return (vector signed char)__builtin_vsx_lxvw4x(__a, __b);
12360 }
12361
12362 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vsx_ld(int __a,const vector unsigned char * __b)12363 vec_vsx_ld(int __a, const vector unsigned char *__b) {
12364 return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b);
12365 }
12366
12367 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vsx_ld(int __a,const unsigned char * __b)12368 vec_vsx_ld(int __a, const unsigned char *__b) {
12369 return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b);
12370 }
12371
12372 #endif
12373
12374 /* vec_vsx_st */
12375
12376 #ifdef __VSX__
12377
vec_vsx_st(vector bool int __a,int __b,vector bool int * __c)12378 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
12379 vector bool int *__c) {
12380 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12381 }
12382
vec_vsx_st(vector bool int __a,int __b,signed int * __c)12383 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
12384 signed int *__c) {
12385 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12386 }
12387
vec_vsx_st(vector bool int __a,int __b,unsigned int * __c)12388 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
12389 unsigned int *__c) {
12390 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12391 }
12392
vec_vsx_st(vector signed int __a,int __b,vector signed int * __c)12393 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
12394 vector signed int *__c) {
12395 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12396 }
12397
vec_vsx_st(vector signed int __a,int __b,signed int * __c)12398 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
12399 signed int *__c) {
12400 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12401 }
12402
vec_vsx_st(vector unsigned int __a,int __b,vector unsigned int * __c)12403 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
12404 vector unsigned int *__c) {
12405 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12406 }
12407
vec_vsx_st(vector unsigned int __a,int __b,unsigned int * __c)12408 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
12409 unsigned int *__c) {
12410 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12411 }
12412
vec_vsx_st(vector float __a,int __b,vector float * __c)12413 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
12414 vector float *__c) {
12415 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12416 }
12417
vec_vsx_st(vector float __a,int __b,float * __c)12418 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
12419 float *__c) {
12420 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12421 }
12422
vec_vsx_st(vector signed long long __a,int __b,vector signed long long * __c)12423 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed long long __a,
12424 int __b,
12425 vector signed long long *__c) {
12426 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
12427 }
12428
vec_vsx_st(vector unsigned long long __a,int __b,vector unsigned long long * __c)12429 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned long long __a,
12430 int __b,
12431 vector unsigned long long *__c) {
12432 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
12433 }
12434
vec_vsx_st(vector double __a,int __b,vector double * __c)12435 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
12436 vector double *__c) {
12437 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
12438 }
12439
vec_vsx_st(vector double __a,int __b,double * __c)12440 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
12441 double *__c) {
12442 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
12443 }
12444
vec_vsx_st(vector bool short __a,int __b,vector bool short * __c)12445 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
12446 vector bool short *__c) {
12447 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12448 }
12449
vec_vsx_st(vector bool short __a,int __b,signed short * __c)12450 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
12451 signed short *__c) {
12452 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12453 }
12454
vec_vsx_st(vector bool short __a,int __b,unsigned short * __c)12455 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
12456 unsigned short *__c) {
12457 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12458 }
vec_vsx_st(vector signed short __a,int __b,vector signed short * __c)12459 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b,
12460 vector signed short *__c) {
12461 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12462 }
12463
vec_vsx_st(vector signed short __a,int __b,signed short * __c)12464 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b,
12465 signed short *__c) {
12466 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12467 }
12468
vec_vsx_st(vector unsigned short __a,int __b,vector unsigned short * __c)12469 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a,
12470 int __b,
12471 vector unsigned short *__c) {
12472 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12473 }
12474
vec_vsx_st(vector unsigned short __a,int __b,unsigned short * __c)12475 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a,
12476 int __b, unsigned short *__c) {
12477 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12478 }
12479
vec_vsx_st(vector bool char __a,int __b,vector bool char * __c)12480 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
12481 vector bool char *__c) {
12482 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12483 }
12484
vec_vsx_st(vector bool char __a,int __b,signed char * __c)12485 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
12486 signed char *__c) {
12487 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12488 }
12489
vec_vsx_st(vector bool char __a,int __b,unsigned char * __c)12490 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
12491 unsigned char *__c) {
12492 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12493 }
12494
vec_vsx_st(vector signed char __a,int __b,vector signed char * __c)12495 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b,
12496 vector signed char *__c) {
12497 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12498 }
12499
vec_vsx_st(vector signed char __a,int __b,signed char * __c)12500 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b,
12501 signed char *__c) {
12502 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12503 }
12504
vec_vsx_st(vector unsigned char __a,int __b,vector unsigned char * __c)12505 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a,
12506 int __b,
12507 vector unsigned char *__c) {
12508 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12509 }
12510
vec_vsx_st(vector unsigned char __a,int __b,unsigned char * __c)12511 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a,
12512 int __b, unsigned char *__c) {
12513 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12514 }
12515
12516 #endif
12517
12518 #ifdef __VSX__
12519 #define vec_xxpermdi __builtin_vsx_xxpermdi
12520 #define vec_xxsldwi __builtin_vsx_xxsldwi
12521 #endif
12522
12523 /* vec_xor */
12524
12525 #define __builtin_altivec_vxor vec_xor
12526
12527 static __inline__ vector signed char __ATTRS_o_ai
vec_xor(vector signed char __a,vector signed char __b)12528 vec_xor(vector signed char __a, vector signed char __b) {
12529 return __a ^ __b;
12530 }
12531
12532 static __inline__ vector signed char __ATTRS_o_ai
vec_xor(vector bool char __a,vector signed char __b)12533 vec_xor(vector bool char __a, vector signed char __b) {
12534 return (vector signed char)__a ^ __b;
12535 }
12536
12537 static __inline__ vector signed char __ATTRS_o_ai
vec_xor(vector signed char __a,vector bool char __b)12538 vec_xor(vector signed char __a, vector bool char __b) {
12539 return __a ^ (vector signed char)__b;
12540 }
12541
12542 static __inline__ vector unsigned char __ATTRS_o_ai
vec_xor(vector unsigned char __a,vector unsigned char __b)12543 vec_xor(vector unsigned char __a, vector unsigned char __b) {
12544 return __a ^ __b;
12545 }
12546
12547 static __inline__ vector unsigned char __ATTRS_o_ai
vec_xor(vector bool char __a,vector unsigned char __b)12548 vec_xor(vector bool char __a, vector unsigned char __b) {
12549 return (vector unsigned char)__a ^ __b;
12550 }
12551
12552 static __inline__ vector unsigned char __ATTRS_o_ai
vec_xor(vector unsigned char __a,vector bool char __b)12553 vec_xor(vector unsigned char __a, vector bool char __b) {
12554 return __a ^ (vector unsigned char)__b;
12555 }
12556
vec_xor(vector bool char __a,vector bool char __b)12557 static __inline__ vector bool char __ATTRS_o_ai vec_xor(vector bool char __a,
12558 vector bool char __b) {
12559 return __a ^ __b;
12560 }
12561
vec_xor(vector short __a,vector short __b)12562 static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a,
12563 vector short __b) {
12564 return __a ^ __b;
12565 }
12566
vec_xor(vector bool short __a,vector short __b)12567 static __inline__ vector short __ATTRS_o_ai vec_xor(vector bool short __a,
12568 vector short __b) {
12569 return (vector short)__a ^ __b;
12570 }
12571
vec_xor(vector short __a,vector bool short __b)12572 static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a,
12573 vector bool short __b) {
12574 return __a ^ (vector short)__b;
12575 }
12576
12577 static __inline__ vector unsigned short __ATTRS_o_ai
vec_xor(vector unsigned short __a,vector unsigned short __b)12578 vec_xor(vector unsigned short __a, vector unsigned short __b) {
12579 return __a ^ __b;
12580 }
12581
12582 static __inline__ vector unsigned short __ATTRS_o_ai
vec_xor(vector bool short __a,vector unsigned short __b)12583 vec_xor(vector bool short __a, vector unsigned short __b) {
12584 return (vector unsigned short)__a ^ __b;
12585 }
12586
12587 static __inline__ vector unsigned short __ATTRS_o_ai
vec_xor(vector unsigned short __a,vector bool short __b)12588 vec_xor(vector unsigned short __a, vector bool short __b) {
12589 return __a ^ (vector unsigned short)__b;
12590 }
12591
12592 static __inline__ vector bool short __ATTRS_o_ai
vec_xor(vector bool short __a,vector bool short __b)12593 vec_xor(vector bool short __a, vector bool short __b) {
12594 return __a ^ __b;
12595 }
12596
vec_xor(vector int __a,vector int __b)12597 static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a,
12598 vector int __b) {
12599 return __a ^ __b;
12600 }
12601
vec_xor(vector bool int __a,vector int __b)12602 static __inline__ vector int __ATTRS_o_ai vec_xor(vector bool int __a,
12603 vector int __b) {
12604 return (vector int)__a ^ __b;
12605 }
12606
vec_xor(vector int __a,vector bool int __b)12607 static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a,
12608 vector bool int __b) {
12609 return __a ^ (vector int)__b;
12610 }
12611
12612 static __inline__ vector unsigned int __ATTRS_o_ai
vec_xor(vector unsigned int __a,vector unsigned int __b)12613 vec_xor(vector unsigned int __a, vector unsigned int __b) {
12614 return __a ^ __b;
12615 }
12616
12617 static __inline__ vector unsigned int __ATTRS_o_ai
vec_xor(vector bool int __a,vector unsigned int __b)12618 vec_xor(vector bool int __a, vector unsigned int __b) {
12619 return (vector unsigned int)__a ^ __b;
12620 }
12621
12622 static __inline__ vector unsigned int __ATTRS_o_ai
vec_xor(vector unsigned int __a,vector bool int __b)12623 vec_xor(vector unsigned int __a, vector bool int __b) {
12624 return __a ^ (vector unsigned int)__b;
12625 }
12626
vec_xor(vector bool int __a,vector bool int __b)12627 static __inline__ vector bool int __ATTRS_o_ai vec_xor(vector bool int __a,
12628 vector bool int __b) {
12629 return __a ^ __b;
12630 }
12631
vec_xor(vector float __a,vector float __b)12632 static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a,
12633 vector float __b) {
12634 vector unsigned int __res =
12635 (vector unsigned int)__a ^ (vector unsigned int)__b;
12636 return (vector float)__res;
12637 }
12638
vec_xor(vector bool int __a,vector float __b)12639 static __inline__ vector float __ATTRS_o_ai vec_xor(vector bool int __a,
12640 vector float __b) {
12641 vector unsigned int __res =
12642 (vector unsigned int)__a ^ (vector unsigned int)__b;
12643 return (vector float)__res;
12644 }
12645
vec_xor(vector float __a,vector bool int __b)12646 static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a,
12647 vector bool int __b) {
12648 vector unsigned int __res =
12649 (vector unsigned int)__a ^ (vector unsigned int)__b;
12650 return (vector float)__res;
12651 }
12652
12653 #ifdef __VSX__
12654 static __inline__ vector signed long long __ATTRS_o_ai
vec_xor(vector signed long long __a,vector signed long long __b)12655 vec_xor(vector signed long long __a, vector signed long long __b) {
12656 return __a ^ __b;
12657 }
12658
12659 static __inline__ vector signed long long __ATTRS_o_ai
vec_xor(vector bool long long __a,vector signed long long __b)12660 vec_xor(vector bool long long __a, vector signed long long __b) {
12661 return (vector signed long long)__a ^ __b;
12662 }
12663
12664 static __inline__ vector signed long long __ATTRS_o_ai
vec_xor(vector signed long long __a,vector bool long long __b)12665 vec_xor(vector signed long long __a, vector bool long long __b) {
12666 return __a ^ (vector signed long long)__b;
12667 }
12668
12669 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_xor(vector unsigned long long __a,vector unsigned long long __b)12670 vec_xor(vector unsigned long long __a, vector unsigned long long __b) {
12671 return __a ^ __b;
12672 }
12673
12674 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_xor(vector bool long long __a,vector unsigned long long __b)12675 vec_xor(vector bool long long __a, vector unsigned long long __b) {
12676 return (vector unsigned long long)__a ^ __b;
12677 }
12678
12679 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_xor(vector unsigned long long __a,vector bool long long __b)12680 vec_xor(vector unsigned long long __a, vector bool long long __b) {
12681 return __a ^ (vector unsigned long long)__b;
12682 }
12683
12684 static __inline__ vector bool long long __ATTRS_o_ai
vec_xor(vector bool long long __a,vector bool long long __b)12685 vec_xor(vector bool long long __a, vector bool long long __b) {
12686 return __a ^ __b;
12687 }
12688
vec_xor(vector double __a,vector double __b)12689 static __inline__ vector double __ATTRS_o_ai vec_xor(vector double __a,
12690 vector double __b) {
12691 return (vector double)((vector unsigned long long)__a ^
12692 (vector unsigned long long)__b);
12693 }
12694
12695 static __inline__ vector double __ATTRS_o_ai
vec_xor(vector double __a,vector bool long long __b)12696 vec_xor(vector double __a, vector bool long long __b) {
12697 return (vector double)((vector unsigned long long)__a ^
12698 (vector unsigned long long)__b);
12699 }
12700
vec_xor(vector bool long long __a,vector double __b)12701 static __inline__ vector double __ATTRS_o_ai vec_xor(vector bool long long __a,
12702 vector double __b) {
12703 return (vector double)((vector unsigned long long)__a ^
12704 (vector unsigned long long)__b);
12705 }
12706 #endif
12707
12708 /* vec_vxor */
12709
12710 static __inline__ vector signed char __ATTRS_o_ai
vec_vxor(vector signed char __a,vector signed char __b)12711 vec_vxor(vector signed char __a, vector signed char __b) {
12712 return __a ^ __b;
12713 }
12714
12715 static __inline__ vector signed char __ATTRS_o_ai
vec_vxor(vector bool char __a,vector signed char __b)12716 vec_vxor(vector bool char __a, vector signed char __b) {
12717 return (vector signed char)__a ^ __b;
12718 }
12719
12720 static __inline__ vector signed char __ATTRS_o_ai
vec_vxor(vector signed char __a,vector bool char __b)12721 vec_vxor(vector signed char __a, vector bool char __b) {
12722 return __a ^ (vector signed char)__b;
12723 }
12724
12725 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vxor(vector unsigned char __a,vector unsigned char __b)12726 vec_vxor(vector unsigned char __a, vector unsigned char __b) {
12727 return __a ^ __b;
12728 }
12729
12730 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vxor(vector bool char __a,vector unsigned char __b)12731 vec_vxor(vector bool char __a, vector unsigned char __b) {
12732 return (vector unsigned char)__a ^ __b;
12733 }
12734
12735 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vxor(vector unsigned char __a,vector bool char __b)12736 vec_vxor(vector unsigned char __a, vector bool char __b) {
12737 return __a ^ (vector unsigned char)__b;
12738 }
12739
vec_vxor(vector bool char __a,vector bool char __b)12740 static __inline__ vector bool char __ATTRS_o_ai vec_vxor(vector bool char __a,
12741 vector bool char __b) {
12742 return __a ^ __b;
12743 }
12744
vec_vxor(vector short __a,vector short __b)12745 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a,
12746 vector short __b) {
12747 return __a ^ __b;
12748 }
12749
vec_vxor(vector bool short __a,vector short __b)12750 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector bool short __a,
12751 vector short __b) {
12752 return (vector short)__a ^ __b;
12753 }
12754
vec_vxor(vector short __a,vector bool short __b)12755 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a,
12756 vector bool short __b) {
12757 return __a ^ (vector short)__b;
12758 }
12759
12760 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vxor(vector unsigned short __a,vector unsigned short __b)12761 vec_vxor(vector unsigned short __a, vector unsigned short __b) {
12762 return __a ^ __b;
12763 }
12764
12765 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vxor(vector bool short __a,vector unsigned short __b)12766 vec_vxor(vector bool short __a, vector unsigned short __b) {
12767 return (vector unsigned short)__a ^ __b;
12768 }
12769
12770 static __inline__ vector unsigned short __ATTRS_o_ai
vec_vxor(vector unsigned short __a,vector bool short __b)12771 vec_vxor(vector unsigned short __a, vector bool short __b) {
12772 return __a ^ (vector unsigned short)__b;
12773 }
12774
12775 static __inline__ vector bool short __ATTRS_o_ai
vec_vxor(vector bool short __a,vector bool short __b)12776 vec_vxor(vector bool short __a, vector bool short __b) {
12777 return __a ^ __b;
12778 }
12779
vec_vxor(vector int __a,vector int __b)12780 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a,
12781 vector int __b) {
12782 return __a ^ __b;
12783 }
12784
vec_vxor(vector bool int __a,vector int __b)12785 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector bool int __a,
12786 vector int __b) {
12787 return (vector int)__a ^ __b;
12788 }
12789
vec_vxor(vector int __a,vector bool int __b)12790 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a,
12791 vector bool int __b) {
12792 return __a ^ (vector int)__b;
12793 }
12794
12795 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vxor(vector unsigned int __a,vector unsigned int __b)12796 vec_vxor(vector unsigned int __a, vector unsigned int __b) {
12797 return __a ^ __b;
12798 }
12799
12800 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vxor(vector bool int __a,vector unsigned int __b)12801 vec_vxor(vector bool int __a, vector unsigned int __b) {
12802 return (vector unsigned int)__a ^ __b;
12803 }
12804
12805 static __inline__ vector unsigned int __ATTRS_o_ai
vec_vxor(vector unsigned int __a,vector bool int __b)12806 vec_vxor(vector unsigned int __a, vector bool int __b) {
12807 return __a ^ (vector unsigned int)__b;
12808 }
12809
vec_vxor(vector bool int __a,vector bool int __b)12810 static __inline__ vector bool int __ATTRS_o_ai vec_vxor(vector bool int __a,
12811 vector bool int __b) {
12812 return __a ^ __b;
12813 }
12814
vec_vxor(vector float __a,vector float __b)12815 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a,
12816 vector float __b) {
12817 vector unsigned int __res =
12818 (vector unsigned int)__a ^ (vector unsigned int)__b;
12819 return (vector float)__res;
12820 }
12821
vec_vxor(vector bool int __a,vector float __b)12822 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector bool int __a,
12823 vector float __b) {
12824 vector unsigned int __res =
12825 (vector unsigned int)__a ^ (vector unsigned int)__b;
12826 return (vector float)__res;
12827 }
12828
vec_vxor(vector float __a,vector bool int __b)12829 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a,
12830 vector bool int __b) {
12831 vector unsigned int __res =
12832 (vector unsigned int)__a ^ (vector unsigned int)__b;
12833 return (vector float)__res;
12834 }
12835
12836 #ifdef __VSX__
12837 static __inline__ vector signed long long __ATTRS_o_ai
vec_vxor(vector signed long long __a,vector signed long long __b)12838 vec_vxor(vector signed long long __a, vector signed long long __b) {
12839 return __a ^ __b;
12840 }
12841
12842 static __inline__ vector signed long long __ATTRS_o_ai
vec_vxor(vector bool long long __a,vector signed long long __b)12843 vec_vxor(vector bool long long __a, vector signed long long __b) {
12844 return (vector signed long long)__a ^ __b;
12845 }
12846
12847 static __inline__ vector signed long long __ATTRS_o_ai
vec_vxor(vector signed long long __a,vector bool long long __b)12848 vec_vxor(vector signed long long __a, vector bool long long __b) {
12849 return __a ^ (vector signed long long)__b;
12850 }
12851
12852 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_vxor(vector unsigned long long __a,vector unsigned long long __b)12853 vec_vxor(vector unsigned long long __a, vector unsigned long long __b) {
12854 return __a ^ __b;
12855 }
12856
12857 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_vxor(vector bool long long __a,vector unsigned long long __b)12858 vec_vxor(vector bool long long __a, vector unsigned long long __b) {
12859 return (vector unsigned long long)__a ^ __b;
12860 }
12861
12862 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_vxor(vector unsigned long long __a,vector bool long long __b)12863 vec_vxor(vector unsigned long long __a, vector bool long long __b) {
12864 return __a ^ (vector unsigned long long)__b;
12865 }
12866
12867 static __inline__ vector bool long long __ATTRS_o_ai
vec_vxor(vector bool long long __a,vector bool long long __b)12868 vec_vxor(vector bool long long __a, vector bool long long __b) {
12869 return __a ^ __b;
12870 }
12871 #endif
12872
12873 /* ------------------------ extensions for CBEA ----------------------------- */
12874
12875 /* vec_extract */
12876
vec_extract(vector signed char __a,int __b)12877 static __inline__ signed char __ATTRS_o_ai vec_extract(vector signed char __a,
12878 int __b) {
12879 return __a[__b];
12880 }
12881
12882 static __inline__ unsigned char __ATTRS_o_ai
vec_extract(vector unsigned char __a,int __b)12883 vec_extract(vector unsigned char __a, int __b) {
12884 return __a[__b];
12885 }
12886
vec_extract(vector bool char __a,int __b)12887 static __inline__ unsigned char __ATTRS_o_ai vec_extract(vector bool char __a,
12888 int __b) {
12889 return __a[__b];
12890 }
12891
vec_extract(vector signed short __a,int __b)12892 static __inline__ signed short __ATTRS_o_ai vec_extract(vector signed short __a,
12893 int __b) {
12894 return __a[__b];
12895 }
12896
12897 static __inline__ unsigned short __ATTRS_o_ai
vec_extract(vector unsigned short __a,int __b)12898 vec_extract(vector unsigned short __a, int __b) {
12899 return __a[__b];
12900 }
12901
vec_extract(vector bool short __a,int __b)12902 static __inline__ unsigned short __ATTRS_o_ai vec_extract(vector bool short __a,
12903 int __b) {
12904 return __a[__b];
12905 }
12906
vec_extract(vector signed int __a,int __b)12907 static __inline__ signed int __ATTRS_o_ai vec_extract(vector signed int __a,
12908 int __b) {
12909 return __a[__b];
12910 }
12911
vec_extract(vector unsigned int __a,int __b)12912 static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector unsigned int __a,
12913 int __b) {
12914 return __a[__b];
12915 }
12916
vec_extract(vector bool int __a,int __b)12917 static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector bool int __a,
12918 int __b) {
12919 return __a[__b];
12920 }
12921
12922 #ifdef __VSX__
12923 static __inline__ signed long long __ATTRS_o_ai
vec_extract(vector signed long long __a,int __b)12924 vec_extract(vector signed long long __a, int __b) {
12925 return __a[__b];
12926 }
12927
12928 static __inline__ unsigned long long __ATTRS_o_ai
vec_extract(vector unsigned long long __a,int __b)12929 vec_extract(vector unsigned long long __a, int __b) {
12930 return __a[__b];
12931 }
12932
12933 static __inline__ unsigned long long __ATTRS_o_ai
vec_extract(vector bool long long __a,int __b)12934 vec_extract(vector bool long long __a, int __b) {
12935 return __a[__b];
12936 }
12937
vec_extract(vector double __a,int __b)12938 static __inline__ double __ATTRS_o_ai vec_extract(vector double __a, int __b) {
12939 return __a[__b];
12940 }
12941 #endif
12942
vec_extract(vector float __a,int __b)12943 static __inline__ float __ATTRS_o_ai vec_extract(vector float __a, int __b) {
12944 return __a[__b];
12945 }
12946
12947 #ifdef __POWER9_VECTOR__
12948
12949 #define vec_insert4b __builtin_vsx_insertword
12950 #define vec_extract4b __builtin_vsx_extractuword
12951
12952 /* vec_extract_exp */
12953
12954 static __inline__ vector unsigned int __ATTRS_o_ai
vec_extract_exp(vector float __a)12955 vec_extract_exp(vector float __a) {
12956 return __builtin_vsx_xvxexpsp(__a);
12957 }
12958
12959 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_extract_exp(vector double __a)12960 vec_extract_exp(vector double __a) {
12961 return __builtin_vsx_xvxexpdp(__a);
12962 }
12963
12964 /* vec_extract_sig */
12965
12966 static __inline__ vector unsigned int __ATTRS_o_ai
vec_extract_sig(vector float __a)12967 vec_extract_sig(vector float __a) {
12968 return __builtin_vsx_xvxsigsp(__a);
12969 }
12970
12971 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_extract_sig(vector double __a)12972 vec_extract_sig (vector double __a) {
12973 return __builtin_vsx_xvxsigdp(__a);
12974 }
12975
12976 static __inline__ vector float __ATTRS_o_ai
vec_extract_fp32_from_shorth(vector unsigned short __a)12977 vec_extract_fp32_from_shorth(vector unsigned short __a) {
12978 vector unsigned short __b =
12979 #ifdef __LITTLE_ENDIAN__
12980 __builtin_shufflevector(__a, __a, 0, -1, 1, -1, 2, -1, 3, -1);
12981 #else
12982 __builtin_shufflevector(__a, __a, -1, 0, -1, 1, -1, 2, -1, 3);
12983 #endif
12984 return __builtin_vsx_xvcvhpsp(__b);
12985 }
12986
12987 static __inline__ vector float __ATTRS_o_ai
vec_extract_fp32_from_shortl(vector unsigned short __a)12988 vec_extract_fp32_from_shortl(vector unsigned short __a) {
12989 vector unsigned short __b =
12990 #ifdef __LITTLE_ENDIAN__
12991 __builtin_shufflevector(__a, __a, 4, -1, 5, -1, 6, -1, 7, -1);
12992 #else
12993 __builtin_shufflevector(__a, __a, -1, 4, -1, 5, -1, 6, -1, 7);
12994 #endif
12995 return __builtin_vsx_xvcvhpsp(__b);
12996 }
12997 #endif /* __POWER9_VECTOR__ */
12998
12999 /* vec_insert */
13000
13001 static __inline__ vector signed char __ATTRS_o_ai
vec_insert(signed char __a,vector signed char __b,int __c)13002 vec_insert(signed char __a, vector signed char __b, int __c) {
13003 __b[__c] = __a;
13004 return __b;
13005 }
13006
13007 static __inline__ vector unsigned char __ATTRS_o_ai
vec_insert(unsigned char __a,vector unsigned char __b,int __c)13008 vec_insert(unsigned char __a, vector unsigned char __b, int __c) {
13009 __b[__c] = __a;
13010 return __b;
13011 }
13012
vec_insert(unsigned char __a,vector bool char __b,int __c)13013 static __inline__ vector bool char __ATTRS_o_ai vec_insert(unsigned char __a,
13014 vector bool char __b,
13015 int __c) {
13016 __b[__c] = __a;
13017 return __b;
13018 }
13019
13020 static __inline__ vector signed short __ATTRS_o_ai
vec_insert(signed short __a,vector signed short __b,int __c)13021 vec_insert(signed short __a, vector signed short __b, int __c) {
13022 __b[__c] = __a;
13023 return __b;
13024 }
13025
13026 static __inline__ vector unsigned short __ATTRS_o_ai
vec_insert(unsigned short __a,vector unsigned short __b,int __c)13027 vec_insert(unsigned short __a, vector unsigned short __b, int __c) {
13028 __b[__c] = __a;
13029 return __b;
13030 }
13031
13032 static __inline__ vector bool short __ATTRS_o_ai
vec_insert(unsigned short __a,vector bool short __b,int __c)13033 vec_insert(unsigned short __a, vector bool short __b, int __c) {
13034 __b[__c] = __a;
13035 return __b;
13036 }
13037
13038 static __inline__ vector signed int __ATTRS_o_ai
vec_insert(signed int __a,vector signed int __b,int __c)13039 vec_insert(signed int __a, vector signed int __b, int __c) {
13040 __b[__c] = __a;
13041 return __b;
13042 }
13043
13044 static __inline__ vector unsigned int __ATTRS_o_ai
vec_insert(unsigned int __a,vector unsigned int __b,int __c)13045 vec_insert(unsigned int __a, vector unsigned int __b, int __c) {
13046 __b[__c] = __a;
13047 return __b;
13048 }
13049
vec_insert(unsigned int __a,vector bool int __b,int __c)13050 static __inline__ vector bool int __ATTRS_o_ai vec_insert(unsigned int __a,
13051 vector bool int __b,
13052 int __c) {
13053 __b[__c] = __a;
13054 return __b;
13055 }
13056
13057 #ifdef __VSX__
13058 static __inline__ vector signed long long __ATTRS_o_ai
vec_insert(signed long long __a,vector signed long long __b,int __c)13059 vec_insert(signed long long __a, vector signed long long __b, int __c) {
13060 __b[__c] = __a;
13061 return __b;
13062 }
13063
13064 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_insert(unsigned long long __a,vector unsigned long long __b,int __c)13065 vec_insert(unsigned long long __a, vector unsigned long long __b, int __c) {
13066 __b[__c] = __a;
13067 return __b;
13068 }
13069
13070 static __inline__ vector bool long long __ATTRS_o_ai
vec_insert(unsigned long long __a,vector bool long long __b,int __c)13071 vec_insert(unsigned long long __a, vector bool long long __b, int __c) {
13072 __b[__c] = __a;
13073 return __b;
13074 }
vec_insert(double __a,vector double __b,int __c)13075 static __inline__ vector double __ATTRS_o_ai vec_insert(double __a,
13076 vector double __b,
13077 int __c) {
13078 __b[__c] = __a;
13079 return __b;
13080 }
13081 #endif
13082
vec_insert(float __a,vector float __b,int __c)13083 static __inline__ vector float __ATTRS_o_ai vec_insert(float __a,
13084 vector float __b,
13085 int __c) {
13086 __b[__c] = __a;
13087 return __b;
13088 }
13089
13090 /* vec_lvlx */
13091
13092 static __inline__ vector signed char __ATTRS_o_ai
vec_lvlx(int __a,const signed char * __b)13093 vec_lvlx(int __a, const signed char *__b) {
13094 return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
13095 vec_lvsl(__a, __b));
13096 }
13097
13098 static __inline__ vector signed char __ATTRS_o_ai
vec_lvlx(int __a,const vector signed char * __b)13099 vec_lvlx(int __a, const vector signed char *__b) {
13100 return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
13101 vec_lvsl(__a, (unsigned char *)__b));
13102 }
13103
13104 static __inline__ vector unsigned char __ATTRS_o_ai
vec_lvlx(int __a,const unsigned char * __b)13105 vec_lvlx(int __a, const unsigned char *__b) {
13106 return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
13107 vec_lvsl(__a, __b));
13108 }
13109
13110 static __inline__ vector unsigned char __ATTRS_o_ai
vec_lvlx(int __a,const vector unsigned char * __b)13111 vec_lvlx(int __a, const vector unsigned char *__b) {
13112 return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
13113 vec_lvsl(__a, (unsigned char *)__b));
13114 }
13115
13116 static __inline__ vector bool char __ATTRS_o_ai
vec_lvlx(int __a,const vector bool char * __b)13117 vec_lvlx(int __a, const vector bool char *__b) {
13118 return vec_perm(vec_ld(__a, __b), (vector bool char)(0),
13119 vec_lvsl(__a, (unsigned char *)__b));
13120 }
13121
vec_lvlx(int __a,const short * __b)13122 static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a,
13123 const short *__b) {
13124 return vec_perm(vec_ld(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
13125 }
13126
vec_lvlx(int __a,const vector short * __b)13127 static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a,
13128 const vector short *__b) {
13129 return vec_perm(vec_ld(__a, __b), (vector short)(0),
13130 vec_lvsl(__a, (unsigned char *)__b));
13131 }
13132
13133 static __inline__ vector unsigned short __ATTRS_o_ai
vec_lvlx(int __a,const unsigned short * __b)13134 vec_lvlx(int __a, const unsigned short *__b) {
13135 return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
13136 vec_lvsl(__a, __b));
13137 }
13138
13139 static __inline__ vector unsigned short __ATTRS_o_ai
vec_lvlx(int __a,const vector unsigned short * __b)13140 vec_lvlx(int __a, const vector unsigned short *__b) {
13141 return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
13142 vec_lvsl(__a, (unsigned char *)__b));
13143 }
13144
13145 static __inline__ vector bool short __ATTRS_o_ai
vec_lvlx(int __a,const vector bool short * __b)13146 vec_lvlx(int __a, const vector bool short *__b) {
13147 return vec_perm(vec_ld(__a, __b), (vector bool short)(0),
13148 vec_lvsl(__a, (unsigned char *)__b));
13149 }
13150
vec_lvlx(int __a,const vector pixel * __b)13151 static __inline__ vector pixel __ATTRS_o_ai vec_lvlx(int __a,
13152 const vector pixel *__b) {
13153 return vec_perm(vec_ld(__a, __b), (vector pixel)(0),
13154 vec_lvsl(__a, (unsigned char *)__b));
13155 }
13156
vec_lvlx(int __a,const int * __b)13157 static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a, const int *__b) {
13158 return vec_perm(vec_ld(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
13159 }
13160
vec_lvlx(int __a,const vector int * __b)13161 static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a,
13162 const vector int *__b) {
13163 return vec_perm(vec_ld(__a, __b), (vector int)(0),
13164 vec_lvsl(__a, (unsigned char *)__b));
13165 }
13166
13167 static __inline__ vector unsigned int __ATTRS_o_ai
vec_lvlx(int __a,const unsigned int * __b)13168 vec_lvlx(int __a, const unsigned int *__b) {
13169 return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
13170 vec_lvsl(__a, __b));
13171 }
13172
13173 static __inline__ vector unsigned int __ATTRS_o_ai
vec_lvlx(int __a,const vector unsigned int * __b)13174 vec_lvlx(int __a, const vector unsigned int *__b) {
13175 return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
13176 vec_lvsl(__a, (unsigned char *)__b));
13177 }
13178
13179 static __inline__ vector bool int __ATTRS_o_ai
vec_lvlx(int __a,const vector bool int * __b)13180 vec_lvlx(int __a, const vector bool int *__b) {
13181 return vec_perm(vec_ld(__a, __b), (vector bool int)(0),
13182 vec_lvsl(__a, (unsigned char *)__b));
13183 }
13184
vec_lvlx(int __a,const float * __b)13185 static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a,
13186 const float *__b) {
13187 return vec_perm(vec_ld(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
13188 }
13189
vec_lvlx(int __a,const vector float * __b)13190 static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a,
13191 const vector float *__b) {
13192 return vec_perm(vec_ld(__a, __b), (vector float)(0),
13193 vec_lvsl(__a, (unsigned char *)__b));
13194 }
13195
13196 /* vec_lvlxl */
13197
13198 static __inline__ vector signed char __ATTRS_o_ai
vec_lvlxl(int __a,const signed char * __b)13199 vec_lvlxl(int __a, const signed char *__b) {
13200 return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
13201 vec_lvsl(__a, __b));
13202 }
13203
13204 static __inline__ vector signed char __ATTRS_o_ai
vec_lvlxl(int __a,const vector signed char * __b)13205 vec_lvlxl(int __a, const vector signed char *__b) {
13206 return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
13207 vec_lvsl(__a, (unsigned char *)__b));
13208 }
13209
13210 static __inline__ vector unsigned char __ATTRS_o_ai
vec_lvlxl(int __a,const unsigned char * __b)13211 vec_lvlxl(int __a, const unsigned char *__b) {
13212 return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
13213 vec_lvsl(__a, __b));
13214 }
13215
13216 static __inline__ vector unsigned char __ATTRS_o_ai
vec_lvlxl(int __a,const vector unsigned char * __b)13217 vec_lvlxl(int __a, const vector unsigned char *__b) {
13218 return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
13219 vec_lvsl(__a, (unsigned char *)__b));
13220 }
13221
13222 static __inline__ vector bool char __ATTRS_o_ai
vec_lvlxl(int __a,const vector bool char * __b)13223 vec_lvlxl(int __a, const vector bool char *__b) {
13224 return vec_perm(vec_ldl(__a, __b), (vector bool char)(0),
13225 vec_lvsl(__a, (unsigned char *)__b));
13226 }
13227
vec_lvlxl(int __a,const short * __b)13228 static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a,
13229 const short *__b) {
13230 return vec_perm(vec_ldl(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
13231 }
13232
vec_lvlxl(int __a,const vector short * __b)13233 static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a,
13234 const vector short *__b) {
13235 return vec_perm(vec_ldl(__a, __b), (vector short)(0),
13236 vec_lvsl(__a, (unsigned char *)__b));
13237 }
13238
13239 static __inline__ vector unsigned short __ATTRS_o_ai
vec_lvlxl(int __a,const unsigned short * __b)13240 vec_lvlxl(int __a, const unsigned short *__b) {
13241 return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
13242 vec_lvsl(__a, __b));
13243 }
13244
13245 static __inline__ vector unsigned short __ATTRS_o_ai
vec_lvlxl(int __a,const vector unsigned short * __b)13246 vec_lvlxl(int __a, const vector unsigned short *__b) {
13247 return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
13248 vec_lvsl(__a, (unsigned char *)__b));
13249 }
13250
13251 static __inline__ vector bool short __ATTRS_o_ai
vec_lvlxl(int __a,const vector bool short * __b)13252 vec_lvlxl(int __a, const vector bool short *__b) {
13253 return vec_perm(vec_ldl(__a, __b), (vector bool short)(0),
13254 vec_lvsl(__a, (unsigned char *)__b));
13255 }
13256
vec_lvlxl(int __a,const vector pixel * __b)13257 static __inline__ vector pixel __ATTRS_o_ai vec_lvlxl(int __a,
13258 const vector pixel *__b) {
13259 return vec_perm(vec_ldl(__a, __b), (vector pixel)(0),
13260 vec_lvsl(__a, (unsigned char *)__b));
13261 }
13262
vec_lvlxl(int __a,const int * __b)13263 static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a, const int *__b) {
13264 return vec_perm(vec_ldl(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
13265 }
13266
vec_lvlxl(int __a,const vector int * __b)13267 static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a,
13268 const vector int *__b) {
13269 return vec_perm(vec_ldl(__a, __b), (vector int)(0),
13270 vec_lvsl(__a, (unsigned char *)__b));
13271 }
13272
13273 static __inline__ vector unsigned int __ATTRS_o_ai
vec_lvlxl(int __a,const unsigned int * __b)13274 vec_lvlxl(int __a, const unsigned int *__b) {
13275 return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
13276 vec_lvsl(__a, __b));
13277 }
13278
13279 static __inline__ vector unsigned int __ATTRS_o_ai
vec_lvlxl(int __a,const vector unsigned int * __b)13280 vec_lvlxl(int __a, const vector unsigned int *__b) {
13281 return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
13282 vec_lvsl(__a, (unsigned char *)__b));
13283 }
13284
13285 static __inline__ vector bool int __ATTRS_o_ai
vec_lvlxl(int __a,const vector bool int * __b)13286 vec_lvlxl(int __a, const vector bool int *__b) {
13287 return vec_perm(vec_ldl(__a, __b), (vector bool int)(0),
13288 vec_lvsl(__a, (unsigned char *)__b));
13289 }
13290
vec_lvlxl(int __a,const float * __b)13291 static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a,
13292 const float *__b) {
13293 return vec_perm(vec_ldl(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
13294 }
13295
vec_lvlxl(int __a,vector float * __b)13296 static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a,
13297 vector float *__b) {
13298 return vec_perm(vec_ldl(__a, __b), (vector float)(0),
13299 vec_lvsl(__a, (unsigned char *)__b));
13300 }
13301
13302 /* vec_lvrx */
13303
13304 static __inline__ vector signed char __ATTRS_o_ai
vec_lvrx(int __a,const signed char * __b)13305 vec_lvrx(int __a, const signed char *__b) {
13306 return vec_perm((vector signed char)(0), vec_ld(__a, __b),
13307 vec_lvsl(__a, __b));
13308 }
13309
13310 static __inline__ vector signed char __ATTRS_o_ai
vec_lvrx(int __a,const vector signed char * __b)13311 vec_lvrx(int __a, const vector signed char *__b) {
13312 return vec_perm((vector signed char)(0), vec_ld(__a, __b),
13313 vec_lvsl(__a, (unsigned char *)__b));
13314 }
13315
13316 static __inline__ vector unsigned char __ATTRS_o_ai
vec_lvrx(int __a,const unsigned char * __b)13317 vec_lvrx(int __a, const unsigned char *__b) {
13318 return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
13319 vec_lvsl(__a, __b));
13320 }
13321
13322 static __inline__ vector unsigned char __ATTRS_o_ai
vec_lvrx(int __a,const vector unsigned char * __b)13323 vec_lvrx(int __a, const vector unsigned char *__b) {
13324 return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
13325 vec_lvsl(__a, (unsigned char *)__b));
13326 }
13327
13328 static __inline__ vector bool char __ATTRS_o_ai
vec_lvrx(int __a,const vector bool char * __b)13329 vec_lvrx(int __a, const vector bool char *__b) {
13330 return vec_perm((vector bool char)(0), vec_ld(__a, __b),
13331 vec_lvsl(__a, (unsigned char *)__b));
13332 }
13333
vec_lvrx(int __a,const short * __b)13334 static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a,
13335 const short *__b) {
13336 return vec_perm((vector short)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
13337 }
13338
vec_lvrx(int __a,const vector short * __b)13339 static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a,
13340 const vector short *__b) {
13341 return vec_perm((vector short)(0), vec_ld(__a, __b),
13342 vec_lvsl(__a, (unsigned char *)__b));
13343 }
13344
13345 static __inline__ vector unsigned short __ATTRS_o_ai
vec_lvrx(int __a,const unsigned short * __b)13346 vec_lvrx(int __a, const unsigned short *__b) {
13347 return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
13348 vec_lvsl(__a, __b));
13349 }
13350
13351 static __inline__ vector unsigned short __ATTRS_o_ai
vec_lvrx(int __a,const vector unsigned short * __b)13352 vec_lvrx(int __a, const vector unsigned short *__b) {
13353 return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
13354 vec_lvsl(__a, (unsigned char *)__b));
13355 }
13356
13357 static __inline__ vector bool short __ATTRS_o_ai
vec_lvrx(int __a,const vector bool short * __b)13358 vec_lvrx(int __a, const vector bool short *__b) {
13359 return vec_perm((vector bool short)(0), vec_ld(__a, __b),
13360 vec_lvsl(__a, (unsigned char *)__b));
13361 }
13362
vec_lvrx(int __a,const vector pixel * __b)13363 static __inline__ vector pixel __ATTRS_o_ai vec_lvrx(int __a,
13364 const vector pixel *__b) {
13365 return vec_perm((vector pixel)(0), vec_ld(__a, __b),
13366 vec_lvsl(__a, (unsigned char *)__b));
13367 }
13368
vec_lvrx(int __a,const int * __b)13369 static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a, const int *__b) {
13370 return vec_perm((vector int)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
13371 }
13372
vec_lvrx(int __a,const vector int * __b)13373 static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a,
13374 const vector int *__b) {
13375 return vec_perm((vector int)(0), vec_ld(__a, __b),
13376 vec_lvsl(__a, (unsigned char *)__b));
13377 }
13378
13379 static __inline__ vector unsigned int __ATTRS_o_ai
vec_lvrx(int __a,const unsigned int * __b)13380 vec_lvrx(int __a, const unsigned int *__b) {
13381 return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
13382 vec_lvsl(__a, __b));
13383 }
13384
13385 static __inline__ vector unsigned int __ATTRS_o_ai
vec_lvrx(int __a,const vector unsigned int * __b)13386 vec_lvrx(int __a, const vector unsigned int *__b) {
13387 return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
13388 vec_lvsl(__a, (unsigned char *)__b));
13389 }
13390
13391 static __inline__ vector bool int __ATTRS_o_ai
vec_lvrx(int __a,const vector bool int * __b)13392 vec_lvrx(int __a, const vector bool int *__b) {
13393 return vec_perm((vector bool int)(0), vec_ld(__a, __b),
13394 vec_lvsl(__a, (unsigned char *)__b));
13395 }
13396
vec_lvrx(int __a,const float * __b)13397 static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a,
13398 const float *__b) {
13399 return vec_perm((vector float)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
13400 }
13401
vec_lvrx(int __a,const vector float * __b)13402 static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a,
13403 const vector float *__b) {
13404 return vec_perm((vector float)(0), vec_ld(__a, __b),
13405 vec_lvsl(__a, (unsigned char *)__b));
13406 }
13407
13408 /* vec_lvrxl */
13409
13410 static __inline__ vector signed char __ATTRS_o_ai
vec_lvrxl(int __a,const signed char * __b)13411 vec_lvrxl(int __a, const signed char *__b) {
13412 return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
13413 vec_lvsl(__a, __b));
13414 }
13415
13416 static __inline__ vector signed char __ATTRS_o_ai
vec_lvrxl(int __a,const vector signed char * __b)13417 vec_lvrxl(int __a, const vector signed char *__b) {
13418 return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
13419 vec_lvsl(__a, (unsigned char *)__b));
13420 }
13421
13422 static __inline__ vector unsigned char __ATTRS_o_ai
vec_lvrxl(int __a,const unsigned char * __b)13423 vec_lvrxl(int __a, const unsigned char *__b) {
13424 return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
13425 vec_lvsl(__a, __b));
13426 }
13427
13428 static __inline__ vector unsigned char __ATTRS_o_ai
vec_lvrxl(int __a,const vector unsigned char * __b)13429 vec_lvrxl(int __a, const vector unsigned char *__b) {
13430 return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
13431 vec_lvsl(__a, (unsigned char *)__b));
13432 }
13433
13434 static __inline__ vector bool char __ATTRS_o_ai
vec_lvrxl(int __a,const vector bool char * __b)13435 vec_lvrxl(int __a, const vector bool char *__b) {
13436 return vec_perm((vector bool char)(0), vec_ldl(__a, __b),
13437 vec_lvsl(__a, (unsigned char *)__b));
13438 }
13439
vec_lvrxl(int __a,const short * __b)13440 static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a,
13441 const short *__b) {
13442 return vec_perm((vector short)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
13443 }
13444
vec_lvrxl(int __a,const vector short * __b)13445 static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a,
13446 const vector short *__b) {
13447 return vec_perm((vector short)(0), vec_ldl(__a, __b),
13448 vec_lvsl(__a, (unsigned char *)__b));
13449 }
13450
13451 static __inline__ vector unsigned short __ATTRS_o_ai
vec_lvrxl(int __a,const unsigned short * __b)13452 vec_lvrxl(int __a, const unsigned short *__b) {
13453 return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
13454 vec_lvsl(__a, __b));
13455 }
13456
13457 static __inline__ vector unsigned short __ATTRS_o_ai
vec_lvrxl(int __a,const vector unsigned short * __b)13458 vec_lvrxl(int __a, const vector unsigned short *__b) {
13459 return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
13460 vec_lvsl(__a, (unsigned char *)__b));
13461 }
13462
13463 static __inline__ vector bool short __ATTRS_o_ai
vec_lvrxl(int __a,const vector bool short * __b)13464 vec_lvrxl(int __a, const vector bool short *__b) {
13465 return vec_perm((vector bool short)(0), vec_ldl(__a, __b),
13466 vec_lvsl(__a, (unsigned char *)__b));
13467 }
13468
vec_lvrxl(int __a,const vector pixel * __b)13469 static __inline__ vector pixel __ATTRS_o_ai vec_lvrxl(int __a,
13470 const vector pixel *__b) {
13471 return vec_perm((vector pixel)(0), vec_ldl(__a, __b),
13472 vec_lvsl(__a, (unsigned char *)__b));
13473 }
13474
vec_lvrxl(int __a,const int * __b)13475 static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a, const int *__b) {
13476 return vec_perm((vector int)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
13477 }
13478
vec_lvrxl(int __a,const vector int * __b)13479 static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a,
13480 const vector int *__b) {
13481 return vec_perm((vector int)(0), vec_ldl(__a, __b),
13482 vec_lvsl(__a, (unsigned char *)__b));
13483 }
13484
13485 static __inline__ vector unsigned int __ATTRS_o_ai
vec_lvrxl(int __a,const unsigned int * __b)13486 vec_lvrxl(int __a, const unsigned int *__b) {
13487 return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
13488 vec_lvsl(__a, __b));
13489 }
13490
13491 static __inline__ vector unsigned int __ATTRS_o_ai
vec_lvrxl(int __a,const vector unsigned int * __b)13492 vec_lvrxl(int __a, const vector unsigned int *__b) {
13493 return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
13494 vec_lvsl(__a, (unsigned char *)__b));
13495 }
13496
13497 static __inline__ vector bool int __ATTRS_o_ai
vec_lvrxl(int __a,const vector bool int * __b)13498 vec_lvrxl(int __a, const vector bool int *__b) {
13499 return vec_perm((vector bool int)(0), vec_ldl(__a, __b),
13500 vec_lvsl(__a, (unsigned char *)__b));
13501 }
13502
vec_lvrxl(int __a,const float * __b)13503 static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a,
13504 const float *__b) {
13505 return vec_perm((vector float)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
13506 }
13507
vec_lvrxl(int __a,const vector float * __b)13508 static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a,
13509 const vector float *__b) {
13510 return vec_perm((vector float)(0), vec_ldl(__a, __b),
13511 vec_lvsl(__a, (unsigned char *)__b));
13512 }
13513
13514 /* vec_stvlx */
13515
vec_stvlx(vector signed char __a,int __b,signed char * __c)13516 static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
13517 signed char *__c) {
13518 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13519 __c);
13520 }
13521
vec_stvlx(vector signed char __a,int __b,vector signed char * __c)13522 static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
13523 vector signed char *__c) {
13524 return vec_st(
13525 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13526 __b, __c);
13527 }
13528
vec_stvlx(vector unsigned char __a,int __b,unsigned char * __c)13529 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
13530 unsigned char *__c) {
13531 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13532 __c);
13533 }
13534
vec_stvlx(vector unsigned char __a,int __b,vector unsigned char * __c)13535 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
13536 vector unsigned char *__c) {
13537 return vec_st(
13538 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13539 __b, __c);
13540 }
13541
vec_stvlx(vector bool char __a,int __b,vector bool char * __c)13542 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool char __a, int __b,
13543 vector bool char *__c) {
13544 return vec_st(
13545 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13546 __b, __c);
13547 }
13548
vec_stvlx(vector short __a,int __b,short * __c)13549 static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
13550 short *__c) {
13551 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13552 __c);
13553 }
13554
vec_stvlx(vector short __a,int __b,vector short * __c)13555 static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
13556 vector short *__c) {
13557 return vec_st(
13558 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13559 __b, __c);
13560 }
13561
vec_stvlx(vector unsigned short __a,int __b,unsigned short * __c)13562 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a,
13563 int __b, unsigned short *__c) {
13564 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13565 __c);
13566 }
13567
vec_stvlx(vector unsigned short __a,int __b,vector unsigned short * __c)13568 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a,
13569 int __b,
13570 vector unsigned short *__c) {
13571 return vec_st(
13572 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13573 __b, __c);
13574 }
13575
vec_stvlx(vector bool short __a,int __b,vector bool short * __c)13576 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool short __a, int __b,
13577 vector bool short *__c) {
13578 return vec_st(
13579 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13580 __b, __c);
13581 }
13582
vec_stvlx(vector pixel __a,int __b,vector pixel * __c)13583 static __inline__ void __ATTRS_o_ai vec_stvlx(vector pixel __a, int __b,
13584 vector pixel *__c) {
13585 return vec_st(
13586 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13587 __b, __c);
13588 }
13589
vec_stvlx(vector int __a,int __b,int * __c)13590 static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b,
13591 int *__c) {
13592 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13593 __c);
13594 }
13595
vec_stvlx(vector int __a,int __b,vector int * __c)13596 static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b,
13597 vector int *__c) {
13598 return vec_st(
13599 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13600 __b, __c);
13601 }
13602
vec_stvlx(vector unsigned int __a,int __b,unsigned int * __c)13603 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
13604 unsigned int *__c) {
13605 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13606 __c);
13607 }
13608
vec_stvlx(vector unsigned int __a,int __b,vector unsigned int * __c)13609 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
13610 vector unsigned int *__c) {
13611 return vec_st(
13612 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13613 __b, __c);
13614 }
13615
vec_stvlx(vector bool int __a,int __b,vector bool int * __c)13616 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool int __a, int __b,
13617 vector bool int *__c) {
13618 return vec_st(
13619 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13620 __b, __c);
13621 }
13622
vec_stvlx(vector float __a,int __b,vector float * __c)13623 static __inline__ void __ATTRS_o_ai vec_stvlx(vector float __a, int __b,
13624 vector float *__c) {
13625 return vec_st(
13626 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13627 __b, __c);
13628 }
13629
13630 /* vec_stvlxl */
13631
vec_stvlxl(vector signed char __a,int __b,signed char * __c)13632 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
13633 signed char *__c) {
13634 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13635 __c);
13636 }
13637
vec_stvlxl(vector signed char __a,int __b,vector signed char * __c)13638 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
13639 vector signed char *__c) {
13640 return vec_stl(
13641 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13642 __b, __c);
13643 }
13644
vec_stvlxl(vector unsigned char __a,int __b,unsigned char * __c)13645 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a,
13646 int __b, unsigned char *__c) {
13647 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13648 __c);
13649 }
13650
vec_stvlxl(vector unsigned char __a,int __b,vector unsigned char * __c)13651 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a,
13652 int __b,
13653 vector unsigned char *__c) {
13654 return vec_stl(
13655 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13656 __b, __c);
13657 }
13658
vec_stvlxl(vector bool char __a,int __b,vector bool char * __c)13659 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool char __a, int __b,
13660 vector bool char *__c) {
13661 return vec_stl(
13662 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13663 __b, __c);
13664 }
13665
vec_stvlxl(vector short __a,int __b,short * __c)13666 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
13667 short *__c) {
13668 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13669 __c);
13670 }
13671
vec_stvlxl(vector short __a,int __b,vector short * __c)13672 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
13673 vector short *__c) {
13674 return vec_stl(
13675 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13676 __b, __c);
13677 }
13678
vec_stvlxl(vector unsigned short __a,int __b,unsigned short * __c)13679 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a,
13680 int __b, unsigned short *__c) {
13681 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13682 __c);
13683 }
13684
vec_stvlxl(vector unsigned short __a,int __b,vector unsigned short * __c)13685 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a,
13686 int __b,
13687 vector unsigned short *__c) {
13688 return vec_stl(
13689 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13690 __b, __c);
13691 }
13692
vec_stvlxl(vector bool short __a,int __b,vector bool short * __c)13693 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool short __a, int __b,
13694 vector bool short *__c) {
13695 return vec_stl(
13696 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13697 __b, __c);
13698 }
13699
vec_stvlxl(vector pixel __a,int __b,vector pixel * __c)13700 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector pixel __a, int __b,
13701 vector pixel *__c) {
13702 return vec_stl(
13703 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13704 __b, __c);
13705 }
13706
vec_stvlxl(vector int __a,int __b,int * __c)13707 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b,
13708 int *__c) {
13709 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13710 __c);
13711 }
13712
vec_stvlxl(vector int __a,int __b,vector int * __c)13713 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b,
13714 vector int *__c) {
13715 return vec_stl(
13716 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13717 __b, __c);
13718 }
13719
vec_stvlxl(vector unsigned int __a,int __b,unsigned int * __c)13720 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
13721 unsigned int *__c) {
13722 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13723 __c);
13724 }
13725
vec_stvlxl(vector unsigned int __a,int __b,vector unsigned int * __c)13726 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
13727 vector unsigned int *__c) {
13728 return vec_stl(
13729 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13730 __b, __c);
13731 }
13732
vec_stvlxl(vector bool int __a,int __b,vector bool int * __c)13733 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool int __a, int __b,
13734 vector bool int *__c) {
13735 return vec_stl(
13736 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13737 __b, __c);
13738 }
13739
vec_stvlxl(vector float __a,int __b,vector float * __c)13740 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector float __a, int __b,
13741 vector float *__c) {
13742 return vec_stl(
13743 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13744 __b, __c);
13745 }
13746
13747 /* vec_stvrx */
13748
vec_stvrx(vector signed char __a,int __b,signed char * __c)13749 static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
13750 signed char *__c) {
13751 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13752 __c);
13753 }
13754
vec_stvrx(vector signed char __a,int __b,vector signed char * __c)13755 static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
13756 vector signed char *__c) {
13757 return vec_st(
13758 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13759 __b, __c);
13760 }
13761
vec_stvrx(vector unsigned char __a,int __b,unsigned char * __c)13762 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
13763 unsigned char *__c) {
13764 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13765 __c);
13766 }
13767
vec_stvrx(vector unsigned char __a,int __b,vector unsigned char * __c)13768 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
13769 vector unsigned char *__c) {
13770 return vec_st(
13771 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13772 __b, __c);
13773 }
13774
vec_stvrx(vector bool char __a,int __b,vector bool char * __c)13775 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool char __a, int __b,
13776 vector bool char *__c) {
13777 return vec_st(
13778 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13779 __b, __c);
13780 }
13781
vec_stvrx(vector short __a,int __b,short * __c)13782 static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
13783 short *__c) {
13784 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13785 __c);
13786 }
13787
vec_stvrx(vector short __a,int __b,vector short * __c)13788 static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
13789 vector short *__c) {
13790 return vec_st(
13791 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13792 __b, __c);
13793 }
13794
vec_stvrx(vector unsigned short __a,int __b,unsigned short * __c)13795 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a,
13796 int __b, unsigned short *__c) {
13797 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13798 __c);
13799 }
13800
vec_stvrx(vector unsigned short __a,int __b,vector unsigned short * __c)13801 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a,
13802 int __b,
13803 vector unsigned short *__c) {
13804 return vec_st(
13805 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13806 __b, __c);
13807 }
13808
vec_stvrx(vector bool short __a,int __b,vector bool short * __c)13809 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool short __a, int __b,
13810 vector bool short *__c) {
13811 return vec_st(
13812 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13813 __b, __c);
13814 }
13815
vec_stvrx(vector pixel __a,int __b,vector pixel * __c)13816 static __inline__ void __ATTRS_o_ai vec_stvrx(vector pixel __a, int __b,
13817 vector pixel *__c) {
13818 return vec_st(
13819 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13820 __b, __c);
13821 }
13822
vec_stvrx(vector int __a,int __b,int * __c)13823 static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b,
13824 int *__c) {
13825 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13826 __c);
13827 }
13828
vec_stvrx(vector int __a,int __b,vector int * __c)13829 static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b,
13830 vector int *__c) {
13831 return vec_st(
13832 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13833 __b, __c);
13834 }
13835
vec_stvrx(vector unsigned int __a,int __b,unsigned int * __c)13836 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
13837 unsigned int *__c) {
13838 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13839 __c);
13840 }
13841
vec_stvrx(vector unsigned int __a,int __b,vector unsigned int * __c)13842 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
13843 vector unsigned int *__c) {
13844 return vec_st(
13845 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13846 __b, __c);
13847 }
13848
vec_stvrx(vector bool int __a,int __b,vector bool int * __c)13849 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool int __a, int __b,
13850 vector bool int *__c) {
13851 return vec_st(
13852 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13853 __b, __c);
13854 }
13855
vec_stvrx(vector float __a,int __b,vector float * __c)13856 static __inline__ void __ATTRS_o_ai vec_stvrx(vector float __a, int __b,
13857 vector float *__c) {
13858 return vec_st(
13859 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13860 __b, __c);
13861 }
13862
13863 /* vec_stvrxl */
13864
vec_stvrxl(vector signed char __a,int __b,signed char * __c)13865 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
13866 signed char *__c) {
13867 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13868 __c);
13869 }
13870
vec_stvrxl(vector signed char __a,int __b,vector signed char * __c)13871 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
13872 vector signed char *__c) {
13873 return vec_stl(
13874 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13875 __b, __c);
13876 }
13877
vec_stvrxl(vector unsigned char __a,int __b,unsigned char * __c)13878 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a,
13879 int __b, unsigned char *__c) {
13880 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13881 __c);
13882 }
13883
vec_stvrxl(vector unsigned char __a,int __b,vector unsigned char * __c)13884 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a,
13885 int __b,
13886 vector unsigned char *__c) {
13887 return vec_stl(
13888 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13889 __b, __c);
13890 }
13891
vec_stvrxl(vector bool char __a,int __b,vector bool char * __c)13892 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool char __a, int __b,
13893 vector bool char *__c) {
13894 return vec_stl(
13895 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13896 __b, __c);
13897 }
13898
vec_stvrxl(vector short __a,int __b,short * __c)13899 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
13900 short *__c) {
13901 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13902 __c);
13903 }
13904
vec_stvrxl(vector short __a,int __b,vector short * __c)13905 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
13906 vector short *__c) {
13907 return vec_stl(
13908 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13909 __b, __c);
13910 }
13911
vec_stvrxl(vector unsigned short __a,int __b,unsigned short * __c)13912 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a,
13913 int __b, unsigned short *__c) {
13914 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13915 __c);
13916 }
13917
vec_stvrxl(vector unsigned short __a,int __b,vector unsigned short * __c)13918 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a,
13919 int __b,
13920 vector unsigned short *__c) {
13921 return vec_stl(
13922 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13923 __b, __c);
13924 }
13925
vec_stvrxl(vector bool short __a,int __b,vector bool short * __c)13926 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool short __a, int __b,
13927 vector bool short *__c) {
13928 return vec_stl(
13929 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13930 __b, __c);
13931 }
13932
vec_stvrxl(vector pixel __a,int __b,vector pixel * __c)13933 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector pixel __a, int __b,
13934 vector pixel *__c) {
13935 return vec_stl(
13936 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13937 __b, __c);
13938 }
13939
vec_stvrxl(vector int __a,int __b,int * __c)13940 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b,
13941 int *__c) {
13942 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13943 __c);
13944 }
13945
vec_stvrxl(vector int __a,int __b,vector int * __c)13946 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b,
13947 vector int *__c) {
13948 return vec_stl(
13949 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13950 __b, __c);
13951 }
13952
vec_stvrxl(vector unsigned int __a,int __b,unsigned int * __c)13953 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
13954 unsigned int *__c) {
13955 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13956 __c);
13957 }
13958
vec_stvrxl(vector unsigned int __a,int __b,vector unsigned int * __c)13959 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
13960 vector unsigned int *__c) {
13961 return vec_stl(
13962 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13963 __b, __c);
13964 }
13965
vec_stvrxl(vector bool int __a,int __b,vector bool int * __c)13966 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool int __a, int __b,
13967 vector bool int *__c) {
13968 return vec_stl(
13969 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13970 __b, __c);
13971 }
13972
vec_stvrxl(vector float __a,int __b,vector float * __c)13973 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector float __a, int __b,
13974 vector float *__c) {
13975 return vec_stl(
13976 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13977 __b, __c);
13978 }
13979
13980 /* vec_promote */
13981
vec_promote(signed char __a,int __b)13982 static __inline__ vector signed char __ATTRS_o_ai vec_promote(signed char __a,
13983 int __b) {
13984 vector signed char __res = (vector signed char)(0);
13985 __res[__b] = __a;
13986 return __res;
13987 }
13988
13989 static __inline__ vector unsigned char __ATTRS_o_ai
vec_promote(unsigned char __a,int __b)13990 vec_promote(unsigned char __a, int __b) {
13991 vector unsigned char __res = (vector unsigned char)(0);
13992 __res[__b] = __a;
13993 return __res;
13994 }
13995
vec_promote(short __a,int __b)13996 static __inline__ vector short __ATTRS_o_ai vec_promote(short __a, int __b) {
13997 vector short __res = (vector short)(0);
13998 __res[__b] = __a;
13999 return __res;
14000 }
14001
14002 static __inline__ vector unsigned short __ATTRS_o_ai
vec_promote(unsigned short __a,int __b)14003 vec_promote(unsigned short __a, int __b) {
14004 vector unsigned short __res = (vector unsigned short)(0);
14005 __res[__b] = __a;
14006 return __res;
14007 }
14008
vec_promote(int __a,int __b)14009 static __inline__ vector int __ATTRS_o_ai vec_promote(int __a, int __b) {
14010 vector int __res = (vector int)(0);
14011 __res[__b] = __a;
14012 return __res;
14013 }
14014
vec_promote(unsigned int __a,int __b)14015 static __inline__ vector unsigned int __ATTRS_o_ai vec_promote(unsigned int __a,
14016 int __b) {
14017 vector unsigned int __res = (vector unsigned int)(0);
14018 __res[__b] = __a;
14019 return __res;
14020 }
14021
vec_promote(float __a,int __b)14022 static __inline__ vector float __ATTRS_o_ai vec_promote(float __a, int __b) {
14023 vector float __res = (vector float)(0);
14024 __res[__b] = __a;
14025 return __res;
14026 }
14027
14028 /* vec_splats */
14029
vec_splats(signed char __a)14030 static __inline__ vector signed char __ATTRS_o_ai vec_splats(signed char __a) {
14031 return (vector signed char)(__a);
14032 }
14033
14034 static __inline__ vector unsigned char __ATTRS_o_ai
vec_splats(unsigned char __a)14035 vec_splats(unsigned char __a) {
14036 return (vector unsigned char)(__a);
14037 }
14038
vec_splats(short __a)14039 static __inline__ vector short __ATTRS_o_ai vec_splats(short __a) {
14040 return (vector short)(__a);
14041 }
14042
14043 static __inline__ vector unsigned short __ATTRS_o_ai
vec_splats(unsigned short __a)14044 vec_splats(unsigned short __a) {
14045 return (vector unsigned short)(__a);
14046 }
14047
vec_splats(int __a)14048 static __inline__ vector int __ATTRS_o_ai vec_splats(int __a) {
14049 return (vector int)(__a);
14050 }
14051
14052 static __inline__ vector unsigned int __ATTRS_o_ai
vec_splats(unsigned int __a)14053 vec_splats(unsigned int __a) {
14054 return (vector unsigned int)(__a);
14055 }
14056
14057 #ifdef __VSX__
14058 static __inline__ vector signed long long __ATTRS_o_ai
vec_splats(signed long long __a)14059 vec_splats(signed long long __a) {
14060 return (vector signed long long)(__a);
14061 }
14062
14063 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_splats(unsigned long long __a)14064 vec_splats(unsigned long long __a) {
14065 return (vector unsigned long long)(__a);
14066 }
14067
14068 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
14069 static __inline__ vector signed __int128 __ATTRS_o_ai
vec_splats(signed __int128 __a)14070 vec_splats(signed __int128 __a) {
14071 return (vector signed __int128)(__a);
14072 }
14073
14074 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_splats(unsigned __int128 __a)14075 vec_splats(unsigned __int128 __a) {
14076 return (vector unsigned __int128)(__a);
14077 }
14078
14079 #endif
14080
vec_splats(double __a)14081 static __inline__ vector double __ATTRS_o_ai vec_splats(double __a) {
14082 return (vector double)(__a);
14083 }
14084 #endif
14085
vec_splats(float __a)14086 static __inline__ vector float __ATTRS_o_ai vec_splats(float __a) {
14087 return (vector float)(__a);
14088 }
14089
14090 /* ----------------------------- predicates --------------------------------- */
14091
14092 /* vec_all_eq */
14093
vec_all_eq(vector signed char __a,vector signed char __b)14094 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a,
14095 vector signed char __b) {
14096 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
14097 (vector char)__b);
14098 }
14099
vec_all_eq(vector signed char __a,vector bool char __b)14100 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a,
14101 vector bool char __b) {
14102 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
14103 (vector char)__b);
14104 }
14105
vec_all_eq(vector unsigned char __a,vector unsigned char __b)14106 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
14107 vector unsigned char __b) {
14108 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
14109 (vector char)__b);
14110 }
14111
vec_all_eq(vector unsigned char __a,vector bool char __b)14112 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
14113 vector bool char __b) {
14114 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
14115 (vector char)__b);
14116 }
14117
vec_all_eq(vector bool char __a,vector signed char __b)14118 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
14119 vector signed char __b) {
14120 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
14121 (vector char)__b);
14122 }
14123
vec_all_eq(vector bool char __a,vector unsigned char __b)14124 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
14125 vector unsigned char __b) {
14126 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
14127 (vector char)__b);
14128 }
14129
vec_all_eq(vector bool char __a,vector bool char __b)14130 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
14131 vector bool char __b) {
14132 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
14133 (vector char)__b);
14134 }
14135
vec_all_eq(vector short __a,vector short __b)14136 static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a,
14137 vector short __b) {
14138 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b);
14139 }
14140
vec_all_eq(vector short __a,vector bool short __b)14141 static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a,
14142 vector bool short __b) {
14143 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b);
14144 }
14145
vec_all_eq(vector unsigned short __a,vector unsigned short __b)14146 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
14147 vector unsigned short __b) {
14148 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
14149 (vector short)__b);
14150 }
14151
vec_all_eq(vector unsigned short __a,vector bool short __b)14152 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
14153 vector bool short __b) {
14154 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
14155 (vector short)__b);
14156 }
14157
vec_all_eq(vector bool short __a,vector short __b)14158 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
14159 vector short __b) {
14160 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
14161 (vector short)__b);
14162 }
14163
vec_all_eq(vector bool short __a,vector unsigned short __b)14164 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
14165 vector unsigned short __b) {
14166 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
14167 (vector short)__b);
14168 }
14169
vec_all_eq(vector bool short __a,vector bool short __b)14170 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
14171 vector bool short __b) {
14172 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
14173 (vector short)__b);
14174 }
14175
vec_all_eq(vector pixel __a,vector pixel __b)14176 static __inline__ int __ATTRS_o_ai vec_all_eq(vector pixel __a,
14177 vector pixel __b) {
14178 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
14179 (vector short)__b);
14180 }
14181
vec_all_eq(vector int __a,vector int __b)14182 static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a, vector int __b) {
14183 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b);
14184 }
14185
vec_all_eq(vector int __a,vector bool int __b)14186 static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a,
14187 vector bool int __b) {
14188 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b);
14189 }
14190
vec_all_eq(vector unsigned int __a,vector unsigned int __b)14191 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
14192 vector unsigned int __b) {
14193 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
14194 (vector int)__b);
14195 }
14196
vec_all_eq(vector unsigned int __a,vector bool int __b)14197 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
14198 vector bool int __b) {
14199 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
14200 (vector int)__b);
14201 }
14202
vec_all_eq(vector bool int __a,vector int __b)14203 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
14204 vector int __b) {
14205 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
14206 (vector int)__b);
14207 }
14208
vec_all_eq(vector bool int __a,vector unsigned int __b)14209 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
14210 vector unsigned int __b) {
14211 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
14212 (vector int)__b);
14213 }
14214
vec_all_eq(vector bool int __a,vector bool int __b)14215 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
14216 vector bool int __b) {
14217 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
14218 (vector int)__b);
14219 }
14220
14221 #ifdef __POWER8_VECTOR__
vec_all_eq(vector signed long long __a,vector signed long long __b)14222 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed long long __a,
14223 vector signed long long __b) {
14224 return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, __b);
14225 }
14226
vec_all_eq(vector long long __a,vector bool long long __b)14227 static __inline__ int __ATTRS_o_ai vec_all_eq(vector long long __a,
14228 vector bool long long __b) {
14229 return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, (vector long long)__b);
14230 }
14231
vec_all_eq(vector unsigned long long __a,vector unsigned long long __b)14232 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
14233 vector unsigned long long __b) {
14234 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
14235 (vector long long)__b);
14236 }
14237
vec_all_eq(vector unsigned long long __a,vector bool long long __b)14238 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
14239 vector bool long long __b) {
14240 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
14241 (vector long long)__b);
14242 }
14243
vec_all_eq(vector bool long long __a,vector long long __b)14244 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
14245 vector long long __b) {
14246 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
14247 (vector long long)__b);
14248 }
14249
vec_all_eq(vector bool long long __a,vector unsigned long long __b)14250 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
14251 vector unsigned long long __b) {
14252 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
14253 (vector long long)__b);
14254 }
14255
vec_all_eq(vector bool long long __a,vector bool long long __b)14256 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
14257 vector bool long long __b) {
14258 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
14259 (vector long long)__b);
14260 }
14261 #endif
14262
vec_all_eq(vector float __a,vector float __b)14263 static __inline__ int __ATTRS_o_ai vec_all_eq(vector float __a,
14264 vector float __b) {
14265 #ifdef __VSX__
14266 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __b);
14267 #else
14268 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b);
14269 #endif
14270 }
14271
14272 #ifdef __VSX__
vec_all_eq(vector double __a,vector double __b)14273 static __inline__ int __ATTRS_o_ai vec_all_eq(vector double __a,
14274 vector double __b) {
14275 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __b);
14276 }
14277 #endif
14278
14279 #ifdef __POWER10_VECTOR__
vec_all_eq(vector signed __int128 __a,vector signed __int128 __b)14280 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed __int128 __a,
14281 vector signed __int128 __b) {
14282 return __builtin_altivec_vcmpequq_p(__CR6_LT, __a, __b);
14283 }
14284
vec_all_eq(vector unsigned __int128 __a,vector unsigned __int128 __b)14285 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned __int128 __a,
14286 vector unsigned __int128 __b) {
14287 return __builtin_altivec_vcmpequq_p(__CR6_LT, __a, __b);
14288 }
14289 #endif
14290
14291 /* vec_all_ge */
14292
vec_all_ge(vector signed char __a,vector signed char __b)14293 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a,
14294 vector signed char __b) {
14295 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a);
14296 }
14297
vec_all_ge(vector signed char __a,vector bool char __b)14298 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a,
14299 vector bool char __b) {
14300 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a);
14301 }
14302
vec_all_ge(vector unsigned char __a,vector unsigned char __b)14303 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
14304 vector unsigned char __b) {
14305 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a);
14306 }
14307
vec_all_ge(vector unsigned char __a,vector bool char __b)14308 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
14309 vector bool char __b) {
14310 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a);
14311 }
14312
vec_all_ge(vector bool char __a,vector signed char __b)14313 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
14314 vector signed char __b) {
14315 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
14316 (vector unsigned char)__a);
14317 }
14318
vec_all_ge(vector bool char __a,vector unsigned char __b)14319 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
14320 vector unsigned char __b) {
14321 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a);
14322 }
14323
vec_all_ge(vector bool char __a,vector bool char __b)14324 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
14325 vector bool char __b) {
14326 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
14327 (vector unsigned char)__a);
14328 }
14329
vec_all_ge(vector short __a,vector short __b)14330 static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a,
14331 vector short __b) {
14332 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a);
14333 }
14334
vec_all_ge(vector short __a,vector bool short __b)14335 static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a,
14336 vector bool short __b) {
14337 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a);
14338 }
14339
vec_all_ge(vector unsigned short __a,vector unsigned short __b)14340 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
14341 vector unsigned short __b) {
14342 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a);
14343 }
14344
vec_all_ge(vector unsigned short __a,vector bool short __b)14345 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
14346 vector bool short __b) {
14347 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
14348 __a);
14349 }
14350
vec_all_ge(vector bool short __a,vector short __b)14351 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
14352 vector short __b) {
14353 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
14354 (vector unsigned short)__a);
14355 }
14356
vec_all_ge(vector bool short __a,vector unsigned short __b)14357 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
14358 vector unsigned short __b) {
14359 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b,
14360 (vector unsigned short)__a);
14361 }
14362
vec_all_ge(vector bool short __a,vector bool short __b)14363 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
14364 vector bool short __b) {
14365 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
14366 (vector unsigned short)__a);
14367 }
14368
vec_all_ge(vector int __a,vector int __b)14369 static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a, vector int __b) {
14370 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a);
14371 }
14372
vec_all_ge(vector int __a,vector bool int __b)14373 static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a,
14374 vector bool int __b) {
14375 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a);
14376 }
14377
vec_all_ge(vector unsigned int __a,vector unsigned int __b)14378 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
14379 vector unsigned int __b) {
14380 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a);
14381 }
14382
vec_all_ge(vector unsigned int __a,vector bool int __b)14383 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
14384 vector bool int __b) {
14385 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a);
14386 }
14387
vec_all_ge(vector bool int __a,vector int __b)14388 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
14389 vector int __b) {
14390 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
14391 (vector unsigned int)__a);
14392 }
14393
vec_all_ge(vector bool int __a,vector unsigned int __b)14394 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
14395 vector unsigned int __b) {
14396 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a);
14397 }
14398
vec_all_ge(vector bool int __a,vector bool int __b)14399 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
14400 vector bool int __b) {
14401 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
14402 (vector unsigned int)__a);
14403 }
14404
14405 #ifdef __POWER8_VECTOR__
vec_all_ge(vector signed long long __a,vector signed long long __b)14406 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
14407 vector signed long long __b) {
14408 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, __a);
14409 }
vec_all_ge(vector signed long long __a,vector bool long long __b)14410 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
14411 vector bool long long __b) {
14412 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__b,
14413 __a);
14414 }
14415
vec_all_ge(vector unsigned long long __a,vector unsigned long long __b)14416 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
14417 vector unsigned long long __b) {
14418 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, __a);
14419 }
14420
vec_all_ge(vector unsigned long long __a,vector bool long long __b)14421 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
14422 vector bool long long __b) {
14423 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
14424 __a);
14425 }
14426
vec_all_ge(vector bool long long __a,vector signed long long __b)14427 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
14428 vector signed long long __b) {
14429 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
14430 (vector unsigned long long)__a);
14431 }
14432
vec_all_ge(vector bool long long __a,vector unsigned long long __b)14433 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
14434 vector unsigned long long __b) {
14435 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b,
14436 (vector unsigned long long)__a);
14437 }
14438
vec_all_ge(vector bool long long __a,vector bool long long __b)14439 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
14440 vector bool long long __b) {
14441 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
14442 (vector unsigned long long)__a);
14443 }
14444 #endif
14445
vec_all_ge(vector float __a,vector float __b)14446 static __inline__ int __ATTRS_o_ai vec_all_ge(vector float __a,
14447 vector float __b) {
14448 #ifdef __VSX__
14449 return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __a, __b);
14450 #else
14451 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b);
14452 #endif
14453 }
14454
14455 #ifdef __VSX__
vec_all_ge(vector double __a,vector double __b)14456 static __inline__ int __ATTRS_o_ai vec_all_ge(vector double __a,
14457 vector double __b) {
14458 return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __a, __b);
14459 }
14460 #endif
14461
14462 #ifdef __POWER10_VECTOR__
vec_all_ge(vector signed __int128 __a,vector signed __int128 __b)14463 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed __int128 __a,
14464 vector signed __int128 __b) {
14465 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ, __b, __a);
14466 }
14467
vec_all_ge(vector unsigned __int128 __a,vector unsigned __int128 __b)14468 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned __int128 __a,
14469 vector unsigned __int128 __b) {
14470 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ, __b, __a);
14471 }
14472 #endif
14473
14474 /* vec_all_gt */
14475
vec_all_gt(vector signed char __a,vector signed char __b)14476 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a,
14477 vector signed char __b) {
14478 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b);
14479 }
14480
vec_all_gt(vector signed char __a,vector bool char __b)14481 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a,
14482 vector bool char __b) {
14483 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b);
14484 }
14485
vec_all_gt(vector unsigned char __a,vector unsigned char __b)14486 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
14487 vector unsigned char __b) {
14488 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b);
14489 }
14490
vec_all_gt(vector unsigned char __a,vector bool char __b)14491 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
14492 vector bool char __b) {
14493 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b);
14494 }
14495
vec_all_gt(vector bool char __a,vector signed char __b)14496 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
14497 vector signed char __b) {
14498 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
14499 (vector unsigned char)__b);
14500 }
14501
vec_all_gt(vector bool char __a,vector unsigned char __b)14502 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
14503 vector unsigned char __b) {
14504 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b);
14505 }
14506
vec_all_gt(vector bool char __a,vector bool char __b)14507 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
14508 vector bool char __b) {
14509 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
14510 (vector unsigned char)__b);
14511 }
14512
vec_all_gt(vector short __a,vector short __b)14513 static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a,
14514 vector short __b) {
14515 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b);
14516 }
14517
vec_all_gt(vector short __a,vector bool short __b)14518 static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a,
14519 vector bool short __b) {
14520 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b);
14521 }
14522
vec_all_gt(vector unsigned short __a,vector unsigned short __b)14523 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
14524 vector unsigned short __b) {
14525 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b);
14526 }
14527
vec_all_gt(vector unsigned short __a,vector bool short __b)14528 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
14529 vector bool short __b) {
14530 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a,
14531 (vector unsigned short)__b);
14532 }
14533
vec_all_gt(vector bool short __a,vector short __b)14534 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
14535 vector short __b) {
14536 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
14537 (vector unsigned short)__b);
14538 }
14539
vec_all_gt(vector bool short __a,vector unsigned short __b)14540 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
14541 vector unsigned short __b) {
14542 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
14543 __b);
14544 }
14545
vec_all_gt(vector bool short __a,vector bool short __b)14546 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
14547 vector bool short __b) {
14548 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
14549 (vector unsigned short)__b);
14550 }
14551
vec_all_gt(vector int __a,vector int __b)14552 static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a, vector int __b) {
14553 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b);
14554 }
14555
vec_all_gt(vector int __a,vector bool int __b)14556 static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a,
14557 vector bool int __b) {
14558 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b);
14559 }
14560
vec_all_gt(vector unsigned int __a,vector unsigned int __b)14561 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
14562 vector unsigned int __b) {
14563 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b);
14564 }
14565
vec_all_gt(vector unsigned int __a,vector bool int __b)14566 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
14567 vector bool int __b) {
14568 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b);
14569 }
14570
vec_all_gt(vector bool int __a,vector int __b)14571 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
14572 vector int __b) {
14573 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
14574 (vector unsigned int)__b);
14575 }
14576
vec_all_gt(vector bool int __a,vector unsigned int __b)14577 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
14578 vector unsigned int __b) {
14579 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b);
14580 }
14581
vec_all_gt(vector bool int __a,vector bool int __b)14582 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
14583 vector bool int __b) {
14584 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
14585 (vector unsigned int)__b);
14586 }
14587
14588 #ifdef __POWER8_VECTOR__
vec_all_gt(vector signed long long __a,vector signed long long __b)14589 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
14590 vector signed long long __b) {
14591 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, __b);
14592 }
vec_all_gt(vector signed long long __a,vector bool long long __b)14593 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
14594 vector bool long long __b) {
14595 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a,
14596 (vector signed long long)__b);
14597 }
14598
vec_all_gt(vector unsigned long long __a,vector unsigned long long __b)14599 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
14600 vector unsigned long long __b) {
14601 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, __b);
14602 }
14603
vec_all_gt(vector unsigned long long __a,vector bool long long __b)14604 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
14605 vector bool long long __b) {
14606 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a,
14607 (vector unsigned long long)__b);
14608 }
14609
vec_all_gt(vector bool long long __a,vector signed long long __b)14610 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
14611 vector signed long long __b) {
14612 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
14613 (vector unsigned long long)__b);
14614 }
14615
vec_all_gt(vector bool long long __a,vector unsigned long long __b)14616 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
14617 vector unsigned long long __b) {
14618 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
14619 __b);
14620 }
14621
vec_all_gt(vector bool long long __a,vector bool long long __b)14622 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
14623 vector bool long long __b) {
14624 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
14625 (vector unsigned long long)__b);
14626 }
14627 #endif
14628
vec_all_gt(vector float __a,vector float __b)14629 static __inline__ int __ATTRS_o_ai vec_all_gt(vector float __a,
14630 vector float __b) {
14631 #ifdef __VSX__
14632 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __a, __b);
14633 #else
14634 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b);
14635 #endif
14636 }
14637
14638 #ifdef __VSX__
vec_all_gt(vector double __a,vector double __b)14639 static __inline__ int __ATTRS_o_ai vec_all_gt(vector double __a,
14640 vector double __b) {
14641 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __a, __b);
14642 }
14643 #endif
14644
14645 #ifdef __POWER10_VECTOR__
vec_all_gt(vector signed __int128 __a,vector signed __int128 __b)14646 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed __int128 __a,
14647 vector signed __int128 __b) {
14648 return __builtin_altivec_vcmpgtsq_p(__CR6_LT, __a, __b);
14649 }
14650
vec_all_gt(vector unsigned __int128 __a,vector unsigned __int128 __b)14651 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned __int128 __a,
14652 vector unsigned __int128 __b) {
14653 return __builtin_altivec_vcmpgtuq_p(__CR6_LT, __a, __b);
14654 }
14655 #endif
14656
14657 /* vec_all_in */
14658
14659 static __inline__ int __attribute__((__always_inline__))
vec_all_in(vector float __a,vector float __b)14660 vec_all_in(vector float __a, vector float __b) {
14661 return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b);
14662 }
14663
14664 /* vec_all_le */
14665
vec_all_le(vector signed char __a,vector signed char __b)14666 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a,
14667 vector signed char __b) {
14668 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b);
14669 }
14670
vec_all_le(vector signed char __a,vector bool char __b)14671 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a,
14672 vector bool char __b) {
14673 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b);
14674 }
14675
vec_all_le(vector unsigned char __a,vector unsigned char __b)14676 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
14677 vector unsigned char __b) {
14678 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b);
14679 }
14680
vec_all_le(vector unsigned char __a,vector bool char __b)14681 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
14682 vector bool char __b) {
14683 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b);
14684 }
14685
vec_all_le(vector bool char __a,vector signed char __b)14686 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
14687 vector signed char __b) {
14688 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
14689 (vector unsigned char)__b);
14690 }
14691
vec_all_le(vector bool char __a,vector unsigned char __b)14692 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
14693 vector unsigned char __b) {
14694 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b);
14695 }
14696
vec_all_le(vector bool char __a,vector bool char __b)14697 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
14698 vector bool char __b) {
14699 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
14700 (vector unsigned char)__b);
14701 }
14702
vec_all_le(vector short __a,vector short __b)14703 static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a,
14704 vector short __b) {
14705 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b);
14706 }
14707
vec_all_le(vector short __a,vector bool short __b)14708 static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a,
14709 vector bool short __b) {
14710 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b);
14711 }
14712
vec_all_le(vector unsigned short __a,vector unsigned short __b)14713 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
14714 vector unsigned short __b) {
14715 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b);
14716 }
14717
vec_all_le(vector unsigned short __a,vector bool short __b)14718 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
14719 vector bool short __b) {
14720 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a,
14721 (vector unsigned short)__b);
14722 }
14723
vec_all_le(vector bool short __a,vector short __b)14724 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
14725 vector short __b) {
14726 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
14727 (vector unsigned short)__b);
14728 }
14729
vec_all_le(vector bool short __a,vector unsigned short __b)14730 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
14731 vector unsigned short __b) {
14732 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
14733 __b);
14734 }
14735
vec_all_le(vector bool short __a,vector bool short __b)14736 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
14737 vector bool short __b) {
14738 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
14739 (vector unsigned short)__b);
14740 }
14741
vec_all_le(vector int __a,vector int __b)14742 static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a, vector int __b) {
14743 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b);
14744 }
14745
vec_all_le(vector int __a,vector bool int __b)14746 static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a,
14747 vector bool int __b) {
14748 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b);
14749 }
14750
vec_all_le(vector unsigned int __a,vector unsigned int __b)14751 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
14752 vector unsigned int __b) {
14753 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b);
14754 }
14755
vec_all_le(vector unsigned int __a,vector bool int __b)14756 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
14757 vector bool int __b) {
14758 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b);
14759 }
14760
vec_all_le(vector bool int __a,vector int __b)14761 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
14762 vector int __b) {
14763 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
14764 (vector unsigned int)__b);
14765 }
14766
vec_all_le(vector bool int __a,vector unsigned int __b)14767 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
14768 vector unsigned int __b) {
14769 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b);
14770 }
14771
vec_all_le(vector bool int __a,vector bool int __b)14772 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
14773 vector bool int __b) {
14774 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
14775 (vector unsigned int)__b);
14776 }
14777
14778 #ifdef __POWER8_VECTOR__
vec_all_le(vector signed long long __a,vector signed long long __b)14779 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a,
14780 vector signed long long __b) {
14781 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, __b);
14782 }
14783
vec_all_le(vector unsigned long long __a,vector unsigned long long __b)14784 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
14785 vector unsigned long long __b) {
14786 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, __b);
14787 }
14788
vec_all_le(vector signed long long __a,vector bool long long __b)14789 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a,
14790 vector bool long long __b) {
14791 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a,
14792 (vector signed long long)__b);
14793 }
14794
vec_all_le(vector unsigned long long __a,vector bool long long __b)14795 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
14796 vector bool long long __b) {
14797 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a,
14798 (vector unsigned long long)__b);
14799 }
14800
vec_all_le(vector bool long long __a,vector signed long long __b)14801 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
14802 vector signed long long __b) {
14803 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
14804 (vector unsigned long long)__b);
14805 }
14806
vec_all_le(vector bool long long __a,vector unsigned long long __b)14807 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
14808 vector unsigned long long __b) {
14809 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
14810 __b);
14811 }
14812
vec_all_le(vector bool long long __a,vector bool long long __b)14813 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
14814 vector bool long long __b) {
14815 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
14816 (vector unsigned long long)__b);
14817 }
14818 #endif
14819
vec_all_le(vector float __a,vector float __b)14820 static __inline__ int __ATTRS_o_ai vec_all_le(vector float __a,
14821 vector float __b) {
14822 #ifdef __VSX__
14823 return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __b, __a);
14824 #else
14825 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a);
14826 #endif
14827 }
14828
14829 #ifdef __VSX__
vec_all_le(vector double __a,vector double __b)14830 static __inline__ int __ATTRS_o_ai vec_all_le(vector double __a,
14831 vector double __b) {
14832 return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __b, __a);
14833 }
14834 #endif
14835
14836 #ifdef __POWER10_VECTOR__
vec_all_le(vector signed __int128 __a,vector signed __int128 __b)14837 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed __int128 __a,
14838 vector signed __int128 __b) {
14839 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ, __a, __b);
14840 }
14841
vec_all_le(vector unsigned __int128 __a,vector unsigned __int128 __b)14842 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned __int128 __a,
14843 vector unsigned __int128 __b) {
14844 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ, __a, __b);
14845 }
14846 #endif
14847
14848 /* vec_all_lt */
14849
vec_all_lt(vector signed char __a,vector signed char __b)14850 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a,
14851 vector signed char __b) {
14852 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a);
14853 }
14854
vec_all_lt(vector signed char __a,vector bool char __b)14855 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a,
14856 vector bool char __b) {
14857 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a);
14858 }
14859
vec_all_lt(vector unsigned char __a,vector unsigned char __b)14860 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
14861 vector unsigned char __b) {
14862 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a);
14863 }
14864
vec_all_lt(vector unsigned char __a,vector bool char __b)14865 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
14866 vector bool char __b) {
14867 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a);
14868 }
14869
vec_all_lt(vector bool char __a,vector signed char __b)14870 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
14871 vector signed char __b) {
14872 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
14873 (vector unsigned char)__a);
14874 }
14875
vec_all_lt(vector bool char __a,vector unsigned char __b)14876 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
14877 vector unsigned char __b) {
14878 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a);
14879 }
14880
vec_all_lt(vector bool char __a,vector bool char __b)14881 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
14882 vector bool char __b) {
14883 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
14884 (vector unsigned char)__a);
14885 }
14886
vec_all_lt(vector short __a,vector short __b)14887 static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a,
14888 vector short __b) {
14889 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a);
14890 }
14891
vec_all_lt(vector short __a,vector bool short __b)14892 static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a,
14893 vector bool short __b) {
14894 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a);
14895 }
14896
vec_all_lt(vector unsigned short __a,vector unsigned short __b)14897 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
14898 vector unsigned short __b) {
14899 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a);
14900 }
14901
vec_all_lt(vector unsigned short __a,vector bool short __b)14902 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
14903 vector bool short __b) {
14904 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
14905 __a);
14906 }
14907
vec_all_lt(vector bool short __a,vector short __b)14908 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
14909 vector short __b) {
14910 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
14911 (vector unsigned short)__a);
14912 }
14913
vec_all_lt(vector bool short __a,vector unsigned short __b)14914 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
14915 vector unsigned short __b) {
14916 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b,
14917 (vector unsigned short)__a);
14918 }
14919
vec_all_lt(vector bool short __a,vector bool short __b)14920 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
14921 vector bool short __b) {
14922 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
14923 (vector unsigned short)__a);
14924 }
14925
vec_all_lt(vector int __a,vector int __b)14926 static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a, vector int __b) {
14927 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a);
14928 }
14929
vec_all_lt(vector int __a,vector bool int __b)14930 static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a,
14931 vector bool int __b) {
14932 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a);
14933 }
14934
vec_all_lt(vector unsigned int __a,vector unsigned int __b)14935 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
14936 vector unsigned int __b) {
14937 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a);
14938 }
14939
vec_all_lt(vector unsigned int __a,vector bool int __b)14940 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
14941 vector bool int __b) {
14942 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a);
14943 }
14944
vec_all_lt(vector bool int __a,vector int __b)14945 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
14946 vector int __b) {
14947 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
14948 (vector unsigned int)__a);
14949 }
14950
vec_all_lt(vector bool int __a,vector unsigned int __b)14951 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
14952 vector unsigned int __b) {
14953 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a);
14954 }
14955
vec_all_lt(vector bool int __a,vector bool int __b)14956 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
14957 vector bool int __b) {
14958 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
14959 (vector unsigned int)__a);
14960 }
14961
14962 #ifdef __POWER8_VECTOR__
vec_all_lt(vector signed long long __a,vector signed long long __b)14963 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
14964 vector signed long long __b) {
14965 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, __a);
14966 }
14967
vec_all_lt(vector unsigned long long __a,vector unsigned long long __b)14968 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
14969 vector unsigned long long __b) {
14970 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, __a);
14971 }
14972
vec_all_lt(vector signed long long __a,vector bool long long __b)14973 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
14974 vector bool long long __b) {
14975 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__b,
14976 __a);
14977 }
14978
vec_all_lt(vector unsigned long long __a,vector bool long long __b)14979 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
14980 vector bool long long __b) {
14981 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
14982 __a);
14983 }
14984
vec_all_lt(vector bool long long __a,vector signed long long __b)14985 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
14986 vector signed long long __b) {
14987 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
14988 (vector unsigned long long)__a);
14989 }
14990
vec_all_lt(vector bool long long __a,vector unsigned long long __b)14991 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
14992 vector unsigned long long __b) {
14993 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b,
14994 (vector unsigned long long)__a);
14995 }
14996
vec_all_lt(vector bool long long __a,vector bool long long __b)14997 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
14998 vector bool long long __b) {
14999 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
15000 (vector unsigned long long)__a);
15001 }
15002 #endif
15003
vec_all_lt(vector float __a,vector float __b)15004 static __inline__ int __ATTRS_o_ai vec_all_lt(vector float __a,
15005 vector float __b) {
15006 #ifdef __VSX__
15007 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __b, __a);
15008 #else
15009 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a);
15010 #endif
15011 }
15012
15013 #ifdef __VSX__
vec_all_lt(vector double __a,vector double __b)15014 static __inline__ int __ATTRS_o_ai vec_all_lt(vector double __a,
15015 vector double __b) {
15016 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __b, __a);
15017 }
15018 #endif
15019
15020 #ifdef __POWER10_VECTOR__
vec_all_lt(vector signed __int128 __a,vector signed __int128 __b)15021 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed __int128 __a,
15022 vector signed __int128 __b) {
15023 return __builtin_altivec_vcmpgtsq_p(__CR6_LT, __b, __a);
15024 }
15025
vec_all_lt(vector unsigned __int128 __a,vector unsigned __int128 __b)15026 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned __int128 __a,
15027 vector unsigned __int128 __b) {
15028 return __builtin_altivec_vcmpgtuq_p(__CR6_LT, __b, __a);
15029 }
15030 #endif
15031
15032 /* vec_all_nan */
15033
vec_all_nan(vector float __a)15034 static __inline__ int __ATTRS_o_ai vec_all_nan(vector float __a) {
15035 #ifdef __VSX__
15036 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __a);
15037 #else
15038 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a);
15039 #endif
15040 }
15041
15042 #ifdef __VSX__
vec_all_nan(vector double __a)15043 static __inline__ int __ATTRS_o_ai vec_all_nan(vector double __a) {
15044 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __a);
15045 }
15046 #endif
15047
15048 /* vec_all_ne */
15049
vec_all_ne(vector signed char __a,vector signed char __b)15050 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a,
15051 vector signed char __b) {
15052 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
15053 (vector char)__b);
15054 }
15055
vec_all_ne(vector signed char __a,vector bool char __b)15056 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a,
15057 vector bool char __b) {
15058 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
15059 (vector char)__b);
15060 }
15061
vec_all_ne(vector unsigned char __a,vector unsigned char __b)15062 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
15063 vector unsigned char __b) {
15064 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
15065 (vector char)__b);
15066 }
15067
vec_all_ne(vector unsigned char __a,vector bool char __b)15068 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
15069 vector bool char __b) {
15070 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
15071 (vector char)__b);
15072 }
15073
vec_all_ne(vector bool char __a,vector signed char __b)15074 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
15075 vector signed char __b) {
15076 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
15077 (vector char)__b);
15078 }
15079
vec_all_ne(vector bool char __a,vector unsigned char __b)15080 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
15081 vector unsigned char __b) {
15082 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
15083 (vector char)__b);
15084 }
15085
vec_all_ne(vector bool char __a,vector bool char __b)15086 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
15087 vector bool char __b) {
15088 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
15089 (vector char)__b);
15090 }
15091
vec_all_ne(vector short __a,vector short __b)15092 static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a,
15093 vector short __b) {
15094 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b);
15095 }
15096
vec_all_ne(vector short __a,vector bool short __b)15097 static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a,
15098 vector bool short __b) {
15099 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b);
15100 }
15101
vec_all_ne(vector unsigned short __a,vector unsigned short __b)15102 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
15103 vector unsigned short __b) {
15104 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
15105 (vector short)__b);
15106 }
15107
vec_all_ne(vector unsigned short __a,vector bool short __b)15108 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
15109 vector bool short __b) {
15110 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
15111 (vector short)__b);
15112 }
15113
vec_all_ne(vector bool short __a,vector short __b)15114 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
15115 vector short __b) {
15116 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
15117 (vector short)__b);
15118 }
15119
vec_all_ne(vector bool short __a,vector unsigned short __b)15120 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
15121 vector unsigned short __b) {
15122 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
15123 (vector short)__b);
15124 }
15125
vec_all_ne(vector bool short __a,vector bool short __b)15126 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
15127 vector bool short __b) {
15128 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
15129 (vector short)__b);
15130 }
15131
vec_all_ne(vector pixel __a,vector pixel __b)15132 static __inline__ int __ATTRS_o_ai vec_all_ne(vector pixel __a,
15133 vector pixel __b) {
15134 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
15135 (vector short)__b);
15136 }
15137
vec_all_ne(vector int __a,vector int __b)15138 static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a, vector int __b) {
15139 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b);
15140 }
15141
vec_all_ne(vector int __a,vector bool int __b)15142 static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a,
15143 vector bool int __b) {
15144 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b);
15145 }
15146
vec_all_ne(vector unsigned int __a,vector unsigned int __b)15147 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
15148 vector unsigned int __b) {
15149 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
15150 (vector int)__b);
15151 }
15152
vec_all_ne(vector unsigned int __a,vector bool int __b)15153 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
15154 vector bool int __b) {
15155 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
15156 (vector int)__b);
15157 }
15158
vec_all_ne(vector bool int __a,vector int __b)15159 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
15160 vector int __b) {
15161 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
15162 (vector int)__b);
15163 }
15164
vec_all_ne(vector bool int __a,vector unsigned int __b)15165 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
15166 vector unsigned int __b) {
15167 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
15168 (vector int)__b);
15169 }
15170
vec_all_ne(vector bool int __a,vector bool int __b)15171 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
15172 vector bool int __b) {
15173 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
15174 (vector int)__b);
15175 }
15176
15177 #ifdef __POWER8_VECTOR__
vec_all_ne(vector signed long long __a,vector signed long long __b)15178 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
15179 vector signed long long __b) {
15180 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, __b);
15181 }
15182
vec_all_ne(vector unsigned long long __a,vector unsigned long long __b)15183 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
15184 vector unsigned long long __b) {
15185 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector long long)__a,
15186 (vector long long)__b);
15187 }
15188
vec_all_ne(vector signed long long __a,vector bool long long __b)15189 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
15190 vector bool long long __b) {
15191 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a,
15192 (vector signed long long)__b);
15193 }
15194
vec_all_ne(vector unsigned long long __a,vector bool long long __b)15195 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
15196 vector bool long long __b) {
15197 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
15198 (vector signed long long)__b);
15199 }
15200
vec_all_ne(vector bool long long __a,vector signed long long __b)15201 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
15202 vector signed long long __b) {
15203 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
15204 (vector signed long long)__b);
15205 }
15206
vec_all_ne(vector bool long long __a,vector unsigned long long __b)15207 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
15208 vector unsigned long long __b) {
15209 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
15210 (vector signed long long)__b);
15211 }
15212
vec_all_ne(vector bool long long __a,vector bool long long __b)15213 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
15214 vector bool long long __b) {
15215 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
15216 (vector signed long long)__b);
15217 }
15218 #endif
15219
vec_all_ne(vector float __a,vector float __b)15220 static __inline__ int __ATTRS_o_ai vec_all_ne(vector float __a,
15221 vector float __b) {
15222 #ifdef __VSX__
15223 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __b);
15224 #else
15225 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b);
15226 #endif
15227 }
15228
15229 #ifdef __VSX__
vec_all_ne(vector double __a,vector double __b)15230 static __inline__ int __ATTRS_o_ai vec_all_ne(vector double __a,
15231 vector double __b) {
15232 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b);
15233 }
15234 #endif
15235
15236 #ifdef __POWER10_VECTOR__
vec_all_ne(vector signed __int128 __a,vector signed __int128 __b)15237 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed __int128 __a,
15238 vector signed __int128 __b) {
15239 return __builtin_altivec_vcmpequq_p(__CR6_EQ, __a, __b);
15240 }
15241
vec_all_ne(vector unsigned __int128 __a,vector unsigned __int128 __b)15242 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned __int128 __a,
15243 vector unsigned __int128 __b) {
15244 return __builtin_altivec_vcmpequq_p(__CR6_EQ, __a, __b);
15245 }
15246 #endif
15247
15248 /* vec_all_nge */
15249
vec_all_nge(vector float __a,vector float __b)15250 static __inline__ int __ATTRS_o_ai vec_all_nge(vector float __a,
15251 vector float __b) {
15252 #ifdef __VSX__
15253 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __a, __b);
15254 #else
15255 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b);
15256 #endif
15257 }
15258
15259 #ifdef __VSX__
vec_all_nge(vector double __a,vector double __b)15260 static __inline__ int __ATTRS_o_ai vec_all_nge(vector double __a,
15261 vector double __b) {
15262 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __a, __b);
15263 }
15264 #endif
15265
15266 /* vec_all_ngt */
15267
vec_all_ngt(vector float __a,vector float __b)15268 static __inline__ int __ATTRS_o_ai vec_all_ngt(vector float __a,
15269 vector float __b) {
15270 #ifdef __VSX__
15271 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __a, __b);
15272 #else
15273 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b);
15274 #endif
15275 }
15276
15277 #ifdef __VSX__
vec_all_ngt(vector double __a,vector double __b)15278 static __inline__ int __ATTRS_o_ai vec_all_ngt(vector double __a,
15279 vector double __b) {
15280 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __a, __b);
15281 }
15282 #endif
15283
15284 /* vec_all_nle */
15285
15286 static __inline__ int __attribute__((__always_inline__))
vec_all_nle(vector float __a,vector float __b)15287 vec_all_nle(vector float __a, vector float __b) {
15288 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a);
15289 }
15290
15291 /* vec_all_nlt */
15292
15293 static __inline__ int __attribute__((__always_inline__))
vec_all_nlt(vector float __a,vector float __b)15294 vec_all_nlt(vector float __a, vector float __b) {
15295 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a);
15296 }
15297
15298 /* vec_all_numeric */
15299
15300 static __inline__ int __attribute__((__always_inline__))
vec_all_numeric(vector float __a)15301 vec_all_numeric(vector float __a) {
15302 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a);
15303 }
15304
15305 /* vec_any_eq */
15306
vec_any_eq(vector signed char __a,vector signed char __b)15307 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a,
15308 vector signed char __b) {
15309 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
15310 (vector char)__b);
15311 }
15312
vec_any_eq(vector signed char __a,vector bool char __b)15313 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a,
15314 vector bool char __b) {
15315 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
15316 (vector char)__b);
15317 }
15318
vec_any_eq(vector unsigned char __a,vector unsigned char __b)15319 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
15320 vector unsigned char __b) {
15321 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
15322 (vector char)__b);
15323 }
15324
vec_any_eq(vector unsigned char __a,vector bool char __b)15325 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
15326 vector bool char __b) {
15327 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
15328 (vector char)__b);
15329 }
15330
vec_any_eq(vector bool char __a,vector signed char __b)15331 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
15332 vector signed char __b) {
15333 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
15334 (vector char)__b);
15335 }
15336
vec_any_eq(vector bool char __a,vector unsigned char __b)15337 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
15338 vector unsigned char __b) {
15339 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
15340 (vector char)__b);
15341 }
15342
vec_any_eq(vector bool char __a,vector bool char __b)15343 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
15344 vector bool char __b) {
15345 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
15346 (vector char)__b);
15347 }
15348
vec_any_eq(vector short __a,vector short __b)15349 static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a,
15350 vector short __b) {
15351 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b);
15352 }
15353
vec_any_eq(vector short __a,vector bool short __b)15354 static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a,
15355 vector bool short __b) {
15356 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b);
15357 }
15358
vec_any_eq(vector unsigned short __a,vector unsigned short __b)15359 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
15360 vector unsigned short __b) {
15361 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
15362 (vector short)__b);
15363 }
15364
vec_any_eq(vector unsigned short __a,vector bool short __b)15365 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
15366 vector bool short __b) {
15367 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
15368 (vector short)__b);
15369 }
15370
vec_any_eq(vector bool short __a,vector short __b)15371 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
15372 vector short __b) {
15373 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
15374 (vector short)__b);
15375 }
15376
vec_any_eq(vector bool short __a,vector unsigned short __b)15377 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
15378 vector unsigned short __b) {
15379 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
15380 (vector short)__b);
15381 }
15382
vec_any_eq(vector bool short __a,vector bool short __b)15383 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
15384 vector bool short __b) {
15385 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
15386 (vector short)__b);
15387 }
15388
vec_any_eq(vector pixel __a,vector pixel __b)15389 static __inline__ int __ATTRS_o_ai vec_any_eq(vector pixel __a,
15390 vector pixel __b) {
15391 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
15392 (vector short)__b);
15393 }
15394
vec_any_eq(vector int __a,vector int __b)15395 static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a, vector int __b) {
15396 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b);
15397 }
15398
vec_any_eq(vector int __a,vector bool int __b)15399 static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a,
15400 vector bool int __b) {
15401 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b);
15402 }
15403
vec_any_eq(vector unsigned int __a,vector unsigned int __b)15404 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
15405 vector unsigned int __b) {
15406 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
15407 (vector int)__b);
15408 }
15409
vec_any_eq(vector unsigned int __a,vector bool int __b)15410 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
15411 vector bool int __b) {
15412 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
15413 (vector int)__b);
15414 }
15415
vec_any_eq(vector bool int __a,vector int __b)15416 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
15417 vector int __b) {
15418 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
15419 (vector int)__b);
15420 }
15421
vec_any_eq(vector bool int __a,vector unsigned int __b)15422 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
15423 vector unsigned int __b) {
15424 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
15425 (vector int)__b);
15426 }
15427
vec_any_eq(vector bool int __a,vector bool int __b)15428 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
15429 vector bool int __b) {
15430 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
15431 (vector int)__b);
15432 }
15433
15434 #ifdef __POWER8_VECTOR__
vec_any_eq(vector signed long long __a,vector signed long long __b)15435 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
15436 vector signed long long __b) {
15437 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, __b);
15438 }
15439
vec_any_eq(vector unsigned long long __a,vector unsigned long long __b)15440 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
15441 vector unsigned long long __b) {
15442 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector long long)__a,
15443 (vector long long)__b);
15444 }
15445
vec_any_eq(vector signed long long __a,vector bool long long __b)15446 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
15447 vector bool long long __b) {
15448 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a,
15449 (vector signed long long)__b);
15450 }
15451
vec_any_eq(vector unsigned long long __a,vector bool long long __b)15452 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
15453 vector bool long long __b) {
15454 return __builtin_altivec_vcmpequd_p(
15455 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
15456 }
15457
vec_any_eq(vector bool long long __a,vector signed long long __b)15458 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
15459 vector signed long long __b) {
15460 return __builtin_altivec_vcmpequd_p(
15461 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
15462 }
15463
vec_any_eq(vector bool long long __a,vector unsigned long long __b)15464 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
15465 vector unsigned long long __b) {
15466 return __builtin_altivec_vcmpequd_p(
15467 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
15468 }
15469
vec_any_eq(vector bool long long __a,vector bool long long __b)15470 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
15471 vector bool long long __b) {
15472 return __builtin_altivec_vcmpequd_p(
15473 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
15474 }
15475 #endif
15476
vec_any_eq(vector float __a,vector float __b)15477 static __inline__ int __ATTRS_o_ai vec_any_eq(vector float __a,
15478 vector float __b) {
15479 #ifdef __VSX__
15480 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __b);
15481 #else
15482 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b);
15483 #endif
15484 }
15485
15486 #ifdef __VSX__
vec_any_eq(vector double __a,vector double __b)15487 static __inline__ int __ATTRS_o_ai vec_any_eq(vector double __a,
15488 vector double __b) {
15489 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __b);
15490 }
15491 #endif
15492
15493 #ifdef __POWER10_VECTOR__
vec_any_eq(vector signed __int128 __a,vector signed __int128 __b)15494 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed __int128 __a,
15495 vector signed __int128 __b) {
15496 return __builtin_altivec_vcmpequq_p(__CR6_EQ_REV, __a, __b);
15497 }
15498
vec_any_eq(vector unsigned __int128 __a,vector unsigned __int128 __b)15499 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned __int128 __a,
15500 vector unsigned __int128 __b) {
15501 return __builtin_altivec_vcmpequq_p(__CR6_EQ_REV, __a, __b);
15502 }
15503 #endif
15504
15505 /* vec_any_ge */
15506
vec_any_ge(vector signed char __a,vector signed char __b)15507 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a,
15508 vector signed char __b) {
15509 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a);
15510 }
15511
vec_any_ge(vector signed char __a,vector bool char __b)15512 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a,
15513 vector bool char __b) {
15514 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b,
15515 __a);
15516 }
15517
vec_any_ge(vector unsigned char __a,vector unsigned char __b)15518 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
15519 vector unsigned char __b) {
15520 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a);
15521 }
15522
vec_any_ge(vector unsigned char __a,vector bool char __b)15523 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
15524 vector bool char __b) {
15525 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
15526 __a);
15527 }
15528
vec_any_ge(vector bool char __a,vector signed char __b)15529 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
15530 vector signed char __b) {
15531 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
15532 (vector unsigned char)__a);
15533 }
15534
vec_any_ge(vector bool char __a,vector unsigned char __b)15535 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
15536 vector unsigned char __b) {
15537 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b,
15538 (vector unsigned char)__a);
15539 }
15540
vec_any_ge(vector bool char __a,vector bool char __b)15541 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
15542 vector bool char __b) {
15543 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
15544 (vector unsigned char)__a);
15545 }
15546
vec_any_ge(vector short __a,vector short __b)15547 static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a,
15548 vector short __b) {
15549 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a);
15550 }
15551
vec_any_ge(vector short __a,vector bool short __b)15552 static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a,
15553 vector bool short __b) {
15554 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a);
15555 }
15556
vec_any_ge(vector unsigned short __a,vector unsigned short __b)15557 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
15558 vector unsigned short __b) {
15559 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a);
15560 }
15561
vec_any_ge(vector unsigned short __a,vector bool short __b)15562 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
15563 vector bool short __b) {
15564 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
15565 __a);
15566 }
15567
vec_any_ge(vector bool short __a,vector short __b)15568 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
15569 vector short __b) {
15570 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
15571 (vector unsigned short)__a);
15572 }
15573
vec_any_ge(vector bool short __a,vector unsigned short __b)15574 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
15575 vector unsigned short __b) {
15576 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b,
15577 (vector unsigned short)__a);
15578 }
15579
vec_any_ge(vector bool short __a,vector bool short __b)15580 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
15581 vector bool short __b) {
15582 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
15583 (vector unsigned short)__a);
15584 }
15585
vec_any_ge(vector int __a,vector int __b)15586 static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a, vector int __b) {
15587 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a);
15588 }
15589
vec_any_ge(vector int __a,vector bool int __b)15590 static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a,
15591 vector bool int __b) {
15592 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a);
15593 }
15594
vec_any_ge(vector unsigned int __a,vector unsigned int __b)15595 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
15596 vector unsigned int __b) {
15597 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a);
15598 }
15599
vec_any_ge(vector unsigned int __a,vector bool int __b)15600 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
15601 vector bool int __b) {
15602 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
15603 __a);
15604 }
15605
vec_any_ge(vector bool int __a,vector int __b)15606 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
15607 vector int __b) {
15608 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
15609 (vector unsigned int)__a);
15610 }
15611
vec_any_ge(vector bool int __a,vector unsigned int __b)15612 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
15613 vector unsigned int __b) {
15614 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b,
15615 (vector unsigned int)__a);
15616 }
15617
vec_any_ge(vector bool int __a,vector bool int __b)15618 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
15619 vector bool int __b) {
15620 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
15621 (vector unsigned int)__a);
15622 }
15623
15624 #ifdef __POWER8_VECTOR__
vec_any_ge(vector signed long long __a,vector signed long long __b)15625 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
15626 vector signed long long __b) {
15627 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, __a);
15628 }
15629
vec_any_ge(vector unsigned long long __a,vector unsigned long long __b)15630 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
15631 vector unsigned long long __b) {
15632 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, __a);
15633 }
15634
vec_any_ge(vector signed long long __a,vector bool long long __b)15635 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
15636 vector bool long long __b) {
15637 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV,
15638 (vector signed long long)__b, __a);
15639 }
15640
vec_any_ge(vector unsigned long long __a,vector bool long long __b)15641 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
15642 vector bool long long __b) {
15643 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15644 (vector unsigned long long)__b, __a);
15645 }
15646
vec_any_ge(vector bool long long __a,vector signed long long __b)15647 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
15648 vector signed long long __b) {
15649 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15650 (vector unsigned long long)__b,
15651 (vector unsigned long long)__a);
15652 }
15653
vec_any_ge(vector bool long long __a,vector unsigned long long __b)15654 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
15655 vector unsigned long long __b) {
15656 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b,
15657 (vector unsigned long long)__a);
15658 }
15659
vec_any_ge(vector bool long long __a,vector bool long long __b)15660 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
15661 vector bool long long __b) {
15662 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15663 (vector unsigned long long)__b,
15664 (vector unsigned long long)__a);
15665 }
15666 #endif
15667
vec_any_ge(vector float __a,vector float __b)15668 static __inline__ int __ATTRS_o_ai vec_any_ge(vector float __a,
15669 vector float __b) {
15670 #ifdef __VSX__
15671 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __a, __b);
15672 #else
15673 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b);
15674 #endif
15675 }
15676
15677 #ifdef __VSX__
vec_any_ge(vector double __a,vector double __b)15678 static __inline__ int __ATTRS_o_ai vec_any_ge(vector double __a,
15679 vector double __b) {
15680 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __a, __b);
15681 }
15682 #endif
15683
15684 #ifdef __POWER10_VECTOR__
vec_any_ge(vector signed __int128 __a,vector signed __int128 __b)15685 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed __int128 __a,
15686 vector signed __int128 __b) {
15687 return __builtin_altivec_vcmpgtsq_p(__CR6_LT_REV, __b, __a);
15688 }
15689
vec_any_ge(vector unsigned __int128 __a,vector unsigned __int128 __b)15690 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned __int128 __a,
15691 vector unsigned __int128 __b) {
15692 return __builtin_altivec_vcmpgtuq_p(__CR6_LT_REV, __b, __a);
15693 }
15694 #endif
15695
15696 /* vec_any_gt */
15697
vec_any_gt(vector signed char __a,vector signed char __b)15698 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a,
15699 vector signed char __b) {
15700 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b);
15701 }
15702
vec_any_gt(vector signed char __a,vector bool char __b)15703 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a,
15704 vector bool char __b) {
15705 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a,
15706 (vector signed char)__b);
15707 }
15708
vec_any_gt(vector unsigned char __a,vector unsigned char __b)15709 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
15710 vector unsigned char __b) {
15711 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b);
15712 }
15713
vec_any_gt(vector unsigned char __a,vector bool char __b)15714 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
15715 vector bool char __b) {
15716 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a,
15717 (vector unsigned char)__b);
15718 }
15719
vec_any_gt(vector bool char __a,vector signed char __b)15720 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
15721 vector signed char __b) {
15722 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
15723 (vector unsigned char)__b);
15724 }
15725
vec_any_gt(vector bool char __a,vector unsigned char __b)15726 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
15727 vector unsigned char __b) {
15728 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
15729 __b);
15730 }
15731
vec_any_gt(vector bool char __a,vector bool char __b)15732 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
15733 vector bool char __b) {
15734 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
15735 (vector unsigned char)__b);
15736 }
15737
vec_any_gt(vector short __a,vector short __b)15738 static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a,
15739 vector short __b) {
15740 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b);
15741 }
15742
vec_any_gt(vector short __a,vector bool short __b)15743 static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a,
15744 vector bool short __b) {
15745 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b);
15746 }
15747
vec_any_gt(vector unsigned short __a,vector unsigned short __b)15748 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
15749 vector unsigned short __b) {
15750 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b);
15751 }
15752
vec_any_gt(vector unsigned short __a,vector bool short __b)15753 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
15754 vector bool short __b) {
15755 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a,
15756 (vector unsigned short)__b);
15757 }
15758
vec_any_gt(vector bool short __a,vector short __b)15759 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
15760 vector short __b) {
15761 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
15762 (vector unsigned short)__b);
15763 }
15764
vec_any_gt(vector bool short __a,vector unsigned short __b)15765 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
15766 vector unsigned short __b) {
15767 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
15768 __b);
15769 }
15770
vec_any_gt(vector bool short __a,vector bool short __b)15771 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
15772 vector bool short __b) {
15773 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
15774 (vector unsigned short)__b);
15775 }
15776
vec_any_gt(vector int __a,vector int __b)15777 static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a, vector int __b) {
15778 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b);
15779 }
15780
vec_any_gt(vector int __a,vector bool int __b)15781 static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a,
15782 vector bool int __b) {
15783 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b);
15784 }
15785
vec_any_gt(vector unsigned int __a,vector unsigned int __b)15786 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
15787 vector unsigned int __b) {
15788 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b);
15789 }
15790
vec_any_gt(vector unsigned int __a,vector bool int __b)15791 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
15792 vector bool int __b) {
15793 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a,
15794 (vector unsigned int)__b);
15795 }
15796
vec_any_gt(vector bool int __a,vector int __b)15797 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
15798 vector int __b) {
15799 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
15800 (vector unsigned int)__b);
15801 }
15802
vec_any_gt(vector bool int __a,vector unsigned int __b)15803 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
15804 vector unsigned int __b) {
15805 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
15806 __b);
15807 }
15808
vec_any_gt(vector bool int __a,vector bool int __b)15809 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
15810 vector bool int __b) {
15811 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
15812 (vector unsigned int)__b);
15813 }
15814
15815 #ifdef __POWER8_VECTOR__
vec_any_gt(vector signed long long __a,vector signed long long __b)15816 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
15817 vector signed long long __b) {
15818 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, __b);
15819 }
15820
vec_any_gt(vector unsigned long long __a,vector unsigned long long __b)15821 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
15822 vector unsigned long long __b) {
15823 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, __b);
15824 }
15825
vec_any_gt(vector signed long long __a,vector bool long long __b)15826 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
15827 vector bool long long __b) {
15828 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a,
15829 (vector signed long long)__b);
15830 }
15831
vec_any_gt(vector unsigned long long __a,vector bool long long __b)15832 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
15833 vector bool long long __b) {
15834 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a,
15835 (vector unsigned long long)__b);
15836 }
15837
vec_any_gt(vector bool long long __a,vector signed long long __b)15838 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
15839 vector signed long long __b) {
15840 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15841 (vector unsigned long long)__a,
15842 (vector unsigned long long)__b);
15843 }
15844
vec_any_gt(vector bool long long __a,vector unsigned long long __b)15845 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
15846 vector unsigned long long __b) {
15847 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15848 (vector unsigned long long)__a, __b);
15849 }
15850
vec_any_gt(vector bool long long __a,vector bool long long __b)15851 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
15852 vector bool long long __b) {
15853 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15854 (vector unsigned long long)__a,
15855 (vector unsigned long long)__b);
15856 }
15857 #endif
15858
vec_any_gt(vector float __a,vector float __b)15859 static __inline__ int __ATTRS_o_ai vec_any_gt(vector float __a,
15860 vector float __b) {
15861 #ifdef __VSX__
15862 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __a, __b);
15863 #else
15864 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b);
15865 #endif
15866 }
15867
15868 #ifdef __VSX__
vec_any_gt(vector double __a,vector double __b)15869 static __inline__ int __ATTRS_o_ai vec_any_gt(vector double __a,
15870 vector double __b) {
15871 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __a, __b);
15872 }
15873 #endif
15874
15875 #ifdef __POWER10_VECTOR__
vec_any_gt(vector signed __int128 __a,vector signed __int128 __b)15876 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed __int128 __a,
15877 vector signed __int128 __b) {
15878 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ_REV, __a, __b);
15879 }
15880
vec_any_gt(vector unsigned __int128 __a,vector unsigned __int128 __b)15881 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned __int128 __a,
15882 vector unsigned __int128 __b) {
15883 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ_REV, __a, __b);
15884 }
15885 #endif
15886
15887 /* vec_any_le */
15888
vec_any_le(vector signed char __a,vector signed char __b)15889 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a,
15890 vector signed char __b) {
15891 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b);
15892 }
15893
vec_any_le(vector signed char __a,vector bool char __b)15894 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a,
15895 vector bool char __b) {
15896 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a,
15897 (vector signed char)__b);
15898 }
15899
vec_any_le(vector unsigned char __a,vector unsigned char __b)15900 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
15901 vector unsigned char __b) {
15902 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b);
15903 }
15904
vec_any_le(vector unsigned char __a,vector bool char __b)15905 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
15906 vector bool char __b) {
15907 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a,
15908 (vector unsigned char)__b);
15909 }
15910
vec_any_le(vector bool char __a,vector signed char __b)15911 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
15912 vector signed char __b) {
15913 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
15914 (vector unsigned char)__b);
15915 }
15916
vec_any_le(vector bool char __a,vector unsigned char __b)15917 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
15918 vector unsigned char __b) {
15919 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
15920 __b);
15921 }
15922
vec_any_le(vector bool char __a,vector bool char __b)15923 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
15924 vector bool char __b) {
15925 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
15926 (vector unsigned char)__b);
15927 }
15928
vec_any_le(vector short __a,vector short __b)15929 static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a,
15930 vector short __b) {
15931 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b);
15932 }
15933
vec_any_le(vector short __a,vector bool short __b)15934 static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a,
15935 vector bool short __b) {
15936 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b);
15937 }
15938
vec_any_le(vector unsigned short __a,vector unsigned short __b)15939 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
15940 vector unsigned short __b) {
15941 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b);
15942 }
15943
vec_any_le(vector unsigned short __a,vector bool short __b)15944 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
15945 vector bool short __b) {
15946 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a,
15947 (vector unsigned short)__b);
15948 }
15949
vec_any_le(vector bool short __a,vector short __b)15950 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
15951 vector short __b) {
15952 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
15953 (vector unsigned short)__b);
15954 }
15955
vec_any_le(vector bool short __a,vector unsigned short __b)15956 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
15957 vector unsigned short __b) {
15958 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
15959 __b);
15960 }
15961
vec_any_le(vector bool short __a,vector bool short __b)15962 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
15963 vector bool short __b) {
15964 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
15965 (vector unsigned short)__b);
15966 }
15967
vec_any_le(vector int __a,vector int __b)15968 static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a, vector int __b) {
15969 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b);
15970 }
15971
vec_any_le(vector int __a,vector bool int __b)15972 static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a,
15973 vector bool int __b) {
15974 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b);
15975 }
15976
vec_any_le(vector unsigned int __a,vector unsigned int __b)15977 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
15978 vector unsigned int __b) {
15979 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b);
15980 }
15981
vec_any_le(vector unsigned int __a,vector bool int __b)15982 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
15983 vector bool int __b) {
15984 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a,
15985 (vector unsigned int)__b);
15986 }
15987
vec_any_le(vector bool int __a,vector int __b)15988 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
15989 vector int __b) {
15990 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
15991 (vector unsigned int)__b);
15992 }
15993
vec_any_le(vector bool int __a,vector unsigned int __b)15994 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
15995 vector unsigned int __b) {
15996 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
15997 __b);
15998 }
15999
vec_any_le(vector bool int __a,vector bool int __b)16000 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
16001 vector bool int __b) {
16002 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
16003 (vector unsigned int)__b);
16004 }
16005
16006 #ifdef __POWER8_VECTOR__
vec_any_le(vector signed long long __a,vector signed long long __b)16007 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a,
16008 vector signed long long __b) {
16009 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, __b);
16010 }
16011
vec_any_le(vector unsigned long long __a,vector unsigned long long __b)16012 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
16013 vector unsigned long long __b) {
16014 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, __b);
16015 }
16016
vec_any_le(vector signed long long __a,vector bool long long __b)16017 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a,
16018 vector bool long long __b) {
16019 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a,
16020 (vector signed long long)__b);
16021 }
16022
vec_any_le(vector unsigned long long __a,vector bool long long __b)16023 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
16024 vector bool long long __b) {
16025 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a,
16026 (vector unsigned long long)__b);
16027 }
16028
vec_any_le(vector bool long long __a,vector signed long long __b)16029 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
16030 vector signed long long __b) {
16031 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
16032 (vector unsigned long long)__a,
16033 (vector unsigned long long)__b);
16034 }
16035
vec_any_le(vector bool long long __a,vector unsigned long long __b)16036 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
16037 vector unsigned long long __b) {
16038 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
16039 (vector unsigned long long)__a, __b);
16040 }
16041
vec_any_le(vector bool long long __a,vector bool long long __b)16042 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
16043 vector bool long long __b) {
16044 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
16045 (vector unsigned long long)__a,
16046 (vector unsigned long long)__b);
16047 }
16048 #endif
16049
vec_any_le(vector float __a,vector float __b)16050 static __inline__ int __ATTRS_o_ai vec_any_le(vector float __a,
16051 vector float __b) {
16052 #ifdef __VSX__
16053 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __b, __a);
16054 #else
16055 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a);
16056 #endif
16057 }
16058
16059 #ifdef __VSX__
vec_any_le(vector double __a,vector double __b)16060 static __inline__ int __ATTRS_o_ai vec_any_le(vector double __a,
16061 vector double __b) {
16062 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __b, __a);
16063 }
16064 #endif
16065
16066 #ifdef __POWER10_VECTOR__
vec_any_le(vector signed __int128 __a,vector signed __int128 __b)16067 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed __int128 __a,
16068 vector signed __int128 __b) {
16069 return __builtin_altivec_vcmpgtsq_p(__CR6_LT_REV, __a, __b);
16070 }
16071
vec_any_le(vector unsigned __int128 __a,vector unsigned __int128 __b)16072 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned __int128 __a,
16073 vector unsigned __int128 __b) {
16074 return __builtin_altivec_vcmpgtuq_p(__CR6_LT_REV, __a, __b);
16075 }
16076 #endif
16077
16078 /* vec_any_lt */
16079
vec_any_lt(vector signed char __a,vector signed char __b)16080 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a,
16081 vector signed char __b) {
16082 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a);
16083 }
16084
vec_any_lt(vector signed char __a,vector bool char __b)16085 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a,
16086 vector bool char __b) {
16087 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b,
16088 __a);
16089 }
16090
vec_any_lt(vector unsigned char __a,vector unsigned char __b)16091 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
16092 vector unsigned char __b) {
16093 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a);
16094 }
16095
vec_any_lt(vector unsigned char __a,vector bool char __b)16096 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
16097 vector bool char __b) {
16098 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
16099 __a);
16100 }
16101
vec_any_lt(vector bool char __a,vector signed char __b)16102 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
16103 vector signed char __b) {
16104 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
16105 (vector unsigned char)__a);
16106 }
16107
vec_any_lt(vector bool char __a,vector unsigned char __b)16108 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
16109 vector unsigned char __b) {
16110 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b,
16111 (vector unsigned char)__a);
16112 }
16113
vec_any_lt(vector bool char __a,vector bool char __b)16114 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
16115 vector bool char __b) {
16116 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
16117 (vector unsigned char)__a);
16118 }
16119
vec_any_lt(vector short __a,vector short __b)16120 static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a,
16121 vector short __b) {
16122 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a);
16123 }
16124
vec_any_lt(vector short __a,vector bool short __b)16125 static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a,
16126 vector bool short __b) {
16127 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a);
16128 }
16129
vec_any_lt(vector unsigned short __a,vector unsigned short __b)16130 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
16131 vector unsigned short __b) {
16132 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a);
16133 }
16134
vec_any_lt(vector unsigned short __a,vector bool short __b)16135 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
16136 vector bool short __b) {
16137 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
16138 __a);
16139 }
16140
vec_any_lt(vector bool short __a,vector short __b)16141 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
16142 vector short __b) {
16143 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
16144 (vector unsigned short)__a);
16145 }
16146
vec_any_lt(vector bool short __a,vector unsigned short __b)16147 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
16148 vector unsigned short __b) {
16149 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b,
16150 (vector unsigned short)__a);
16151 }
16152
vec_any_lt(vector bool short __a,vector bool short __b)16153 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
16154 vector bool short __b) {
16155 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
16156 (vector unsigned short)__a);
16157 }
16158
vec_any_lt(vector int __a,vector int __b)16159 static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a, vector int __b) {
16160 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a);
16161 }
16162
vec_any_lt(vector int __a,vector bool int __b)16163 static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a,
16164 vector bool int __b) {
16165 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a);
16166 }
16167
vec_any_lt(vector unsigned int __a,vector unsigned int __b)16168 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
16169 vector unsigned int __b) {
16170 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a);
16171 }
16172
vec_any_lt(vector unsigned int __a,vector bool int __b)16173 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
16174 vector bool int __b) {
16175 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
16176 __a);
16177 }
16178
vec_any_lt(vector bool int __a,vector int __b)16179 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
16180 vector int __b) {
16181 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
16182 (vector unsigned int)__a);
16183 }
16184
vec_any_lt(vector bool int __a,vector unsigned int __b)16185 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
16186 vector unsigned int __b) {
16187 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b,
16188 (vector unsigned int)__a);
16189 }
16190
vec_any_lt(vector bool int __a,vector bool int __b)16191 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
16192 vector bool int __b) {
16193 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
16194 (vector unsigned int)__a);
16195 }
16196
16197 #ifdef __POWER8_VECTOR__
vec_any_lt(vector signed long long __a,vector signed long long __b)16198 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
16199 vector signed long long __b) {
16200 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, __a);
16201 }
16202
vec_any_lt(vector unsigned long long __a,vector unsigned long long __b)16203 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
16204 vector unsigned long long __b) {
16205 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, __a);
16206 }
16207
vec_any_lt(vector signed long long __a,vector bool long long __b)16208 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
16209 vector bool long long __b) {
16210 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV,
16211 (vector signed long long)__b, __a);
16212 }
16213
vec_any_lt(vector unsigned long long __a,vector bool long long __b)16214 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
16215 vector bool long long __b) {
16216 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
16217 (vector unsigned long long)__b, __a);
16218 }
16219
vec_any_lt(vector bool long long __a,vector signed long long __b)16220 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
16221 vector signed long long __b) {
16222 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
16223 (vector unsigned long long)__b,
16224 (vector unsigned long long)__a);
16225 }
16226
vec_any_lt(vector bool long long __a,vector unsigned long long __b)16227 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
16228 vector unsigned long long __b) {
16229 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b,
16230 (vector unsigned long long)__a);
16231 }
16232
vec_any_lt(vector bool long long __a,vector bool long long __b)16233 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
16234 vector bool long long __b) {
16235 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
16236 (vector unsigned long long)__b,
16237 (vector unsigned long long)__a);
16238 }
16239 #endif
16240
vec_any_lt(vector float __a,vector float __b)16241 static __inline__ int __ATTRS_o_ai vec_any_lt(vector float __a,
16242 vector float __b) {
16243 #ifdef __VSX__
16244 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __b, __a);
16245 #else
16246 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a);
16247 #endif
16248 }
16249
16250 #ifdef __VSX__
vec_any_lt(vector double __a,vector double __b)16251 static __inline__ int __ATTRS_o_ai vec_any_lt(vector double __a,
16252 vector double __b) {
16253 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __b, __a);
16254 }
16255 #endif
16256
16257 #ifdef __POWER10_VECTOR__
vec_any_lt(vector signed __int128 __a,vector signed __int128 __b)16258 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed __int128 __a,
16259 vector signed __int128 __b) {
16260 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ_REV, __b, __a);
16261 }
16262
vec_any_lt(vector unsigned __int128 __a,vector unsigned __int128 __b)16263 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned __int128 __a,
16264 vector unsigned __int128 __b) {
16265 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ_REV, __b, __a);
16266 }
16267 #endif
16268
16269 /* vec_any_nan */
16270
16271 static __inline__ int __attribute__((__always_inline__))
vec_any_nan(vector float __a)16272 vec_any_nan(vector float __a) {
16273 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a);
16274 }
16275
16276 /* vec_any_ne */
16277
vec_any_ne(vector signed char __a,vector signed char __b)16278 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a,
16279 vector signed char __b) {
16280 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
16281 (vector char)__b);
16282 }
16283
vec_any_ne(vector signed char __a,vector bool char __b)16284 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a,
16285 vector bool char __b) {
16286 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
16287 (vector char)__b);
16288 }
16289
vec_any_ne(vector unsigned char __a,vector unsigned char __b)16290 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
16291 vector unsigned char __b) {
16292 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
16293 (vector char)__b);
16294 }
16295
vec_any_ne(vector unsigned char __a,vector bool char __b)16296 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
16297 vector bool char __b) {
16298 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
16299 (vector char)__b);
16300 }
16301
vec_any_ne(vector bool char __a,vector signed char __b)16302 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
16303 vector signed char __b) {
16304 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
16305 (vector char)__b);
16306 }
16307
vec_any_ne(vector bool char __a,vector unsigned char __b)16308 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
16309 vector unsigned char __b) {
16310 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
16311 (vector char)__b);
16312 }
16313
vec_any_ne(vector bool char __a,vector bool char __b)16314 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
16315 vector bool char __b) {
16316 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
16317 (vector char)__b);
16318 }
16319
vec_any_ne(vector short __a,vector short __b)16320 static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a,
16321 vector short __b) {
16322 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b);
16323 }
16324
vec_any_ne(vector short __a,vector bool short __b)16325 static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a,
16326 vector bool short __b) {
16327 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b);
16328 }
16329
vec_any_ne(vector unsigned short __a,vector unsigned short __b)16330 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
16331 vector unsigned short __b) {
16332 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
16333 (vector short)__b);
16334 }
16335
vec_any_ne(vector unsigned short __a,vector bool short __b)16336 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
16337 vector bool short __b) {
16338 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
16339 (vector short)__b);
16340 }
16341
vec_any_ne(vector bool short __a,vector short __b)16342 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
16343 vector short __b) {
16344 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
16345 (vector short)__b);
16346 }
16347
vec_any_ne(vector bool short __a,vector unsigned short __b)16348 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
16349 vector unsigned short __b) {
16350 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
16351 (vector short)__b);
16352 }
16353
vec_any_ne(vector bool short __a,vector bool short __b)16354 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
16355 vector bool short __b) {
16356 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
16357 (vector short)__b);
16358 }
16359
vec_any_ne(vector pixel __a,vector pixel __b)16360 static __inline__ int __ATTRS_o_ai vec_any_ne(vector pixel __a,
16361 vector pixel __b) {
16362 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
16363 (vector short)__b);
16364 }
16365
vec_any_ne(vector int __a,vector int __b)16366 static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a, vector int __b) {
16367 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b);
16368 }
16369
vec_any_ne(vector int __a,vector bool int __b)16370 static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a,
16371 vector bool int __b) {
16372 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b);
16373 }
16374
vec_any_ne(vector unsigned int __a,vector unsigned int __b)16375 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
16376 vector unsigned int __b) {
16377 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
16378 (vector int)__b);
16379 }
16380
vec_any_ne(vector unsigned int __a,vector bool int __b)16381 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
16382 vector bool int __b) {
16383 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
16384 (vector int)__b);
16385 }
16386
vec_any_ne(vector bool int __a,vector int __b)16387 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
16388 vector int __b) {
16389 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
16390 (vector int)__b);
16391 }
16392
vec_any_ne(vector bool int __a,vector unsigned int __b)16393 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
16394 vector unsigned int __b) {
16395 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
16396 (vector int)__b);
16397 }
16398
vec_any_ne(vector bool int __a,vector bool int __b)16399 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
16400 vector bool int __b) {
16401 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
16402 (vector int)__b);
16403 }
16404
16405 #ifdef __POWER8_VECTOR__
vec_any_ne(vector signed long long __a,vector signed long long __b)16406 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
16407 vector signed long long __b) {
16408 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, __b);
16409 }
16410
vec_any_ne(vector unsigned long long __a,vector unsigned long long __b)16411 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
16412 vector unsigned long long __b) {
16413 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector long long)__a,
16414 (vector long long)__b);
16415 }
16416
vec_any_ne(vector signed long long __a,vector bool long long __b)16417 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
16418 vector bool long long __b) {
16419 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a,
16420 (vector signed long long)__b);
16421 }
16422
vec_any_ne(vector unsigned long long __a,vector bool long long __b)16423 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
16424 vector bool long long __b) {
16425 return __builtin_altivec_vcmpequd_p(
16426 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
16427 }
16428
vec_any_ne(vector bool long long __a,vector signed long long __b)16429 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
16430 vector signed long long __b) {
16431 return __builtin_altivec_vcmpequd_p(
16432 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
16433 }
16434
vec_any_ne(vector bool long long __a,vector unsigned long long __b)16435 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
16436 vector unsigned long long __b) {
16437 return __builtin_altivec_vcmpequd_p(
16438 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
16439 }
16440
vec_any_ne(vector bool long long __a,vector bool long long __b)16441 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
16442 vector bool long long __b) {
16443 return __builtin_altivec_vcmpequd_p(
16444 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
16445 }
16446 #endif
16447
vec_any_ne(vector float __a,vector float __b)16448 static __inline__ int __ATTRS_o_ai vec_any_ne(vector float __a,
16449 vector float __b) {
16450 #ifdef __VSX__
16451 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __b);
16452 #else
16453 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b);
16454 #endif
16455 }
16456
16457 #ifdef __VSX__
vec_any_ne(vector double __a,vector double __b)16458 static __inline__ int __ATTRS_o_ai vec_any_ne(vector double __a,
16459 vector double __b) {
16460 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __b);
16461 }
16462 #endif
16463
16464 #ifdef __POWER10_VECTOR__
vec_any_ne(vector signed __int128 __a,vector signed __int128 __b)16465 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed __int128 __a,
16466 vector signed __int128 __b) {
16467 return __builtin_altivec_vcmpequq_p(__CR6_LT_REV, __a, __b);
16468 }
16469
vec_any_ne(vector unsigned __int128 __a,vector unsigned __int128 __b)16470 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned __int128 __a,
16471 vector unsigned __int128 __b) {
16472 return __builtin_altivec_vcmpequq_p(__CR6_LT_REV, __a, __b);
16473 }
16474 #endif
16475
16476 /* vec_any_nge */
16477
16478 static __inline__ int __attribute__((__always_inline__))
vec_any_nge(vector float __a,vector float __b)16479 vec_any_nge(vector float __a, vector float __b) {
16480 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b);
16481 }
16482
16483 /* vec_any_ngt */
16484
16485 static __inline__ int __attribute__((__always_inline__))
vec_any_ngt(vector float __a,vector float __b)16486 vec_any_ngt(vector float __a, vector float __b) {
16487 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b);
16488 }
16489
16490 /* vec_any_nle */
16491
16492 static __inline__ int __attribute__((__always_inline__))
vec_any_nle(vector float __a,vector float __b)16493 vec_any_nle(vector float __a, vector float __b) {
16494 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a);
16495 }
16496
16497 /* vec_any_nlt */
16498
16499 static __inline__ int __attribute__((__always_inline__))
vec_any_nlt(vector float __a,vector float __b)16500 vec_any_nlt(vector float __a, vector float __b) {
16501 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a);
16502 }
16503
16504 /* vec_any_numeric */
16505
16506 static __inline__ int __attribute__((__always_inline__))
vec_any_numeric(vector float __a)16507 vec_any_numeric(vector float __a) {
16508 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a);
16509 }
16510
16511 /* vec_any_out */
16512
16513 static __inline__ int __attribute__((__always_inline__))
vec_any_out(vector float __a,vector float __b)16514 vec_any_out(vector float __a, vector float __b) {
16515 return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b);
16516 }
16517
16518 /* Power 8 Crypto functions
16519 Note: We diverge from the current GCC implementation with regard
16520 to cryptography and related functions as follows:
16521 - Only the SHA and AES instructions and builtins are disabled by -mno-crypto
16522 - The remaining ones are only available on Power8 and up so
16523 require -mpower8-vector
16524 The justification for this is that export requirements require that
16525 Category:Vector.Crypto is optional (i.e. compliant hardware may not provide
16526 support). As a result, we need to be able to turn off support for those.
16527 The remaining ones (currently controlled by -mcrypto for GCC) still
16528 need to be provided on compliant hardware even if Vector.Crypto is not
16529 provided.
16530 */
16531 #ifdef __CRYPTO__
16532 #define vec_sbox_be __builtin_altivec_crypto_vsbox
16533 #define vec_cipher_be __builtin_altivec_crypto_vcipher
16534 #define vec_cipherlast_be __builtin_altivec_crypto_vcipherlast
16535 #define vec_ncipher_be __builtin_altivec_crypto_vncipher
16536 #define vec_ncipherlast_be __builtin_altivec_crypto_vncipherlast
16537
16538 static __inline__ vector unsigned long long __attribute__((__always_inline__))
__builtin_crypto_vsbox(vector unsigned long long __a)16539 __builtin_crypto_vsbox(vector unsigned long long __a) {
16540 return __builtin_altivec_crypto_vsbox(__a);
16541 }
16542
16543 static __inline__ vector unsigned long long __attribute__((__always_inline__))
__builtin_crypto_vcipher(vector unsigned long long __a,vector unsigned long long __b)16544 __builtin_crypto_vcipher(vector unsigned long long __a,
16545 vector unsigned long long __b) {
16546 return __builtin_altivec_crypto_vcipher(__a, __b);
16547 }
16548
16549 static __inline__ vector unsigned long long __attribute__((__always_inline__))
__builtin_crypto_vcipherlast(vector unsigned long long __a,vector unsigned long long __b)16550 __builtin_crypto_vcipherlast(vector unsigned long long __a,
16551 vector unsigned long long __b) {
16552 return __builtin_altivec_crypto_vcipherlast(__a, __b);
16553 }
16554
16555 static __inline__ vector unsigned long long __attribute__((__always_inline__))
__builtin_crypto_vncipher(vector unsigned long long __a,vector unsigned long long __b)16556 __builtin_crypto_vncipher(vector unsigned long long __a,
16557 vector unsigned long long __b) {
16558 return __builtin_altivec_crypto_vncipher(__a, __b);
16559 }
16560
16561 static __inline__ vector unsigned long long __attribute__((__always_inline__))
__builtin_crypto_vncipherlast(vector unsigned long long __a,vector unsigned long long __b)16562 __builtin_crypto_vncipherlast(vector unsigned long long __a,
16563 vector unsigned long long __b) {
16564 return __builtin_altivec_crypto_vncipherlast(__a, __b);
16565 }
16566
16567 #define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad
16568 #define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw
16569
16570 #define vec_shasigma_be(X, Y, Z) \
16571 _Generic((X), vector unsigned int \
16572 : __builtin_crypto_vshasigmaw, vector unsigned long long \
16573 : __builtin_crypto_vshasigmad)((X), (Y), (Z))
16574 #endif
16575
16576 #ifdef __POWER8_VECTOR__
16577 static __inline__ vector bool char __ATTRS_o_ai
vec_permxor(vector bool char __a,vector bool char __b,vector bool char __c)16578 vec_permxor(vector bool char __a, vector bool char __b,
16579 vector bool char __c) {
16580 return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
16581 }
16582
16583 static __inline__ vector signed char __ATTRS_o_ai
vec_permxor(vector signed char __a,vector signed char __b,vector signed char __c)16584 vec_permxor(vector signed char __a, vector signed char __b,
16585 vector signed char __c) {
16586 return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
16587 }
16588
16589 static __inline__ vector unsigned char __ATTRS_o_ai
vec_permxor(vector unsigned char __a,vector unsigned char __b,vector unsigned char __c)16590 vec_permxor(vector unsigned char __a, vector unsigned char __b,
16591 vector unsigned char __c) {
16592 return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
16593 }
16594
16595 static __inline__ vector unsigned char __ATTRS_o_ai
__builtin_crypto_vpermxor(vector unsigned char __a,vector unsigned char __b,vector unsigned char __c)16596 __builtin_crypto_vpermxor(vector unsigned char __a, vector unsigned char __b,
16597 vector unsigned char __c) {
16598 return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
16599 }
16600
16601 static __inline__ vector unsigned short __ATTRS_o_ai
__builtin_crypto_vpermxor(vector unsigned short __a,vector unsigned short __b,vector unsigned short __c)16602 __builtin_crypto_vpermxor(vector unsigned short __a, vector unsigned short __b,
16603 vector unsigned short __c) {
16604 return (vector unsigned short)__builtin_altivec_crypto_vpermxor(
16605 (vector unsigned char)__a, (vector unsigned char)__b,
16606 (vector unsigned char)__c);
16607 }
16608
__builtin_crypto_vpermxor(vector unsigned int __a,vector unsigned int __b,vector unsigned int __c)16609 static __inline__ vector unsigned int __ATTRS_o_ai __builtin_crypto_vpermxor(
16610 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
16611 return (vector unsigned int)__builtin_altivec_crypto_vpermxor(
16612 (vector unsigned char)__a, (vector unsigned char)__b,
16613 (vector unsigned char)__c);
16614 }
16615
16616 static __inline__ vector unsigned long long __ATTRS_o_ai
__builtin_crypto_vpermxor(vector unsigned long long __a,vector unsigned long long __b,vector unsigned long long __c)16617 __builtin_crypto_vpermxor(vector unsigned long long __a,
16618 vector unsigned long long __b,
16619 vector unsigned long long __c) {
16620 return (vector unsigned long long)__builtin_altivec_crypto_vpermxor(
16621 (vector unsigned char)__a, (vector unsigned char)__b,
16622 (vector unsigned char)__c);
16623 }
16624
16625 static __inline__ vector unsigned char __ATTRS_o_ai
__builtin_crypto_vpmsumb(vector unsigned char __a,vector unsigned char __b)16626 __builtin_crypto_vpmsumb(vector unsigned char __a, vector unsigned char __b) {
16627 return __builtin_altivec_crypto_vpmsumb(__a, __b);
16628 }
16629
16630 static __inline__ vector unsigned short __ATTRS_o_ai
__builtin_crypto_vpmsumb(vector unsigned short __a,vector unsigned short __b)16631 __builtin_crypto_vpmsumb(vector unsigned short __a, vector unsigned short __b) {
16632 return __builtin_altivec_crypto_vpmsumh(__a, __b);
16633 }
16634
16635 static __inline__ vector unsigned int __ATTRS_o_ai
__builtin_crypto_vpmsumb(vector unsigned int __a,vector unsigned int __b)16636 __builtin_crypto_vpmsumb(vector unsigned int __a, vector unsigned int __b) {
16637 return __builtin_altivec_crypto_vpmsumw(__a, __b);
16638 }
16639
16640 static __inline__ vector unsigned long long __ATTRS_o_ai
__builtin_crypto_vpmsumb(vector unsigned long long __a,vector unsigned long long __b)16641 __builtin_crypto_vpmsumb(vector unsigned long long __a,
16642 vector unsigned long long __b) {
16643 return __builtin_altivec_crypto_vpmsumd(__a, __b);
16644 }
16645
16646 static __inline__ vector signed char __ATTRS_o_ai
vec_vgbbd(vector signed char __a)16647 vec_vgbbd(vector signed char __a) {
16648 return __builtin_altivec_vgbbd((vector unsigned char)__a);
16649 }
16650
16651 #define vec_pmsum_be __builtin_crypto_vpmsumb
16652 #define vec_gb __builtin_altivec_vgbbd
16653
16654 static __inline__ vector unsigned char __ATTRS_o_ai
vec_vgbbd(vector unsigned char __a)16655 vec_vgbbd(vector unsigned char __a) {
16656 return __builtin_altivec_vgbbd(__a);
16657 }
16658
16659 static __inline__ vector long long __ATTRS_o_ai
vec_vbpermq(vector signed char __a,vector signed char __b)16660 vec_vbpermq(vector signed char __a, vector signed char __b) {
16661 return __builtin_altivec_vbpermq((vector unsigned char)__a,
16662 (vector unsigned char)__b);
16663 }
16664
16665 static __inline__ vector long long __ATTRS_o_ai
vec_vbpermq(vector unsigned char __a,vector unsigned char __b)16666 vec_vbpermq(vector unsigned char __a, vector unsigned char __b) {
16667 return __builtin_altivec_vbpermq(__a, __b);
16668 }
16669
16670 #ifdef __powerpc64__
16671 static __inline__ vector unsigned long long __attribute__((__always_inline__))
vec_bperm(vector unsigned __int128 __a,vector unsigned char __b)16672 vec_bperm(vector unsigned __int128 __a, vector unsigned char __b) {
16673 return __builtin_altivec_vbpermq((vector unsigned char)__a,
16674 (vector unsigned char)__b);
16675 }
16676 #endif
16677 #endif
16678
16679
16680 /* vec_reve */
16681
vec_reve(vector bool char __a)16682 static inline __ATTRS_o_ai vector bool char vec_reve(vector bool char __a) {
16683 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
16684 5, 4, 3, 2, 1, 0);
16685 }
16686
vec_reve(vector signed char __a)16687 static inline __ATTRS_o_ai vector signed char vec_reve(vector signed char __a) {
16688 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
16689 5, 4, 3, 2, 1, 0);
16690 }
16691
16692 static inline __ATTRS_o_ai vector unsigned char
vec_reve(vector unsigned char __a)16693 vec_reve(vector unsigned char __a) {
16694 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
16695 5, 4, 3, 2, 1, 0);
16696 }
16697
vec_reve(vector bool int __a)16698 static inline __ATTRS_o_ai vector bool int vec_reve(vector bool int __a) {
16699 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
16700 }
16701
vec_reve(vector signed int __a)16702 static inline __ATTRS_o_ai vector signed int vec_reve(vector signed int __a) {
16703 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
16704 }
16705
16706 static inline __ATTRS_o_ai vector unsigned int
vec_reve(vector unsigned int __a)16707 vec_reve(vector unsigned int __a) {
16708 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
16709 }
16710
vec_reve(vector bool short __a)16711 static inline __ATTRS_o_ai vector bool short vec_reve(vector bool short __a) {
16712 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
16713 }
16714
16715 static inline __ATTRS_o_ai vector signed short
vec_reve(vector signed short __a)16716 vec_reve(vector signed short __a) {
16717 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
16718 }
16719
16720 static inline __ATTRS_o_ai vector unsigned short
vec_reve(vector unsigned short __a)16721 vec_reve(vector unsigned short __a) {
16722 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
16723 }
16724
vec_reve(vector float __a)16725 static inline __ATTRS_o_ai vector float vec_reve(vector float __a) {
16726 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
16727 }
16728
16729 #ifdef __VSX__
16730 static inline __ATTRS_o_ai vector bool long long
vec_reve(vector bool long long __a)16731 vec_reve(vector bool long long __a) {
16732 return __builtin_shufflevector(__a, __a, 1, 0);
16733 }
16734
16735 static inline __ATTRS_o_ai vector signed long long
vec_reve(vector signed long long __a)16736 vec_reve(vector signed long long __a) {
16737 return __builtin_shufflevector(__a, __a, 1, 0);
16738 }
16739
16740 static inline __ATTRS_o_ai vector unsigned long long
vec_reve(vector unsigned long long __a)16741 vec_reve(vector unsigned long long __a) {
16742 return __builtin_shufflevector(__a, __a, 1, 0);
16743 }
16744
vec_reve(vector double __a)16745 static inline __ATTRS_o_ai vector double vec_reve(vector double __a) {
16746 return __builtin_shufflevector(__a, __a, 1, 0);
16747 }
16748 #endif
16749
16750 /* vec_revb */
16751 static __inline__ vector bool char __ATTRS_o_ai
vec_revb(vector bool char __a)16752 vec_revb(vector bool char __a) {
16753 return __a;
16754 }
16755
16756 static __inline__ vector signed char __ATTRS_o_ai
vec_revb(vector signed char __a)16757 vec_revb(vector signed char __a) {
16758 return __a;
16759 }
16760
16761 static __inline__ vector unsigned char __ATTRS_o_ai
vec_revb(vector unsigned char __a)16762 vec_revb(vector unsigned char __a) {
16763 return __a;
16764 }
16765
16766 static __inline__ vector bool short __ATTRS_o_ai
vec_revb(vector bool short __a)16767 vec_revb(vector bool short __a) {
16768 vector unsigned char __indices =
16769 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
16770 return vec_perm(__a, __a, __indices);
16771 }
16772
16773 static __inline__ vector signed short __ATTRS_o_ai
vec_revb(vector signed short __a)16774 vec_revb(vector signed short __a) {
16775 vector unsigned char __indices =
16776 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
16777 return vec_perm(__a, __a, __indices);
16778 }
16779
16780 static __inline__ vector unsigned short __ATTRS_o_ai
vec_revb(vector unsigned short __a)16781 vec_revb(vector unsigned short __a) {
16782 vector unsigned char __indices =
16783 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
16784 return vec_perm(__a, __a, __indices);
16785 }
16786
16787 static __inline__ vector bool int __ATTRS_o_ai
vec_revb(vector bool int __a)16788 vec_revb(vector bool int __a) {
16789 vector unsigned char __indices =
16790 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
16791 return vec_perm(__a, __a, __indices);
16792 }
16793
16794 static __inline__ vector signed int __ATTRS_o_ai
vec_revb(vector signed int __a)16795 vec_revb(vector signed int __a) {
16796 vector unsigned char __indices =
16797 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
16798 return vec_perm(__a, __a, __indices);
16799 }
16800
16801 static __inline__ vector unsigned int __ATTRS_o_ai
vec_revb(vector unsigned int __a)16802 vec_revb(vector unsigned int __a) {
16803 vector unsigned char __indices =
16804 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
16805 return vec_perm(__a, __a, __indices);
16806 }
16807
16808 static __inline__ vector float __ATTRS_o_ai
vec_revb(vector float __a)16809 vec_revb(vector float __a) {
16810 vector unsigned char __indices =
16811 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
16812 return vec_perm(__a, __a, __indices);
16813 }
16814
16815 #ifdef __VSX__
16816 static __inline__ vector bool long long __ATTRS_o_ai
vec_revb(vector bool long long __a)16817 vec_revb(vector bool long long __a) {
16818 vector unsigned char __indices =
16819 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
16820 return vec_perm(__a, __a, __indices);
16821 }
16822
16823 static __inline__ vector signed long long __ATTRS_o_ai
vec_revb(vector signed long long __a)16824 vec_revb(vector signed long long __a) {
16825 vector unsigned char __indices =
16826 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
16827 return vec_perm(__a, __a, __indices);
16828 }
16829
16830 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_revb(vector unsigned long long __a)16831 vec_revb(vector unsigned long long __a) {
16832 vector unsigned char __indices =
16833 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
16834 return vec_perm(__a, __a, __indices);
16835 }
16836
16837 static __inline__ vector double __ATTRS_o_ai
vec_revb(vector double __a)16838 vec_revb(vector double __a) {
16839 vector unsigned char __indices =
16840 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
16841 return vec_perm(__a, __a, __indices);
16842 }
16843 #endif /* End __VSX__ */
16844
16845 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16846 static __inline__ vector signed __int128 __ATTRS_o_ai
vec_revb(vector signed __int128 __a)16847 vec_revb(vector signed __int128 __a) {
16848 vector unsigned char __indices =
16849 { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
16850 return (vector signed __int128)vec_perm((vector signed int)__a,
16851 (vector signed int)__a,
16852 __indices);
16853 }
16854
16855 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_revb(vector unsigned __int128 __a)16856 vec_revb(vector unsigned __int128 __a) {
16857 vector unsigned char __indices =
16858 { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
16859 return (vector unsigned __int128)vec_perm((vector signed int)__a,
16860 (vector signed int)__a,
16861 __indices);
16862 }
16863 #endif /* END __POWER8_VECTOR__ && __powerpc64__ */
16864
16865 /* vec_xl */
16866
16867 typedef vector signed char unaligned_vec_schar __attribute__((aligned(1)));
16868 typedef vector unsigned char unaligned_vec_uchar __attribute__((aligned(1)));
16869 typedef vector signed short unaligned_vec_sshort __attribute__((aligned(1)));
16870 typedef vector unsigned short unaligned_vec_ushort __attribute__((aligned(1)));
16871 typedef vector signed int unaligned_vec_sint __attribute__((aligned(1)));
16872 typedef vector unsigned int unaligned_vec_uint __attribute__((aligned(1)));
16873 typedef vector float unaligned_vec_float __attribute__((aligned(1)));
16874
vec_xl(signed long long __offset,const signed char * __ptr)16875 static inline __ATTRS_o_ai vector signed char vec_xl(signed long long __offset,
16876 const signed char *__ptr) {
16877 return *(unaligned_vec_schar *)(__ptr + __offset);
16878 }
16879
16880 static inline __ATTRS_o_ai vector unsigned char
vec_xl(signed long long __offset,const unsigned char * __ptr)16881 vec_xl(signed long long __offset, const unsigned char *__ptr) {
16882 return *(unaligned_vec_uchar*)(__ptr + __offset);
16883 }
16884
vec_xl(signed long long __offset,const signed short * __ptr)16885 static inline __ATTRS_o_ai vector signed short vec_xl(signed long long __offset,
16886 const signed short *__ptr) {
16887 signed char *__addr = (signed char *)__ptr + __offset;
16888 return *(unaligned_vec_sshort *)__addr;
16889 }
16890
16891 static inline __ATTRS_o_ai vector unsigned short
vec_xl(signed long long __offset,const unsigned short * __ptr)16892 vec_xl(signed long long __offset, const unsigned short *__ptr) {
16893 signed char *__addr = (signed char *)__ptr + __offset;
16894 return *(unaligned_vec_ushort *)__addr;
16895 }
16896
vec_xl(signed long long __offset,const signed int * __ptr)16897 static inline __ATTRS_o_ai vector signed int vec_xl(signed long long __offset,
16898 const signed int *__ptr) {
16899 signed char *__addr = (signed char *)__ptr + __offset;
16900 return *(unaligned_vec_sint *)__addr;
16901 }
16902
vec_xl(signed long long __offset,const unsigned int * __ptr)16903 static inline __ATTRS_o_ai vector unsigned int vec_xl(signed long long __offset,
16904 const unsigned int *__ptr) {
16905 signed char *__addr = (signed char *)__ptr + __offset;
16906 return *(unaligned_vec_uint *)__addr;
16907 }
16908
vec_xl(signed long long __offset,const float * __ptr)16909 static inline __ATTRS_o_ai vector float vec_xl(signed long long __offset,
16910 const float *__ptr) {
16911 signed char *__addr = (signed char *)__ptr + __offset;
16912 return *(unaligned_vec_float *)__addr;
16913 }
16914
16915 #ifdef __VSX__
16916 typedef vector signed long long unaligned_vec_sll __attribute__((aligned(1)));
16917 typedef vector unsigned long long unaligned_vec_ull __attribute__((aligned(1)));
16918 typedef vector double unaligned_vec_double __attribute__((aligned(1)));
16919
16920 static inline __ATTRS_o_ai vector signed long long
vec_xl(signed long long __offset,const signed long long * __ptr)16921 vec_xl(signed long long __offset, const signed long long *__ptr) {
16922 signed char *__addr = (signed char *)__ptr + __offset;
16923 return *(unaligned_vec_sll *)__addr;
16924 }
16925
16926 static inline __ATTRS_o_ai vector unsigned long long
vec_xl(signed long long __offset,const unsigned long long * __ptr)16927 vec_xl(signed long long __offset, const unsigned long long *__ptr) {
16928 signed char *__addr = (signed char *)__ptr + __offset;
16929 return *(unaligned_vec_ull *)__addr;
16930 }
16931
vec_xl(signed long long __offset,const double * __ptr)16932 static inline __ATTRS_o_ai vector double vec_xl(signed long long __offset,
16933 const double *__ptr) {
16934 signed char *__addr = (signed char *)__ptr + __offset;
16935 return *(unaligned_vec_double *)__addr;
16936 }
16937 #endif
16938
16939 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16940 typedef vector signed __int128 unaligned_vec_si128 __attribute__((aligned(1)));
16941 typedef vector unsigned __int128 unaligned_vec_ui128
16942 __attribute__((aligned(1)));
16943 static inline __ATTRS_o_ai vector signed __int128
vec_xl(signed long long __offset,const signed __int128 * __ptr)16944 vec_xl(signed long long __offset, const signed __int128 *__ptr) {
16945 signed char *__addr = (signed char *)__ptr + __offset;
16946 return *(unaligned_vec_si128 *)__addr;
16947 }
16948
16949 static inline __ATTRS_o_ai vector unsigned __int128
vec_xl(signed long long __offset,const unsigned __int128 * __ptr)16950 vec_xl(signed long long __offset, const unsigned __int128 *__ptr) {
16951 signed char *__addr = (signed char *)__ptr + __offset;
16952 return *(unaligned_vec_ui128 *)__addr;
16953 }
16954 #endif
16955
16956 /* vec_xl_be */
16957
16958 #ifdef __LITTLE_ENDIAN__
16959 static __inline__ vector signed char __ATTRS_o_ai
vec_xl_be(signed long long __offset,const signed char * __ptr)16960 vec_xl_be(signed long long __offset, const signed char *__ptr) {
16961 vector signed char __vec = (vector signed char)__builtin_vsx_lxvd2x_be(__offset, __ptr);
16962 return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
16963 13, 12, 11, 10, 9, 8);
16964 }
16965
16966 static __inline__ vector unsigned char __ATTRS_o_ai
vec_xl_be(signed long long __offset,const unsigned char * __ptr)16967 vec_xl_be(signed long long __offset, const unsigned char *__ptr) {
16968 vector unsigned char __vec = (vector unsigned char)__builtin_vsx_lxvd2x_be(__offset, __ptr);
16969 return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
16970 13, 12, 11, 10, 9, 8);
16971 }
16972
16973 static __inline__ vector signed short __ATTRS_o_ai
vec_xl_be(signed long long __offset,const signed short * __ptr)16974 vec_xl_be(signed long long __offset, const signed short *__ptr) {
16975 vector signed short __vec = (vector signed short)__builtin_vsx_lxvd2x_be(__offset, __ptr);
16976 return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
16977 }
16978
16979 static __inline__ vector unsigned short __ATTRS_o_ai
vec_xl_be(signed long long __offset,const unsigned short * __ptr)16980 vec_xl_be(signed long long __offset, const unsigned short *__ptr) {
16981 vector unsigned short __vec = (vector unsigned short)__builtin_vsx_lxvd2x_be(__offset, __ptr);
16982 return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
16983 }
16984
16985 static __inline__ vector signed int __ATTRS_o_ai
vec_xl_be(signed long long __offset,const signed int * __ptr)16986 vec_xl_be(signed long long __offset, const signed int *__ptr) {
16987 return (vector signed int)__builtin_vsx_lxvw4x_be(__offset, __ptr);
16988 }
16989
16990 static __inline__ vector unsigned int __ATTRS_o_ai
vec_xl_be(signed long long __offset,const unsigned int * __ptr)16991 vec_xl_be(signed long long __offset, const unsigned int *__ptr) {
16992 return (vector unsigned int)__builtin_vsx_lxvw4x_be(__offset, __ptr);
16993 }
16994
16995 static __inline__ vector float __ATTRS_o_ai
vec_xl_be(signed long long __offset,const float * __ptr)16996 vec_xl_be(signed long long __offset, const float *__ptr) {
16997 return (vector float)__builtin_vsx_lxvw4x_be(__offset, __ptr);
16998 }
16999
17000 #ifdef __VSX__
17001 static __inline__ vector signed long long __ATTRS_o_ai
vec_xl_be(signed long long __offset,const signed long long * __ptr)17002 vec_xl_be(signed long long __offset, const signed long long *__ptr) {
17003 return (vector signed long long)__builtin_vsx_lxvd2x_be(__offset, __ptr);
17004 }
17005
17006 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_xl_be(signed long long __offset,const unsigned long long * __ptr)17007 vec_xl_be(signed long long __offset, const unsigned long long *__ptr) {
17008 return (vector unsigned long long)__builtin_vsx_lxvd2x_be(__offset, __ptr);
17009 }
17010
17011 static __inline__ vector double __ATTRS_o_ai
vec_xl_be(signed long long __offset,const double * __ptr)17012 vec_xl_be(signed long long __offset, const double *__ptr) {
17013 return (vector double)__builtin_vsx_lxvd2x_be(__offset, __ptr);
17014 }
17015 #endif
17016
17017 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
17018 static __inline__ vector signed __int128 __ATTRS_o_ai
vec_xl_be(signed long long __offset,const signed __int128 * __ptr)17019 vec_xl_be(signed long long __offset, const signed __int128 *__ptr) {
17020 return vec_xl(__offset, __ptr);
17021 }
17022
17023 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_xl_be(signed long long __offset,const unsigned __int128 * __ptr)17024 vec_xl_be(signed long long __offset, const unsigned __int128 *__ptr) {
17025 return vec_xl(__offset, __ptr);
17026 }
17027 #endif
17028 #else
17029 #define vec_xl_be vec_xl
17030 #endif
17031
17032 #if defined(__POWER10_VECTOR__) && defined(__VSX__)
17033
17034 /* vect_xl_sext */
17035
17036 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_xl_sext(signed long long __offset,const signed char * __pointer)17037 vec_xl_sext(signed long long __offset, const signed char *__pointer) {
17038 return (vector unsigned __int128)*(__pointer + __offset);
17039 }
17040
17041 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_xl_sext(signed long long __offset,const signed short * __pointer)17042 vec_xl_sext(signed long long __offset, const signed short *__pointer) {
17043 return (vector unsigned __int128)*(__pointer + __offset);
17044 }
17045
17046 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_xl_sext(signed long long __offset,const signed int * __pointer)17047 vec_xl_sext(signed long long __offset, const signed int *__pointer) {
17048 return (vector unsigned __int128)*(__pointer + __offset);
17049 }
17050
17051 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_xl_sext(signed long long __offset,const signed long long * __pointer)17052 vec_xl_sext(signed long long __offset, const signed long long *__pointer) {
17053 return (vector unsigned __int128)*(__pointer + __offset);
17054 }
17055
17056 /* vec_xl_zext */
17057
17058 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_xl_zext(signed long long __offset,const unsigned char * __pointer)17059 vec_xl_zext(signed long long __offset, const unsigned char *__pointer) {
17060 return (vector unsigned __int128)*(__pointer + __offset);
17061 }
17062
17063 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_xl_zext(signed long long __offset,const unsigned short * __pointer)17064 vec_xl_zext(signed long long __offset, const unsigned short *__pointer) {
17065 return (vector unsigned __int128)*(__pointer + __offset);
17066 }
17067
17068 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_xl_zext(signed long long __offset,const unsigned int * __pointer)17069 vec_xl_zext(signed long long __offset, const unsigned int *__pointer) {
17070 return (vector unsigned __int128)*(__pointer + __offset);
17071 }
17072
17073 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_xl_zext(signed long long __offset,const unsigned long long * __pointer)17074 vec_xl_zext(signed long long __offset, const unsigned long long *__pointer) {
17075 return (vector unsigned __int128)*(__pointer + __offset);
17076 }
17077
17078 #endif
17079
17080 /* vec_xst */
17081
vec_xst(vector signed char __vec,signed long long __offset,signed char * __ptr)17082 static inline __ATTRS_o_ai void vec_xst(vector signed char __vec,
17083 signed long long __offset,
17084 signed char *__ptr) {
17085 *(unaligned_vec_schar *)(__ptr + __offset) = __vec;
17086 }
17087
vec_xst(vector unsigned char __vec,signed long long __offset,unsigned char * __ptr)17088 static inline __ATTRS_o_ai void vec_xst(vector unsigned char __vec,
17089 signed long long __offset,
17090 unsigned char *__ptr) {
17091 *(unaligned_vec_uchar *)(__ptr + __offset) = __vec;
17092 }
17093
vec_xst(vector signed short __vec,signed long long __offset,signed short * __ptr)17094 static inline __ATTRS_o_ai void vec_xst(vector signed short __vec,
17095 signed long long __offset,
17096 signed short *__ptr) {
17097 signed char *__addr = (signed char *)__ptr + __offset;
17098 *(unaligned_vec_sshort *)__addr = __vec;
17099 }
17100
vec_xst(vector unsigned short __vec,signed long long __offset,unsigned short * __ptr)17101 static inline __ATTRS_o_ai void vec_xst(vector unsigned short __vec,
17102 signed long long __offset,
17103 unsigned short *__ptr) {
17104 signed char *__addr = (signed char *)__ptr + __offset;
17105 *(unaligned_vec_ushort *)__addr = __vec;
17106 }
17107
vec_xst(vector signed int __vec,signed long long __offset,signed int * __ptr)17108 static inline __ATTRS_o_ai void vec_xst(vector signed int __vec,
17109 signed long long __offset,
17110 signed int *__ptr) {
17111 signed char *__addr = (signed char *)__ptr + __offset;
17112 *(unaligned_vec_sint *)__addr = __vec;
17113 }
17114
vec_xst(vector unsigned int __vec,signed long long __offset,unsigned int * __ptr)17115 static inline __ATTRS_o_ai void vec_xst(vector unsigned int __vec,
17116 signed long long __offset,
17117 unsigned int *__ptr) {
17118 signed char *__addr = (signed char *)__ptr + __offset;
17119 *(unaligned_vec_uint *)__addr = __vec;
17120 }
17121
vec_xst(vector float __vec,signed long long __offset,float * __ptr)17122 static inline __ATTRS_o_ai void vec_xst(vector float __vec,
17123 signed long long __offset,
17124 float *__ptr) {
17125 signed char *__addr = (signed char *)__ptr + __offset;
17126 *(unaligned_vec_float *)__addr = __vec;
17127 }
17128
17129 #ifdef __VSX__
vec_xst(vector signed long long __vec,signed long long __offset,signed long long * __ptr)17130 static inline __ATTRS_o_ai void vec_xst(vector signed long long __vec,
17131 signed long long __offset,
17132 signed long long *__ptr) {
17133 signed char *__addr = (signed char *)__ptr + __offset;
17134 *(unaligned_vec_sll *)__addr = __vec;
17135 }
17136
vec_xst(vector unsigned long long __vec,signed long long __offset,unsigned long long * __ptr)17137 static inline __ATTRS_o_ai void vec_xst(vector unsigned long long __vec,
17138 signed long long __offset,
17139 unsigned long long *__ptr) {
17140 signed char *__addr = (signed char *)__ptr + __offset;
17141 *(unaligned_vec_ull *)__addr = __vec;
17142 }
17143
vec_xst(vector double __vec,signed long long __offset,double * __ptr)17144 static inline __ATTRS_o_ai void vec_xst(vector double __vec,
17145 signed long long __offset,
17146 double *__ptr) {
17147 signed char *__addr = (signed char *)__ptr + __offset;
17148 *(unaligned_vec_double *)__addr = __vec;
17149 }
17150 #endif
17151
17152 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
vec_xst(vector signed __int128 __vec,signed long long __offset,signed __int128 * __ptr)17153 static inline __ATTRS_o_ai void vec_xst(vector signed __int128 __vec,
17154 signed long long __offset,
17155 signed __int128 *__ptr) {
17156 signed char *__addr = (signed char *)__ptr + __offset;
17157 *(unaligned_vec_si128 *)__addr = __vec;
17158 }
17159
vec_xst(vector unsigned __int128 __vec,signed long long __offset,unsigned __int128 * __ptr)17160 static inline __ATTRS_o_ai void vec_xst(vector unsigned __int128 __vec,
17161 signed long long __offset,
17162 unsigned __int128 *__ptr) {
17163 signed char *__addr = (signed char *)__ptr + __offset;
17164 *(unaligned_vec_ui128 *)__addr = __vec;
17165 }
17166 #endif
17167
17168 /* vec_xst_trunc */
17169
17170 #if defined(__POWER10_VECTOR__) && defined(__VSX__)
vec_xst_trunc(vector signed __int128 __vec,signed long long __offset,signed char * __ptr)17171 static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec,
17172 signed long long __offset,
17173 signed char *__ptr) {
17174 *(__ptr + __offset) = (signed char)__vec[0];
17175 }
17176
vec_xst_trunc(vector unsigned __int128 __vec,signed long long __offset,unsigned char * __ptr)17177 static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec,
17178 signed long long __offset,
17179 unsigned char *__ptr) {
17180 *(__ptr + __offset) = (unsigned char)__vec[0];
17181 }
17182
vec_xst_trunc(vector signed __int128 __vec,signed long long __offset,signed short * __ptr)17183 static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec,
17184 signed long long __offset,
17185 signed short *__ptr) {
17186 *(__ptr + __offset) = (signed short)__vec[0];
17187 }
17188
vec_xst_trunc(vector unsigned __int128 __vec,signed long long __offset,unsigned short * __ptr)17189 static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec,
17190 signed long long __offset,
17191 unsigned short *__ptr) {
17192 *(__ptr + __offset) = (unsigned short)__vec[0];
17193 }
17194
vec_xst_trunc(vector signed __int128 __vec,signed long long __offset,signed int * __ptr)17195 static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec,
17196 signed long long __offset,
17197 signed int *__ptr) {
17198 *(__ptr + __offset) = (signed int)__vec[0];
17199 }
17200
vec_xst_trunc(vector unsigned __int128 __vec,signed long long __offset,unsigned int * __ptr)17201 static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec,
17202 signed long long __offset,
17203 unsigned int *__ptr) {
17204 *(__ptr + __offset) = (unsigned int)__vec[0];
17205 }
17206
vec_xst_trunc(vector signed __int128 __vec,signed long long __offset,signed long long * __ptr)17207 static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec,
17208 signed long long __offset,
17209 signed long long *__ptr) {
17210 *(__ptr + __offset) = (signed long long)__vec[0];
17211 }
17212
vec_xst_trunc(vector unsigned __int128 __vec,signed long long __offset,unsigned long long * __ptr)17213 static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec,
17214 signed long long __offset,
17215 unsigned long long *__ptr) {
17216 *(__ptr + __offset) = (unsigned long long)__vec[0];
17217 }
17218 #endif
17219
17220 /* vec_xst_be */
17221
17222 #ifdef __LITTLE_ENDIAN__
vec_xst_be(vector signed char __vec,signed long long __offset,signed char * __ptr)17223 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed char __vec,
17224 signed long long __offset,
17225 signed char *__ptr) {
17226 vector signed char __tmp =
17227 __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
17228 13, 12, 11, 10, 9, 8);
17229 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double;
17230 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr);
17231 }
17232
vec_xst_be(vector unsigned char __vec,signed long long __offset,unsigned char * __ptr)17233 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned char __vec,
17234 signed long long __offset,
17235 unsigned char *__ptr) {
17236 vector unsigned char __tmp =
17237 __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
17238 13, 12, 11, 10, 9, 8);
17239 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double;
17240 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr);
17241 }
17242
vec_xst_be(vector signed short __vec,signed long long __offset,signed short * __ptr)17243 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed short __vec,
17244 signed long long __offset,
17245 signed short *__ptr) {
17246 vector signed short __tmp =
17247 __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
17248 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double;
17249 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr);
17250 }
17251
vec_xst_be(vector unsigned short __vec,signed long long __offset,unsigned short * __ptr)17252 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned short __vec,
17253 signed long long __offset,
17254 unsigned short *__ptr) {
17255 vector unsigned short __tmp =
17256 __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
17257 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double;
17258 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr);
17259 }
17260
vec_xst_be(vector signed int __vec,signed long long __offset,signed int * __ptr)17261 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed int __vec,
17262 signed long long __offset,
17263 signed int *__ptr) {
17264 __builtin_vsx_stxvw4x_be(__vec, __offset, __ptr);
17265 }
17266
vec_xst_be(vector unsigned int __vec,signed long long __offset,unsigned int * __ptr)17267 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned int __vec,
17268 signed long long __offset,
17269 unsigned int *__ptr) {
17270 __builtin_vsx_stxvw4x_be((vector int)__vec, __offset, __ptr);
17271 }
17272
vec_xst_be(vector float __vec,signed long long __offset,float * __ptr)17273 static __inline__ void __ATTRS_o_ai vec_xst_be(vector float __vec,
17274 signed long long __offset,
17275 float *__ptr) {
17276 __builtin_vsx_stxvw4x_be((vector int)__vec, __offset, __ptr);
17277 }
17278
17279 #ifdef __VSX__
vec_xst_be(vector signed long long __vec,signed long long __offset,signed long long * __ptr)17280 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed long long __vec,
17281 signed long long __offset,
17282 signed long long *__ptr) {
17283 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr);
17284 }
17285
vec_xst_be(vector unsigned long long __vec,signed long long __offset,unsigned long long * __ptr)17286 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned long long __vec,
17287 signed long long __offset,
17288 unsigned long long *__ptr) {
17289 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr);
17290 }
17291
vec_xst_be(vector double __vec,signed long long __offset,double * __ptr)17292 static __inline__ void __ATTRS_o_ai vec_xst_be(vector double __vec,
17293 signed long long __offset,
17294 double *__ptr) {
17295 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr);
17296 }
17297 #endif
17298
17299 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
vec_xst_be(vector signed __int128 __vec,signed long long __offset,signed __int128 * __ptr)17300 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed __int128 __vec,
17301 signed long long __offset,
17302 signed __int128 *__ptr) {
17303 vec_xst(__vec, __offset, __ptr);
17304 }
17305
vec_xst_be(vector unsigned __int128 __vec,signed long long __offset,unsigned __int128 * __ptr)17306 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned __int128 __vec,
17307 signed long long __offset,
17308 unsigned __int128 *__ptr) {
17309 vec_xst(__vec, __offset, __ptr);
17310 }
17311 #endif
17312 #else
17313 #define vec_xst_be vec_xst
17314 #endif
17315
17316 #ifdef __POWER9_VECTOR__
17317 #define vec_test_data_class(__a, __b) \
17318 _Generic( \
17319 (__a), vector float \
17320 : (vector bool int)__builtin_vsx_xvtstdcsp((vector float)(__a), (__b)), \
17321 vector double \
17322 : (vector bool long long)__builtin_vsx_xvtstdcdp((vector double)(__a), \
17323 (__b)))
17324
17325 #endif /* #ifdef __POWER9_VECTOR__ */
17326
vec_neg(vector float __a)17327 static vector float __ATTRS_o_ai vec_neg(vector float __a) {
17328 return -__a;
17329 }
17330
17331 #ifdef __VSX__
vec_neg(vector double __a)17332 static vector double __ATTRS_o_ai vec_neg(vector double __a) {
17333 return -__a;
17334 }
17335
17336 #endif
17337
17338 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
vec_neg(vector long long __a)17339 static vector long long __ATTRS_o_ai vec_neg(vector long long __a) {
17340 return -__a;
17341 }
17342 #endif
17343
vec_neg(vector signed int __a)17344 static vector signed int __ATTRS_o_ai vec_neg(vector signed int __a) {
17345 return -__a;
17346 }
17347
vec_neg(vector signed short __a)17348 static vector signed short __ATTRS_o_ai vec_neg(vector signed short __a) {
17349 return -__a;
17350 }
17351
vec_neg(vector signed char __a)17352 static vector signed char __ATTRS_o_ai vec_neg(vector signed char __a) {
17353 return -__a;
17354 }
17355
vec_nabs(vector float __a)17356 static vector float __ATTRS_o_ai vec_nabs(vector float __a) {
17357 return - vec_abs(__a);
17358 }
17359
17360 #ifdef __VSX__
vec_nabs(vector double __a)17361 static vector double __ATTRS_o_ai vec_nabs(vector double __a) {
17362 return - vec_abs(__a);
17363 }
17364
17365 #endif
17366
17367 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
vec_nabs(vector long long __a)17368 static vector long long __ATTRS_o_ai vec_nabs(vector long long __a) {
17369 return __builtin_altivec_vminsd(__a, -__a);
17370 }
17371 #endif
17372
vec_nabs(vector signed int __a)17373 static vector signed int __ATTRS_o_ai vec_nabs(vector signed int __a) {
17374 return __builtin_altivec_vminsw(__a, -__a);
17375 }
17376
vec_nabs(vector signed short __a)17377 static vector signed short __ATTRS_o_ai vec_nabs(vector signed short __a) {
17378 return __builtin_altivec_vminsh(__a, -__a);
17379 }
17380
vec_nabs(vector signed char __a)17381 static vector signed char __ATTRS_o_ai vec_nabs(vector signed char __a) {
17382 return __builtin_altivec_vminsb(__a, -__a);
17383 }
17384
17385 #ifdef __POWER10_VECTOR__
17386
17387 /* vec_extractm */
17388
17389 static __inline__ unsigned int __ATTRS_o_ai
vec_extractm(vector unsigned char __a)17390 vec_extractm(vector unsigned char __a) {
17391 return __builtin_altivec_vextractbm(__a);
17392 }
17393
17394 static __inline__ unsigned int __ATTRS_o_ai
vec_extractm(vector unsigned short __a)17395 vec_extractm(vector unsigned short __a) {
17396 return __builtin_altivec_vextracthm(__a);
17397 }
17398
17399 static __inline__ unsigned int __ATTRS_o_ai
vec_extractm(vector unsigned int __a)17400 vec_extractm(vector unsigned int __a) {
17401 return __builtin_altivec_vextractwm(__a);
17402 }
17403
17404 static __inline__ unsigned int __ATTRS_o_ai
vec_extractm(vector unsigned long long __a)17405 vec_extractm(vector unsigned long long __a) {
17406 return __builtin_altivec_vextractdm(__a);
17407 }
17408
17409 static __inline__ unsigned int __ATTRS_o_ai
vec_extractm(vector unsigned __int128 __a)17410 vec_extractm(vector unsigned __int128 __a) {
17411 return __builtin_altivec_vextractqm(__a);
17412 }
17413
17414 /* vec_expandm */
17415
17416 static __inline__ vector unsigned char __ATTRS_o_ai
vec_expandm(vector unsigned char __a)17417 vec_expandm(vector unsigned char __a) {
17418 return __builtin_altivec_vexpandbm(__a);
17419 }
17420
17421 static __inline__ vector unsigned short __ATTRS_o_ai
vec_expandm(vector unsigned short __a)17422 vec_expandm(vector unsigned short __a) {
17423 return __builtin_altivec_vexpandhm(__a);
17424 }
17425
17426 static __inline__ vector unsigned int __ATTRS_o_ai
vec_expandm(vector unsigned int __a)17427 vec_expandm(vector unsigned int __a) {
17428 return __builtin_altivec_vexpandwm(__a);
17429 }
17430
17431 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_expandm(vector unsigned long long __a)17432 vec_expandm(vector unsigned long long __a) {
17433 return __builtin_altivec_vexpanddm(__a);
17434 }
17435
17436 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_expandm(vector unsigned __int128 __a)17437 vec_expandm(vector unsigned __int128 __a) {
17438 return __builtin_altivec_vexpandqm(__a);
17439 }
17440
17441 /* vec_cntm */
17442
17443 #define vec_cntm(__a, __mp) \
17444 _Generic((__a), vector unsigned char \
17445 : __builtin_altivec_vcntmbb((__a), (unsigned int)(__mp)), \
17446 vector unsigned short \
17447 : __builtin_altivec_vcntmbh((__a), (unsigned int)(__mp)), \
17448 vector unsigned int \
17449 : __builtin_altivec_vcntmbw((__a), (unsigned int)(__mp)), \
17450 vector unsigned long long \
17451 : __builtin_altivec_vcntmbd((__a), (unsigned int)(__mp)))
17452
17453 /* vec_gen[b|h|w|d|q]m */
17454
17455 static __inline__ vector unsigned char __ATTRS_o_ai
vec_genbm(unsigned long long __bm)17456 vec_genbm(unsigned long long __bm) {
17457 return __builtin_altivec_mtvsrbm(__bm);
17458 }
17459
17460 static __inline__ vector unsigned short __ATTRS_o_ai
vec_genhm(unsigned long long __bm)17461 vec_genhm(unsigned long long __bm) {
17462 return __builtin_altivec_mtvsrhm(__bm);
17463 }
17464
17465 static __inline__ vector unsigned int __ATTRS_o_ai
vec_genwm(unsigned long long __bm)17466 vec_genwm(unsigned long long __bm) {
17467 return __builtin_altivec_mtvsrwm(__bm);
17468 }
17469
17470 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_gendm(unsigned long long __bm)17471 vec_gendm(unsigned long long __bm) {
17472 return __builtin_altivec_mtvsrdm(__bm);
17473 }
17474
17475 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_genqm(unsigned long long __bm)17476 vec_genqm(unsigned long long __bm) {
17477 return __builtin_altivec_mtvsrqm(__bm);
17478 }
17479
17480 /* vec_pdep */
17481
17482 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_pdep(vector unsigned long long __a,vector unsigned long long __b)17483 vec_pdep(vector unsigned long long __a, vector unsigned long long __b) {
17484 return __builtin_altivec_vpdepd(__a, __b);
17485 }
17486
17487 /* vec_pext */
17488
17489 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_pext(vector unsigned long long __a,vector unsigned long long __b)17490 vec_pext(vector unsigned long long __a, vector unsigned long long __b) {
17491 return __builtin_altivec_vpextd(__a, __b);
17492 }
17493
17494 /* vec_cfuge */
17495
17496 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_cfuge(vector unsigned long long __a,vector unsigned long long __b)17497 vec_cfuge(vector unsigned long long __a, vector unsigned long long __b) {
17498 return __builtin_altivec_vcfuged(__a, __b);
17499 }
17500
17501 /* vec_gnb */
17502
17503 #define vec_gnb(__a, __b) __builtin_altivec_vgnb(__a, __b)
17504
17505 /* vec_ternarylogic */
17506 #ifdef __VSX__
17507 #define vec_ternarylogic(__a, __b, __c, __imm) \
17508 _Generic((__a), vector unsigned char \
17509 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \
17510 (vector unsigned long long)(__b), \
17511 (vector unsigned long long)(__c), (__imm)), \
17512 vector unsigned short \
17513 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \
17514 (vector unsigned long long)(__b), \
17515 (vector unsigned long long)(__c), (__imm)), \
17516 vector unsigned int \
17517 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \
17518 (vector unsigned long long)(__b), \
17519 (vector unsigned long long)(__c), (__imm)), \
17520 vector unsigned long long \
17521 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \
17522 (vector unsigned long long)(__b), \
17523 (vector unsigned long long)(__c), (__imm)), \
17524 vector unsigned __int128 \
17525 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \
17526 (vector unsigned long long)(__b), \
17527 (vector unsigned long long)(__c), (__imm)))
17528 #endif /* __VSX__ */
17529
17530 /* vec_genpcvm */
17531
17532 #ifdef __VSX__
17533 #define vec_genpcvm(__a, __imm) \
17534 _Generic((__a), vector unsigned char \
17535 : __builtin_vsx_xxgenpcvbm((__a), (int)(__imm)), \
17536 vector unsigned short \
17537 : __builtin_vsx_xxgenpcvhm((__a), (int)(__imm)), \
17538 vector unsigned int \
17539 : __builtin_vsx_xxgenpcvwm((__a), (int)(__imm)), \
17540 vector unsigned long long \
17541 : __builtin_vsx_xxgenpcvdm((__a), (int)(__imm)))
17542 #endif /* __VSX__ */
17543
17544 /* vec_clrl */
17545
17546 static __inline__ vector signed char __ATTRS_o_ai
vec_clrl(vector signed char __a,unsigned int __n)17547 vec_clrl(vector signed char __a, unsigned int __n) {
17548 #ifdef __LITTLE_ENDIAN__
17549 return __builtin_altivec_vclrrb(__a, __n);
17550 #else
17551 return __builtin_altivec_vclrlb( __a, __n);
17552 #endif
17553 }
17554
17555 static __inline__ vector unsigned char __ATTRS_o_ai
vec_clrl(vector unsigned char __a,unsigned int __n)17556 vec_clrl(vector unsigned char __a, unsigned int __n) {
17557 #ifdef __LITTLE_ENDIAN__
17558 return __builtin_altivec_vclrrb((vector signed char)__a, __n);
17559 #else
17560 return __builtin_altivec_vclrlb((vector signed char)__a, __n);
17561 #endif
17562 }
17563
17564 /* vec_clrr */
17565
17566 static __inline__ vector signed char __ATTRS_o_ai
vec_clrr(vector signed char __a,unsigned int __n)17567 vec_clrr(vector signed char __a, unsigned int __n) {
17568 #ifdef __LITTLE_ENDIAN__
17569 return __builtin_altivec_vclrlb(__a, __n);
17570 #else
17571 return __builtin_altivec_vclrrb( __a, __n);
17572 #endif
17573 }
17574
17575 static __inline__ vector unsigned char __ATTRS_o_ai
vec_clrr(vector unsigned char __a,unsigned int __n)17576 vec_clrr(vector unsigned char __a, unsigned int __n) {
17577 #ifdef __LITTLE_ENDIAN__
17578 return __builtin_altivec_vclrlb((vector signed char)__a, __n);
17579 #else
17580 return __builtin_altivec_vclrrb((vector signed char)__a, __n);
17581 #endif
17582 }
17583
17584 /* vec_cntlzm */
17585
17586 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_cntlzm(vector unsigned long long __a,vector unsigned long long __b)17587 vec_cntlzm(vector unsigned long long __a, vector unsigned long long __b) {
17588 return __builtin_altivec_vclzdm(__a, __b);
17589 }
17590
17591 /* vec_cnttzm */
17592
17593 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_cnttzm(vector unsigned long long __a,vector unsigned long long __b)17594 vec_cnttzm(vector unsigned long long __a, vector unsigned long long __b) {
17595 return __builtin_altivec_vctzdm(__a, __b);
17596 }
17597
17598 /* vec_mod */
17599
17600 static __inline__ vector signed int __ATTRS_o_ai
vec_mod(vector signed int __a,vector signed int __b)17601 vec_mod(vector signed int __a, vector signed int __b) {
17602 return __a % __b;
17603 }
17604
17605 static __inline__ vector unsigned int __ATTRS_o_ai
vec_mod(vector unsigned int __a,vector unsigned int __b)17606 vec_mod(vector unsigned int __a, vector unsigned int __b) {
17607 return __a % __b;
17608 }
17609
17610 static __inline__ vector signed long long __ATTRS_o_ai
vec_mod(vector signed long long __a,vector signed long long __b)17611 vec_mod(vector signed long long __a, vector signed long long __b) {
17612 return __a % __b;
17613 }
17614
17615 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_mod(vector unsigned long long __a,vector unsigned long long __b)17616 vec_mod(vector unsigned long long __a, vector unsigned long long __b) {
17617 return __a % __b;
17618 }
17619
17620 static __inline__ vector signed __int128 __ATTRS_o_ai
vec_mod(vector signed __int128 __a,vector signed __int128 __b)17621 vec_mod(vector signed __int128 __a, vector signed __int128 __b) {
17622 return __a % __b;
17623 }
17624
17625 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_mod(vector unsigned __int128 __a,vector unsigned __int128 __b)17626 vec_mod(vector unsigned __int128 __a, vector unsigned __int128 __b) {
17627 return __a % __b;
17628 }
17629
17630 /* vec_sldbi */
17631
17632 #define vec_sldb(__a, __b, __c) __builtin_altivec_vsldbi(__a, __b, (__c & 0x7))
17633
17634 /* vec_srdbi */
17635
17636 #define vec_srdb(__a, __b, __c) __builtin_altivec_vsrdbi(__a, __b, (__c & 0x7))
17637
17638 /* vec_insertl */
17639
17640 static __inline__ vector unsigned char __ATTRS_o_ai
vec_insertl(unsigned char __a,vector unsigned char __b,unsigned int __c)17641 vec_insertl(unsigned char __a, vector unsigned char __b, unsigned int __c) {
17642 #ifdef __LITTLE_ENDIAN__
17643 return __builtin_altivec_vinsbrx(__b, __c, __a);
17644 #else
17645 return __builtin_altivec_vinsblx(__b, __c, __a);
17646 #endif
17647 }
17648
17649 static __inline__ vector unsigned short __ATTRS_o_ai
vec_insertl(unsigned short __a,vector unsigned short __b,unsigned int __c)17650 vec_insertl(unsigned short __a, vector unsigned short __b, unsigned int __c) {
17651 #ifdef __LITTLE_ENDIAN__
17652 return __builtin_altivec_vinshrx(__b, __c, __a);
17653 #else
17654 return __builtin_altivec_vinshlx(__b, __c, __a);
17655 #endif
17656 }
17657
17658 static __inline__ vector unsigned int __ATTRS_o_ai
vec_insertl(unsigned int __a,vector unsigned int __b,unsigned int __c)17659 vec_insertl(unsigned int __a, vector unsigned int __b, unsigned int __c) {
17660 #ifdef __LITTLE_ENDIAN__
17661 return __builtin_altivec_vinswrx(__b, __c, __a);
17662 #else
17663 return __builtin_altivec_vinswlx(__b, __c, __a);
17664 #endif
17665 }
17666
17667 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_insertl(unsigned long long __a,vector unsigned long long __b,unsigned int __c)17668 vec_insertl(unsigned long long __a, vector unsigned long long __b,
17669 unsigned int __c) {
17670 #ifdef __LITTLE_ENDIAN__
17671 return __builtin_altivec_vinsdrx(__b, __c, __a);
17672 #else
17673 return __builtin_altivec_vinsdlx(__b, __c, __a);
17674 #endif
17675 }
17676
17677 static __inline__ vector unsigned char __ATTRS_o_ai
vec_insertl(vector unsigned char __a,vector unsigned char __b,unsigned int __c)17678 vec_insertl(vector unsigned char __a, vector unsigned char __b,
17679 unsigned int __c) {
17680 #ifdef __LITTLE_ENDIAN__
17681 return __builtin_altivec_vinsbvrx(__b, __c, __a);
17682 #else
17683 return __builtin_altivec_vinsbvlx(__b, __c, __a);
17684 #endif
17685 }
17686
17687 static __inline__ vector unsigned short __ATTRS_o_ai
vec_insertl(vector unsigned short __a,vector unsigned short __b,unsigned int __c)17688 vec_insertl(vector unsigned short __a, vector unsigned short __b,
17689 unsigned int __c) {
17690 #ifdef __LITTLE_ENDIAN__
17691 return __builtin_altivec_vinshvrx(__b, __c, __a);
17692 #else
17693 return __builtin_altivec_vinshvlx(__b, __c, __a);
17694 #endif
17695 }
17696
17697 static __inline__ vector unsigned int __ATTRS_o_ai
vec_insertl(vector unsigned int __a,vector unsigned int __b,unsigned int __c)17698 vec_insertl(vector unsigned int __a, vector unsigned int __b,
17699 unsigned int __c) {
17700 #ifdef __LITTLE_ENDIAN__
17701 return __builtin_altivec_vinswvrx(__b, __c, __a);
17702 #else
17703 return __builtin_altivec_vinswvlx(__b, __c, __a);
17704 #endif
17705 }
17706
17707 /* vec_inserth */
17708
17709 static __inline__ vector unsigned char __ATTRS_o_ai
vec_inserth(unsigned char __a,vector unsigned char __b,unsigned int __c)17710 vec_inserth(unsigned char __a, vector unsigned char __b, unsigned int __c) {
17711 #ifdef __LITTLE_ENDIAN__
17712 return __builtin_altivec_vinsblx(__b, __c, __a);
17713 #else
17714 return __builtin_altivec_vinsbrx(__b, __c, __a);
17715 #endif
17716 }
17717
17718 static __inline__ vector unsigned short __ATTRS_o_ai
vec_inserth(unsigned short __a,vector unsigned short __b,unsigned int __c)17719 vec_inserth(unsigned short __a, vector unsigned short __b, unsigned int __c) {
17720 #ifdef __LITTLE_ENDIAN__
17721 return __builtin_altivec_vinshlx(__b, __c, __a);
17722 #else
17723 return __builtin_altivec_vinshrx(__b, __c, __a);
17724 #endif
17725 }
17726
17727 static __inline__ vector unsigned int __ATTRS_o_ai
vec_inserth(unsigned int __a,vector unsigned int __b,unsigned int __c)17728 vec_inserth(unsigned int __a, vector unsigned int __b, unsigned int __c) {
17729 #ifdef __LITTLE_ENDIAN__
17730 return __builtin_altivec_vinswlx(__b, __c, __a);
17731 #else
17732 return __builtin_altivec_vinswrx(__b, __c, __a);
17733 #endif
17734 }
17735
17736 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_inserth(unsigned long long __a,vector unsigned long long __b,unsigned int __c)17737 vec_inserth(unsigned long long __a, vector unsigned long long __b,
17738 unsigned int __c) {
17739 #ifdef __LITTLE_ENDIAN__
17740 return __builtin_altivec_vinsdlx(__b, __c, __a);
17741 #else
17742 return __builtin_altivec_vinsdrx(__b, __c, __a);
17743 #endif
17744 }
17745
17746 static __inline__ vector unsigned char __ATTRS_o_ai
vec_inserth(vector unsigned char __a,vector unsigned char __b,unsigned int __c)17747 vec_inserth(vector unsigned char __a, vector unsigned char __b,
17748 unsigned int __c) {
17749 #ifdef __LITTLE_ENDIAN__
17750 return __builtin_altivec_vinsbvlx(__b, __c, __a);
17751 #else
17752 return __builtin_altivec_vinsbvrx(__b, __c, __a);
17753 #endif
17754 }
17755
17756 static __inline__ vector unsigned short __ATTRS_o_ai
vec_inserth(vector unsigned short __a,vector unsigned short __b,unsigned int __c)17757 vec_inserth(vector unsigned short __a, vector unsigned short __b,
17758 unsigned int __c) {
17759 #ifdef __LITTLE_ENDIAN__
17760 return __builtin_altivec_vinshvlx(__b, __c, __a);
17761 #else
17762 return __builtin_altivec_vinshvrx(__b, __c, __a);
17763 #endif
17764 }
17765
17766 static __inline__ vector unsigned int __ATTRS_o_ai
vec_inserth(vector unsigned int __a,vector unsigned int __b,unsigned int __c)17767 vec_inserth(vector unsigned int __a, vector unsigned int __b,
17768 unsigned int __c) {
17769 #ifdef __LITTLE_ENDIAN__
17770 return __builtin_altivec_vinswvlx(__b, __c, __a);
17771 #else
17772 return __builtin_altivec_vinswvrx(__b, __c, __a);
17773 #endif
17774 }
17775
17776 /* vec_extractl */
17777
vec_extractl(vector unsigned char __a,vector unsigned char __b,unsigned int __c)17778 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extractl(
17779 vector unsigned char __a, vector unsigned char __b, unsigned int __c) {
17780 #ifdef __LITTLE_ENDIAN__
17781 return __builtin_altivec_vextdubvrx(__a, __b, __c);
17782 #else
17783 vector unsigned long long __ret = __builtin_altivec_vextdubvlx(__a, __b, __c);
17784 return vec_sld(__ret, __ret, 8);
17785 #endif
17786 }
17787
vec_extractl(vector unsigned short __a,vector unsigned short __b,unsigned int __c)17788 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extractl(
17789 vector unsigned short __a, vector unsigned short __b, unsigned int __c) {
17790 #ifdef __LITTLE_ENDIAN__
17791 return __builtin_altivec_vextduhvrx(__a, __b, __c);
17792 #else
17793 vector unsigned long long __ret = __builtin_altivec_vextduhvlx(__a, __b, __c);
17794 return vec_sld(__ret, __ret, 8);
17795 #endif
17796 }
17797
vec_extractl(vector unsigned int __a,vector unsigned int __b,unsigned int __c)17798 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extractl(
17799 vector unsigned int __a, vector unsigned int __b, unsigned int __c) {
17800 #ifdef __LITTLE_ENDIAN__
17801 return __builtin_altivec_vextduwvrx(__a, __b, __c);
17802 #else
17803 vector unsigned long long __ret = __builtin_altivec_vextduwvlx(__a, __b, __c);
17804 return vec_sld(__ret, __ret, 8);
17805 #endif
17806 }
17807
17808 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_extractl(vector unsigned long long __a,vector unsigned long long __b,unsigned int __c)17809 vec_extractl(vector unsigned long long __a, vector unsigned long long __b,
17810 unsigned int __c) {
17811 #ifdef __LITTLE_ENDIAN__
17812 return __builtin_altivec_vextddvrx(__a, __b, __c);
17813 #else
17814 vector unsigned long long __ret = __builtin_altivec_vextddvlx(__a, __b, __c);
17815 return vec_sld(__ret, __ret, 8);
17816 #endif
17817 }
17818
17819 /* vec_extracth */
17820
vec_extracth(vector unsigned char __a,vector unsigned char __b,unsigned int __c)17821 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extracth(
17822 vector unsigned char __a, vector unsigned char __b, unsigned int __c) {
17823 #ifdef __LITTLE_ENDIAN__
17824 return __builtin_altivec_vextdubvlx(__a, __b, __c);
17825 #else
17826 vector unsigned long long __ret = __builtin_altivec_vextdubvrx(__a, __b, __c);
17827 return vec_sld(__ret, __ret, 8);
17828 #endif
17829 }
17830
vec_extracth(vector unsigned short __a,vector unsigned short __b,unsigned int __c)17831 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extracth(
17832 vector unsigned short __a, vector unsigned short __b, unsigned int __c) {
17833 #ifdef __LITTLE_ENDIAN__
17834 return __builtin_altivec_vextduhvlx(__a, __b, __c);
17835 #else
17836 vector unsigned long long __ret = __builtin_altivec_vextduhvrx(__a, __b, __c);
17837 return vec_sld(__ret, __ret, 8);
17838 #endif
17839 }
17840
vec_extracth(vector unsigned int __a,vector unsigned int __b,unsigned int __c)17841 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extracth(
17842 vector unsigned int __a, vector unsigned int __b, unsigned int __c) {
17843 #ifdef __LITTLE_ENDIAN__
17844 return __builtin_altivec_vextduwvlx(__a, __b, __c);
17845 #else
17846 vector unsigned long long __ret = __builtin_altivec_vextduwvrx(__a, __b, __c);
17847 return vec_sld(__ret, __ret, 8);
17848 #endif
17849 }
17850
17851 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_extracth(vector unsigned long long __a,vector unsigned long long __b,unsigned int __c)17852 vec_extracth(vector unsigned long long __a, vector unsigned long long __b,
17853 unsigned int __c) {
17854 #ifdef __LITTLE_ENDIAN__
17855 return __builtin_altivec_vextddvlx(__a, __b, __c);
17856 #else
17857 vector unsigned long long __ret = __builtin_altivec_vextddvrx(__a, __b, __c);
17858 return vec_sld(__ret, __ret, 8);
17859 #endif
17860 }
17861
17862 #ifdef __VSX__
17863
17864 /* vec_permx */
17865
17866 #define vec_permx(__a, __b, __c, __d) \
17867 __builtin_vsx_xxpermx((__a), (__b), (__c), (__d))
17868
17869 /* vec_blendv */
17870
17871 static __inline__ vector signed char __ATTRS_o_ai
vec_blendv(vector signed char __a,vector signed char __b,vector unsigned char __c)17872 vec_blendv(vector signed char __a, vector signed char __b,
17873 vector unsigned char __c) {
17874 return __builtin_vsx_xxblendvb(__a, __b, __c);
17875 }
17876
17877 static __inline__ vector unsigned char __ATTRS_o_ai
vec_blendv(vector unsigned char __a,vector unsigned char __b,vector unsigned char __c)17878 vec_blendv(vector unsigned char __a, vector unsigned char __b,
17879 vector unsigned char __c) {
17880 return __builtin_vsx_xxblendvb(__a, __b, __c);
17881 }
17882
17883 static __inline__ vector signed short __ATTRS_o_ai
vec_blendv(vector signed short __a,vector signed short __b,vector unsigned short __c)17884 vec_blendv(vector signed short __a, vector signed short __b,
17885 vector unsigned short __c) {
17886 return __builtin_vsx_xxblendvh(__a, __b, __c);
17887 }
17888
17889 static __inline__ vector unsigned short __ATTRS_o_ai
vec_blendv(vector unsigned short __a,vector unsigned short __b,vector unsigned short __c)17890 vec_blendv(vector unsigned short __a, vector unsigned short __b,
17891 vector unsigned short __c) {
17892 return __builtin_vsx_xxblendvh(__a, __b, __c);
17893 }
17894
17895 static __inline__ vector signed int __ATTRS_o_ai
vec_blendv(vector signed int __a,vector signed int __b,vector unsigned int __c)17896 vec_blendv(vector signed int __a, vector signed int __b,
17897 vector unsigned int __c) {
17898 return __builtin_vsx_xxblendvw(__a, __b, __c);
17899 }
17900
17901 static __inline__ vector unsigned int __ATTRS_o_ai
vec_blendv(vector unsigned int __a,vector unsigned int __b,vector unsigned int __c)17902 vec_blendv(vector unsigned int __a, vector unsigned int __b,
17903 vector unsigned int __c) {
17904 return __builtin_vsx_xxblendvw(__a, __b, __c);
17905 }
17906
17907 static __inline__ vector signed long long __ATTRS_o_ai
vec_blendv(vector signed long long __a,vector signed long long __b,vector unsigned long long __c)17908 vec_blendv(vector signed long long __a, vector signed long long __b,
17909 vector unsigned long long __c) {
17910 return __builtin_vsx_xxblendvd(__a, __b, __c);
17911 }
17912
17913 static __inline__ vector unsigned long long __ATTRS_o_ai
vec_blendv(vector unsigned long long __a,vector unsigned long long __b,vector unsigned long long __c)17914 vec_blendv(vector unsigned long long __a, vector unsigned long long __b,
17915 vector unsigned long long __c) {
17916 return __builtin_vsx_xxblendvd(__a, __b, __c);
17917 }
17918
17919 static __inline__ vector float __ATTRS_o_ai
vec_blendv(vector float __a,vector float __b,vector unsigned int __c)17920 vec_blendv(vector float __a, vector float __b, vector unsigned int __c) {
17921 return __builtin_vsx_xxblendvw(__a, __b, __c);
17922 }
17923
17924 static __inline__ vector double __ATTRS_o_ai
vec_blendv(vector double __a,vector double __b,vector unsigned long long __c)17925 vec_blendv(vector double __a, vector double __b,
17926 vector unsigned long long __c) {
17927 return __builtin_vsx_xxblendvd(__a, __b, __c);
17928 }
17929
17930 /* vec_replace_elt */
17931
17932 #define vec_replace_elt __builtin_altivec_vec_replace_elt
17933
17934 /* vec_replace_unaligned */
17935
17936 #define vec_replace_unaligned __builtin_altivec_vec_replace_unaligned
17937
17938 /* vec_splati */
17939
17940 #define vec_splati(__a) \
17941 _Generic((__a), signed int \
17942 : ((vector signed int)__a), unsigned int \
17943 : ((vector unsigned int)__a), float \
17944 : ((vector float)__a))
17945
17946 /* vec_spatid */
17947
vec_splatid(const float __a)17948 static __inline__ vector double __ATTRS_o_ai vec_splatid(const float __a) {
17949 return ((vector double)((double)__a));
17950 }
17951
17952 /* vec_splati_ins */
17953
vec_splati_ins(vector signed int __a,const unsigned int __b,const signed int __c)17954 static __inline__ vector signed int __ATTRS_o_ai vec_splati_ins(
17955 vector signed int __a, const unsigned int __b, const signed int __c) {
17956 #ifdef __LITTLE_ENDIAN__
17957 __a[1 - __b] = __c;
17958 __a[3 - __b] = __c;
17959 #else
17960 __a[__b] = __c;
17961 __a[2 + __b] = __c;
17962 #endif
17963 return __a;
17964 }
17965
vec_splati_ins(vector unsigned int __a,const unsigned int __b,const unsigned int __c)17966 static __inline__ vector unsigned int __ATTRS_o_ai vec_splati_ins(
17967 vector unsigned int __a, const unsigned int __b, const unsigned int __c) {
17968 #ifdef __LITTLE_ENDIAN__
17969 __a[1 - __b] = __c;
17970 __a[3 - __b] = __c;
17971 #else
17972 __a[__b] = __c;
17973 __a[2 + __b] = __c;
17974 #endif
17975 return __a;
17976 }
17977
17978 static __inline__ vector float __ATTRS_o_ai
vec_splati_ins(vector float __a,const unsigned int __b,const float __c)17979 vec_splati_ins(vector float __a, const unsigned int __b, const float __c) {
17980 #ifdef __LITTLE_ENDIAN__
17981 __a[1 - __b] = __c;
17982 __a[3 - __b] = __c;
17983 #else
17984 __a[__b] = __c;
17985 __a[2 + __b] = __c;
17986 #endif
17987 return __a;
17988 }
17989
17990 /* vec_test_lsbb_all_ones */
17991
17992 static __inline__ int __ATTRS_o_ai
vec_test_lsbb_all_ones(vector unsigned char __a)17993 vec_test_lsbb_all_ones(vector unsigned char __a) {
17994 return __builtin_vsx_xvtlsbb(__a, 1);
17995 }
17996
17997 /* vec_test_lsbb_all_zeros */
17998
17999 static __inline__ int __ATTRS_o_ai
vec_test_lsbb_all_zeros(vector unsigned char __a)18000 vec_test_lsbb_all_zeros(vector unsigned char __a) {
18001 return __builtin_vsx_xvtlsbb(__a, 0);
18002 }
18003 #endif /* __VSX__ */
18004
18005 /* vec_stril */
18006
18007 static __inline__ vector unsigned char __ATTRS_o_ai
vec_stril(vector unsigned char __a)18008 vec_stril(vector unsigned char __a) {
18009 #ifdef __LITTLE_ENDIAN__
18010 return __builtin_altivec_vstribr((vector signed char)__a);
18011 #else
18012 return __builtin_altivec_vstribl((vector signed char)__a);
18013 #endif
18014 }
18015
18016 static __inline__ vector signed char __ATTRS_o_ai
vec_stril(vector signed char __a)18017 vec_stril(vector signed char __a) {
18018 #ifdef __LITTLE_ENDIAN__
18019 return __builtin_altivec_vstribr(__a);
18020 #else
18021 return __builtin_altivec_vstribl(__a);
18022 #endif
18023 }
18024
18025 static __inline__ vector unsigned short __ATTRS_o_ai
vec_stril(vector unsigned short __a)18026 vec_stril(vector unsigned short __a) {
18027 #ifdef __LITTLE_ENDIAN__
18028 return __builtin_altivec_vstrihr((vector signed short)__a);
18029 #else
18030 return __builtin_altivec_vstrihl((vector signed short)__a);
18031 #endif
18032 }
18033
18034 static __inline__ vector signed short __ATTRS_o_ai
vec_stril(vector signed short __a)18035 vec_stril(vector signed short __a) {
18036 #ifdef __LITTLE_ENDIAN__
18037 return __builtin_altivec_vstrihr(__a);
18038 #else
18039 return __builtin_altivec_vstrihl(__a);
18040 #endif
18041 }
18042
18043 /* vec_stril_p */
18044
vec_stril_p(vector unsigned char __a)18045 static __inline__ int __ATTRS_o_ai vec_stril_p(vector unsigned char __a) {
18046 #ifdef __LITTLE_ENDIAN__
18047 return __builtin_altivec_vstribr_p(__CR6_EQ, (vector signed char)__a);
18048 #else
18049 return __builtin_altivec_vstribl_p(__CR6_EQ, (vector signed char)__a);
18050 #endif
18051 }
18052
vec_stril_p(vector signed char __a)18053 static __inline__ int __ATTRS_o_ai vec_stril_p(vector signed char __a) {
18054 #ifdef __LITTLE_ENDIAN__
18055 return __builtin_altivec_vstribr_p(__CR6_EQ, __a);
18056 #else
18057 return __builtin_altivec_vstribl_p(__CR6_EQ, __a);
18058 #endif
18059 }
18060
vec_stril_p(vector unsigned short __a)18061 static __inline__ int __ATTRS_o_ai vec_stril_p(vector unsigned short __a) {
18062 #ifdef __LITTLE_ENDIAN__
18063 return __builtin_altivec_vstrihr_p(__CR6_EQ, (vector signed short)__a);
18064 #else
18065 return __builtin_altivec_vstrihl_p(__CR6_EQ, (vector signed short)__a);
18066 #endif
18067 }
18068
vec_stril_p(vector signed short __a)18069 static __inline__ int __ATTRS_o_ai vec_stril_p(vector signed short __a) {
18070 #ifdef __LITTLE_ENDIAN__
18071 return __builtin_altivec_vstrihr_p(__CR6_EQ, __a);
18072 #else
18073 return __builtin_altivec_vstrihl_p(__CR6_EQ, __a);
18074 #endif
18075 }
18076
18077 /* vec_strir */
18078
18079 static __inline__ vector unsigned char __ATTRS_o_ai
vec_strir(vector unsigned char __a)18080 vec_strir(vector unsigned char __a) {
18081 #ifdef __LITTLE_ENDIAN__
18082 return __builtin_altivec_vstribl((vector signed char)__a);
18083 #else
18084 return __builtin_altivec_vstribr((vector signed char)__a);
18085 #endif
18086 }
18087
18088 static __inline__ vector signed char __ATTRS_o_ai
vec_strir(vector signed char __a)18089 vec_strir(vector signed char __a) {
18090 #ifdef __LITTLE_ENDIAN__
18091 return __builtin_altivec_vstribl(__a);
18092 #else
18093 return __builtin_altivec_vstribr(__a);
18094 #endif
18095 }
18096
18097 static __inline__ vector unsigned short __ATTRS_o_ai
vec_strir(vector unsigned short __a)18098 vec_strir(vector unsigned short __a) {
18099 #ifdef __LITTLE_ENDIAN__
18100 return __builtin_altivec_vstrihl((vector signed short)__a);
18101 #else
18102 return __builtin_altivec_vstrihr((vector signed short)__a);
18103 #endif
18104 }
18105
18106 static __inline__ vector signed short __ATTRS_o_ai
vec_strir(vector signed short __a)18107 vec_strir(vector signed short __a) {
18108 #ifdef __LITTLE_ENDIAN__
18109 return __builtin_altivec_vstrihl(__a);
18110 #else
18111 return __builtin_altivec_vstrihr(__a);
18112 #endif
18113 }
18114
18115 /* vec_strir_p */
18116
vec_strir_p(vector unsigned char __a)18117 static __inline__ int __ATTRS_o_ai vec_strir_p(vector unsigned char __a) {
18118 #ifdef __LITTLE_ENDIAN__
18119 return __builtin_altivec_vstribl_p(__CR6_EQ, (vector signed char)__a);
18120 #else
18121 return __builtin_altivec_vstribr_p(__CR6_EQ, (vector signed char)__a);
18122 #endif
18123 }
18124
vec_strir_p(vector signed char __a)18125 static __inline__ int __ATTRS_o_ai vec_strir_p(vector signed char __a) {
18126 #ifdef __LITTLE_ENDIAN__
18127 return __builtin_altivec_vstribl_p(__CR6_EQ, __a);
18128 #else
18129 return __builtin_altivec_vstribr_p(__CR6_EQ, __a);
18130 #endif
18131 }
18132
vec_strir_p(vector unsigned short __a)18133 static __inline__ int __ATTRS_o_ai vec_strir_p(vector unsigned short __a) {
18134 #ifdef __LITTLE_ENDIAN__
18135 return __builtin_altivec_vstrihl_p(__CR6_EQ, (vector signed short)__a);
18136 #else
18137 return __builtin_altivec_vstrihr_p(__CR6_EQ, (vector signed short)__a);
18138 #endif
18139 }
18140
vec_strir_p(vector signed short __a)18141 static __inline__ int __ATTRS_o_ai vec_strir_p(vector signed short __a) {
18142 #ifdef __LITTLE_ENDIAN__
18143 return __builtin_altivec_vstrihl_p(__CR6_EQ, __a);
18144 #else
18145 return __builtin_altivec_vstrihr_p(__CR6_EQ, __a);
18146 #endif
18147 }
18148
18149 /* vs[l | r | ra] */
18150
18151 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_sl(vector unsigned __int128 __a,vector unsigned __int128 __b)18152 vec_sl(vector unsigned __int128 __a, vector unsigned __int128 __b) {
18153 return __a << (__b % (vector unsigned __int128)(sizeof(unsigned __int128) *
18154 __CHAR_BIT__));
18155 }
18156
18157 static __inline__ vector signed __int128 __ATTRS_o_ai
vec_sl(vector signed __int128 __a,vector unsigned __int128 __b)18158 vec_sl(vector signed __int128 __a, vector unsigned __int128 __b) {
18159 return __a << (__b % (vector unsigned __int128)(sizeof(unsigned __int128) *
18160 __CHAR_BIT__));
18161 }
18162
18163 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_sr(vector unsigned __int128 __a,vector unsigned __int128 __b)18164 vec_sr(vector unsigned __int128 __a, vector unsigned __int128 __b) {
18165 return __a >> (__b % (vector unsigned __int128)(sizeof(unsigned __int128) *
18166 __CHAR_BIT__));
18167 }
18168
18169 static __inline__ vector signed __int128 __ATTRS_o_ai
vec_sr(vector signed __int128 __a,vector unsigned __int128 __b)18170 vec_sr(vector signed __int128 __a, vector unsigned __int128 __b) {
18171 return (
18172 vector signed __int128)(((vector unsigned __int128)__a) >>
18173 (__b %
18174 (vector unsigned __int128)(sizeof(
18175 unsigned __int128) *
18176 __CHAR_BIT__)));
18177 }
18178
18179 static __inline__ vector unsigned __int128 __ATTRS_o_ai
vec_sra(vector unsigned __int128 __a,vector unsigned __int128 __b)18180 vec_sra(vector unsigned __int128 __a, vector unsigned __int128 __b) {
18181 return (
18182 vector unsigned __int128)(((vector signed __int128)__a) >>
18183 (__b %
18184 (vector unsigned __int128)(sizeof(
18185 unsigned __int128) *
18186 __CHAR_BIT__)));
18187 }
18188
18189 static __inline__ vector signed __int128 __ATTRS_o_ai
vec_sra(vector signed __int128 __a,vector unsigned __int128 __b)18190 vec_sra(vector signed __int128 __a, vector unsigned __int128 __b) {
18191 return __a >> (__b % (vector unsigned __int128)(sizeof(unsigned __int128) *
18192 __CHAR_BIT__));
18193 }
18194
18195 #endif /* __POWER10_VECTOR__ */
18196
18197 #undef __ATTRS_o_ai
18198
18199 #endif /* __ALTIVEC_H */
18200