blob: 2c80e24db335195b0968920464991f933ad37a41 [file] [log] [blame]
Chris Lattnerdad40622010-04-14 03:54:58 +00001/*===---- altivec.h - Standard header for type generic math ---------------===*\
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21\*===----------------------------------------------------------------------===*/
22
23#ifndef __ALTIVEC_H
24#define __ALTIVEC_H
25
26#ifndef __ALTIVEC__
27#error "AltiVec support not enabled"
28#endif
29
30/* constants for mapping CR6 bits to predicate result. */
31
Bill Seurer703e8482015-06-09 14:39:47 +000032#define __CR6_EQ 0
Chris Lattnerdad40622010-04-14 03:54:58 +000033#define __CR6_EQ_REV 1
Bill Seurer703e8482015-06-09 14:39:47 +000034#define __CR6_LT 2
Chris Lattnerdad40622010-04-14 03:54:58 +000035#define __CR6_LT_REV 3
36
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000037#define __ATTRS_o_ai __attribute__((__overloadable__, __always_inline__))
38
Bill Seurer703e8482015-06-09 14:39:47 +000039static vector signed char __ATTRS_o_ai vec_perm(vector signed char __a,
40 vector signed char __b,
41 vector unsigned char __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000042
Bill Seurer703e8482015-06-09 14:39:47 +000043static vector unsigned char __ATTRS_o_ai vec_perm(vector unsigned char __a,
44 vector unsigned char __b,
45 vector unsigned char __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000046
Bill Seurer703e8482015-06-09 14:39:47 +000047static vector bool char __ATTRS_o_ai vec_perm(vector bool char __a,
48 vector bool char __b,
49 vector unsigned char __c);
Anton Yartsev9e968982010-08-19 03:00:09 +000050
Bill Seurer703e8482015-06-09 14:39:47 +000051static vector short __ATTRS_o_ai vec_perm(vector short __a, vector short __b,
52 vector unsigned char __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000053
Bill Seurer703e8482015-06-09 14:39:47 +000054static vector unsigned short __ATTRS_o_ai vec_perm(vector unsigned short __a,
55 vector unsigned short __b,
56 vector unsigned char __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000057
Bill Seurer703e8482015-06-09 14:39:47 +000058static vector bool short __ATTRS_o_ai vec_perm(vector bool short __a,
59 vector bool short __b,
60 vector unsigned char __c);
Anton Yartsev9e968982010-08-19 03:00:09 +000061
Bill Seurer703e8482015-06-09 14:39:47 +000062static vector pixel __ATTRS_o_ai vec_perm(vector pixel __a, vector pixel __b,
63 vector unsigned char __c);
Anton Yartsev9e968982010-08-19 03:00:09 +000064
Bill Seurer703e8482015-06-09 14:39:47 +000065static vector int __ATTRS_o_ai vec_perm(vector int __a, vector int __b,
66 vector unsigned char __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000067
Bill Seurer703e8482015-06-09 14:39:47 +000068static vector unsigned int __ATTRS_o_ai vec_perm(vector unsigned int __a,
69 vector unsigned int __b,
70 vector unsigned char __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000071
Bill Seurer703e8482015-06-09 14:39:47 +000072static vector bool int __ATTRS_o_ai vec_perm(vector bool int __a,
73 vector bool int __b,
74 vector unsigned char __c);
Anton Yartsev9e968982010-08-19 03:00:09 +000075
Bill Seurer703e8482015-06-09 14:39:47 +000076static vector float __ATTRS_o_ai vec_perm(vector float __a, vector float __b,
77 vector unsigned char __c);
Chris Lattnerdad40622010-04-14 03:54:58 +000078
Bill Schmidt41e14c42015-05-16 01:02:25 +000079#ifdef __VSX__
Bill Seurer703e8482015-06-09 14:39:47 +000080static vector long long __ATTRS_o_ai vec_perm(vector long long __a,
81 vector long long __b,
82 vector unsigned char __c);
Bill Schmidt41e14c42015-05-16 01:02:25 +000083
84static vector unsigned long long __ATTRS_o_ai
85vec_perm(vector unsigned long long __a, vector unsigned long long __b,
86 vector unsigned char __c);
87
Bill Seurer703e8482015-06-09 14:39:47 +000088static vector double __ATTRS_o_ai vec_perm(vector double __a, vector double __b,
89 vector unsigned char __c);
Bill Schmidt41e14c42015-05-16 01:02:25 +000090#endif
91
Bill Seurer703e8482015-06-09 14:39:47 +000092static vector unsigned char __ATTRS_o_ai vec_xor(vector unsigned char __a,
93 vector unsigned char __b);
Bill Schmidtf7e289c2014-06-05 19:07:40 +000094
Chris Lattnerdad40622010-04-14 03:54:58 +000095/* vec_abs */
96
Chris Lattnerdad40622010-04-14 03:54:58 +000097#define __builtin_altivec_abs_v16qi vec_abs
Bill Seurer703e8482015-06-09 14:39:47 +000098#define __builtin_altivec_abs_v8hi vec_abs
99#define __builtin_altivec_abs_v4si vec_abs
Chris Lattnerdad40622010-04-14 03:54:58 +0000100
Bill Seurer703e8482015-06-09 14:39:47 +0000101static vector signed char __ATTRS_o_ai vec_abs(vector signed char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000102 return __builtin_altivec_vmaxsb(__a, -__a);
Chris Lattnerdad40622010-04-14 03:54:58 +0000103}
104
Bill Seurer703e8482015-06-09 14:39:47 +0000105static vector signed short __ATTRS_o_ai vec_abs(vector signed short __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000106 return __builtin_altivec_vmaxsh(__a, -__a);
Chris Lattnerdad40622010-04-14 03:54:58 +0000107}
108
Bill Seurer703e8482015-06-09 14:39:47 +0000109static vector signed int __ATTRS_o_ai vec_abs(vector signed int __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000110 return __builtin_altivec_vmaxsw(__a, -__a);
Chris Lattnerdad40622010-04-14 03:54:58 +0000111}
112
Nemanja Ivanovic2f1f9262015-06-26 19:27:20 +0000113#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
114static vector signed long long __ATTRS_o_ai
115vec_abs(vector signed long long __a) {
116 return __builtin_altivec_vmaxsd(__a, -__a);
117}
118#endif
119
Bill Seurer703e8482015-06-09 14:39:47 +0000120static vector float __ATTRS_o_ai vec_abs(vector float __a) {
121 vector unsigned int __res =
122 (vector unsigned int)__a & (vector unsigned int)(0x7FFFFFFF);
David Blaikie3302f2b2013-01-16 23:08:36 +0000123 return (vector float)__res;
Chris Lattnerdad40622010-04-14 03:54:58 +0000124}
125
Nemanja Ivanovic2f1f9262015-06-26 19:27:20 +0000126#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
127static vector double __ATTRS_o_ai vec_abs(vector double __a) {
128 vector unsigned long long __res = { 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFF };
129 __res &= (vector unsigned int)__a;
130 return (vector double)__res;
131}
132#endif
Chris Lattnerdad40622010-04-14 03:54:58 +0000133
Nemanja Ivanovic2f1f9262015-06-26 19:27:20 +0000134/* vec_abss */
Chris Lattnerdad40622010-04-14 03:54:58 +0000135#define __builtin_altivec_abss_v16qi vec_abss
Bill Seurer703e8482015-06-09 14:39:47 +0000136#define __builtin_altivec_abss_v8hi vec_abss
137#define __builtin_altivec_abss_v4si vec_abss
Chris Lattnerdad40622010-04-14 03:54:58 +0000138
Bill Seurer703e8482015-06-09 14:39:47 +0000139static vector signed char __ATTRS_o_ai vec_abss(vector signed char __a) {
140 return __builtin_altivec_vmaxsb(
141 __a, __builtin_altivec_vsubsbs((vector signed char)(0), __a));
Chris Lattnerdad40622010-04-14 03:54:58 +0000142}
143
Bill Seurer703e8482015-06-09 14:39:47 +0000144static vector signed short __ATTRS_o_ai vec_abss(vector signed short __a) {
145 return __builtin_altivec_vmaxsh(
146 __a, __builtin_altivec_vsubshs((vector signed short)(0), __a));
Chris Lattnerdad40622010-04-14 03:54:58 +0000147}
148
Bill Seurer703e8482015-06-09 14:39:47 +0000149static vector signed int __ATTRS_o_ai vec_abss(vector signed int __a) {
150 return __builtin_altivec_vmaxsw(
151 __a, __builtin_altivec_vsubsws((vector signed int)(0), __a));
Chris Lattnerdad40622010-04-14 03:54:58 +0000152}
153
154/* vec_add */
155
Bill Seurer703e8482015-06-09 14:39:47 +0000156static vector signed char __ATTRS_o_ai vec_add(vector signed char __a,
157 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000158 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000159}
160
Bill Seurer703e8482015-06-09 14:39:47 +0000161static vector signed char __ATTRS_o_ai vec_add(vector bool char __a,
162 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000163 return (vector signed char)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000164}
165
Bill Seurer703e8482015-06-09 14:39:47 +0000166static vector signed char __ATTRS_o_ai vec_add(vector signed char __a,
167 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000168 return __a + (vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000169}
170
Bill Seurer703e8482015-06-09 14:39:47 +0000171static vector unsigned char __ATTRS_o_ai vec_add(vector unsigned char __a,
172 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000173 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000174}
175
Bill Seurer703e8482015-06-09 14:39:47 +0000176static vector unsigned char __ATTRS_o_ai vec_add(vector bool char __a,
177 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000178 return (vector unsigned char)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000179}
180
Bill Seurer703e8482015-06-09 14:39:47 +0000181static vector unsigned char __ATTRS_o_ai vec_add(vector unsigned char __a,
182 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000183 return __a + (vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000184}
185
Bill Seurer703e8482015-06-09 14:39:47 +0000186static vector short __ATTRS_o_ai vec_add(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000187 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000188}
189
Bill Seurer703e8482015-06-09 14:39:47 +0000190static vector short __ATTRS_o_ai vec_add(vector bool short __a,
191 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000192 return (vector short)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000193}
194
Bill Seurer703e8482015-06-09 14:39:47 +0000195static vector short __ATTRS_o_ai vec_add(vector short __a,
196 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000197 return __a + (vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000198}
199
Bill Seurer703e8482015-06-09 14:39:47 +0000200static vector unsigned short __ATTRS_o_ai vec_add(vector unsigned short __a,
201 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000202 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000203}
204
Bill Seurer703e8482015-06-09 14:39:47 +0000205static vector unsigned short __ATTRS_o_ai vec_add(vector bool short __a,
206 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000207 return (vector unsigned short)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000208}
209
Bill Seurer703e8482015-06-09 14:39:47 +0000210static vector unsigned short __ATTRS_o_ai vec_add(vector unsigned short __a,
211 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000212 return __a + (vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000213}
214
Bill Seurer703e8482015-06-09 14:39:47 +0000215static vector int __ATTRS_o_ai vec_add(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000216 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000217}
218
Bill Seurer703e8482015-06-09 14:39:47 +0000219static vector int __ATTRS_o_ai vec_add(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000220 return (vector int)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000221}
222
Bill Seurer703e8482015-06-09 14:39:47 +0000223static vector int __ATTRS_o_ai vec_add(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000224 return __a + (vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000225}
226
Bill Seurer703e8482015-06-09 14:39:47 +0000227static vector unsigned int __ATTRS_o_ai vec_add(vector unsigned int __a,
228 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000229 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000230}
231
Bill Seurer703e8482015-06-09 14:39:47 +0000232static vector unsigned int __ATTRS_o_ai vec_add(vector bool int __a,
233 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000234 return (vector unsigned int)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000235}
236
Bill Seurer703e8482015-06-09 14:39:47 +0000237static vector unsigned int __ATTRS_o_ai vec_add(vector unsigned int __a,
238 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000239 return __a + (vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000240}
241
Kit Barton5944ee212015-05-25 15:52:45 +0000242#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
Nemanja Ivanovic2f1f9262015-06-26 19:27:20 +0000243static vector signed long long __ATTRS_o_ai
244vec_add(vector signed long long __a, vector signed long long __b) {
245 return __a + __b;
246}
247
248static vector unsigned long long __ATTRS_o_ai
249vec_add(vector unsigned long long __a, vector unsigned long long __b) {
250 return __a + __b;
251}
252
Bill Seurer703e8482015-06-09 14:39:47 +0000253static vector signed __int128 __ATTRS_o_ai vec_add(vector signed __int128 __a,
254 vector signed __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +0000255 return __a + __b;
256}
257
258static vector unsigned __int128 __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000259vec_add(vector unsigned __int128 __a, vector unsigned __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +0000260 return __a + __b;
261}
262#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
263
Bill Seurer703e8482015-06-09 14:39:47 +0000264static vector float __ATTRS_o_ai vec_add(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000265 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000266}
267
Nemanja Ivanovic2f1f9262015-06-26 19:27:20 +0000268#ifdef __VSX__
269static vector double __ATTRS_o_ai
270vec_add(vector double __a, vector double __b) {
271 return __a + __b;
272}
273#endif // __VSX__
274
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000275/* vec_vaddubm */
276
277#define __builtin_altivec_vaddubm vec_vaddubm
278
Bill Seurer703e8482015-06-09 14:39:47 +0000279static vector signed char __ATTRS_o_ai vec_vaddubm(vector signed char __a,
280 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000281 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000282}
283
Bill Seurer703e8482015-06-09 14:39:47 +0000284static vector signed char __ATTRS_o_ai vec_vaddubm(vector bool char __a,
285 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000286 return (vector signed char)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000287}
288
Bill Seurer703e8482015-06-09 14:39:47 +0000289static vector signed char __ATTRS_o_ai vec_vaddubm(vector signed char __a,
290 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000291 return __a + (vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000292}
293
Bill Seurer703e8482015-06-09 14:39:47 +0000294static vector unsigned char __ATTRS_o_ai vec_vaddubm(vector unsigned char __a,
295 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000296 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000297}
298
Bill Seurer703e8482015-06-09 14:39:47 +0000299static vector unsigned char __ATTRS_o_ai vec_vaddubm(vector bool char __a,
300 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000301 return (vector unsigned char)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000302}
303
Bill Seurer703e8482015-06-09 14:39:47 +0000304static vector unsigned char __ATTRS_o_ai vec_vaddubm(vector unsigned char __a,
305 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000306 return __a + (vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000307}
308
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000309/* vec_vadduhm */
310
311#define __builtin_altivec_vadduhm vec_vadduhm
312
Bill Seurer703e8482015-06-09 14:39:47 +0000313static vector short __ATTRS_o_ai vec_vadduhm(vector short __a,
314 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000315 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000316}
317
Bill Seurer703e8482015-06-09 14:39:47 +0000318static vector short __ATTRS_o_ai vec_vadduhm(vector bool short __a,
319 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000320 return (vector short)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000321}
322
Bill Seurer703e8482015-06-09 14:39:47 +0000323static vector short __ATTRS_o_ai vec_vadduhm(vector short __a,
324 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000325 return __a + (vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000326}
327
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000328static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000329vec_vadduhm(vector unsigned short __a, vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000330 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000331}
332
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000333static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000334vec_vadduhm(vector bool short __a, vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000335 return (vector unsigned short)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000336}
337
Bill Seurer703e8482015-06-09 14:39:47 +0000338static vector unsigned short __ATTRS_o_ai vec_vadduhm(vector unsigned short __a,
339 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000340 return __a + (vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000341}
342
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000343/* vec_vadduwm */
344
345#define __builtin_altivec_vadduwm vec_vadduwm
346
Bill Seurer703e8482015-06-09 14:39:47 +0000347static vector int __ATTRS_o_ai vec_vadduwm(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000348 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000349}
350
Bill Seurer703e8482015-06-09 14:39:47 +0000351static vector int __ATTRS_o_ai vec_vadduwm(vector bool int __a,
352 vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000353 return (vector int)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000354}
355
Bill Seurer703e8482015-06-09 14:39:47 +0000356static vector int __ATTRS_o_ai vec_vadduwm(vector int __a,
357 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000358 return __a + (vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000359}
360
Bill Seurer703e8482015-06-09 14:39:47 +0000361static vector unsigned int __ATTRS_o_ai vec_vadduwm(vector unsigned int __a,
362 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000363 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000364}
365
Bill Seurer703e8482015-06-09 14:39:47 +0000366static vector unsigned int __ATTRS_o_ai vec_vadduwm(vector bool int __a,
367 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000368 return (vector unsigned int)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000369}
370
Bill Seurer703e8482015-06-09 14:39:47 +0000371static vector unsigned int __ATTRS_o_ai vec_vadduwm(vector unsigned int __a,
372 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000373 return __a + (vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000374}
375
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000376/* vec_vaddfp */
377
Bill Seurer703e8482015-06-09 14:39:47 +0000378#define __builtin_altivec_vaddfp vec_vaddfp
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000379
380static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +0000381vec_vaddfp(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000382 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000383}
384
Chris Lattnerdad40622010-04-14 03:54:58 +0000385/* vec_addc */
386
Bill Seurer703e8482015-06-09 14:39:47 +0000387static vector unsigned int __ATTRS_o_ai vec_addc(vector unsigned int __a,
388 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000389 return __builtin_altivec_vaddcuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000390}
391
Kit Barton5944ee212015-05-25 15:52:45 +0000392#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
393static vector signed __int128 __ATTRS_o_ai
394vec_addc(vector signed __int128 __a, vector signed __int128 __b) {
395 return __builtin_altivec_vaddcuq(__a, __b);
396}
397
398static vector unsigned __int128 __ATTRS_o_ai
399vec_addc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
400 return __builtin_altivec_vaddcuq(__a, __b);
401}
402#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
403
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000404/* vec_vaddcuw */
405
406static vector unsigned int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +0000407vec_vaddcuw(vector unsigned int __a, vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000408 return __builtin_altivec_vaddcuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000409}
Chris Lattnerdad40622010-04-14 03:54:58 +0000410
411/* vec_adds */
412
Bill Seurer703e8482015-06-09 14:39:47 +0000413static vector signed char __ATTRS_o_ai vec_adds(vector signed char __a,
414 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000415 return __builtin_altivec_vaddsbs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000416}
417
Bill Seurer703e8482015-06-09 14:39:47 +0000418static vector signed char __ATTRS_o_ai vec_adds(vector bool char __a,
419 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000420 return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000421}
422
Bill Seurer703e8482015-06-09 14:39:47 +0000423static vector signed char __ATTRS_o_ai vec_adds(vector signed char __a,
424 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000425 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000426}
427
Bill Seurer703e8482015-06-09 14:39:47 +0000428static vector unsigned char __ATTRS_o_ai vec_adds(vector unsigned char __a,
429 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000430 return __builtin_altivec_vaddubs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000431}
432
Bill Seurer703e8482015-06-09 14:39:47 +0000433static vector unsigned char __ATTRS_o_ai vec_adds(vector bool char __a,
434 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000435 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000436}
437
Bill Seurer703e8482015-06-09 14:39:47 +0000438static vector unsigned char __ATTRS_o_ai vec_adds(vector unsigned char __a,
439 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000440 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000441}
442
Bill Seurer703e8482015-06-09 14:39:47 +0000443static vector short __ATTRS_o_ai vec_adds(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000444 return __builtin_altivec_vaddshs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000445}
446
Bill Seurer703e8482015-06-09 14:39:47 +0000447static vector short __ATTRS_o_ai vec_adds(vector bool short __a,
448 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000449 return __builtin_altivec_vaddshs((vector short)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000450}
451
Bill Seurer703e8482015-06-09 14:39:47 +0000452static vector short __ATTRS_o_ai vec_adds(vector short __a,
453 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000454 return __builtin_altivec_vaddshs(__a, (vector short)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000455}
456
Bill Seurer703e8482015-06-09 14:39:47 +0000457static vector unsigned short __ATTRS_o_ai vec_adds(vector unsigned short __a,
458 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000459 return __builtin_altivec_vadduhs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000460}
461
Bill Seurer703e8482015-06-09 14:39:47 +0000462static vector unsigned short __ATTRS_o_ai vec_adds(vector bool short __a,
463 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000464 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000465}
466
Bill Seurer703e8482015-06-09 14:39:47 +0000467static vector unsigned short __ATTRS_o_ai vec_adds(vector unsigned short __a,
468 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000469 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000470}
471
Bill Seurer703e8482015-06-09 14:39:47 +0000472static vector int __ATTRS_o_ai vec_adds(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000473 return __builtin_altivec_vaddsws(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000474}
475
Bill Seurer703e8482015-06-09 14:39:47 +0000476static vector int __ATTRS_o_ai vec_adds(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000477 return __builtin_altivec_vaddsws((vector int)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000478}
479
Bill Seurer703e8482015-06-09 14:39:47 +0000480static vector int __ATTRS_o_ai vec_adds(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000481 return __builtin_altivec_vaddsws(__a, (vector int)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000482}
483
Bill Seurer703e8482015-06-09 14:39:47 +0000484static vector unsigned int __ATTRS_o_ai vec_adds(vector unsigned int __a,
485 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000486 return __builtin_altivec_vadduws(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000487}
488
Bill Seurer703e8482015-06-09 14:39:47 +0000489static vector unsigned int __ATTRS_o_ai vec_adds(vector bool int __a,
490 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000491 return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000492}
493
Bill Seurer703e8482015-06-09 14:39:47 +0000494static vector unsigned int __ATTRS_o_ai vec_adds(vector unsigned int __a,
495 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000496 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000497}
498
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000499/* vec_vaddsbs */
Chris Lattnerdad40622010-04-14 03:54:58 +0000500
Bill Seurer703e8482015-06-09 14:39:47 +0000501static vector signed char __ATTRS_o_ai vec_vaddsbs(vector signed char __a,
502 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000503 return __builtin_altivec_vaddsbs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000504}
505
Bill Seurer703e8482015-06-09 14:39:47 +0000506static vector signed char __ATTRS_o_ai vec_vaddsbs(vector bool char __a,
507 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000508 return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000509}
510
Bill Seurer703e8482015-06-09 14:39:47 +0000511static vector signed char __ATTRS_o_ai vec_vaddsbs(vector signed char __a,
512 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000513 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000514}
515
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000516/* vec_vaddubs */
517
Bill Seurer703e8482015-06-09 14:39:47 +0000518static vector unsigned char __ATTRS_o_ai vec_vaddubs(vector unsigned char __a,
519 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000520 return __builtin_altivec_vaddubs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000521}
522
Bill Seurer703e8482015-06-09 14:39:47 +0000523static vector unsigned char __ATTRS_o_ai vec_vaddubs(vector bool char __a,
524 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000525 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000526}
527
Bill Seurer703e8482015-06-09 14:39:47 +0000528static vector unsigned char __ATTRS_o_ai vec_vaddubs(vector unsigned char __a,
529 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000530 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000531}
532
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000533/* vec_vaddshs */
534
Bill Seurer703e8482015-06-09 14:39:47 +0000535static vector short __ATTRS_o_ai vec_vaddshs(vector short __a,
536 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000537 return __builtin_altivec_vaddshs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000538}
539
Bill Seurer703e8482015-06-09 14:39:47 +0000540static vector short __ATTRS_o_ai vec_vaddshs(vector bool short __a,
541 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000542 return __builtin_altivec_vaddshs((vector short)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000543}
544
Bill Seurer703e8482015-06-09 14:39:47 +0000545static vector short __ATTRS_o_ai vec_vaddshs(vector short __a,
546 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000547 return __builtin_altivec_vaddshs(__a, (vector short)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000548}
549
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000550/* vec_vadduhs */
551
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000552static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000553vec_vadduhs(vector unsigned short __a, vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000554 return __builtin_altivec_vadduhs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000555}
556
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000557static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000558vec_vadduhs(vector bool short __a, vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000559 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000560}
561
Bill Seurer703e8482015-06-09 14:39:47 +0000562static vector unsigned short __ATTRS_o_ai vec_vadduhs(vector unsigned short __a,
563 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000564 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000565}
566
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000567/* vec_vaddsws */
568
Bill Seurer703e8482015-06-09 14:39:47 +0000569static vector int __ATTRS_o_ai vec_vaddsws(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000570 return __builtin_altivec_vaddsws(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000571}
572
Bill Seurer703e8482015-06-09 14:39:47 +0000573static vector int __ATTRS_o_ai vec_vaddsws(vector bool int __a,
574 vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000575 return __builtin_altivec_vaddsws((vector int)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000576}
577
Bill Seurer703e8482015-06-09 14:39:47 +0000578static vector int __ATTRS_o_ai vec_vaddsws(vector int __a,
579 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000580 return __builtin_altivec_vaddsws(__a, (vector int)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000581}
582
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000583/* vec_vadduws */
584
Bill Seurer703e8482015-06-09 14:39:47 +0000585static vector unsigned int __ATTRS_o_ai vec_vadduws(vector unsigned int __a,
586 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000587 return __builtin_altivec_vadduws(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000588}
589
Bill Seurer703e8482015-06-09 14:39:47 +0000590static vector unsigned int __ATTRS_o_ai vec_vadduws(vector bool int __a,
591 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000592 return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000593}
594
Bill Seurer703e8482015-06-09 14:39:47 +0000595static vector unsigned int __ATTRS_o_ai vec_vadduws(vector unsigned int __a,
596 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000597 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000598}
599
Kit Barton5944ee212015-05-25 15:52:45 +0000600#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
601/* vec_vadduqm */
602
603static vector signed __int128 __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000604vec_vadduqm(vector signed __int128 __a, vector signed __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +0000605 return __a + __b;
606}
607
608static vector unsigned __int128 __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000609vec_vadduqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +0000610 return __a + __b;
611}
612
613/* vec_vaddeuqm */
614
615static vector signed __int128 __ATTRS_o_ai
616vec_vaddeuqm(vector signed __int128 __a, vector signed __int128 __b,
617 vector signed __int128 __c) {
618 return __builtin_altivec_vaddeuqm(__a, __b, __c);
619}
620
621static vector unsigned __int128 __ATTRS_o_ai
622vec_vaddeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
623 vector unsigned __int128 __c) {
624 return __builtin_altivec_vaddeuqm(__a, __b, __c);
625}
626
627/* vec_vaddcuq */
628
629static vector signed __int128 __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000630vec_vaddcuq(vector signed __int128 __a, vector signed __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +0000631 return __builtin_altivec_vaddcuq(__a, __b);
632}
633
634static vector unsigned __int128 __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000635vec_vaddcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +0000636 return __builtin_altivec_vaddcuq(__a, __b);
637}
638
639/* vec_vaddecuq */
640
641static vector signed __int128 __ATTRS_o_ai
642vec_vaddecuq(vector signed __int128 __a, vector signed __int128 __b,
643 vector signed __int128 __c) {
644 return __builtin_altivec_vaddecuq(__a, __b, __c);
645}
646
647static vector unsigned __int128 __ATTRS_o_ai
648vec_vaddecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
649 vector unsigned __int128 __c) {
650 return __builtin_altivec_vaddecuq(__a, __b, __c);
651}
652#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
653
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000654/* vec_and */
655
656#define __builtin_altivec_vand vec_and
657
Bill Seurer703e8482015-06-09 14:39:47 +0000658static vector signed char __ATTRS_o_ai vec_and(vector signed char __a,
659 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000660 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000661}
662
Bill Seurer703e8482015-06-09 14:39:47 +0000663static vector signed char __ATTRS_o_ai vec_and(vector bool char __a,
664 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000665 return (vector signed char)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000666}
667
Bill Seurer703e8482015-06-09 14:39:47 +0000668static vector signed char __ATTRS_o_ai vec_and(vector signed char __a,
669 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000670 return __a & (vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000671}
672
Bill Seurer703e8482015-06-09 14:39:47 +0000673static vector unsigned char __ATTRS_o_ai vec_and(vector unsigned char __a,
674 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000675 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000676}
677
Bill Seurer703e8482015-06-09 14:39:47 +0000678static vector unsigned char __ATTRS_o_ai vec_and(vector bool char __a,
679 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000680 return (vector unsigned char)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000681}
682
Bill Seurer703e8482015-06-09 14:39:47 +0000683static vector unsigned char __ATTRS_o_ai vec_and(vector unsigned char __a,
684 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000685 return __a & (vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000686}
687
Bill Seurer703e8482015-06-09 14:39:47 +0000688static vector bool char __ATTRS_o_ai vec_and(vector bool char __a,
689 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000690 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000691}
692
Bill Seurer703e8482015-06-09 14:39:47 +0000693static vector short __ATTRS_o_ai vec_and(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000694 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000695}
696
Bill Seurer703e8482015-06-09 14:39:47 +0000697static vector short __ATTRS_o_ai vec_and(vector bool short __a,
698 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000699 return (vector short)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000700}
701
Bill Seurer703e8482015-06-09 14:39:47 +0000702static vector short __ATTRS_o_ai vec_and(vector short __a,
703 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000704 return __a & (vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000705}
706
Bill Seurer703e8482015-06-09 14:39:47 +0000707static vector unsigned short __ATTRS_o_ai vec_and(vector unsigned short __a,
708 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000709 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000710}
711
Bill Seurer703e8482015-06-09 14:39:47 +0000712static vector unsigned short __ATTRS_o_ai vec_and(vector bool short __a,
713 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000714 return (vector unsigned short)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000715}
716
Bill Seurer703e8482015-06-09 14:39:47 +0000717static vector unsigned short __ATTRS_o_ai vec_and(vector unsigned short __a,
718 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000719 return __a & (vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000720}
721
Bill Seurer703e8482015-06-09 14:39:47 +0000722static vector bool short __ATTRS_o_ai vec_and(vector bool short __a,
723 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000724 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000725}
726
Bill Seurer703e8482015-06-09 14:39:47 +0000727static vector int __ATTRS_o_ai vec_and(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000728 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000729}
730
Bill Seurer703e8482015-06-09 14:39:47 +0000731static vector int __ATTRS_o_ai vec_and(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000732 return (vector int)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000733}
734
Bill Seurer703e8482015-06-09 14:39:47 +0000735static vector int __ATTRS_o_ai vec_and(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000736 return __a & (vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000737}
738
Bill Seurer703e8482015-06-09 14:39:47 +0000739static vector unsigned int __ATTRS_o_ai vec_and(vector unsigned int __a,
740 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000741 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000742}
743
Bill Seurer703e8482015-06-09 14:39:47 +0000744static vector unsigned int __ATTRS_o_ai vec_and(vector bool int __a,
745 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000746 return (vector unsigned int)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000747}
748
Bill Seurer703e8482015-06-09 14:39:47 +0000749static vector unsigned int __ATTRS_o_ai vec_and(vector unsigned int __a,
750 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000751 return __a & (vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000752}
753
Bill Seurer703e8482015-06-09 14:39:47 +0000754static vector bool int __ATTRS_o_ai vec_and(vector bool int __a,
755 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000756 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000757}
758
Bill Seurer703e8482015-06-09 14:39:47 +0000759static vector float __ATTRS_o_ai vec_and(vector float __a, vector float __b) {
760 vector unsigned int __res =
761 (vector unsigned int)__a & (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +0000762 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000763}
764
Bill Seurer703e8482015-06-09 14:39:47 +0000765static vector float __ATTRS_o_ai vec_and(vector bool int __a,
766 vector float __b) {
767 vector unsigned int __res =
768 (vector unsigned int)__a & (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +0000769 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000770}
771
Bill Seurer703e8482015-06-09 14:39:47 +0000772static vector float __ATTRS_o_ai vec_and(vector float __a,
773 vector bool int __b) {
774 vector unsigned int __res =
775 (vector unsigned int)__a & (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +0000776 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000777}
778
Bill Seurer8be14f12015-06-04 18:45:44 +0000779#ifdef __VSX__
Nemanja Ivanovic2f1f9262015-06-26 19:27:20 +0000780static vector double __ATTRS_o_ai vec_and(vector bool long long __a, vector double __b) {
781 vector unsigned long long __res =
782 (vector unsigned long long)__a & (vector unsigned long long)__b;
783 return (vector double)__res;
784}
785
786static vector double __ATTRS_o_ai vec_and(vector double __a, vector bool long long __b) {
787 vector unsigned long long __res =
788 (vector unsigned long long)__a & (vector unsigned long long)__b;
789 return (vector double)__res;
790}
791
792static vector double __ATTRS_o_ai vec_and(vector double __a, vector double __b) {
793 vector unsigned long long __res =
794 (vector unsigned long long)__a & (vector unsigned long long)__b;
795 return (vector double)__res;
796}
797
Bill Seurer8be14f12015-06-04 18:45:44 +0000798static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000799vec_and(vector signed long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +0000800 return __a & __b;
801}
802
803static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000804vec_and(vector bool long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +0000805 return (vector signed long long)__a & __b;
806}
807
Bill Seurer703e8482015-06-09 14:39:47 +0000808static vector signed long long __ATTRS_o_ai vec_and(vector signed long long __a,
809 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +0000810 return __a & (vector signed long long)__b;
811}
812
813static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000814vec_and(vector unsigned long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +0000815 return __a & __b;
816}
817
818static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000819vec_and(vector bool long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +0000820 return (vector unsigned long long)__a & __b;
821}
822
823static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000824vec_and(vector unsigned long long __a, vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +0000825 return __a & (vector unsigned long long)__b;
826}
827
Bill Seurer703e8482015-06-09 14:39:47 +0000828static vector bool long long __ATTRS_o_ai vec_and(vector bool long long __a,
829 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +0000830 return __a & __b;
831}
832#endif
833
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000834/* vec_vand */
835
Bill Seurer703e8482015-06-09 14:39:47 +0000836static vector signed char __ATTRS_o_ai vec_vand(vector signed char __a,
837 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000838 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000839}
840
Bill Seurer703e8482015-06-09 14:39:47 +0000841static vector signed char __ATTRS_o_ai vec_vand(vector bool char __a,
842 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000843 return (vector signed char)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000844}
845
Bill Seurer703e8482015-06-09 14:39:47 +0000846static vector signed char __ATTRS_o_ai vec_vand(vector signed char __a,
847 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000848 return __a & (vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000849}
850
Bill Seurer703e8482015-06-09 14:39:47 +0000851static vector unsigned char __ATTRS_o_ai vec_vand(vector unsigned char __a,
852 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000853 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000854}
855
Bill Seurer703e8482015-06-09 14:39:47 +0000856static vector unsigned char __ATTRS_o_ai vec_vand(vector bool char __a,
857 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000858 return (vector unsigned char)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000859}
860
Bill Seurer703e8482015-06-09 14:39:47 +0000861static vector unsigned char __ATTRS_o_ai vec_vand(vector unsigned char __a,
862 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000863 return __a & (vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000864}
865
Bill Seurer703e8482015-06-09 14:39:47 +0000866static vector bool char __ATTRS_o_ai vec_vand(vector bool char __a,
867 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000868 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000869}
870
Bill Seurer703e8482015-06-09 14:39:47 +0000871static vector short __ATTRS_o_ai vec_vand(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000872 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000873}
874
Bill Seurer703e8482015-06-09 14:39:47 +0000875static vector short __ATTRS_o_ai vec_vand(vector bool short __a,
876 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000877 return (vector short)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000878}
879
Bill Seurer703e8482015-06-09 14:39:47 +0000880static vector short __ATTRS_o_ai vec_vand(vector short __a,
881 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000882 return __a & (vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000883}
884
Bill Seurer703e8482015-06-09 14:39:47 +0000885static vector unsigned short __ATTRS_o_ai vec_vand(vector unsigned short __a,
886 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000887 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000888}
889
Bill Seurer703e8482015-06-09 14:39:47 +0000890static vector unsigned short __ATTRS_o_ai vec_vand(vector bool short __a,
891 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000892 return (vector unsigned short)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000893}
894
Bill Seurer703e8482015-06-09 14:39:47 +0000895static vector unsigned short __ATTRS_o_ai vec_vand(vector unsigned short __a,
896 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000897 return __a & (vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000898}
899
Bill Seurer703e8482015-06-09 14:39:47 +0000900static vector bool short __ATTRS_o_ai vec_vand(vector bool short __a,
901 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000902 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000903}
904
Bill Seurer703e8482015-06-09 14:39:47 +0000905static vector int __ATTRS_o_ai vec_vand(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000906 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000907}
908
Bill Seurer703e8482015-06-09 14:39:47 +0000909static vector int __ATTRS_o_ai vec_vand(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000910 return (vector int)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000911}
912
Bill Seurer703e8482015-06-09 14:39:47 +0000913static vector int __ATTRS_o_ai vec_vand(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000914 return __a & (vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000915}
916
Bill Seurer703e8482015-06-09 14:39:47 +0000917static vector unsigned int __ATTRS_o_ai vec_vand(vector unsigned int __a,
918 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000919 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000920}
921
Bill Seurer703e8482015-06-09 14:39:47 +0000922static vector unsigned int __ATTRS_o_ai vec_vand(vector bool int __a,
923 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000924 return (vector unsigned int)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000925}
926
Bill Seurer703e8482015-06-09 14:39:47 +0000927static vector unsigned int __ATTRS_o_ai vec_vand(vector unsigned int __a,
928 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000929 return __a & (vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000930}
931
Bill Seurer703e8482015-06-09 14:39:47 +0000932static vector bool int __ATTRS_o_ai vec_vand(vector bool int __a,
933 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000934 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000935}
936
Bill Seurer703e8482015-06-09 14:39:47 +0000937static vector float __ATTRS_o_ai vec_vand(vector float __a, vector float __b) {
938 vector unsigned int __res =
939 (vector unsigned int)__a & (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +0000940 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000941}
942
Bill Seurer703e8482015-06-09 14:39:47 +0000943static vector float __ATTRS_o_ai vec_vand(vector bool int __a,
944 vector float __b) {
945 vector unsigned int __res =
946 (vector unsigned int)__a & (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +0000947 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000948}
949
Bill Seurer703e8482015-06-09 14:39:47 +0000950static vector float __ATTRS_o_ai vec_vand(vector float __a,
951 vector bool int __b) {
952 vector unsigned int __res =
953 (vector unsigned int)__a & (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +0000954 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000955}
956
Bill Seurer8be14f12015-06-04 18:45:44 +0000957#ifdef __VSX__
958static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000959vec_vand(vector signed long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +0000960 return __a & __b;
961}
962
963static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000964vec_vand(vector bool long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +0000965 return (vector signed long long)__a & __b;
966}
967
968static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000969vec_vand(vector signed long long __a, vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +0000970 return __a & (vector signed long long)__b;
971}
972
973static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000974vec_vand(vector unsigned long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +0000975 return __a & __b;
976}
977
978static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000979vec_vand(vector bool long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +0000980 return (vector unsigned long long)__a & __b;
981}
982
983static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000984vec_vand(vector unsigned long long __a, vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +0000985 return __a & (vector unsigned long long)__b;
986}
987
Bill Seurer703e8482015-06-09 14:39:47 +0000988static vector bool long long __ATTRS_o_ai vec_vand(vector bool long long __a,
989 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +0000990 return __a & __b;
991}
992#endif
993
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000994/* vec_andc */
995
996#define __builtin_altivec_vandc vec_andc
997
Bill Seurer703e8482015-06-09 14:39:47 +0000998static vector signed char __ATTRS_o_ai vec_andc(vector signed char __a,
999 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001000 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001001}
1002
Bill Seurer703e8482015-06-09 14:39:47 +00001003static vector signed char __ATTRS_o_ai vec_andc(vector bool char __a,
1004 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001005 return (vector signed char)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001006}
1007
Bill Seurer703e8482015-06-09 14:39:47 +00001008static vector signed char __ATTRS_o_ai vec_andc(vector signed char __a,
1009 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001010 return __a & ~(vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001011}
1012
Bill Seurer703e8482015-06-09 14:39:47 +00001013static vector unsigned char __ATTRS_o_ai vec_andc(vector unsigned char __a,
1014 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001015 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001016}
1017
Bill Seurer703e8482015-06-09 14:39:47 +00001018static vector unsigned char __ATTRS_o_ai vec_andc(vector bool char __a,
1019 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001020 return (vector unsigned char)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001021}
1022
Bill Seurer703e8482015-06-09 14:39:47 +00001023static vector unsigned char __ATTRS_o_ai vec_andc(vector unsigned char __a,
1024 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001025 return __a & ~(vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001026}
1027
Bill Seurer703e8482015-06-09 14:39:47 +00001028static vector bool char __ATTRS_o_ai vec_andc(vector bool char __a,
1029 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001030 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001031}
1032
Bill Seurer703e8482015-06-09 14:39:47 +00001033static vector short __ATTRS_o_ai vec_andc(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001034 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001035}
1036
Bill Seurer703e8482015-06-09 14:39:47 +00001037static vector short __ATTRS_o_ai vec_andc(vector bool short __a,
1038 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001039 return (vector short)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001040}
1041
Bill Seurer703e8482015-06-09 14:39:47 +00001042static vector short __ATTRS_o_ai vec_andc(vector short __a,
1043 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001044 return __a & ~(vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001045}
1046
Bill Seurer703e8482015-06-09 14:39:47 +00001047static vector unsigned short __ATTRS_o_ai vec_andc(vector unsigned short __a,
1048 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001049 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001050}
1051
Bill Seurer703e8482015-06-09 14:39:47 +00001052static vector unsigned short __ATTRS_o_ai vec_andc(vector bool short __a,
1053 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001054 return (vector unsigned short)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001055}
1056
Bill Seurer703e8482015-06-09 14:39:47 +00001057static vector unsigned short __ATTRS_o_ai vec_andc(vector unsigned short __a,
1058 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001059 return __a & ~(vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001060}
1061
Bill Seurer703e8482015-06-09 14:39:47 +00001062static vector bool short __ATTRS_o_ai vec_andc(vector bool short __a,
1063 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001064 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001065}
1066
Bill Seurer703e8482015-06-09 14:39:47 +00001067static vector int __ATTRS_o_ai vec_andc(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001068 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001069}
1070
Bill Seurer703e8482015-06-09 14:39:47 +00001071static vector int __ATTRS_o_ai vec_andc(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001072 return (vector int)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001073}
1074
Bill Seurer703e8482015-06-09 14:39:47 +00001075static vector int __ATTRS_o_ai vec_andc(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001076 return __a & ~(vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001077}
1078
Bill Seurer703e8482015-06-09 14:39:47 +00001079static vector unsigned int __ATTRS_o_ai vec_andc(vector unsigned int __a,
1080 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001081 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001082}
1083
Bill Seurer703e8482015-06-09 14:39:47 +00001084static vector unsigned int __ATTRS_o_ai vec_andc(vector bool int __a,
1085 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001086 return (vector unsigned int)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001087}
1088
Bill Seurer703e8482015-06-09 14:39:47 +00001089static vector unsigned int __ATTRS_o_ai vec_andc(vector unsigned int __a,
1090 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001091 return __a & ~(vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001092}
1093
Bill Seurer703e8482015-06-09 14:39:47 +00001094static vector bool int __ATTRS_o_ai vec_andc(vector bool int __a,
1095 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001096 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001097}
1098
Bill Seurer703e8482015-06-09 14:39:47 +00001099static vector float __ATTRS_o_ai vec_andc(vector float __a, vector float __b) {
1100 vector unsigned int __res =
1101 (vector unsigned int)__a & ~(vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00001102 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001103}
1104
Bill Seurer703e8482015-06-09 14:39:47 +00001105static vector float __ATTRS_o_ai vec_andc(vector bool int __a,
1106 vector float __b) {
1107 vector unsigned int __res =
1108 (vector unsigned int)__a & ~(vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00001109 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001110}
1111
Bill Seurer703e8482015-06-09 14:39:47 +00001112static vector float __ATTRS_o_ai vec_andc(vector float __a,
1113 vector bool int __b) {
1114 vector unsigned int __res =
1115 (vector unsigned int)__a & ~(vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00001116 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001117}
1118
Bill Seurer8be14f12015-06-04 18:45:44 +00001119#ifdef __VSX__
Nemanja Ivanovic2f1f9262015-06-26 19:27:20 +00001120static vector double __ATTRS_o_ai
1121vec_andc(vector bool long long __a, vector double __b) {
1122 vector unsigned long long __res =
1123 (vector unsigned long long)__a & ~(vector unsigned long long)__b;
1124 return (vector double)__res;
1125}
1126
1127static vector double __ATTRS_o_ai
1128vec_andc(vector double __a, vector bool long long __b) {
1129 vector unsigned long long __res =
1130 (vector unsigned long long)__a & ~(vector unsigned long long)__b;
1131 return (vector double)__res;
1132}
1133
1134static vector double __ATTRS_o_ai vec_andc(vector double __a, vector double __b) {
1135 vector unsigned long long __res =
1136 (vector unsigned long long)__a & ~(vector unsigned long long)__b;
1137 return (vector double)__res;
1138}
1139
Bill Seurer8be14f12015-06-04 18:45:44 +00001140static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001141vec_andc(vector signed long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00001142 return __a & ~__b;
1143}
1144
1145static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001146vec_andc(vector bool long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00001147 return (vector signed long long)__a & ~__b;
1148}
1149
1150static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001151vec_andc(vector signed long long __a, vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00001152 return __a & ~(vector signed long long)__b;
1153}
1154
1155static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001156vec_andc(vector unsigned long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00001157 return __a & ~__b;
1158}
1159
1160static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001161vec_andc(vector bool long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00001162 return (vector unsigned long long)__a & ~__b;
1163}
1164
1165static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001166vec_andc(vector unsigned long long __a, vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00001167 return __a & ~(vector unsigned long long)__b;
1168}
1169
Bill Seurer703e8482015-06-09 14:39:47 +00001170static vector bool long long __ATTRS_o_ai vec_andc(vector bool long long __a,
1171 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00001172 return __a & ~__b;
1173}
1174#endif
1175
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001176/* vec_vandc */
1177
Bill Seurer703e8482015-06-09 14:39:47 +00001178static vector signed char __ATTRS_o_ai vec_vandc(vector signed char __a,
1179 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001180 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001181}
1182
Bill Seurer703e8482015-06-09 14:39:47 +00001183static vector signed char __ATTRS_o_ai vec_vandc(vector bool char __a,
1184 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001185 return (vector signed char)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001186}
1187
Bill Seurer703e8482015-06-09 14:39:47 +00001188static vector signed char __ATTRS_o_ai vec_vandc(vector signed char __a,
1189 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001190 return __a & ~(vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001191}
1192
Bill Seurer703e8482015-06-09 14:39:47 +00001193static vector unsigned char __ATTRS_o_ai vec_vandc(vector unsigned char __a,
1194 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001195 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001196}
1197
Bill Seurer703e8482015-06-09 14:39:47 +00001198static vector unsigned char __ATTRS_o_ai vec_vandc(vector bool char __a,
1199 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001200 return (vector unsigned char)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001201}
1202
Bill Seurer703e8482015-06-09 14:39:47 +00001203static vector unsigned char __ATTRS_o_ai vec_vandc(vector unsigned char __a,
1204 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001205 return __a & ~(vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001206}
1207
Bill Seurer703e8482015-06-09 14:39:47 +00001208static vector bool char __ATTRS_o_ai vec_vandc(vector bool char __a,
1209 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001210 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001211}
1212
Bill Seurer703e8482015-06-09 14:39:47 +00001213static vector short __ATTRS_o_ai vec_vandc(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001214 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001215}
1216
Bill Seurer703e8482015-06-09 14:39:47 +00001217static vector short __ATTRS_o_ai vec_vandc(vector bool short __a,
1218 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001219 return (vector short)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001220}
1221
Bill Seurer703e8482015-06-09 14:39:47 +00001222static vector short __ATTRS_o_ai vec_vandc(vector short __a,
1223 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001224 return __a & ~(vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001225}
1226
Bill Seurer703e8482015-06-09 14:39:47 +00001227static vector unsigned short __ATTRS_o_ai vec_vandc(vector unsigned short __a,
1228 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001229 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001230}
1231
Bill Seurer703e8482015-06-09 14:39:47 +00001232static vector unsigned short __ATTRS_o_ai vec_vandc(vector bool short __a,
1233 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001234 return (vector unsigned short)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001235}
1236
Bill Seurer703e8482015-06-09 14:39:47 +00001237static vector unsigned short __ATTRS_o_ai vec_vandc(vector unsigned short __a,
1238 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001239 return __a & ~(vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001240}
1241
Bill Seurer703e8482015-06-09 14:39:47 +00001242static vector bool short __ATTRS_o_ai vec_vandc(vector bool short __a,
1243 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001244 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001245}
1246
Bill Seurer703e8482015-06-09 14:39:47 +00001247static vector int __ATTRS_o_ai vec_vandc(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001248 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001249}
1250
Bill Seurer703e8482015-06-09 14:39:47 +00001251static vector int __ATTRS_o_ai vec_vandc(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001252 return (vector int)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001253}
1254
Bill Seurer703e8482015-06-09 14:39:47 +00001255static vector int __ATTRS_o_ai vec_vandc(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001256 return __a & ~(vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001257}
1258
Bill Seurer703e8482015-06-09 14:39:47 +00001259static vector unsigned int __ATTRS_o_ai vec_vandc(vector unsigned int __a,
1260 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001261 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001262}
1263
Bill Seurer703e8482015-06-09 14:39:47 +00001264static vector unsigned int __ATTRS_o_ai vec_vandc(vector bool int __a,
1265 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001266 return (vector unsigned int)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001267}
1268
Bill Seurer703e8482015-06-09 14:39:47 +00001269static vector unsigned int __ATTRS_o_ai vec_vandc(vector unsigned int __a,
1270 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001271 return __a & ~(vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001272}
1273
Bill Seurer703e8482015-06-09 14:39:47 +00001274static vector bool int __ATTRS_o_ai vec_vandc(vector bool int __a,
1275 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001276 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001277}
1278
Bill Seurer703e8482015-06-09 14:39:47 +00001279static vector float __ATTRS_o_ai vec_vandc(vector float __a, vector float __b) {
1280 vector unsigned int __res =
1281 (vector unsigned int)__a & ~(vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00001282 return (vector float)__res;
Chris Lattnerdad40622010-04-14 03:54:58 +00001283}
1284
Bill Seurer703e8482015-06-09 14:39:47 +00001285static vector float __ATTRS_o_ai vec_vandc(vector bool int __a,
1286 vector float __b) {
1287 vector unsigned int __res =
1288 (vector unsigned int)__a & ~(vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00001289 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001290}
1291
Bill Seurer703e8482015-06-09 14:39:47 +00001292static vector float __ATTRS_o_ai vec_vandc(vector float __a,
1293 vector bool int __b) {
1294 vector unsigned int __res =
1295 (vector unsigned int)__a & ~(vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00001296 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001297}
1298
Bill Seurer8be14f12015-06-04 18:45:44 +00001299#ifdef __VSX__
1300static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001301vec_vandc(vector signed long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00001302 return __a & ~__b;
1303}
1304
1305static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001306vec_vandc(vector bool long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00001307 return (vector signed long long)__a & ~__b;
1308}
1309
1310static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001311vec_vandc(vector signed long long __a, vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00001312 return __a & ~(vector signed long long)__b;
1313}
1314
1315static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001316vec_vandc(vector unsigned long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00001317 return __a & ~__b;
1318}
1319
1320static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001321vec_vandc(vector bool long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00001322 return (vector unsigned long long)__a & ~__b;
1323}
1324
1325static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001326vec_vandc(vector unsigned long long __a, vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00001327 return __a & ~(vector unsigned long long)__b;
1328}
1329
Bill Seurer703e8482015-06-09 14:39:47 +00001330static vector bool long long __ATTRS_o_ai vec_vandc(vector bool long long __a,
1331 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00001332 return __a & ~__b;
1333}
1334#endif
1335
Chris Lattnerdad40622010-04-14 03:54:58 +00001336/* vec_avg */
1337
Bill Seurer703e8482015-06-09 14:39:47 +00001338static vector signed char __ATTRS_o_ai vec_avg(vector signed char __a,
1339 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001340 return __builtin_altivec_vavgsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001341}
1342
Bill Seurer703e8482015-06-09 14:39:47 +00001343static vector unsigned char __ATTRS_o_ai vec_avg(vector unsigned char __a,
1344 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001345 return __builtin_altivec_vavgub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001346}
1347
Bill Seurer703e8482015-06-09 14:39:47 +00001348static vector short __ATTRS_o_ai vec_avg(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001349 return __builtin_altivec_vavgsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001350}
1351
Bill Seurer703e8482015-06-09 14:39:47 +00001352static vector unsigned short __ATTRS_o_ai vec_avg(vector unsigned short __a,
1353 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001354 return __builtin_altivec_vavguh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001355}
1356
Bill Seurer703e8482015-06-09 14:39:47 +00001357static vector int __ATTRS_o_ai vec_avg(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001358 return __builtin_altivec_vavgsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001359}
1360
Bill Seurer703e8482015-06-09 14:39:47 +00001361static vector unsigned int __ATTRS_o_ai vec_avg(vector unsigned int __a,
1362 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001363 return __builtin_altivec_vavguw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001364}
1365
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001366/* vec_vavgsb */
Chris Lattnerdad40622010-04-14 03:54:58 +00001367
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001368static vector signed char __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001369vec_vavgsb(vector signed char __a, vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001370 return __builtin_altivec_vavgsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001371}
1372
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001373/* vec_vavgub */
1374
1375static vector unsigned char __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001376vec_vavgub(vector unsigned char __a, vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001377 return __builtin_altivec_vavgub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001378}
1379
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001380/* vec_vavgsh */
1381
1382static vector short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001383vec_vavgsh(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001384 return __builtin_altivec_vavgsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001385}
1386
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001387/* vec_vavguh */
1388
1389static vector unsigned short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001390vec_vavguh(vector unsigned short __a, vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001391 return __builtin_altivec_vavguh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001392}
1393
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001394/* vec_vavgsw */
1395
1396static vector int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001397vec_vavgsw(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001398 return __builtin_altivec_vavgsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001399}
1400
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001401/* vec_vavguw */
1402
1403static vector unsigned int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001404vec_vavguw(vector unsigned int __a, vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001405 return __builtin_altivec_vavguw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001406}
1407
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001408/* vec_ceil */
1409
Nemanja Ivanovic2f1f9262015-06-26 19:27:20 +00001410static vector float __ATTRS_o_ai vec_ceil(vector float __a) {
1411#ifdef __VSX__
1412 return __builtin_vsx_xvrspip(__a);
1413#else
David Blaikie3302f2b2013-01-16 23:08:36 +00001414 return __builtin_altivec_vrfip(__a);
Nemanja Ivanovic2f1f9262015-06-26 19:27:20 +00001415#endif
Chris Lattnerdad40622010-04-14 03:54:58 +00001416}
1417
Nemanja Ivanovic2f1f9262015-06-26 19:27:20 +00001418#ifdef __VSX__
1419static vector double __ATTRS_o_ai vec_ceil(vector double __a) {
1420 return __builtin_vsx_xvrdpip(__a);
1421}
1422#endif
1423
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001424/* vec_vrfip */
Chris Lattnerdad40622010-04-14 03:54:58 +00001425
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001426static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001427vec_vrfip(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001428 return __builtin_altivec_vrfip(__a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001429}
1430
1431/* vec_cmpb */
1432
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001433static vector int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001434vec_cmpb(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001435 return __builtin_altivec_vcmpbfp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001436}
1437
1438/* vec_vcmpbfp */
1439
1440static vector int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001441vec_vcmpbfp(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001442 return __builtin_altivec_vcmpbfp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001443}
Chris Lattnerdad40622010-04-14 03:54:58 +00001444
1445/* vec_cmpeq */
1446
Bill Seurer703e8482015-06-09 14:39:47 +00001447static vector bool char __ATTRS_o_ai vec_cmpeq(vector signed char __a,
1448 vector signed char __b) {
1449 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
1450 (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001451}
1452
Bill Seurer703e8482015-06-09 14:39:47 +00001453static vector bool char __ATTRS_o_ai vec_cmpeq(vector unsigned char __a,
1454 vector unsigned char __b) {
1455 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
1456 (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001457}
1458
Bill Seurer703e8482015-06-09 14:39:47 +00001459static vector bool short __ATTRS_o_ai vec_cmpeq(vector short __a,
1460 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001461 return (vector bool short)__builtin_altivec_vcmpequh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001462}
1463
Bill Seurer703e8482015-06-09 14:39:47 +00001464static vector bool short __ATTRS_o_ai vec_cmpeq(vector unsigned short __a,
1465 vector unsigned short __b) {
1466 return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a,
1467 (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001468}
1469
Bill Seurer703e8482015-06-09 14:39:47 +00001470static vector bool int __ATTRS_o_ai vec_cmpeq(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001471 return (vector bool int)__builtin_altivec_vcmpequw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001472}
1473
Bill Seurer703e8482015-06-09 14:39:47 +00001474static vector bool int __ATTRS_o_ai vec_cmpeq(vector unsigned int __a,
1475 vector unsigned int __b) {
1476 return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a,
1477 (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001478}
1479
Kit Barton8553bec2015-03-11 15:57:19 +00001480#ifdef __POWER8_VECTOR__
1481static vector bool long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001482vec_cmpeq(vector signed long long __a, vector signed long long __b) {
1483 return (vector bool long long)__builtin_altivec_vcmpequd(__a, __b);
Kit Barton8553bec2015-03-11 15:57:19 +00001484}
1485
1486static vector bool long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001487vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b) {
1488 return (vector bool long long)__builtin_altivec_vcmpequd(
1489 (vector long long)__a, (vector long long)__b);
Kit Barton8553bec2015-03-11 15:57:19 +00001490}
1491#endif
1492
Bill Seurer703e8482015-06-09 14:39:47 +00001493static vector bool int __ATTRS_o_ai vec_cmpeq(vector float __a,
1494 vector float __b) {
Nemanja Ivanovic2f1f9262015-06-26 19:27:20 +00001495#ifdef __VSX__
1496 return (vector bool int)__builtin_vsx_xvcmpeqsp(__a, __b);
1497#else
David Blaikie3302f2b2013-01-16 23:08:36 +00001498 return (vector bool int)__builtin_altivec_vcmpeqfp(__a, __b);
Nemanja Ivanovic2f1f9262015-06-26 19:27:20 +00001499#endif
Chris Lattnerdad40622010-04-14 03:54:58 +00001500}
1501
Nemanja Ivanovic2f1f9262015-06-26 19:27:20 +00001502#ifdef __VSX__
1503static vector bool long long __ATTRS_o_ai
1504vec_cmpeq(vector double __a, vector double __b) {
1505 return (vector bool long long)__builtin_vsx_xvcmpeqdp(__a, __b);
1506}
1507#endif
1508
Chris Lattnerdad40622010-04-14 03:54:58 +00001509/* vec_cmpge */
1510
Nemanja Ivanovic2f1f9262015-06-26 19:27:20 +00001511static vector bool int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001512vec_cmpge(vector float __a, vector float __b) {
Nemanja Ivanovic2f1f9262015-06-26 19:27:20 +00001513#ifdef __VSX__
1514 return (vector bool int)__builtin_vsx_xvcmpgesp(__a, __b);
1515#else
David Blaikie3302f2b2013-01-16 23:08:36 +00001516 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
Nemanja Ivanovic2f1f9262015-06-26 19:27:20 +00001517#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001518}
1519
Nemanja Ivanovic2f1f9262015-06-26 19:27:20 +00001520#ifdef __VSX__
1521static vector bool long long __ATTRS_o_ai
1522vec_cmpge(vector double __a, vector double __b) {
1523 return (vector bool long long)__builtin_vsx_xvcmpgedp(__a, __b);
1524}
1525#endif
1526
1527#ifdef __POWER8_VECTOR__
1528/* Forwrad declarations as the functions are used here */
1529static vector bool long long __ATTRS_o_ai
1530vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b);
1531static vector bool long long __ATTRS_o_ai
1532vec_cmpgt(vector signed long long __a, vector signed long long __b);
1533
1534static vector bool long long __ATTRS_o_ai
1535vec_cmpge(vector signed long long __a, vector signed long long __b) {
1536 return ~(vec_cmpgt(__b, __a));
1537}
1538
1539static vector bool long long __ATTRS_o_ai
1540vec_cmpge(vector unsigned long long __a, vector unsigned long long __b) {
1541 return ~(vec_cmpgt(__b, __a));
1542}
1543#endif
1544
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001545/* vec_vcmpgefp */
1546
Anton Yartsevfc83c602010-08-19 03:21:36 +00001547static vector bool int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001548vec_vcmpgefp(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001549 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001550}
Chris Lattnerdad40622010-04-14 03:54:58 +00001551
1552/* vec_cmpgt */
1553
Bill Seurer703e8482015-06-09 14:39:47 +00001554static vector bool char __ATTRS_o_ai vec_cmpgt(vector signed char __a,
1555 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001556 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001557}
1558
Bill Seurer703e8482015-06-09 14:39:47 +00001559static vector bool char __ATTRS_o_ai vec_cmpgt(vector unsigned char __a,
1560 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001561 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001562}
1563
Bill Seurer703e8482015-06-09 14:39:47 +00001564static vector bool short __ATTRS_o_ai vec_cmpgt(vector short __a,
1565 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001566 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001567}
1568
Bill Seurer703e8482015-06-09 14:39:47 +00001569static vector bool short __ATTRS_o_ai vec_cmpgt(vector unsigned short __a,
1570 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001571 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001572}
1573
Bill Seurer703e8482015-06-09 14:39:47 +00001574static vector bool int __ATTRS_o_ai vec_cmpgt(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001575 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001576}
1577
Bill Seurer703e8482015-06-09 14:39:47 +00001578static vector bool int __ATTRS_o_ai vec_cmpgt(vector unsigned int __a,
1579 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001580 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001581}
1582
Kit Barton8553bec2015-03-11 15:57:19 +00001583#ifdef __POWER8_VECTOR__
1584static vector bool long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001585vec_cmpgt(vector signed long long __a, vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00001586 return (vector bool long long)__builtin_altivec_vcmpgtsd(__a, __b);
1587}
1588
1589static vector bool long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001590vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00001591 return (vector bool long long)__builtin_altivec_vcmpgtud(__a, __b);
1592}
1593#endif
1594
Bill Seurer703e8482015-06-09 14:39:47 +00001595static vector bool int __ATTRS_o_ai vec_cmpgt(vector float __a,
1596 vector float __b) {
Nemanja Ivanovic2f1f9262015-06-26 19:27:20 +00001597#ifdef __VSX__
1598 return (vector bool int)__builtin_vsx_xvcmpgtsp(__a, __b);
1599#else
David Blaikie3302f2b2013-01-16 23:08:36 +00001600 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
Nemanja Ivanovic2f1f9262015-06-26 19:27:20 +00001601#endif
Chris Lattnerdad40622010-04-14 03:54:58 +00001602}
1603
Nemanja Ivanovic2f1f9262015-06-26 19:27:20 +00001604#ifdef __VSX__
1605static vector bool long long __ATTRS_o_ai
1606vec_cmpgt(vector double __a, vector double __b) {
1607 return (vector bool long long)__builtin_vsx_xvcmpgtdp(__a, __b);
1608}
1609#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001610/* vec_vcmpgtsb */
Chris Lattnerdad40622010-04-14 03:54:58 +00001611
Anton Yartsevfc83c602010-08-19 03:21:36 +00001612static vector bool char __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001613vec_vcmpgtsb(vector signed char __a, vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001614 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001615}
1616
1617/* vec_vcmpgtub */
1618
Anton Yartsevfc83c602010-08-19 03:21:36 +00001619static vector bool char __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001620vec_vcmpgtub(vector unsigned char __a, vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001621 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001622}
1623
1624/* vec_vcmpgtsh */
1625
Anton Yartsevfc83c602010-08-19 03:21:36 +00001626static vector bool short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001627vec_vcmpgtsh(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001628 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001629}
1630
1631/* vec_vcmpgtuh */
1632
Anton Yartsevfc83c602010-08-19 03:21:36 +00001633static vector bool short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001634vec_vcmpgtuh(vector unsigned short __a, vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001635 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001636}
1637
1638/* vec_vcmpgtsw */
1639
Anton Yartsevfc83c602010-08-19 03:21:36 +00001640static vector bool int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001641vec_vcmpgtsw(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001642 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001643}
1644
1645/* vec_vcmpgtuw */
1646
Anton Yartsevfc83c602010-08-19 03:21:36 +00001647static vector bool int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001648vec_vcmpgtuw(vector unsigned int __a, vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001649 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001650}
1651
1652/* vec_vcmpgtfp */
1653
Anton Yartsevfc83c602010-08-19 03:21:36 +00001654static vector bool int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001655vec_vcmpgtfp(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001656 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001657}
1658
1659/* vec_cmple */
Chris Lattnerdad40622010-04-14 03:54:58 +00001660
Nemanja Ivanovic2f1f9262015-06-26 19:27:20 +00001661static vector bool int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001662vec_cmple(vector float __a, vector float __b) {
Nemanja Ivanovic2f1f9262015-06-26 19:27:20 +00001663 return vec_cmpge(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001664}
1665
Nemanja Ivanovic2f1f9262015-06-26 19:27:20 +00001666#ifdef __VSX__
1667static vector bool long long __ATTRS_o_ai
1668vec_cmple(vector double __a, vector double __b) {
1669 return vec_cmpge(__b, __a);
1670}
1671#endif
1672
1673#ifdef __POWER8_VECTOR__
1674static vector bool long long __ATTRS_o_ai
1675vec_cmple(vector signed long long __a, vector signed long long __b) {
1676 return vec_cmpge(__b, __a);
1677}
1678
1679static vector bool long long __ATTRS_o_ai
1680vec_cmple(vector unsigned long long __a, vector unsigned long long __b) {
1681 return vec_cmpge(__b, __a);
1682}
1683#endif
1684
Chris Lattnerdad40622010-04-14 03:54:58 +00001685/* vec_cmplt */
1686
Bill Seurer703e8482015-06-09 14:39:47 +00001687static vector bool char __ATTRS_o_ai vec_cmplt(vector signed char __a,
1688 vector signed char __b) {
Nemanja Ivanovic2f1f9262015-06-26 19:27:20 +00001689 return vec_cmpgt(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001690}
1691
Bill Seurer703e8482015-06-09 14:39:47 +00001692static vector bool char __ATTRS_o_ai vec_cmplt(vector unsigned char __a,
1693 vector unsigned char __b) {
Nemanja Ivanovic2f1f9262015-06-26 19:27:20 +00001694 return vec_cmpgt(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001695}
1696
Bill Seurer703e8482015-06-09 14:39:47 +00001697static vector bool short __ATTRS_o_ai vec_cmplt(vector short __a,
1698 vector short __b) {
Nemanja Ivanovic2f1f9262015-06-26 19:27:20 +00001699 return vec_cmpgt(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001700}
1701
Bill Seurer703e8482015-06-09 14:39:47 +00001702static vector bool short __ATTRS_o_ai vec_cmplt(vector unsigned short __a,
1703 vector unsigned short __b) {
Nemanja Ivanovic2f1f9262015-06-26 19:27:20 +00001704 return vec_cmpgt(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001705}
1706
Bill Seurer703e8482015-06-09 14:39:47 +00001707static vector bool int __ATTRS_o_ai vec_cmplt(vector int __a, vector int __b) {
Nemanja Ivanovic2f1f9262015-06-26 19:27:20 +00001708 return vec_cmpgt(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001709}
1710
Bill Seurer703e8482015-06-09 14:39:47 +00001711static vector bool int __ATTRS_o_ai vec_cmplt(vector unsigned int __a,
1712 vector unsigned int __b) {
Nemanja Ivanovic2f1f9262015-06-26 19:27:20 +00001713 return vec_cmpgt(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001714}
1715
Bill Seurer703e8482015-06-09 14:39:47 +00001716static vector bool int __ATTRS_o_ai vec_cmplt(vector float __a,
1717 vector float __b) {
Nemanja Ivanovic2f1f9262015-06-26 19:27:20 +00001718 return vec_cmpgt(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001719}
1720
Nemanja Ivanovic2f1f9262015-06-26 19:27:20 +00001721#ifdef __VSX__
1722static vector bool long long __ATTRS_o_ai
1723vec_cmplt(vector double __a, vector double __b) {
1724 return vec_cmpgt(__b, __a);
1725}
1726#endif
1727
1728#ifdef __POWER8_VECTOR__
1729static vector bool long long __ATTRS_o_ai
1730vec_cmplt(vector signed long long __a, vector signed long long __b) {
1731 return vec_cmpgt(__b, __a);
1732}
1733
1734static vector bool long long __ATTRS_o_ai
1735vec_cmplt(vector unsigned long long __a, vector unsigned long long __b) {
1736 return vec_cmpgt(__b, __a);
1737}
1738#endif
1739
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001740/* vec_ctf */
1741
Bill Seurer703e8482015-06-09 14:39:47 +00001742static vector float __ATTRS_o_ai vec_ctf(vector int __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001743 return __builtin_altivec_vcfsx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001744}
1745
Bill Seurer703e8482015-06-09 14:39:47 +00001746static vector float __ATTRS_o_ai vec_ctf(vector unsigned int __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001747 return __builtin_altivec_vcfux((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001748}
1749
1750/* vec_vcfsx */
1751
1752static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001753vec_vcfsx(vector int __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001754 return __builtin_altivec_vcfsx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001755}
1756
1757/* vec_vcfux */
1758
1759static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001760vec_vcfux(vector unsigned int __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001761 return __builtin_altivec_vcfux((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001762}
1763
1764/* vec_cts */
1765
1766static vector int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001767vec_cts(vector float __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001768 return __builtin_altivec_vctsxs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001769}
1770
1771/* vec_vctsxs */
1772
1773static vector int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001774vec_vctsxs(vector float __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001775 return __builtin_altivec_vctsxs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001776}
1777
1778/* vec_ctu */
1779
1780static vector unsigned int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001781vec_ctu(vector float __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001782 return __builtin_altivec_vctuxs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001783}
1784
1785/* vec_vctuxs */
1786
1787static vector unsigned int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001788vec_vctuxs(vector float __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001789 return __builtin_altivec_vctuxs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001790}
1791
Bill Schmidtcee13a22014-11-14 12:10:51 +00001792/* vec_div */
1793#ifdef __VSX__
Bill Seurer703e8482015-06-09 14:39:47 +00001794static vector float __ATTRS_o_ai vec_div(vector float __a, vector float __b) {
Bill Schmidtcee13a22014-11-14 12:10:51 +00001795 return __builtin_vsx_xvdivsp(__a, __b);
1796}
1797
Bill Seurer703e8482015-06-09 14:39:47 +00001798static vector double __ATTRS_o_ai vec_div(vector double __a,
1799 vector double __b) {
Bill Schmidtcee13a22014-11-14 12:10:51 +00001800 return __builtin_vsx_xvdivdp(__a, __b);
1801}
1802#endif
1803
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001804/* vec_dss */
1805
Bill Seurer703e8482015-06-09 14:39:47 +00001806static void __attribute__((__always_inline__)) vec_dss(int __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001807 __builtin_altivec_dss(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001808}
1809
1810/* vec_dssall */
1811
Bill Seurer703e8482015-06-09 14:39:47 +00001812static void __attribute__((__always_inline__)) vec_dssall(void) {
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001813 __builtin_altivec_dssall();
1814}
1815
1816/* vec_dst */
1817
1818static void __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001819vec_dst(const void *__a, int __b, int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001820 __builtin_altivec_dst(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001821}
1822
1823/* vec_dstst */
1824
1825static void __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001826vec_dstst(const void *__a, int __b, int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001827 __builtin_altivec_dstst(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001828}
1829
1830/* vec_dststt */
1831
1832static void __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001833vec_dststt(const void *__a, int __b, int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001834 __builtin_altivec_dststt(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001835}
1836
1837/* vec_dstt */
1838
1839static void __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001840vec_dstt(const void *__a, int __b, int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001841 __builtin_altivec_dstt(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001842}
1843
1844/* vec_expte */
1845
1846static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001847vec_expte(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001848 return __builtin_altivec_vexptefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001849}
1850
1851/* vec_vexptefp */
1852
1853static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001854vec_vexptefp(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001855 return __builtin_altivec_vexptefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001856}
1857
1858/* vec_floor */
1859
1860static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001861vec_floor(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001862 return __builtin_altivec_vrfim(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001863}
1864
1865/* vec_vrfim */
1866
1867static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001868vec_vrfim(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001869 return __builtin_altivec_vrfim(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001870}
1871
1872/* vec_ld */
1873
Bill Seurer703e8482015-06-09 14:39:47 +00001874static vector signed char __ATTRS_o_ai vec_ld(int __a,
1875 const vector signed char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001876 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001877}
1878
Bill Seurer703e8482015-06-09 14:39:47 +00001879static vector signed char __ATTRS_o_ai vec_ld(int __a, const signed char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001880 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001881}
1882
1883static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001884vec_ld(int __a, const vector unsigned char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001885 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001886}
1887
Bill Seurer703e8482015-06-09 14:39:47 +00001888static vector unsigned char __ATTRS_o_ai vec_ld(int __a,
1889 const unsigned char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001890 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001891}
1892
Bill Seurer703e8482015-06-09 14:39:47 +00001893static vector bool char __ATTRS_o_ai vec_ld(int __a,
1894 const vector bool char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001895 return (vector bool char)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001896}
1897
Bill Seurer703e8482015-06-09 14:39:47 +00001898static vector short __ATTRS_o_ai vec_ld(int __a, const vector short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001899 return (vector short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001900}
1901
Bill Seurer703e8482015-06-09 14:39:47 +00001902static vector short __ATTRS_o_ai vec_ld(int __a, const short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001903 return (vector short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001904}
1905
1906static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001907vec_ld(int __a, const vector unsigned short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001908 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001909}
1910
Bill Seurer703e8482015-06-09 14:39:47 +00001911static vector unsigned short __ATTRS_o_ai vec_ld(int __a,
1912 const unsigned short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001913 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001914}
1915
Bill Seurer703e8482015-06-09 14:39:47 +00001916static vector bool short __ATTRS_o_ai vec_ld(int __a,
1917 const vector bool short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001918 return (vector bool short)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001919}
1920
Bill Seurer703e8482015-06-09 14:39:47 +00001921static vector pixel __ATTRS_o_ai vec_ld(int __a, const vector pixel *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001922 return (vector pixel)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001923}
1924
Bill Seurer703e8482015-06-09 14:39:47 +00001925static vector int __ATTRS_o_ai vec_ld(int __a, const vector int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001926 return (vector int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001927}
1928
Bill Seurer703e8482015-06-09 14:39:47 +00001929static vector int __ATTRS_o_ai vec_ld(int __a, const int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001930 return (vector int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001931}
1932
Bill Seurer703e8482015-06-09 14:39:47 +00001933static vector unsigned int __ATTRS_o_ai vec_ld(int __a,
1934 const vector unsigned int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001935 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001936}
1937
Bill Seurer703e8482015-06-09 14:39:47 +00001938static vector unsigned int __ATTRS_o_ai vec_ld(int __a,
1939 const unsigned int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001940 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001941}
1942
Bill Seurer703e8482015-06-09 14:39:47 +00001943static vector bool int __ATTRS_o_ai vec_ld(int __a,
1944 const vector bool int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001945 return (vector bool int)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001946}
1947
Bill Seurer703e8482015-06-09 14:39:47 +00001948static vector float __ATTRS_o_ai vec_ld(int __a, const vector float *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001949 return (vector float)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001950}
1951
Bill Seurer703e8482015-06-09 14:39:47 +00001952static vector float __ATTRS_o_ai vec_ld(int __a, const float *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001953 return (vector float)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001954}
1955
1956/* vec_lvx */
1957
Bill Seurer703e8482015-06-09 14:39:47 +00001958static vector signed char __ATTRS_o_ai vec_lvx(int __a,
1959 const vector signed char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001960 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001961}
1962
Bill Seurer703e8482015-06-09 14:39:47 +00001963static vector signed char __ATTRS_o_ai vec_lvx(int __a,
1964 const signed char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001965 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001966}
1967
1968static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001969vec_lvx(int __a, const vector unsigned char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001970 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001971}
1972
Bill Seurer703e8482015-06-09 14:39:47 +00001973static vector unsigned char __ATTRS_o_ai vec_lvx(int __a,
1974 const unsigned char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001975 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001976}
1977
Bill Seurer703e8482015-06-09 14:39:47 +00001978static vector bool char __ATTRS_o_ai vec_lvx(int __a,
1979 const vector bool char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001980 return (vector bool char)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001981}
1982
Bill Seurer703e8482015-06-09 14:39:47 +00001983static vector short __ATTRS_o_ai vec_lvx(int __a, const vector short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001984 return (vector short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001985}
1986
Bill Seurer703e8482015-06-09 14:39:47 +00001987static vector short __ATTRS_o_ai vec_lvx(int __a, const short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001988 return (vector short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001989}
1990
1991static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001992vec_lvx(int __a, const vector unsigned short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001993 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001994}
1995
Bill Seurer703e8482015-06-09 14:39:47 +00001996static vector unsigned short __ATTRS_o_ai vec_lvx(int __a,
1997 const unsigned short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001998 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001999}
2000
Bill Seurer703e8482015-06-09 14:39:47 +00002001static vector bool short __ATTRS_o_ai vec_lvx(int __a,
2002 const vector bool short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002003 return (vector bool short)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002004}
2005
Bill Seurer703e8482015-06-09 14:39:47 +00002006static vector pixel __ATTRS_o_ai vec_lvx(int __a, const vector pixel *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002007 return (vector pixel)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002008}
2009
Bill Seurer703e8482015-06-09 14:39:47 +00002010static vector int __ATTRS_o_ai vec_lvx(int __a, const vector int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002011 return (vector int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002012}
2013
Bill Seurer703e8482015-06-09 14:39:47 +00002014static vector int __ATTRS_o_ai vec_lvx(int __a, const int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002015 return (vector int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002016}
2017
2018static vector unsigned int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002019vec_lvx(int __a, const vector unsigned int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002020 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002021}
2022
Bill Seurer703e8482015-06-09 14:39:47 +00002023static vector unsigned int __ATTRS_o_ai vec_lvx(int __a,
2024 const unsigned int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002025 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002026}
2027
Bill Seurer703e8482015-06-09 14:39:47 +00002028static vector bool int __ATTRS_o_ai vec_lvx(int __a,
2029 const vector bool int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002030 return (vector bool int)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002031}
2032
Bill Seurer703e8482015-06-09 14:39:47 +00002033static vector float __ATTRS_o_ai vec_lvx(int __a, const vector float *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002034 return (vector float)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002035}
2036
Bill Seurer703e8482015-06-09 14:39:47 +00002037static vector float __ATTRS_o_ai vec_lvx(int __a, const float *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002038 return (vector float)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002039}
2040
2041/* vec_lde */
2042
Bill Seurer703e8482015-06-09 14:39:47 +00002043static vector signed char __ATTRS_o_ai vec_lde(int __a,
2044 const signed char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002045 return (vector signed char)__builtin_altivec_lvebx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002046}
2047
Bill Seurer703e8482015-06-09 14:39:47 +00002048static vector unsigned char __ATTRS_o_ai vec_lde(int __a,
2049 const unsigned char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002050 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002051}
2052
Bill Seurer703e8482015-06-09 14:39:47 +00002053static vector short __ATTRS_o_ai vec_lde(int __a, const short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002054 return (vector short)__builtin_altivec_lvehx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002055}
2056
Bill Seurer703e8482015-06-09 14:39:47 +00002057static vector unsigned short __ATTRS_o_ai vec_lde(int __a,
2058 const unsigned short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002059 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002060}
2061
Bill Seurer703e8482015-06-09 14:39:47 +00002062static vector int __ATTRS_o_ai vec_lde(int __a, const int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002063 return (vector int)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002064}
2065
Bill Seurer703e8482015-06-09 14:39:47 +00002066static vector unsigned int __ATTRS_o_ai vec_lde(int __a,
2067 const unsigned int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002068 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002069}
2070
Bill Seurer703e8482015-06-09 14:39:47 +00002071static vector float __ATTRS_o_ai vec_lde(int __a, const float *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002072 return (vector float)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002073}
2074
2075/* vec_lvebx */
2076
Bill Seurer703e8482015-06-09 14:39:47 +00002077static vector signed char __ATTRS_o_ai vec_lvebx(int __a,
2078 const signed char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002079 return (vector signed char)__builtin_altivec_lvebx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002080}
2081
Bill Seurer703e8482015-06-09 14:39:47 +00002082static vector unsigned char __ATTRS_o_ai vec_lvebx(int __a,
2083 const unsigned char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002084 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002085}
2086
2087/* vec_lvehx */
2088
Bill Seurer703e8482015-06-09 14:39:47 +00002089static vector short __ATTRS_o_ai vec_lvehx(int __a, const short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002090 return (vector short)__builtin_altivec_lvehx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002091}
2092
Bill Seurer703e8482015-06-09 14:39:47 +00002093static vector unsigned short __ATTRS_o_ai vec_lvehx(int __a,
2094 const unsigned short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002095 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002096}
2097
2098/* vec_lvewx */
2099
Bill Seurer703e8482015-06-09 14:39:47 +00002100static vector int __ATTRS_o_ai vec_lvewx(int __a, const int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002101 return (vector int)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002102}
2103
Bill Seurer703e8482015-06-09 14:39:47 +00002104static vector unsigned int __ATTRS_o_ai vec_lvewx(int __a,
2105 const unsigned int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002106 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002107}
2108
Bill Seurer703e8482015-06-09 14:39:47 +00002109static vector float __ATTRS_o_ai vec_lvewx(int __a, const float *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002110 return (vector float)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002111}
2112
2113/* vec_ldl */
2114
Bill Seurer703e8482015-06-09 14:39:47 +00002115static vector signed char __ATTRS_o_ai vec_ldl(int __a,
2116 const vector signed char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002117 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002118}
2119
Bill Seurer703e8482015-06-09 14:39:47 +00002120static vector signed char __ATTRS_o_ai vec_ldl(int __a,
2121 const signed char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002122 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002123}
2124
2125static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002126vec_ldl(int __a, const vector unsigned char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002127 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002128}
2129
Bill Seurer703e8482015-06-09 14:39:47 +00002130static vector unsigned char __ATTRS_o_ai vec_ldl(int __a,
2131 const unsigned char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002132 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002133}
2134
Bill Seurer703e8482015-06-09 14:39:47 +00002135static vector bool char __ATTRS_o_ai vec_ldl(int __a,
2136 const vector bool char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002137 return (vector bool char)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002138}
2139
Bill Seurer703e8482015-06-09 14:39:47 +00002140static vector short __ATTRS_o_ai vec_ldl(int __a, const vector short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002141 return (vector short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002142}
2143
Bill Seurer703e8482015-06-09 14:39:47 +00002144static vector short __ATTRS_o_ai vec_ldl(int __a, const short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002145 return (vector short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002146}
2147
2148static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002149vec_ldl(int __a, const vector unsigned short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002150 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002151}
2152
Bill Seurer703e8482015-06-09 14:39:47 +00002153static vector unsigned short __ATTRS_o_ai vec_ldl(int __a,
2154 const unsigned short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002155 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002156}
2157
Bill Seurer703e8482015-06-09 14:39:47 +00002158static vector bool short __ATTRS_o_ai vec_ldl(int __a,
2159 const vector bool short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002160 return (vector bool short)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002161}
2162
Bill Seurer703e8482015-06-09 14:39:47 +00002163static vector pixel __ATTRS_o_ai vec_ldl(int __a, const vector pixel *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002164 return (vector pixel short)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002165}
2166
Bill Seurer703e8482015-06-09 14:39:47 +00002167static vector int __ATTRS_o_ai vec_ldl(int __a, const vector int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002168 return (vector int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002169}
2170
Bill Seurer703e8482015-06-09 14:39:47 +00002171static vector int __ATTRS_o_ai vec_ldl(int __a, const int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002172 return (vector int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002173}
2174
2175static vector unsigned int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002176vec_ldl(int __a, const vector unsigned int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002177 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002178}
2179
Bill Seurer703e8482015-06-09 14:39:47 +00002180static vector unsigned int __ATTRS_o_ai vec_ldl(int __a,
2181 const unsigned int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002182 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002183}
2184
Bill Seurer703e8482015-06-09 14:39:47 +00002185static vector bool int __ATTRS_o_ai vec_ldl(int __a,
2186 const vector bool int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002187 return (vector bool int)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002188}
2189
Bill Seurer703e8482015-06-09 14:39:47 +00002190static vector float __ATTRS_o_ai vec_ldl(int __a, const vector float *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002191 return (vector float)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002192}
2193
Bill Seurer703e8482015-06-09 14:39:47 +00002194static vector float __ATTRS_o_ai vec_ldl(int __a, const float *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002195 return (vector float)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002196}
2197
2198/* vec_lvxl */
2199
Bill Seurer703e8482015-06-09 14:39:47 +00002200static vector signed char __ATTRS_o_ai vec_lvxl(int __a,
2201 const vector signed char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002202 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002203}
2204
Bill Seurer703e8482015-06-09 14:39:47 +00002205static vector signed char __ATTRS_o_ai vec_lvxl(int __a,
2206 const signed char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002207 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002208}
2209
2210static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002211vec_lvxl(int __a, const vector unsigned char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002212 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002213}
2214
Bill Seurer703e8482015-06-09 14:39:47 +00002215static vector unsigned char __ATTRS_o_ai vec_lvxl(int __a,
2216 const unsigned char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002217 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002218}
2219
Bill Seurer703e8482015-06-09 14:39:47 +00002220static vector bool char __ATTRS_o_ai vec_lvxl(int __a,
2221 const vector bool char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002222 return (vector bool char)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002223}
2224
Bill Seurer703e8482015-06-09 14:39:47 +00002225static vector short __ATTRS_o_ai vec_lvxl(int __a, const vector short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002226 return (vector short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002227}
2228
Bill Seurer703e8482015-06-09 14:39:47 +00002229static vector short __ATTRS_o_ai vec_lvxl(int __a, const short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002230 return (vector short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002231}
2232
2233static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002234vec_lvxl(int __a, const vector unsigned short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002235 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002236}
2237
Bill Seurer703e8482015-06-09 14:39:47 +00002238static vector unsigned short __ATTRS_o_ai vec_lvxl(int __a,
2239 const unsigned short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002240 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002241}
2242
Bill Seurer703e8482015-06-09 14:39:47 +00002243static vector bool short __ATTRS_o_ai vec_lvxl(int __a,
2244 const vector bool short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002245 return (vector bool short)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002246}
2247
Bill Seurer703e8482015-06-09 14:39:47 +00002248static vector pixel __ATTRS_o_ai vec_lvxl(int __a, const vector pixel *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002249 return (vector pixel)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002250}
2251
Bill Seurer703e8482015-06-09 14:39:47 +00002252static vector int __ATTRS_o_ai vec_lvxl(int __a, const vector int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002253 return (vector int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002254}
2255
Bill Seurer703e8482015-06-09 14:39:47 +00002256static vector int __ATTRS_o_ai vec_lvxl(int __a, const int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002257 return (vector int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002258}
2259
2260static vector unsigned int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002261vec_lvxl(int __a, const vector unsigned int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002262 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002263}
2264
Bill Seurer703e8482015-06-09 14:39:47 +00002265static vector unsigned int __ATTRS_o_ai vec_lvxl(int __a,
2266 const unsigned int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002267 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002268}
2269
Bill Seurer703e8482015-06-09 14:39:47 +00002270static vector bool int __ATTRS_o_ai vec_lvxl(int __a,
2271 const vector bool int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002272 return (vector bool int)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002273}
2274
Bill Seurer703e8482015-06-09 14:39:47 +00002275static vector float __ATTRS_o_ai vec_lvxl(int __a, const vector float *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002276 return (vector float)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002277}
2278
Bill Seurer703e8482015-06-09 14:39:47 +00002279static vector float __ATTRS_o_ai vec_lvxl(int __a, const float *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002280 return (vector float)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002281}
2282
2283/* vec_loge */
2284
2285static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00002286vec_loge(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002287 return __builtin_altivec_vlogefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002288}
2289
2290/* vec_vlogefp */
2291
2292static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00002293vec_vlogefp(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002294 return __builtin_altivec_vlogefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002295}
2296
2297/* vec_lvsl */
2298
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002299#ifdef __LITTLE_ENDIAN__
2300static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002301 __attribute__((__deprecated__("use assignment for unaligned little endian \
2302loads/stores"))) vec_lvsl(int __a, const signed char *__b) {
2303 vector unsigned char mask =
2304 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2305 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2306 7, 6, 5, 4, 3, 2, 1, 0};
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002307 return vec_perm(mask, mask, reverse);
2308}
2309#else
Bill Seurer703e8482015-06-09 14:39:47 +00002310static vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
2311 const signed char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002312 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002313}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002314#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002315
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002316#ifdef __LITTLE_ENDIAN__
2317static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002318 __attribute__((__deprecated__("use assignment for unaligned little endian \
2319loads/stores"))) vec_lvsl(int __a, const unsigned char *__b) {
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002320 vector unsigned char mask =
Bill Seurer703e8482015-06-09 14:39:47 +00002321 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2322 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2323 7, 6, 5, 4, 3, 2, 1, 0};
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002324 return vec_perm(mask, mask, reverse);
2325}
2326#else
Bill Seurer703e8482015-06-09 14:39:47 +00002327static vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
2328 const unsigned char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002329 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002330}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002331#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002332
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002333#ifdef __LITTLE_ENDIAN__
2334static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002335 __attribute__((__deprecated__("use assignment for unaligned little endian \
2336loads/stores"))) vec_lvsl(int __a, const short *__b) {
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002337 vector unsigned char mask =
Bill Seurer703e8482015-06-09 14:39:47 +00002338 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2339 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2340 7, 6, 5, 4, 3, 2, 1, 0};
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002341 return vec_perm(mask, mask, reverse);
2342}
2343#else
Bill Seurer703e8482015-06-09 14:39:47 +00002344static vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, const short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002345 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002346}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002347#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002348
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002349#ifdef __LITTLE_ENDIAN__
2350static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002351 __attribute__((__deprecated__("use assignment for unaligned little endian \
2352loads/stores"))) vec_lvsl(int __a, const unsigned short *__b) {
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002353 vector unsigned char mask =
Bill Seurer703e8482015-06-09 14:39:47 +00002354 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2355 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2356 7, 6, 5, 4, 3, 2, 1, 0};
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002357 return vec_perm(mask, mask, reverse);
2358}
2359#else
Bill Seurer703e8482015-06-09 14:39:47 +00002360static vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
2361 const unsigned short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002362 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002363}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002364#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002365
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002366#ifdef __LITTLE_ENDIAN__
2367static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002368 __attribute__((__deprecated__("use assignment for unaligned little endian \
2369loads/stores"))) vec_lvsl(int __a, const int *__b) {
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002370 vector unsigned char mask =
Bill Seurer703e8482015-06-09 14:39:47 +00002371 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2372 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2373 7, 6, 5, 4, 3, 2, 1, 0};
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002374 return vec_perm(mask, mask, reverse);
2375}
2376#else
Bill Seurer703e8482015-06-09 14:39:47 +00002377static vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, const int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002378 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002379}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002380#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002381
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002382#ifdef __LITTLE_ENDIAN__
2383static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002384 __attribute__((__deprecated__("use assignment for unaligned little endian \
2385loads/stores"))) vec_lvsl(int __a, const unsigned int *__b) {
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002386 vector unsigned char mask =
Bill Seurer703e8482015-06-09 14:39:47 +00002387 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2388 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2389 7, 6, 5, 4, 3, 2, 1, 0};
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002390 return vec_perm(mask, mask, reverse);
2391}
2392#else
Bill Seurer703e8482015-06-09 14:39:47 +00002393static vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
2394 const unsigned int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002395 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002396}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002397#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002398
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002399#ifdef __LITTLE_ENDIAN__
2400static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002401 __attribute__((__deprecated__("use assignment for unaligned little endian \
2402loads/stores"))) vec_lvsl(int __a, const float *__b) {
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002403 vector unsigned char mask =
Bill Seurer703e8482015-06-09 14:39:47 +00002404 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2405 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2406 7, 6, 5, 4, 3, 2, 1, 0};
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002407 return vec_perm(mask, mask, reverse);
2408}
2409#else
Bill Seurer703e8482015-06-09 14:39:47 +00002410static vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, const float *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002411 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002412}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002413#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002414
2415/* vec_lvsr */
2416
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002417#ifdef __LITTLE_ENDIAN__
2418static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002419 __attribute__((__deprecated__("use assignment for unaligned little endian \
2420loads/stores"))) vec_lvsr(int __a, const signed char *__b) {
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002421 vector unsigned char mask =
Bill Seurer703e8482015-06-09 14:39:47 +00002422 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2423 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2424 7, 6, 5, 4, 3, 2, 1, 0};
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002425 return vec_perm(mask, mask, reverse);
2426}
2427#else
Bill Seurer703e8482015-06-09 14:39:47 +00002428static vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
2429 const signed char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002430 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002431}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002432#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002433
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002434#ifdef __LITTLE_ENDIAN__
2435static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002436 __attribute__((__deprecated__("use assignment for unaligned little endian \
2437loads/stores"))) vec_lvsr(int __a, const unsigned char *__b) {
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002438 vector unsigned char mask =
Bill Seurer703e8482015-06-09 14:39:47 +00002439 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2440 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2441 7, 6, 5, 4, 3, 2, 1, 0};
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002442 return vec_perm(mask, mask, reverse);
2443}
2444#else
Bill Seurer703e8482015-06-09 14:39:47 +00002445static vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
2446 const unsigned char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002447 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002448}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002449#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002450
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002451#ifdef __LITTLE_ENDIAN__
2452static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002453 __attribute__((__deprecated__("use assignment for unaligned little endian \
2454loads/stores"))) vec_lvsr(int __a, const short *__b) {
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002455 vector unsigned char mask =
Bill Seurer703e8482015-06-09 14:39:47 +00002456 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2457 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2458 7, 6, 5, 4, 3, 2, 1, 0};
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002459 return vec_perm(mask, mask, reverse);
2460}
2461#else
Bill Seurer703e8482015-06-09 14:39:47 +00002462static vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, const short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002463 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002464}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002465#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002466
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002467#ifdef __LITTLE_ENDIAN__
2468static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002469 __attribute__((__deprecated__("use assignment for unaligned little endian \
2470loads/stores"))) vec_lvsr(int __a, const unsigned short *__b) {
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002471 vector unsigned char mask =
Bill Seurer703e8482015-06-09 14:39:47 +00002472 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2473 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2474 7, 6, 5, 4, 3, 2, 1, 0};
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002475 return vec_perm(mask, mask, reverse);
2476}
2477#else
Bill Seurer703e8482015-06-09 14:39:47 +00002478static vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
2479 const unsigned short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002480 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002481}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002482#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002483
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002484#ifdef __LITTLE_ENDIAN__
2485static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002486 __attribute__((__deprecated__("use assignment for unaligned little endian \
2487loads/stores"))) vec_lvsr(int __a, const int *__b) {
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002488 vector unsigned char mask =
Bill Seurer703e8482015-06-09 14:39:47 +00002489 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2490 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2491 7, 6, 5, 4, 3, 2, 1, 0};
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002492 return vec_perm(mask, mask, reverse);
2493}
2494#else
Bill Seurer703e8482015-06-09 14:39:47 +00002495static vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, const int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002496 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002497}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002498#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002499
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002500#ifdef __LITTLE_ENDIAN__
2501static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002502 __attribute__((__deprecated__("use assignment for unaligned little endian \
2503loads/stores"))) vec_lvsr(int __a, const unsigned int *__b) {
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002504 vector unsigned char mask =
Bill Seurer703e8482015-06-09 14:39:47 +00002505 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2506 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2507 7, 6, 5, 4, 3, 2, 1, 0};
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002508 return vec_perm(mask, mask, reverse);
2509}
2510#else
Bill Seurer703e8482015-06-09 14:39:47 +00002511static vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
2512 const unsigned int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002513 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002514}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002515#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002516
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002517#ifdef __LITTLE_ENDIAN__
2518static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002519 __attribute__((__deprecated__("use assignment for unaligned little endian \
2520loads/stores"))) vec_lvsr(int __a, const float *__b) {
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002521 vector unsigned char mask =
Bill Seurer703e8482015-06-09 14:39:47 +00002522 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2523 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2524 7, 6, 5, 4, 3, 2, 1, 0};
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002525 return vec_perm(mask, mask, reverse);
2526}
2527#else
Bill Seurer703e8482015-06-09 14:39:47 +00002528static vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, const float *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002529 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002530}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002531#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002532
2533/* vec_madd */
2534
2535static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00002536vec_madd(vector float __a, vector float __b, vector float __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002537 return __builtin_altivec_vmaddfp(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002538}
2539
2540/* vec_vmaddfp */
2541
2542static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00002543vec_vmaddfp(vector float __a, vector float __b, vector float __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002544 return __builtin_altivec_vmaddfp(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002545}
2546
2547/* vec_madds */
2548
2549static vector signed short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00002550vec_madds(vector signed short __a, vector signed short __b,
2551 vector signed short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002552 return __builtin_altivec_vmhaddshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002553}
2554
2555/* vec_vmhaddshs */
2556static vector signed short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00002557vec_vmhaddshs(vector signed short __a, vector signed short __b,
2558 vector signed short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002559 return __builtin_altivec_vmhaddshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002560}
2561
Chris Lattnerdad40622010-04-14 03:54:58 +00002562/* vec_max */
2563
Bill Seurer703e8482015-06-09 14:39:47 +00002564static vector signed char __ATTRS_o_ai vec_max(vector signed char __a,
2565 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002566 return __builtin_altivec_vmaxsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002567}
2568
Bill Seurer703e8482015-06-09 14:39:47 +00002569static vector signed char __ATTRS_o_ai vec_max(vector bool char __a,
2570 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002571 return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002572}
2573
Bill Seurer703e8482015-06-09 14:39:47 +00002574static vector signed char __ATTRS_o_ai vec_max(vector signed char __a,
2575 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002576 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002577}
2578
Bill Seurer703e8482015-06-09 14:39:47 +00002579static vector unsigned char __ATTRS_o_ai vec_max(vector unsigned char __a,
2580 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002581 return __builtin_altivec_vmaxub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002582}
2583
Bill Seurer703e8482015-06-09 14:39:47 +00002584static vector unsigned char __ATTRS_o_ai vec_max(vector bool char __a,
2585 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002586 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002587}
2588
Bill Seurer703e8482015-06-09 14:39:47 +00002589static vector unsigned char __ATTRS_o_ai vec_max(vector unsigned char __a,
2590 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002591 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002592}
2593
Bill Seurer703e8482015-06-09 14:39:47 +00002594static vector short __ATTRS_o_ai vec_max(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002595 return __builtin_altivec_vmaxsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002596}
2597
Bill Seurer703e8482015-06-09 14:39:47 +00002598static vector short __ATTRS_o_ai vec_max(vector bool short __a,
2599 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002600 return __builtin_altivec_vmaxsh((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002601}
2602
Bill Seurer703e8482015-06-09 14:39:47 +00002603static vector short __ATTRS_o_ai vec_max(vector short __a,
2604 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002605 return __builtin_altivec_vmaxsh(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002606}
2607
Bill Seurer703e8482015-06-09 14:39:47 +00002608static vector unsigned short __ATTRS_o_ai vec_max(vector unsigned short __a,
2609 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002610 return __builtin_altivec_vmaxuh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002611}
2612
Bill Seurer703e8482015-06-09 14:39:47 +00002613static vector unsigned short __ATTRS_o_ai vec_max(vector bool short __a,
2614 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002615 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002616}
2617
Bill Seurer703e8482015-06-09 14:39:47 +00002618static vector unsigned short __ATTRS_o_ai vec_max(vector unsigned short __a,
2619 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002620 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002621}
2622
Bill Seurer703e8482015-06-09 14:39:47 +00002623static vector int __ATTRS_o_ai vec_max(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002624 return __builtin_altivec_vmaxsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002625}
2626
Bill Seurer703e8482015-06-09 14:39:47 +00002627static vector int __ATTRS_o_ai vec_max(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002628 return __builtin_altivec_vmaxsw((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002629}
2630
Bill Seurer703e8482015-06-09 14:39:47 +00002631static vector int __ATTRS_o_ai vec_max(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002632 return __builtin_altivec_vmaxsw(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002633}
2634
Bill Seurer703e8482015-06-09 14:39:47 +00002635static vector unsigned int __ATTRS_o_ai vec_max(vector unsigned int __a,
2636 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002637 return __builtin_altivec_vmaxuw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002638}
2639
Bill Seurer703e8482015-06-09 14:39:47 +00002640static vector unsigned int __ATTRS_o_ai vec_max(vector bool int __a,
2641 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002642 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002643}
2644
Bill Seurer703e8482015-06-09 14:39:47 +00002645static vector unsigned int __ATTRS_o_ai vec_max(vector unsigned int __a,
2646 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002647 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002648}
2649
Kit Barton8553bec2015-03-11 15:57:19 +00002650#ifdef __POWER8_VECTOR__
2651static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002652vec_max(vector signed long long __a, vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00002653 return __builtin_altivec_vmaxsd(__a, __b);
2654}
2655
Bill Seurer8be14f12015-06-04 18:45:44 +00002656static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002657vec_max(vector bool long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00002658 return __builtin_altivec_vmaxsd((vector signed long long)__a, __b);
2659}
2660
Bill Seurer703e8482015-06-09 14:39:47 +00002661static vector signed long long __ATTRS_o_ai vec_max(vector signed long long __a,
2662 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00002663 return __builtin_altivec_vmaxsd(__a, (vector signed long long)__b);
2664}
2665
Kit Barton8553bec2015-03-11 15:57:19 +00002666static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002667vec_max(vector unsigned long long __a, vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00002668 return __builtin_altivec_vmaxud(__a, __b);
2669}
Bill Seurer8be14f12015-06-04 18:45:44 +00002670
2671static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002672vec_max(vector bool long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00002673 return __builtin_altivec_vmaxud((vector unsigned long long)__a, __b);
2674}
2675
2676static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002677vec_max(vector unsigned long long __a, vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00002678 return __builtin_altivec_vmaxud(__a, (vector unsigned long long)__b);
2679}
Kit Barton8553bec2015-03-11 15:57:19 +00002680#endif
2681
Bill Seurer703e8482015-06-09 14:39:47 +00002682static vector float __ATTRS_o_ai vec_max(vector float __a, vector float __b) {
Bill Schmidt691e01d2014-10-31 19:19:24 +00002683#ifdef __VSX__
2684 return __builtin_vsx_xvmaxsp(__a, __b);
2685#else
David Blaikie3302f2b2013-01-16 23:08:36 +00002686 return __builtin_altivec_vmaxfp(__a, __b);
Bill Schmidt691e01d2014-10-31 19:19:24 +00002687#endif
Chris Lattnerdad40622010-04-14 03:54:58 +00002688}
2689
Bill Schmidt691e01d2014-10-31 19:19:24 +00002690#ifdef __VSX__
Bill Seurer703e8482015-06-09 14:39:47 +00002691static vector double __ATTRS_o_ai vec_max(vector double __a,
2692 vector double __b) {
Bill Schmidt691e01d2014-10-31 19:19:24 +00002693 return __builtin_vsx_xvmaxdp(__a, __b);
2694}
2695#endif
2696
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002697/* vec_vmaxsb */
2698
Bill Seurer703e8482015-06-09 14:39:47 +00002699static vector signed char __ATTRS_o_ai vec_vmaxsb(vector signed char __a,
2700 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002701 return __builtin_altivec_vmaxsb(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002702}
2703
Bill Seurer703e8482015-06-09 14:39:47 +00002704static vector signed char __ATTRS_o_ai vec_vmaxsb(vector bool char __a,
2705 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002706 return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002707}
2708
Bill Seurer703e8482015-06-09 14:39:47 +00002709static vector signed char __ATTRS_o_ai vec_vmaxsb(vector signed char __a,
2710 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002711 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002712}
2713
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002714/* vec_vmaxub */
2715
Bill Seurer703e8482015-06-09 14:39:47 +00002716static vector unsigned char __ATTRS_o_ai vec_vmaxub(vector unsigned char __a,
2717 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002718 return __builtin_altivec_vmaxub(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002719}
2720
Bill Seurer703e8482015-06-09 14:39:47 +00002721static vector unsigned char __ATTRS_o_ai vec_vmaxub(vector bool char __a,
2722 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002723 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002724}
2725
Bill Seurer703e8482015-06-09 14:39:47 +00002726static vector unsigned char __ATTRS_o_ai vec_vmaxub(vector unsigned char __a,
2727 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002728 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002729}
2730
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002731/* vec_vmaxsh */
2732
Bill Seurer703e8482015-06-09 14:39:47 +00002733static vector short __ATTRS_o_ai vec_vmaxsh(vector short __a,
2734 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002735 return __builtin_altivec_vmaxsh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002736}
2737
Bill Seurer703e8482015-06-09 14:39:47 +00002738static vector short __ATTRS_o_ai vec_vmaxsh(vector bool short __a,
2739 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002740 return __builtin_altivec_vmaxsh((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002741}
2742
Bill Seurer703e8482015-06-09 14:39:47 +00002743static vector short __ATTRS_o_ai vec_vmaxsh(vector short __a,
2744 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002745 return __builtin_altivec_vmaxsh(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002746}
2747
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002748/* vec_vmaxuh */
2749
Anton Yartsevfc83c602010-08-19 03:21:36 +00002750static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002751vec_vmaxuh(vector unsigned short __a, vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002752 return __builtin_altivec_vmaxuh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002753}
2754
Anton Yartsevfc83c602010-08-19 03:21:36 +00002755static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002756vec_vmaxuh(vector bool short __a, vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002757 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002758}
2759
Bill Seurer703e8482015-06-09 14:39:47 +00002760static vector unsigned short __ATTRS_o_ai vec_vmaxuh(vector unsigned short __a,
2761 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002762 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002763}
2764
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002765/* vec_vmaxsw */
2766
Bill Seurer703e8482015-06-09 14:39:47 +00002767static vector int __ATTRS_o_ai vec_vmaxsw(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002768 return __builtin_altivec_vmaxsw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002769}
2770
Bill Seurer703e8482015-06-09 14:39:47 +00002771static vector int __ATTRS_o_ai vec_vmaxsw(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002772 return __builtin_altivec_vmaxsw((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002773}
2774
Bill Seurer703e8482015-06-09 14:39:47 +00002775static vector int __ATTRS_o_ai vec_vmaxsw(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002776 return __builtin_altivec_vmaxsw(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002777}
2778
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002779/* vec_vmaxuw */
2780
Bill Seurer703e8482015-06-09 14:39:47 +00002781static vector unsigned int __ATTRS_o_ai vec_vmaxuw(vector unsigned int __a,
2782 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002783 return __builtin_altivec_vmaxuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002784}
2785
Bill Seurer703e8482015-06-09 14:39:47 +00002786static vector unsigned int __ATTRS_o_ai vec_vmaxuw(vector bool int __a,
2787 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002788 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002789}
2790
Bill Seurer703e8482015-06-09 14:39:47 +00002791static vector unsigned int __ATTRS_o_ai vec_vmaxuw(vector unsigned int __a,
2792 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002793 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002794}
2795
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002796/* vec_vmaxfp */
2797
2798static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00002799vec_vmaxfp(vector float __a, vector float __b) {
Bill Schmidt691e01d2014-10-31 19:19:24 +00002800#ifdef __VSX__
2801 return __builtin_vsx_xvmaxsp(__a, __b);
2802#else
David Blaikie3302f2b2013-01-16 23:08:36 +00002803 return __builtin_altivec_vmaxfp(__a, __b);
Bill Schmidt691e01d2014-10-31 19:19:24 +00002804#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002805}
2806
2807/* vec_mergeh */
2808
Bill Seurer703e8482015-06-09 14:39:47 +00002809static vector signed char __ATTRS_o_ai vec_mergeh(vector signed char __a,
2810 vector signed char __b) {
2811 return vec_perm(__a, __b,
2812 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
2813 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
2814 0x06, 0x16, 0x07, 0x17));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002815}
2816
Bill Seurer703e8482015-06-09 14:39:47 +00002817static vector unsigned char __ATTRS_o_ai vec_mergeh(vector unsigned char __a,
2818 vector unsigned char __b) {
2819 return vec_perm(__a, __b,
2820 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
2821 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
2822 0x06, 0x16, 0x07, 0x17));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002823}
2824
Bill Seurer703e8482015-06-09 14:39:47 +00002825static vector bool char __ATTRS_o_ai vec_mergeh(vector bool char __a,
2826 vector bool char __b) {
2827 return vec_perm(__a, __b,
2828 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
2829 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
2830 0x06, 0x16, 0x07, 0x17));
Anton Yartsev9e968982010-08-19 03:00:09 +00002831}
2832
Bill Seurer703e8482015-06-09 14:39:47 +00002833static vector short __ATTRS_o_ai vec_mergeh(vector short __a,
2834 vector short __b) {
2835 return vec_perm(__a, __b,
2836 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
2837 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
2838 0x06, 0x07, 0x16, 0x17));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002839}
2840
2841static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002842vec_mergeh(vector unsigned short __a, vector unsigned short __b) {
2843 return vec_perm(__a, __b,
2844 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
2845 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
2846 0x06, 0x07, 0x16, 0x17));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002847}
2848
Bill Seurer703e8482015-06-09 14:39:47 +00002849static vector bool short __ATTRS_o_ai vec_mergeh(vector bool short __a,
2850 vector bool short __b) {
2851 return vec_perm(__a, __b,
2852 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
2853 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
2854 0x06, 0x07, 0x16, 0x17));
Anton Yartsev9e968982010-08-19 03:00:09 +00002855}
2856
Bill Seurer703e8482015-06-09 14:39:47 +00002857static vector pixel __ATTRS_o_ai vec_mergeh(vector pixel __a,
2858 vector pixel __b) {
2859 return vec_perm(__a, __b,
2860 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
2861 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
2862 0x06, 0x07, 0x16, 0x17));
Anton Yartsev9e968982010-08-19 03:00:09 +00002863}
2864
Bill Seurer703e8482015-06-09 14:39:47 +00002865static vector int __ATTRS_o_ai vec_mergeh(vector int __a, vector int __b) {
2866 return vec_perm(__a, __b,
2867 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
2868 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
2869 0x14, 0x15, 0x16, 0x17));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002870}
2871
Bill Seurer703e8482015-06-09 14:39:47 +00002872static vector unsigned int __ATTRS_o_ai vec_mergeh(vector unsigned int __a,
2873 vector unsigned int __b) {
2874 return vec_perm(__a, __b,
2875 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
2876 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
2877 0x14, 0x15, 0x16, 0x17));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002878}
2879
Bill Seurer703e8482015-06-09 14:39:47 +00002880static vector bool int __ATTRS_o_ai vec_mergeh(vector bool int __a,
2881 vector bool int __b) {
2882 return vec_perm(__a, __b,
2883 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
2884 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
2885 0x14, 0x15, 0x16, 0x17));
Anton Yartsev9e968982010-08-19 03:00:09 +00002886}
2887
Bill Seurer703e8482015-06-09 14:39:47 +00002888static vector float __ATTRS_o_ai vec_mergeh(vector float __a,
2889 vector float __b) {
2890 return vec_perm(__a, __b,
2891 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
2892 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
2893 0x14, 0x15, 0x16, 0x17));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002894}
2895
2896/* vec_vmrghb */
2897
2898#define __builtin_altivec_vmrghb vec_vmrghb
2899
Bill Seurer703e8482015-06-09 14:39:47 +00002900static vector signed char __ATTRS_o_ai vec_vmrghb(vector signed char __a,
2901 vector signed char __b) {
2902 return vec_perm(__a, __b,
2903 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
2904 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
2905 0x06, 0x16, 0x07, 0x17));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002906}
2907
Bill Seurer703e8482015-06-09 14:39:47 +00002908static vector unsigned char __ATTRS_o_ai vec_vmrghb(vector unsigned char __a,
2909 vector unsigned char __b) {
2910 return vec_perm(__a, __b,
2911 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
2912 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
2913 0x06, 0x16, 0x07, 0x17));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002914}
2915
Bill Seurer703e8482015-06-09 14:39:47 +00002916static vector bool char __ATTRS_o_ai vec_vmrghb(vector bool char __a,
2917 vector bool char __b) {
2918 return vec_perm(__a, __b,
2919 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
2920 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
2921 0x06, 0x16, 0x07, 0x17));
Anton Yartsev9e968982010-08-19 03:00:09 +00002922}
2923
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002924/* vec_vmrghh */
2925
2926#define __builtin_altivec_vmrghh vec_vmrghh
2927
Bill Seurer703e8482015-06-09 14:39:47 +00002928static vector short __ATTRS_o_ai vec_vmrghh(vector short __a,
2929 vector short __b) {
2930 return vec_perm(__a, __b,
2931 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
2932 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
2933 0x06, 0x07, 0x16, 0x17));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002934}
2935
2936static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002937vec_vmrghh(vector unsigned short __a, vector unsigned short __b) {
2938 return vec_perm(__a, __b,
2939 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
2940 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
2941 0x06, 0x07, 0x16, 0x17));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002942}
2943
Bill Seurer703e8482015-06-09 14:39:47 +00002944static vector bool short __ATTRS_o_ai vec_vmrghh(vector bool short __a,
2945 vector bool short __b) {
2946 return vec_perm(__a, __b,
2947 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
2948 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
2949 0x06, 0x07, 0x16, 0x17));
Anton Yartsev9e968982010-08-19 03:00:09 +00002950}
2951
Bill Seurer703e8482015-06-09 14:39:47 +00002952static vector pixel __ATTRS_o_ai vec_vmrghh(vector pixel __a,
2953 vector pixel __b) {
2954 return vec_perm(__a, __b,
2955 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
2956 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
2957 0x06, 0x07, 0x16, 0x17));
Anton Yartsev9e968982010-08-19 03:00:09 +00002958}
2959
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002960/* vec_vmrghw */
2961
2962#define __builtin_altivec_vmrghw vec_vmrghw
2963
Bill Seurer703e8482015-06-09 14:39:47 +00002964static vector int __ATTRS_o_ai vec_vmrghw(vector int __a, vector int __b) {
2965 return vec_perm(__a, __b,
2966 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
2967 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
2968 0x14, 0x15, 0x16, 0x17));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002969}
2970
Bill Seurer703e8482015-06-09 14:39:47 +00002971static vector unsigned int __ATTRS_o_ai vec_vmrghw(vector unsigned int __a,
2972 vector unsigned int __b) {
2973 return vec_perm(__a, __b,
2974 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
2975 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
2976 0x14, 0x15, 0x16, 0x17));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002977}
2978
Bill Seurer703e8482015-06-09 14:39:47 +00002979static vector bool int __ATTRS_o_ai vec_vmrghw(vector bool int __a,
2980 vector bool int __b) {
2981 return vec_perm(__a, __b,
2982 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
2983 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
2984 0x14, 0x15, 0x16, 0x17));
Anton Yartsev9e968982010-08-19 03:00:09 +00002985}
2986
Bill Seurer703e8482015-06-09 14:39:47 +00002987static vector float __ATTRS_o_ai vec_vmrghw(vector float __a,
2988 vector float __b) {
2989 return vec_perm(__a, __b,
2990 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
2991 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
2992 0x14, 0x15, 0x16, 0x17));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002993}
2994
2995/* vec_mergel */
2996
Bill Seurer703e8482015-06-09 14:39:47 +00002997static vector signed char __ATTRS_o_ai vec_mergel(vector signed char __a,
2998 vector signed char __b) {
2999 return vec_perm(__a, __b,
3000 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
3001 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
3002 0x0E, 0x1E, 0x0F, 0x1F));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003003}
3004
Bill Seurer703e8482015-06-09 14:39:47 +00003005static vector unsigned char __ATTRS_o_ai vec_mergel(vector unsigned char __a,
3006 vector unsigned char __b) {
3007 return vec_perm(__a, __b,
3008 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
3009 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
3010 0x0E, 0x1E, 0x0F, 0x1F));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003011}
3012
Bill Seurer703e8482015-06-09 14:39:47 +00003013static vector bool char __ATTRS_o_ai vec_mergel(vector bool char __a,
3014 vector bool char __b) {
3015 return vec_perm(__a, __b,
3016 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
3017 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
3018 0x0E, 0x1E, 0x0F, 0x1F));
Anton Yartsev9e968982010-08-19 03:00:09 +00003019}
3020
Bill Seurer703e8482015-06-09 14:39:47 +00003021static vector short __ATTRS_o_ai vec_mergel(vector short __a,
3022 vector short __b) {
3023 return vec_perm(__a, __b,
3024 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3025 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3026 0x0E, 0x0F, 0x1E, 0x1F));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003027}
3028
3029static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003030vec_mergel(vector unsigned short __a, vector unsigned short __b) {
3031 return vec_perm(__a, __b,
3032 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3033 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3034 0x0E, 0x0F, 0x1E, 0x1F));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003035}
3036
Bill Seurer703e8482015-06-09 14:39:47 +00003037static vector bool short __ATTRS_o_ai vec_mergel(vector bool short __a,
3038 vector bool short __b) {
3039 return vec_perm(__a, __b,
3040 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3041 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3042 0x0E, 0x0F, 0x1E, 0x1F));
Anton Yartsev9e968982010-08-19 03:00:09 +00003043}
3044
Bill Seurer703e8482015-06-09 14:39:47 +00003045static vector pixel __ATTRS_o_ai vec_mergel(vector pixel __a,
3046 vector pixel __b) {
3047 return vec_perm(__a, __b,
3048 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3049 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3050 0x0E, 0x0F, 0x1E, 0x1F));
Anton Yartsev9e968982010-08-19 03:00:09 +00003051}
3052
Bill Seurer703e8482015-06-09 14:39:47 +00003053static vector int __ATTRS_o_ai vec_mergel(vector int __a, vector int __b) {
3054 return vec_perm(__a, __b,
3055 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3056 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3057 0x1C, 0x1D, 0x1E, 0x1F));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003058}
3059
Bill Seurer703e8482015-06-09 14:39:47 +00003060static vector unsigned int __ATTRS_o_ai vec_mergel(vector unsigned int __a,
3061 vector unsigned int __b) {
3062 return vec_perm(__a, __b,
3063 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3064 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3065 0x1C, 0x1D, 0x1E, 0x1F));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003066}
3067
Bill Seurer703e8482015-06-09 14:39:47 +00003068static vector bool int __ATTRS_o_ai vec_mergel(vector bool int __a,
3069 vector bool int __b) {
3070 return vec_perm(__a, __b,
3071 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3072 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3073 0x1C, 0x1D, 0x1E, 0x1F));
Anton Yartsev9e968982010-08-19 03:00:09 +00003074}
3075
Bill Seurer703e8482015-06-09 14:39:47 +00003076static vector float __ATTRS_o_ai vec_mergel(vector float __a,
3077 vector float __b) {
3078 return vec_perm(__a, __b,
3079 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3080 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3081 0x1C, 0x1D, 0x1E, 0x1F));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003082}
3083
3084/* vec_vmrglb */
3085
3086#define __builtin_altivec_vmrglb vec_vmrglb
3087
Bill Seurer703e8482015-06-09 14:39:47 +00003088static vector signed char __ATTRS_o_ai vec_vmrglb(vector signed char __a,
3089 vector signed char __b) {
3090 return vec_perm(__a, __b,
3091 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
3092 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
3093 0x0E, 0x1E, 0x0F, 0x1F));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003094}
3095
Bill Seurer703e8482015-06-09 14:39:47 +00003096static vector unsigned char __ATTRS_o_ai vec_vmrglb(vector unsigned char __a,
3097 vector unsigned char __b) {
3098 return vec_perm(__a, __b,
3099 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
3100 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
3101 0x0E, 0x1E, 0x0F, 0x1F));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003102}
3103
Bill Seurer703e8482015-06-09 14:39:47 +00003104static vector bool char __ATTRS_o_ai vec_vmrglb(vector bool char __a,
3105 vector bool char __b) {
3106 return vec_perm(__a, __b,
3107 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
3108 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
3109 0x0E, 0x1E, 0x0F, 0x1F));
Anton Yartsev9e968982010-08-19 03:00:09 +00003110}
3111
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003112/* vec_vmrglh */
3113
3114#define __builtin_altivec_vmrglh vec_vmrglh
3115
Bill Seurer703e8482015-06-09 14:39:47 +00003116static vector short __ATTRS_o_ai vec_vmrglh(vector short __a,
3117 vector short __b) {
3118 return vec_perm(__a, __b,
3119 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3120 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3121 0x0E, 0x0F, 0x1E, 0x1F));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003122}
3123
3124static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003125vec_vmrglh(vector unsigned short __a, vector unsigned short __b) {
3126 return vec_perm(__a, __b,
3127 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3128 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3129 0x0E, 0x0F, 0x1E, 0x1F));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003130}
3131
Bill Seurer703e8482015-06-09 14:39:47 +00003132static vector bool short __ATTRS_o_ai vec_vmrglh(vector bool short __a,
3133 vector bool short __b) {
3134 return vec_perm(__a, __b,
3135 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3136 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3137 0x0E, 0x0F, 0x1E, 0x1F));
Anton Yartsev9e968982010-08-19 03:00:09 +00003138}
3139
Bill Seurer703e8482015-06-09 14:39:47 +00003140static vector pixel __ATTRS_o_ai vec_vmrglh(vector pixel __a,
3141 vector pixel __b) {
3142 return vec_perm(__a, __b,
3143 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3144 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3145 0x0E, 0x0F, 0x1E, 0x1F));
Anton Yartsev9e968982010-08-19 03:00:09 +00003146}
3147
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003148/* vec_vmrglw */
3149
3150#define __builtin_altivec_vmrglw vec_vmrglw
3151
Bill Seurer703e8482015-06-09 14:39:47 +00003152static vector int __ATTRS_o_ai vec_vmrglw(vector int __a, vector int __b) {
3153 return vec_perm(__a, __b,
3154 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3155 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3156 0x1C, 0x1D, 0x1E, 0x1F));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003157}
3158
Bill Seurer703e8482015-06-09 14:39:47 +00003159static vector unsigned int __ATTRS_o_ai vec_vmrglw(vector unsigned int __a,
3160 vector unsigned int __b) {
3161 return vec_perm(__a, __b,
3162 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3163 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3164 0x1C, 0x1D, 0x1E, 0x1F));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003165}
3166
Bill Seurer703e8482015-06-09 14:39:47 +00003167static vector bool int __ATTRS_o_ai vec_vmrglw(vector bool int __a,
3168 vector bool int __b) {
3169 return vec_perm(__a, __b,
3170 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3171 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3172 0x1C, 0x1D, 0x1E, 0x1F));
Anton Yartsev9e968982010-08-19 03:00:09 +00003173}
3174
Bill Seurer703e8482015-06-09 14:39:47 +00003175static vector float __ATTRS_o_ai vec_vmrglw(vector float __a,
3176 vector float __b) {
3177 return vec_perm(__a, __b,
3178 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3179 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3180 0x1C, 0x1D, 0x1E, 0x1F));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003181}
3182
Kit Bartonb61173e2015-07-02 19:29:05 +00003183
3184#ifdef __POWER8_VECTOR__
3185/* vec_mergee */
3186
3187static vector bool int __ATTRS_o_ai
3188vec_mergee(vector bool int __a, vector bool int __b) {
3189 return vec_perm(__a, __b, (vector unsigned char)
3190 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
3191 0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B));
3192}
3193
3194static vector signed int __ATTRS_o_ai
3195vec_mergee(vector signed int __a, vector signed int __b) {
3196 return vec_perm(__a, __b, (vector unsigned char)
3197 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
3198 0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B));
3199}
3200
3201static vector unsigned int __ATTRS_o_ai
3202vec_mergee(vector unsigned int __a, vector unsigned int __b) {
3203 return vec_perm(__a, __b, (vector unsigned char)
3204 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
3205 0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B));
3206}
3207
3208/* vec_mergeo */
3209
3210static vector bool int __ATTRS_o_ai
3211vec_mergeo(vector bool int __a, vector bool int __b) {
3212 return vec_perm(__a, __b, (vector unsigned char)
3213 (0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17,
3214 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3215}
3216
3217static vector signed int __ATTRS_o_ai
3218vec_mergeo(vector signed int __a, vector signed int __b) {
3219 return vec_perm(__a, __b, (vector unsigned char)
3220 (0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17,
3221 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3222}
3223
3224static vector unsigned int __ATTRS_o_ai
3225vec_mergeo(vector unsigned int __a, vector unsigned int __b) {
3226 return vec_perm(__a, __b, (vector unsigned char)
3227 (0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17,
3228 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3229}
3230
3231#endif
3232
Chris Lattnerdad40622010-04-14 03:54:58 +00003233/* vec_mfvscr */
3234
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003235static vector unsigned short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003236vec_mfvscr(void) {
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003237 return __builtin_altivec_mfvscr();
3238}
Chris Lattnerdad40622010-04-14 03:54:58 +00003239
3240/* vec_min */
3241
Bill Seurer703e8482015-06-09 14:39:47 +00003242static vector signed char __ATTRS_o_ai vec_min(vector signed char __a,
3243 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003244 return __builtin_altivec_vminsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003245}
3246
Bill Seurer703e8482015-06-09 14:39:47 +00003247static vector signed char __ATTRS_o_ai vec_min(vector bool char __a,
3248 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003249 return __builtin_altivec_vminsb((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003250}
3251
Bill Seurer703e8482015-06-09 14:39:47 +00003252static vector signed char __ATTRS_o_ai vec_min(vector signed char __a,
3253 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003254 return __builtin_altivec_vminsb(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003255}
3256
Bill Seurer703e8482015-06-09 14:39:47 +00003257static vector unsigned char __ATTRS_o_ai vec_min(vector unsigned char __a,
3258 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003259 return __builtin_altivec_vminub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003260}
3261
Bill Seurer703e8482015-06-09 14:39:47 +00003262static vector unsigned char __ATTRS_o_ai vec_min(vector bool char __a,
3263 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003264 return __builtin_altivec_vminub((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003265}
3266
Bill Seurer703e8482015-06-09 14:39:47 +00003267static vector unsigned char __ATTRS_o_ai vec_min(vector unsigned char __a,
3268 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003269 return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003270}
3271
Bill Seurer703e8482015-06-09 14:39:47 +00003272static vector short __ATTRS_o_ai vec_min(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003273 return __builtin_altivec_vminsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003274}
3275
Bill Seurer703e8482015-06-09 14:39:47 +00003276static vector short __ATTRS_o_ai vec_min(vector bool short __a,
3277 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003278 return __builtin_altivec_vminsh((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003279}
3280
Bill Seurer703e8482015-06-09 14:39:47 +00003281static vector short __ATTRS_o_ai vec_min(vector short __a,
3282 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003283 return __builtin_altivec_vminsh(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003284}
3285
Bill Seurer703e8482015-06-09 14:39:47 +00003286static vector unsigned short __ATTRS_o_ai vec_min(vector unsigned short __a,
3287 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003288 return __builtin_altivec_vminuh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003289}
3290
Bill Seurer703e8482015-06-09 14:39:47 +00003291static vector unsigned short __ATTRS_o_ai vec_min(vector bool short __a,
3292 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003293 return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003294}
3295
Bill Seurer703e8482015-06-09 14:39:47 +00003296static vector unsigned short __ATTRS_o_ai vec_min(vector unsigned short __a,
3297 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003298 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003299}
3300
Bill Seurer703e8482015-06-09 14:39:47 +00003301static vector int __ATTRS_o_ai vec_min(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003302 return __builtin_altivec_vminsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003303}
3304
Bill Seurer703e8482015-06-09 14:39:47 +00003305static vector int __ATTRS_o_ai vec_min(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003306 return __builtin_altivec_vminsw((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003307}
3308
Bill Seurer703e8482015-06-09 14:39:47 +00003309static vector int __ATTRS_o_ai vec_min(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003310 return __builtin_altivec_vminsw(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003311}
3312
Bill Seurer703e8482015-06-09 14:39:47 +00003313static vector unsigned int __ATTRS_o_ai vec_min(vector unsigned int __a,
3314 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003315 return __builtin_altivec_vminuw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003316}
3317
Bill Seurer703e8482015-06-09 14:39:47 +00003318static vector unsigned int __ATTRS_o_ai vec_min(vector bool int __a,
3319 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003320 return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003321}
3322
Bill Seurer703e8482015-06-09 14:39:47 +00003323static vector unsigned int __ATTRS_o_ai vec_min(vector unsigned int __a,
3324 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003325 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003326}
3327
Kit Barton8553bec2015-03-11 15:57:19 +00003328#ifdef __POWER8_VECTOR__
3329static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003330vec_min(vector signed long long __a, vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00003331 return __builtin_altivec_vminsd(__a, __b);
3332}
3333
Bill Seurer8be14f12015-06-04 18:45:44 +00003334static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003335vec_min(vector bool long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00003336 return __builtin_altivec_vminsd((vector signed long long)__a, __b);
3337}
3338
Bill Seurer703e8482015-06-09 14:39:47 +00003339static vector signed long long __ATTRS_o_ai vec_min(vector signed long long __a,
3340 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00003341 return __builtin_altivec_vminsd(__a, (vector signed long long)__b);
3342}
3343
Kit Barton8553bec2015-03-11 15:57:19 +00003344static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003345vec_min(vector unsigned long long __a, vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00003346 return __builtin_altivec_vminud(__a, __b);
3347}
Bill Seurer8be14f12015-06-04 18:45:44 +00003348
3349static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003350vec_min(vector bool long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00003351 return __builtin_altivec_vminud((vector unsigned long long)__a, __b);
3352}
3353
3354static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003355vec_min(vector unsigned long long __a, vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00003356 return __builtin_altivec_vminud(__a, (vector unsigned long long)__b);
3357}
Kit Barton8553bec2015-03-11 15:57:19 +00003358#endif
3359
Bill Seurer703e8482015-06-09 14:39:47 +00003360static vector float __ATTRS_o_ai vec_min(vector float __a, vector float __b) {
Bill Schmidt691e01d2014-10-31 19:19:24 +00003361#ifdef __VSX__
3362 return __builtin_vsx_xvminsp(__a, __b);
3363#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003364 return __builtin_altivec_vminfp(__a, __b);
Bill Schmidt691e01d2014-10-31 19:19:24 +00003365#endif
Chris Lattnerdad40622010-04-14 03:54:58 +00003366}
3367
Bill Schmidt691e01d2014-10-31 19:19:24 +00003368#ifdef __VSX__
Bill Seurer703e8482015-06-09 14:39:47 +00003369static vector double __ATTRS_o_ai vec_min(vector double __a,
3370 vector double __b) {
Bill Schmidt691e01d2014-10-31 19:19:24 +00003371 return __builtin_vsx_xvmindp(__a, __b);
3372}
3373#endif
3374
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003375/* vec_vminsb */
3376
Bill Seurer703e8482015-06-09 14:39:47 +00003377static vector signed char __ATTRS_o_ai vec_vminsb(vector signed char __a,
3378 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003379 return __builtin_altivec_vminsb(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003380}
3381
Bill Seurer703e8482015-06-09 14:39:47 +00003382static vector signed char __ATTRS_o_ai vec_vminsb(vector bool char __a,
3383 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003384 return __builtin_altivec_vminsb((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003385}
3386
Bill Seurer703e8482015-06-09 14:39:47 +00003387static vector signed char __ATTRS_o_ai vec_vminsb(vector signed char __a,
3388 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003389 return __builtin_altivec_vminsb(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003390}
3391
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003392/* vec_vminub */
3393
Bill Seurer703e8482015-06-09 14:39:47 +00003394static vector unsigned char __ATTRS_o_ai vec_vminub(vector unsigned char __a,
3395 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003396 return __builtin_altivec_vminub(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003397}
3398
Bill Seurer703e8482015-06-09 14:39:47 +00003399static vector unsigned char __ATTRS_o_ai vec_vminub(vector bool char __a,
3400 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003401 return __builtin_altivec_vminub((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003402}
3403
Bill Seurer703e8482015-06-09 14:39:47 +00003404static vector unsigned char __ATTRS_o_ai vec_vminub(vector unsigned char __a,
3405 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003406 return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003407}
3408
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003409/* vec_vminsh */
3410
Bill Seurer703e8482015-06-09 14:39:47 +00003411static vector short __ATTRS_o_ai vec_vminsh(vector short __a,
3412 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003413 return __builtin_altivec_vminsh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003414}
3415
Bill Seurer703e8482015-06-09 14:39:47 +00003416static vector short __ATTRS_o_ai vec_vminsh(vector bool short __a,
3417 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003418 return __builtin_altivec_vminsh((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003419}
3420
Bill Seurer703e8482015-06-09 14:39:47 +00003421static vector short __ATTRS_o_ai vec_vminsh(vector short __a,
3422 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003423 return __builtin_altivec_vminsh(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003424}
3425
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003426/* vec_vminuh */
3427
Anton Yartsevfc83c602010-08-19 03:21:36 +00003428static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003429vec_vminuh(vector unsigned short __a, vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003430 return __builtin_altivec_vminuh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003431}
3432
Anton Yartsevfc83c602010-08-19 03:21:36 +00003433static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003434vec_vminuh(vector bool short __a, vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003435 return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003436}
3437
Bill Seurer703e8482015-06-09 14:39:47 +00003438static vector unsigned short __ATTRS_o_ai vec_vminuh(vector unsigned short __a,
3439 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003440 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003441}
3442
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003443/* vec_vminsw */
3444
Bill Seurer703e8482015-06-09 14:39:47 +00003445static vector int __ATTRS_o_ai vec_vminsw(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003446 return __builtin_altivec_vminsw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003447}
3448
Bill Seurer703e8482015-06-09 14:39:47 +00003449static vector int __ATTRS_o_ai vec_vminsw(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003450 return __builtin_altivec_vminsw((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003451}
3452
Bill Seurer703e8482015-06-09 14:39:47 +00003453static vector int __ATTRS_o_ai vec_vminsw(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003454 return __builtin_altivec_vminsw(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003455}
3456
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003457/* vec_vminuw */
3458
Bill Seurer703e8482015-06-09 14:39:47 +00003459static vector unsigned int __ATTRS_o_ai vec_vminuw(vector unsigned int __a,
3460 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003461 return __builtin_altivec_vminuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003462}
3463
Bill Seurer703e8482015-06-09 14:39:47 +00003464static vector unsigned int __ATTRS_o_ai vec_vminuw(vector bool int __a,
3465 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003466 return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003467}
3468
Bill Seurer703e8482015-06-09 14:39:47 +00003469static vector unsigned int __ATTRS_o_ai vec_vminuw(vector unsigned int __a,
3470 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003471 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003472}
3473
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003474/* vec_vminfp */
3475
3476static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003477vec_vminfp(vector float __a, vector float __b) {
Bill Schmidt691e01d2014-10-31 19:19:24 +00003478#ifdef __VSX__
3479 return __builtin_vsx_xvminsp(__a, __b);
3480#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003481 return __builtin_altivec_vminfp(__a, __b);
Bill Schmidt691e01d2014-10-31 19:19:24 +00003482#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003483}
3484
3485/* vec_mladd */
3486
3487#define __builtin_altivec_vmladduhm vec_mladd
3488
Bill Seurer703e8482015-06-09 14:39:47 +00003489static vector short __ATTRS_o_ai vec_mladd(vector short __a, vector short __b,
3490 vector short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003491 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003492}
3493
Bill Seurer703e8482015-06-09 14:39:47 +00003494static vector short __ATTRS_o_ai vec_mladd(vector short __a,
3495 vector unsigned short __b,
3496 vector unsigned short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003497 return __a * (vector short)__b + (vector short)__c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003498}
3499
Bill Seurer703e8482015-06-09 14:39:47 +00003500static vector short __ATTRS_o_ai vec_mladd(vector unsigned short __a,
3501 vector short __b, vector short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003502 return (vector short)__a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003503}
3504
Bill Seurer703e8482015-06-09 14:39:47 +00003505static vector unsigned short __ATTRS_o_ai vec_mladd(vector unsigned short __a,
3506 vector unsigned short __b,
3507 vector unsigned short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003508 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003509}
3510
3511/* vec_vmladduhm */
3512
Bill Seurer703e8482015-06-09 14:39:47 +00003513static vector short __ATTRS_o_ai vec_vmladduhm(vector short __a,
3514 vector short __b,
3515 vector short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003516 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003517}
3518
Bill Seurer703e8482015-06-09 14:39:47 +00003519static vector short __ATTRS_o_ai vec_vmladduhm(vector short __a,
3520 vector unsigned short __b,
3521 vector unsigned short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003522 return __a * (vector short)__b + (vector short)__c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003523}
3524
Bill Seurer703e8482015-06-09 14:39:47 +00003525static vector short __ATTRS_o_ai vec_vmladduhm(vector unsigned short __a,
3526 vector short __b,
3527 vector short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003528 return (vector short)__a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003529}
3530
3531static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003532vec_vmladduhm(vector unsigned short __a, vector unsigned short __b,
3533 vector unsigned short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003534 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003535}
3536
3537/* vec_mradds */
3538
3539static vector short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003540vec_mradds(vector short __a, vector short __b, vector short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003541 return __builtin_altivec_vmhraddshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003542}
3543
3544/* vec_vmhraddshs */
3545
3546static vector short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003547vec_vmhraddshs(vector short __a, vector short __b, vector short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003548 return __builtin_altivec_vmhraddshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003549}
3550
3551/* vec_msum */
3552
Bill Seurer703e8482015-06-09 14:39:47 +00003553static vector int __ATTRS_o_ai vec_msum(vector signed char __a,
3554 vector unsigned char __b,
3555 vector int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003556 return __builtin_altivec_vmsummbm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003557}
3558
Bill Seurer703e8482015-06-09 14:39:47 +00003559static vector unsigned int __ATTRS_o_ai vec_msum(vector unsigned char __a,
3560 vector unsigned char __b,
3561 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003562 return __builtin_altivec_vmsumubm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003563}
3564
Bill Seurer703e8482015-06-09 14:39:47 +00003565static vector int __ATTRS_o_ai vec_msum(vector short __a, vector short __b,
3566 vector int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003567 return __builtin_altivec_vmsumshm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003568}
3569
Bill Seurer703e8482015-06-09 14:39:47 +00003570static vector unsigned int __ATTRS_o_ai vec_msum(vector unsigned short __a,
3571 vector unsigned short __b,
3572 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003573 return __builtin_altivec_vmsumuhm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003574}
3575
3576/* vec_vmsummbm */
3577
3578static vector int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003579vec_vmsummbm(vector signed char __a, vector unsigned char __b, vector int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003580 return __builtin_altivec_vmsummbm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003581}
3582
3583/* vec_vmsumubm */
3584
3585static vector unsigned int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003586vec_vmsumubm(vector unsigned char __a, vector unsigned char __b,
3587 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003588 return __builtin_altivec_vmsumubm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003589}
3590
3591/* vec_vmsumshm */
3592
3593static vector int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003594vec_vmsumshm(vector short __a, vector short __b, vector int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003595 return __builtin_altivec_vmsumshm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003596}
3597
3598/* vec_vmsumuhm */
3599
3600static vector unsigned int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003601vec_vmsumuhm(vector unsigned short __a, vector unsigned short __b,
3602 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003603 return __builtin_altivec_vmsumuhm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003604}
3605
3606/* vec_msums */
3607
Bill Seurer703e8482015-06-09 14:39:47 +00003608static vector int __ATTRS_o_ai vec_msums(vector short __a, vector short __b,
3609 vector int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003610 return __builtin_altivec_vmsumshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003611}
3612
Bill Seurer703e8482015-06-09 14:39:47 +00003613static vector unsigned int __ATTRS_o_ai vec_msums(vector unsigned short __a,
3614 vector unsigned short __b,
3615 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003616 return __builtin_altivec_vmsumuhs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003617}
3618
3619/* vec_vmsumshs */
3620
3621static vector int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003622vec_vmsumshs(vector short __a, vector short __b, vector int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003623 return __builtin_altivec_vmsumshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003624}
3625
3626/* vec_vmsumuhs */
3627
3628static vector unsigned int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003629vec_vmsumuhs(vector unsigned short __a, vector unsigned short __b,
3630 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003631 return __builtin_altivec_vmsumuhs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003632}
3633
Chris Lattnerdad40622010-04-14 03:54:58 +00003634/* vec_mtvscr */
3635
Bill Seurer703e8482015-06-09 14:39:47 +00003636static void __ATTRS_o_ai vec_mtvscr(vector signed char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003637 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003638}
3639
Bill Seurer703e8482015-06-09 14:39:47 +00003640static void __ATTRS_o_ai vec_mtvscr(vector unsigned char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003641 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003642}
3643
Bill Seurer703e8482015-06-09 14:39:47 +00003644static void __ATTRS_o_ai vec_mtvscr(vector bool char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003645 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003646}
3647
Bill Seurer703e8482015-06-09 14:39:47 +00003648static void __ATTRS_o_ai vec_mtvscr(vector short __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003649 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003650}
3651
Bill Seurer703e8482015-06-09 14:39:47 +00003652static void __ATTRS_o_ai vec_mtvscr(vector unsigned short __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003653 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003654}
3655
Bill Seurer703e8482015-06-09 14:39:47 +00003656static void __ATTRS_o_ai vec_mtvscr(vector bool short __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003657 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003658}
3659
Bill Seurer703e8482015-06-09 14:39:47 +00003660static void __ATTRS_o_ai vec_mtvscr(vector pixel __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003661 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003662}
3663
Bill Seurer703e8482015-06-09 14:39:47 +00003664static void __ATTRS_o_ai vec_mtvscr(vector int __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003665 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003666}
3667
Bill Seurer703e8482015-06-09 14:39:47 +00003668static void __ATTRS_o_ai vec_mtvscr(vector unsigned int __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003669 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003670}
3671
Bill Seurer703e8482015-06-09 14:39:47 +00003672static void __ATTRS_o_ai vec_mtvscr(vector bool int __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003673 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003674}
3675
Bill Seurer703e8482015-06-09 14:39:47 +00003676static void __ATTRS_o_ai vec_mtvscr(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003677 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003678}
3679
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003680/* The vmulos* and vmules* instructions have a big endian bias, so
3681 we must reverse the meaning of "even" and "odd" for little endian. */
3682
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003683/* vec_mule */
3684
Bill Seurer703e8482015-06-09 14:39:47 +00003685static vector short __ATTRS_o_ai vec_mule(vector signed char __a,
3686 vector signed char __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003687#ifdef __LITTLE_ENDIAN__
3688 return __builtin_altivec_vmulosb(__a, __b);
3689#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003690 return __builtin_altivec_vmulesb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003691#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003692}
3693
Bill Seurer703e8482015-06-09 14:39:47 +00003694static vector unsigned short __ATTRS_o_ai vec_mule(vector unsigned char __a,
3695 vector unsigned char __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003696#ifdef __LITTLE_ENDIAN__
3697 return __builtin_altivec_vmuloub(__a, __b);
3698#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003699 return __builtin_altivec_vmuleub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003700#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003701}
3702
Bill Seurer703e8482015-06-09 14:39:47 +00003703static vector int __ATTRS_o_ai vec_mule(vector short __a, vector short __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003704#ifdef __LITTLE_ENDIAN__
3705 return __builtin_altivec_vmulosh(__a, __b);
3706#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003707 return __builtin_altivec_vmulesh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003708#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003709}
3710
Bill Seurer703e8482015-06-09 14:39:47 +00003711static vector unsigned int __ATTRS_o_ai vec_mule(vector unsigned short __a,
3712 vector unsigned short __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003713#ifdef __LITTLE_ENDIAN__
3714 return __builtin_altivec_vmulouh(__a, __b);
3715#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003716 return __builtin_altivec_vmuleuh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003717#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003718}
3719
Kit Barton8553bec2015-03-11 15:57:19 +00003720#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +00003721static vector signed long long __ATTRS_o_ai vec_mule(vector signed int __a,
3722 vector signed int __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00003723#ifdef __LITTLE_ENDIAN__
3724 return __builtin_altivec_vmulosw(__a, __b);
3725#else
3726 return __builtin_altivec_vmulesw(__a, __b);
3727#endif
3728}
3729
3730static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003731vec_mule(vector unsigned int __a, vector unsigned int __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00003732#ifdef __LITTLE_ENDIAN__
3733 return __builtin_altivec_vmulouw(__a, __b);
3734#else
3735 return __builtin_altivec_vmuleuw(__a, __b);
3736#endif
3737}
3738#endif
3739
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003740/* vec_vmulesb */
3741
3742static vector short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003743vec_vmulesb(vector signed char __a, vector signed char __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003744#ifdef __LITTLE_ENDIAN__
3745 return __builtin_altivec_vmulosb(__a, __b);
3746#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003747 return __builtin_altivec_vmulesb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003748#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003749}
3750
3751/* vec_vmuleub */
3752
3753static vector unsigned short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003754vec_vmuleub(vector unsigned char __a, vector unsigned char __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003755#ifdef __LITTLE_ENDIAN__
3756 return __builtin_altivec_vmuloub(__a, __b);
3757#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003758 return __builtin_altivec_vmuleub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003759#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003760}
3761
3762/* vec_vmulesh */
3763
3764static vector int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003765vec_vmulesh(vector short __a, vector short __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003766#ifdef __LITTLE_ENDIAN__
3767 return __builtin_altivec_vmulosh(__a, __b);
3768#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003769 return __builtin_altivec_vmulesh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003770#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003771}
3772
3773/* vec_vmuleuh */
3774
3775static vector unsigned int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003776vec_vmuleuh(vector unsigned short __a, vector unsigned short __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003777#ifdef __LITTLE_ENDIAN__
3778 return __builtin_altivec_vmulouh(__a, __b);
3779#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003780 return __builtin_altivec_vmuleuh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003781#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003782}
3783
3784/* vec_mulo */
3785
Bill Seurer703e8482015-06-09 14:39:47 +00003786static vector short __ATTRS_o_ai vec_mulo(vector signed char __a,
3787 vector signed char __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003788#ifdef __LITTLE_ENDIAN__
3789 return __builtin_altivec_vmulesb(__a, __b);
3790#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003791 return __builtin_altivec_vmulosb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003792#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003793}
3794
Bill Seurer703e8482015-06-09 14:39:47 +00003795static vector unsigned short __ATTRS_o_ai vec_mulo(vector unsigned char __a,
3796 vector unsigned char __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003797#ifdef __LITTLE_ENDIAN__
3798 return __builtin_altivec_vmuleub(__a, __b);
3799#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003800 return __builtin_altivec_vmuloub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003801#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003802}
3803
Bill Seurer703e8482015-06-09 14:39:47 +00003804static vector int __ATTRS_o_ai vec_mulo(vector short __a, vector short __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003805#ifdef __LITTLE_ENDIAN__
3806 return __builtin_altivec_vmulesh(__a, __b);
3807#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003808 return __builtin_altivec_vmulosh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003809#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003810}
3811
Bill Seurer703e8482015-06-09 14:39:47 +00003812static vector unsigned int __ATTRS_o_ai vec_mulo(vector unsigned short __a,
3813 vector unsigned short __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003814#ifdef __LITTLE_ENDIAN__
3815 return __builtin_altivec_vmuleuh(__a, __b);
3816#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003817 return __builtin_altivec_vmulouh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003818#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003819}
3820
Kit Barton8553bec2015-03-11 15:57:19 +00003821#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +00003822static vector signed long long __ATTRS_o_ai vec_mulo(vector signed int __a,
3823 vector signed int __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00003824#ifdef __LITTLE_ENDIAN__
3825 return __builtin_altivec_vmulesw(__a, __b);
3826#else
3827 return __builtin_altivec_vmulosw(__a, __b);
3828#endif
3829}
3830
3831static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003832vec_mulo(vector unsigned int __a, vector unsigned int __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00003833#ifdef __LITTLE_ENDIAN__
3834 return __builtin_altivec_vmuleuw(__a, __b);
3835#else
3836 return __builtin_altivec_vmulouw(__a, __b);
3837#endif
3838}
3839#endif
3840
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003841/* vec_vmulosb */
3842
3843static vector short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003844vec_vmulosb(vector signed char __a, vector signed char __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003845#ifdef __LITTLE_ENDIAN__
3846 return __builtin_altivec_vmulesb(__a, __b);
3847#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003848 return __builtin_altivec_vmulosb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003849#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003850}
3851
3852/* vec_vmuloub */
3853
3854static vector unsigned short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003855vec_vmuloub(vector unsigned char __a, vector unsigned char __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003856#ifdef __LITTLE_ENDIAN__
3857 return __builtin_altivec_vmuleub(__a, __b);
3858#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003859 return __builtin_altivec_vmuloub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003860#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003861}
3862
3863/* vec_vmulosh */
3864
3865static vector int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003866vec_vmulosh(vector short __a, vector short __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003867#ifdef __LITTLE_ENDIAN__
3868 return __builtin_altivec_vmulesh(__a, __b);
3869#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003870 return __builtin_altivec_vmulosh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003871#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003872}
3873
3874/* vec_vmulouh */
3875
3876static vector unsigned int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003877vec_vmulouh(vector unsigned short __a, vector unsigned short __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003878#ifdef __LITTLE_ENDIAN__
3879 return __builtin_altivec_vmuleuh(__a, __b);
3880#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003881 return __builtin_altivec_vmulouh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003882#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003883}
3884
3885/* vec_nmsub */
3886
3887static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003888vec_nmsub(vector float __a, vector float __b, vector float __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003889 return __builtin_altivec_vnmsubfp(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003890}
3891
3892/* vec_vnmsubfp */
3893
3894static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003895vec_vnmsubfp(vector float __a, vector float __b, vector float __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003896 return __builtin_altivec_vnmsubfp(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003897}
3898
3899/* vec_nor */
3900
3901#define __builtin_altivec_vnor vec_nor
3902
Bill Seurer703e8482015-06-09 14:39:47 +00003903static vector signed char __ATTRS_o_ai vec_nor(vector signed char __a,
3904 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003905 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003906}
3907
Bill Seurer703e8482015-06-09 14:39:47 +00003908static vector unsigned char __ATTRS_o_ai vec_nor(vector unsigned char __a,
3909 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003910 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003911}
3912
Bill Seurer703e8482015-06-09 14:39:47 +00003913static vector bool char __ATTRS_o_ai vec_nor(vector bool char __a,
3914 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003915 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003916}
3917
Bill Seurer703e8482015-06-09 14:39:47 +00003918static vector short __ATTRS_o_ai vec_nor(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003919 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003920}
3921
Bill Seurer703e8482015-06-09 14:39:47 +00003922static vector unsigned short __ATTRS_o_ai vec_nor(vector unsigned short __a,
3923 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003924 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003925}
3926
Bill Seurer703e8482015-06-09 14:39:47 +00003927static vector bool short __ATTRS_o_ai vec_nor(vector bool short __a,
3928 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003929 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003930}
3931
Bill Seurer703e8482015-06-09 14:39:47 +00003932static vector int __ATTRS_o_ai vec_nor(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003933 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003934}
3935
Bill Seurer703e8482015-06-09 14:39:47 +00003936static vector unsigned int __ATTRS_o_ai vec_nor(vector unsigned int __a,
3937 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003938 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003939}
3940
Bill Seurer703e8482015-06-09 14:39:47 +00003941static vector bool int __ATTRS_o_ai vec_nor(vector bool int __a,
3942 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003943 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003944}
3945
Bill Seurer703e8482015-06-09 14:39:47 +00003946static vector float __ATTRS_o_ai vec_nor(vector float __a, vector float __b) {
3947 vector unsigned int __res =
3948 ~((vector unsigned int)__a | (vector unsigned int)__b);
David Blaikie3302f2b2013-01-16 23:08:36 +00003949 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003950}
3951
3952/* vec_vnor */
3953
Bill Seurer703e8482015-06-09 14:39:47 +00003954static vector signed char __ATTRS_o_ai vec_vnor(vector signed char __a,
3955 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003956 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003957}
3958
Bill Seurer703e8482015-06-09 14:39:47 +00003959static vector unsigned char __ATTRS_o_ai vec_vnor(vector unsigned char __a,
3960 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003961 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003962}
3963
Bill Seurer703e8482015-06-09 14:39:47 +00003964static vector bool char __ATTRS_o_ai vec_vnor(vector bool char __a,
3965 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003966 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003967}
3968
Bill Seurer703e8482015-06-09 14:39:47 +00003969static vector short __ATTRS_o_ai vec_vnor(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003970 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003971}
3972
Bill Seurer703e8482015-06-09 14:39:47 +00003973static vector unsigned short __ATTRS_o_ai vec_vnor(vector unsigned short __a,
3974 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003975 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003976}
3977
Bill Seurer703e8482015-06-09 14:39:47 +00003978static vector bool short __ATTRS_o_ai vec_vnor(vector bool short __a,
3979 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003980 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003981}
3982
Bill Seurer703e8482015-06-09 14:39:47 +00003983static vector int __ATTRS_o_ai vec_vnor(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003984 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003985}
3986
Bill Seurer703e8482015-06-09 14:39:47 +00003987static vector unsigned int __ATTRS_o_ai vec_vnor(vector unsigned int __a,
3988 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003989 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003990}
3991
Bill Seurer703e8482015-06-09 14:39:47 +00003992static vector bool int __ATTRS_o_ai vec_vnor(vector bool int __a,
3993 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003994 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003995}
3996
Bill Seurer703e8482015-06-09 14:39:47 +00003997static vector float __ATTRS_o_ai vec_vnor(vector float __a, vector float __b) {
3998 vector unsigned int __res =
3999 ~((vector unsigned int)__a | (vector unsigned int)__b);
David Blaikie3302f2b2013-01-16 23:08:36 +00004000 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004001}
4002
Bill Seurer8be14f12015-06-04 18:45:44 +00004003#ifdef __VSX__
4004static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004005vec_nor(vector signed long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004006 return ~(__a | __b);
4007}
4008
4009static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004010vec_nor(vector unsigned long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004011 return ~(__a | __b);
4012}
4013
Bill Seurer703e8482015-06-09 14:39:47 +00004014static vector bool long long __ATTRS_o_ai vec_nor(vector bool long long __a,
4015 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004016 return ~(__a | __b);
4017}
4018#endif
4019
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004020/* vec_or */
4021
4022#define __builtin_altivec_vor vec_or
4023
Bill Seurer703e8482015-06-09 14:39:47 +00004024static vector signed char __ATTRS_o_ai vec_or(vector signed char __a,
4025 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004026 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004027}
4028
Bill Seurer703e8482015-06-09 14:39:47 +00004029static vector signed char __ATTRS_o_ai vec_or(vector bool char __a,
4030 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004031 return (vector signed char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004032}
4033
Bill Seurer703e8482015-06-09 14:39:47 +00004034static vector signed char __ATTRS_o_ai vec_or(vector signed char __a,
4035 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004036 return __a | (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004037}
4038
Bill Seurer703e8482015-06-09 14:39:47 +00004039static vector unsigned char __ATTRS_o_ai vec_or(vector unsigned char __a,
4040 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004041 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004042}
4043
Bill Seurer703e8482015-06-09 14:39:47 +00004044static vector unsigned char __ATTRS_o_ai vec_or(vector bool char __a,
4045 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004046 return (vector unsigned char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004047}
4048
Bill Seurer703e8482015-06-09 14:39:47 +00004049static vector unsigned char __ATTRS_o_ai vec_or(vector unsigned char __a,
4050 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004051 return __a | (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004052}
4053
Bill Seurer703e8482015-06-09 14:39:47 +00004054static vector bool char __ATTRS_o_ai vec_or(vector bool char __a,
4055 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004056 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004057}
4058
Bill Seurer703e8482015-06-09 14:39:47 +00004059static vector short __ATTRS_o_ai vec_or(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004060 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004061}
4062
Bill Seurer703e8482015-06-09 14:39:47 +00004063static vector short __ATTRS_o_ai vec_or(vector bool short __a,
4064 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004065 return (vector short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004066}
4067
Bill Seurer703e8482015-06-09 14:39:47 +00004068static vector short __ATTRS_o_ai vec_or(vector short __a,
4069 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004070 return __a | (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004071}
4072
Bill Seurer703e8482015-06-09 14:39:47 +00004073static vector unsigned short __ATTRS_o_ai vec_or(vector unsigned short __a,
4074 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004075 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004076}
4077
Bill Seurer703e8482015-06-09 14:39:47 +00004078static vector unsigned short __ATTRS_o_ai vec_or(vector bool short __a,
4079 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004080 return (vector unsigned short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004081}
4082
Bill Seurer703e8482015-06-09 14:39:47 +00004083static vector unsigned short __ATTRS_o_ai vec_or(vector unsigned short __a,
4084 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004085 return __a | (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004086}
4087
Bill Seurer703e8482015-06-09 14:39:47 +00004088static vector bool short __ATTRS_o_ai vec_or(vector bool short __a,
4089 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004090 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004091}
4092
Bill Seurer703e8482015-06-09 14:39:47 +00004093static vector int __ATTRS_o_ai vec_or(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004094 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004095}
4096
Bill Seurer703e8482015-06-09 14:39:47 +00004097static vector int __ATTRS_o_ai vec_or(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004098 return (vector int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004099}
4100
Bill Seurer703e8482015-06-09 14:39:47 +00004101static vector int __ATTRS_o_ai vec_or(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004102 return __a | (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004103}
4104
Bill Seurer703e8482015-06-09 14:39:47 +00004105static vector unsigned int __ATTRS_o_ai vec_or(vector unsigned int __a,
4106 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004107 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004108}
4109
Bill Seurer703e8482015-06-09 14:39:47 +00004110static vector unsigned int __ATTRS_o_ai vec_or(vector bool int __a,
4111 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004112 return (vector unsigned int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004113}
4114
Bill Seurer703e8482015-06-09 14:39:47 +00004115static vector unsigned int __ATTRS_o_ai vec_or(vector unsigned int __a,
4116 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004117 return __a | (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004118}
4119
Bill Seurer703e8482015-06-09 14:39:47 +00004120static vector bool int __ATTRS_o_ai vec_or(vector bool int __a,
4121 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004122 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004123}
4124
Bill Seurer703e8482015-06-09 14:39:47 +00004125static vector float __ATTRS_o_ai vec_or(vector float __a, vector float __b) {
4126 vector unsigned int __res =
4127 (vector unsigned int)__a | (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00004128 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004129}
4130
Bill Seurer703e8482015-06-09 14:39:47 +00004131static vector float __ATTRS_o_ai vec_or(vector bool int __a, vector float __b) {
4132 vector unsigned int __res =
4133 (vector unsigned int)__a | (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00004134 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004135}
4136
Bill Seurer703e8482015-06-09 14:39:47 +00004137static vector float __ATTRS_o_ai vec_or(vector float __a, vector bool int __b) {
4138 vector unsigned int __res =
4139 (vector unsigned int)__a | (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00004140 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004141}
4142
Bill Seurer8be14f12015-06-04 18:45:44 +00004143#ifdef __VSX__
4144static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004145vec_or(vector signed long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004146 return __a | __b;
4147}
4148
4149static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004150vec_or(vector bool long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004151 return (vector signed long long)__a | __b;
4152}
4153
Bill Seurer703e8482015-06-09 14:39:47 +00004154static vector signed long long __ATTRS_o_ai vec_or(vector signed long long __a,
4155 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004156 return __a | (vector signed long long)__b;
4157}
4158
4159static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004160vec_or(vector unsigned long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004161 return __a | __b;
4162}
4163
4164static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004165vec_or(vector bool long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004166 return (vector unsigned long long)__a | __b;
4167}
4168
4169static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004170vec_or(vector unsigned long long __a, vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004171 return __a | (vector unsigned long long)__b;
4172}
4173
Bill Seurer703e8482015-06-09 14:39:47 +00004174static vector bool long long __ATTRS_o_ai vec_or(vector bool long long __a,
4175 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004176 return __a | __b;
4177}
4178#endif
4179
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004180/* vec_vor */
4181
Bill Seurer703e8482015-06-09 14:39:47 +00004182static vector signed char __ATTRS_o_ai vec_vor(vector signed char __a,
4183 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004184 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004185}
4186
Bill Seurer703e8482015-06-09 14:39:47 +00004187static vector signed char __ATTRS_o_ai vec_vor(vector bool char __a,
4188 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004189 return (vector signed char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004190}
4191
Bill Seurer703e8482015-06-09 14:39:47 +00004192static vector signed char __ATTRS_o_ai vec_vor(vector signed char __a,
4193 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004194 return __a | (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004195}
4196
Bill Seurer703e8482015-06-09 14:39:47 +00004197static vector unsigned char __ATTRS_o_ai vec_vor(vector unsigned char __a,
4198 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004199 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004200}
4201
Bill Seurer703e8482015-06-09 14:39:47 +00004202static vector unsigned char __ATTRS_o_ai vec_vor(vector bool char __a,
4203 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004204 return (vector unsigned char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004205}
4206
Bill Seurer703e8482015-06-09 14:39:47 +00004207static vector unsigned char __ATTRS_o_ai vec_vor(vector unsigned char __a,
4208 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004209 return __a | (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004210}
4211
Bill Seurer703e8482015-06-09 14:39:47 +00004212static vector bool char __ATTRS_o_ai vec_vor(vector bool char __a,
4213 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004214 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004215}
4216
Bill Seurer703e8482015-06-09 14:39:47 +00004217static vector short __ATTRS_o_ai vec_vor(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004218 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004219}
4220
Bill Seurer703e8482015-06-09 14:39:47 +00004221static vector short __ATTRS_o_ai vec_vor(vector bool short __a,
4222 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004223 return (vector short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004224}
4225
Bill Seurer703e8482015-06-09 14:39:47 +00004226static vector short __ATTRS_o_ai vec_vor(vector short __a,
4227 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004228 return __a | (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004229}
4230
Bill Seurer703e8482015-06-09 14:39:47 +00004231static vector unsigned short __ATTRS_o_ai vec_vor(vector unsigned short __a,
4232 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004233 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004234}
4235
Bill Seurer703e8482015-06-09 14:39:47 +00004236static vector unsigned short __ATTRS_o_ai vec_vor(vector bool short __a,
4237 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004238 return (vector unsigned short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004239}
4240
Bill Seurer703e8482015-06-09 14:39:47 +00004241static vector unsigned short __ATTRS_o_ai vec_vor(vector unsigned short __a,
4242 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004243 return __a | (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004244}
4245
Bill Seurer703e8482015-06-09 14:39:47 +00004246static vector bool short __ATTRS_o_ai vec_vor(vector bool short __a,
4247 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004248 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004249}
4250
Bill Seurer703e8482015-06-09 14:39:47 +00004251static vector int __ATTRS_o_ai vec_vor(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004252 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004253}
4254
Bill Seurer703e8482015-06-09 14:39:47 +00004255static vector int __ATTRS_o_ai vec_vor(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004256 return (vector int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004257}
4258
Bill Seurer703e8482015-06-09 14:39:47 +00004259static vector int __ATTRS_o_ai vec_vor(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004260 return __a | (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004261}
4262
Bill Seurer703e8482015-06-09 14:39:47 +00004263static vector unsigned int __ATTRS_o_ai vec_vor(vector unsigned int __a,
4264 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004265 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004266}
4267
Bill Seurer703e8482015-06-09 14:39:47 +00004268static vector unsigned int __ATTRS_o_ai vec_vor(vector bool int __a,
4269 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004270 return (vector unsigned int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004271}
4272
Bill Seurer703e8482015-06-09 14:39:47 +00004273static vector unsigned int __ATTRS_o_ai vec_vor(vector unsigned int __a,
4274 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004275 return __a | (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004276}
4277
Bill Seurer703e8482015-06-09 14:39:47 +00004278static vector bool int __ATTRS_o_ai vec_vor(vector bool int __a,
4279 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004280 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004281}
4282
Bill Seurer703e8482015-06-09 14:39:47 +00004283static vector float __ATTRS_o_ai vec_vor(vector float __a, vector float __b) {
4284 vector unsigned int __res =
4285 (vector unsigned int)__a | (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00004286 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004287}
4288
Bill Seurer703e8482015-06-09 14:39:47 +00004289static vector float __ATTRS_o_ai vec_vor(vector bool int __a,
4290 vector float __b) {
4291 vector unsigned int __res =
4292 (vector unsigned int)__a | (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00004293 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004294}
4295
Bill Seurer703e8482015-06-09 14:39:47 +00004296static vector float __ATTRS_o_ai vec_vor(vector float __a,
4297 vector bool int __b) {
4298 vector unsigned int __res =
4299 (vector unsigned int)__a | (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00004300 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004301}
4302
Bill Seurer8be14f12015-06-04 18:45:44 +00004303#ifdef __VSX__
4304static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004305vec_vor(vector signed long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004306 return __a | __b;
4307}
4308
4309static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004310vec_vor(vector bool long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004311 return (vector signed long long)__a | __b;
4312}
4313
Bill Seurer703e8482015-06-09 14:39:47 +00004314static vector signed long long __ATTRS_o_ai vec_vor(vector signed long long __a,
4315 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004316 return __a | (vector signed long long)__b;
4317}
4318
4319static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004320vec_vor(vector unsigned long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004321 return __a | __b;
4322}
4323
4324static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004325vec_vor(vector bool long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004326 return (vector unsigned long long)__a | __b;
4327}
4328
4329static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004330vec_vor(vector unsigned long long __a, vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004331 return __a | (vector unsigned long long)__b;
4332}
4333
Bill Seurer703e8482015-06-09 14:39:47 +00004334static vector bool long long __ATTRS_o_ai vec_vor(vector bool long long __a,
4335 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004336 return __a | __b;
4337}
4338#endif
4339
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004340/* vec_pack */
4341
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004342/* The various vector pack instructions have a big-endian bias, so for
4343 little endian we must handle reversed element numbering. */
4344
Bill Seurer703e8482015-06-09 14:39:47 +00004345static vector signed char __ATTRS_o_ai vec_pack(vector signed short __a,
4346 vector signed short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004347#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004348 return (vector signed char)vec_perm(
4349 __a, __b,
4350 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4351 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004352#else
Bill Seurer703e8482015-06-09 14:39:47 +00004353 return (vector signed char)vec_perm(
4354 __a, __b,
4355 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4356 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004357#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004358}
4359
Bill Seurer703e8482015-06-09 14:39:47 +00004360static vector unsigned char __ATTRS_o_ai vec_pack(vector unsigned short __a,
4361 vector unsigned short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004362#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004363 return (vector unsigned char)vec_perm(
4364 __a, __b,
4365 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4366 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004367#else
Bill Seurer703e8482015-06-09 14:39:47 +00004368 return (vector unsigned char)vec_perm(
4369 __a, __b,
4370 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4371 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004372#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004373}
4374
Bill Seurer703e8482015-06-09 14:39:47 +00004375static vector bool char __ATTRS_o_ai vec_pack(vector bool short __a,
4376 vector bool short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004377#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004378 return (vector bool char)vec_perm(
4379 __a, __b,
4380 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4381 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004382#else
Bill Seurer703e8482015-06-09 14:39:47 +00004383 return (vector bool char)vec_perm(
4384 __a, __b,
4385 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4386 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004387#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004388}
4389
Bill Seurer703e8482015-06-09 14:39:47 +00004390static vector short __ATTRS_o_ai vec_pack(vector int __a, vector int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004391#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004392 return (vector short)vec_perm(
4393 __a, __b,
4394 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4395 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004396#else
Bill Seurer703e8482015-06-09 14:39:47 +00004397 return (vector short)vec_perm(
4398 __a, __b,
4399 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4400 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004401#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004402}
4403
Bill Seurer703e8482015-06-09 14:39:47 +00004404static vector unsigned short __ATTRS_o_ai vec_pack(vector unsigned int __a,
4405 vector unsigned int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004406#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004407 return (vector unsigned short)vec_perm(
4408 __a, __b,
4409 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4410 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004411#else
Bill Seurer703e8482015-06-09 14:39:47 +00004412 return (vector unsigned short)vec_perm(
4413 __a, __b,
4414 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4415 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004416#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004417}
4418
Bill Seurer703e8482015-06-09 14:39:47 +00004419static vector bool short __ATTRS_o_ai vec_pack(vector bool int __a,
4420 vector bool int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004421#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004422 return (vector bool short)vec_perm(
4423 __a, __b,
4424 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4425 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004426#else
Bill Seurer703e8482015-06-09 14:39:47 +00004427 return (vector bool short)vec_perm(
4428 __a, __b,
4429 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4430 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004431#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004432}
4433
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004434/* vec_vpkuhum */
4435
4436#define __builtin_altivec_vpkuhum vec_vpkuhum
4437
Bill Seurer703e8482015-06-09 14:39:47 +00004438static vector signed char __ATTRS_o_ai vec_vpkuhum(vector signed short __a,
4439 vector signed short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004440#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004441 return (vector signed char)vec_perm(
4442 __a, __b,
4443 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4444 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004445#else
Bill Seurer703e8482015-06-09 14:39:47 +00004446 return (vector signed char)vec_perm(
4447 __a, __b,
4448 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4449 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004450#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004451}
4452
4453static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004454vec_vpkuhum(vector unsigned short __a, vector unsigned short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004455#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004456 return (vector unsigned char)vec_perm(
4457 __a, __b,
4458 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4459 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004460#else
Bill Seurer703e8482015-06-09 14:39:47 +00004461 return (vector unsigned char)vec_perm(
4462 __a, __b,
4463 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4464 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004465#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004466}
4467
Bill Seurer703e8482015-06-09 14:39:47 +00004468static vector bool char __ATTRS_o_ai vec_vpkuhum(vector bool short __a,
4469 vector bool short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004470#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004471 return (vector bool char)vec_perm(
4472 __a, __b,
4473 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4474 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004475#else
Bill Seurer703e8482015-06-09 14:39:47 +00004476 return (vector bool char)vec_perm(
4477 __a, __b,
4478 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4479 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004480#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004481}
4482
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004483/* vec_vpkuwum */
4484
4485#define __builtin_altivec_vpkuwum vec_vpkuwum
4486
Bill Seurer703e8482015-06-09 14:39:47 +00004487static vector short __ATTRS_o_ai vec_vpkuwum(vector int __a, vector int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004488#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004489 return (vector short)vec_perm(
4490 __a, __b,
4491 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4492 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004493#else
Bill Seurer703e8482015-06-09 14:39:47 +00004494 return (vector short)vec_perm(
4495 __a, __b,
4496 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4497 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004498#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004499}
4500
Bill Seurer703e8482015-06-09 14:39:47 +00004501static vector unsigned short __ATTRS_o_ai vec_vpkuwum(vector unsigned int __a,
4502 vector unsigned int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004503#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004504 return (vector unsigned short)vec_perm(
4505 __a, __b,
4506 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4507 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004508#else
Bill Seurer703e8482015-06-09 14:39:47 +00004509 return (vector unsigned short)vec_perm(
4510 __a, __b,
4511 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4512 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004513#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004514}
4515
Bill Seurer703e8482015-06-09 14:39:47 +00004516static vector bool short __ATTRS_o_ai vec_vpkuwum(vector bool int __a,
4517 vector bool int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004518#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004519 return (vector bool short)vec_perm(
4520 __a, __b,
4521 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4522 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004523#else
Bill Seurer703e8482015-06-09 14:39:47 +00004524 return (vector bool short)vec_perm(
4525 __a, __b,
4526 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4527 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004528#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004529}
4530
Bill Schmidt41e14c42015-05-16 01:02:25 +00004531/* vec_vpkudum */
4532
4533#ifdef __POWER8_VECTOR__
4534#define __builtin_altivec_vpkudum vec_vpkudum
4535
Bill Seurer703e8482015-06-09 14:39:47 +00004536static vector int __ATTRS_o_ai vec_vpkudum(vector long long __a,
4537 vector long long __b) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00004538#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004539 return (vector int)vec_perm(
4540 __a, __b,
4541 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
4542 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
Bill Schmidt41e14c42015-05-16 01:02:25 +00004543#else
Bill Seurer703e8482015-06-09 14:39:47 +00004544 return (vector int)vec_perm(
4545 __a, __b,
4546 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
4547 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
Bill Schmidt41e14c42015-05-16 01:02:25 +00004548#endif
4549}
4550
4551static vector unsigned int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004552vec_vpkudum(vector unsigned long long __a, vector unsigned long long __b) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00004553#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004554 return (vector unsigned int)vec_perm(
4555 __a, __b,
4556 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
4557 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
Bill Schmidt41e14c42015-05-16 01:02:25 +00004558#else
Bill Seurer703e8482015-06-09 14:39:47 +00004559 return (vector unsigned int)vec_perm(
4560 __a, __b,
4561 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
4562 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
Bill Schmidt41e14c42015-05-16 01:02:25 +00004563#endif
4564}
4565
Bill Seurer703e8482015-06-09 14:39:47 +00004566static vector bool int __ATTRS_o_ai vec_vpkudum(vector bool long long __a,
4567 vector bool long long __b) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00004568#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004569 return (vector bool int)vec_perm(
4570 (vector long long)__a, (vector long long)__b,
4571 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
4572 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
Bill Schmidt41e14c42015-05-16 01:02:25 +00004573#else
Bill Seurer703e8482015-06-09 14:39:47 +00004574 return (vector bool int)vec_perm(
4575 (vector long long)__a, (vector long long)__b,
4576 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
4577 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
Bill Schmidt41e14c42015-05-16 01:02:25 +00004578#endif
4579}
4580#endif
4581
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004582/* vec_packpx */
4583
4584static vector pixel __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00004585vec_packpx(vector unsigned int __a, vector unsigned int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004586#ifdef __LITTLE_ENDIAN__
4587 return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
4588#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004589 return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004590#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004591}
4592
4593/* vec_vpkpx */
4594
4595static vector pixel __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00004596vec_vpkpx(vector unsigned int __a, vector unsigned int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004597#ifdef __LITTLE_ENDIAN__
4598 return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
4599#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004600 return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004601#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004602}
4603
4604/* vec_packs */
4605
Bill Seurer703e8482015-06-09 14:39:47 +00004606static vector signed char __ATTRS_o_ai vec_packs(vector short __a,
4607 vector short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004608#ifdef __LITTLE_ENDIAN__
4609 return __builtin_altivec_vpkshss(__b, __a);
4610#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004611 return __builtin_altivec_vpkshss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004612#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004613}
4614
Bill Seurer703e8482015-06-09 14:39:47 +00004615static vector unsigned char __ATTRS_o_ai vec_packs(vector unsigned short __a,
4616 vector unsigned short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004617#ifdef __LITTLE_ENDIAN__
4618 return __builtin_altivec_vpkuhus(__b, __a);
4619#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004620 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004621#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004622}
4623
Bill Seurer703e8482015-06-09 14:39:47 +00004624static vector signed short __ATTRS_o_ai vec_packs(vector int __a,
4625 vector int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004626#ifdef __LITTLE_ENDIAN__
4627 return __builtin_altivec_vpkswss(__b, __a);
4628#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004629 return __builtin_altivec_vpkswss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004630#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004631}
4632
Bill Seurer703e8482015-06-09 14:39:47 +00004633static vector unsigned short __ATTRS_o_ai vec_packs(vector unsigned int __a,
4634 vector unsigned int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004635#ifdef __LITTLE_ENDIAN__
4636 return __builtin_altivec_vpkuwus(__b, __a);
4637#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004638 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004639#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004640}
4641
Bill Schmidt41e14c42015-05-16 01:02:25 +00004642#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +00004643static vector int __ATTRS_o_ai vec_packs(vector long long __a,
4644 vector long long __b) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00004645#ifdef __LITTLE_ENDIAN__
4646 return __builtin_altivec_vpksdss(__b, __a);
4647#else
4648 return __builtin_altivec_vpksdss(__a, __b);
4649#endif
4650}
4651
4652static vector unsigned int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004653vec_packs(vector unsigned long long __a, vector unsigned long long __b) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00004654#ifdef __LITTLE_ENDIAN__
4655 return __builtin_altivec_vpkudus(__b, __a);
4656#else
4657 return __builtin_altivec_vpkudus(__a, __b);
4658#endif
4659}
4660#endif
4661
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004662/* vec_vpkshss */
4663
4664static vector signed char __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00004665vec_vpkshss(vector short __a, vector short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004666#ifdef __LITTLE_ENDIAN__
4667 return __builtin_altivec_vpkshss(__b, __a);
4668#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004669 return __builtin_altivec_vpkshss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004670#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004671}
4672
Bill Schmidt41e14c42015-05-16 01:02:25 +00004673/* vec_vpksdss */
4674
4675#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +00004676static vector int __ATTRS_o_ai vec_vpksdss(vector long long __a,
4677 vector long long __b) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00004678#ifdef __LITTLE_ENDIAN__
4679 return __builtin_altivec_vpksdss(__b, __a);
4680#else
4681 return __builtin_altivec_vpksdss(__a, __b);
4682#endif
4683}
4684#endif
4685
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004686/* vec_vpkuhus */
4687
4688static vector unsigned char __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00004689vec_vpkuhus(vector unsigned short __a, vector unsigned short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004690#ifdef __LITTLE_ENDIAN__
4691 return __builtin_altivec_vpkuhus(__b, __a);
4692#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004693 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004694#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004695}
4696
Bill Schmidt41e14c42015-05-16 01:02:25 +00004697/* vec_vpkudus */
4698
4699#ifdef __POWER8_VECTOR__
4700static vector unsigned int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00004701vec_vpkudus(vector unsigned long long __a, vector unsigned long long __b) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00004702#ifdef __LITTLE_ENDIAN__
4703 return __builtin_altivec_vpkudus(__b, __a);
4704#else
4705 return __builtin_altivec_vpkudus(__a, __b);
4706#endif
4707}
4708#endif
4709
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004710/* vec_vpkswss */
4711
4712static vector signed short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00004713vec_vpkswss(vector int __a, vector int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004714#ifdef __LITTLE_ENDIAN__
4715 return __builtin_altivec_vpkswss(__b, __a);
4716#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004717 return __builtin_altivec_vpkswss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004718#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004719}
4720
4721/* vec_vpkuwus */
4722
4723static vector unsigned short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00004724vec_vpkuwus(vector unsigned int __a, vector unsigned int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004725#ifdef __LITTLE_ENDIAN__
4726 return __builtin_altivec_vpkuwus(__b, __a);
4727#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004728 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004729#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004730}
4731
4732/* vec_packsu */
4733
Bill Seurer703e8482015-06-09 14:39:47 +00004734static vector unsigned char __ATTRS_o_ai vec_packsu(vector short __a,
4735 vector short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004736#ifdef __LITTLE_ENDIAN__
4737 return __builtin_altivec_vpkshus(__b, __a);
4738#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004739 return __builtin_altivec_vpkshus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004740#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004741}
4742
Bill Seurer703e8482015-06-09 14:39:47 +00004743static vector unsigned char __ATTRS_o_ai vec_packsu(vector unsigned short __a,
4744 vector unsigned short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004745#ifdef __LITTLE_ENDIAN__
4746 return __builtin_altivec_vpkuhus(__b, __a);
4747#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004748 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004749#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004750}
4751
Bill Seurer703e8482015-06-09 14:39:47 +00004752static vector unsigned short __ATTRS_o_ai vec_packsu(vector int __a,
4753 vector int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004754#ifdef __LITTLE_ENDIAN__
4755 return __builtin_altivec_vpkswus(__b, __a);
4756#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004757 return __builtin_altivec_vpkswus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004758#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004759}
4760
Bill Seurer703e8482015-06-09 14:39:47 +00004761static vector unsigned short __ATTRS_o_ai vec_packsu(vector unsigned int __a,
4762 vector unsigned int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004763#ifdef __LITTLE_ENDIAN__
4764 return __builtin_altivec_vpkuwus(__b, __a);
4765#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004766 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004767#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004768}
4769
Bill Schmidt41e14c42015-05-16 01:02:25 +00004770#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +00004771static vector unsigned int __ATTRS_o_ai vec_packsu(vector long long __a,
4772 vector long long __b) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00004773#ifdef __LITTLE_ENDIAN__
4774 return __builtin_altivec_vpksdus(__b, __a);
4775#else
4776 return __builtin_altivec_vpksdus(__a, __b);
4777#endif
4778}
4779
4780static vector unsigned int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004781vec_packsu(vector unsigned long long __a, vector unsigned long long __b) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00004782#ifdef __LITTLE_ENDIAN__
4783 return __builtin_altivec_vpkudus(__b, __a);
4784#else
4785 return __builtin_altivec_vpkudus(__a, __b);
4786#endif
4787}
4788#endif
4789
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004790/* vec_vpkshus */
4791
Bill Seurer703e8482015-06-09 14:39:47 +00004792static vector unsigned char __ATTRS_o_ai vec_vpkshus(vector short __a,
4793 vector short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004794#ifdef __LITTLE_ENDIAN__
4795 return __builtin_altivec_vpkshus(__b, __a);
4796#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004797 return __builtin_altivec_vpkshus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004798#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004799}
4800
4801static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004802vec_vpkshus(vector unsigned short __a, vector unsigned short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004803#ifdef __LITTLE_ENDIAN__
4804 return __builtin_altivec_vpkuhus(__b, __a);
4805#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004806 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004807#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004808}
4809
4810/* vec_vpkswus */
4811
Bill Seurer703e8482015-06-09 14:39:47 +00004812static vector unsigned short __ATTRS_o_ai vec_vpkswus(vector int __a,
4813 vector int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004814#ifdef __LITTLE_ENDIAN__
4815 return __builtin_altivec_vpkswus(__b, __a);
4816#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004817 return __builtin_altivec_vpkswus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004818#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004819}
4820
Bill Seurer703e8482015-06-09 14:39:47 +00004821static vector unsigned short __ATTRS_o_ai vec_vpkswus(vector unsigned int __a,
4822 vector unsigned int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004823#ifdef __LITTLE_ENDIAN__
4824 return __builtin_altivec_vpkuwus(__b, __a);
4825#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004826 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004827#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004828}
4829
Bill Schmidt41e14c42015-05-16 01:02:25 +00004830/* vec_vpksdus */
4831
4832#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +00004833static vector unsigned int __ATTRS_o_ai vec_vpksdus(vector long long __a,
4834 vector long long __b) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00004835#ifdef __LITTLE_ENDIAN__
4836 return __builtin_altivec_vpksdus(__b, __a);
4837#else
4838 return __builtin_altivec_vpksdus(__a, __b);
4839#endif
4840}
4841#endif
4842
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004843/* vec_perm */
4844
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004845// The vperm instruction is defined architecturally with a big-endian bias.
4846// For little endian, we swap the input operands and invert the permute
4847// control vector. Only the rightmost 5 bits matter, so we could use
4848// a vector of all 31s instead of all 255s to perform the inversion.
4849// However, when the PCV is not a constant, using 255 has an advantage
4850// in that the vec_xor can be recognized as a vec_nor (and for P8 and
4851// later, possibly a vec_nand).
4852
Bill Seurer703e8482015-06-09 14:39:47 +00004853static vector signed char __ATTRS_o_ai vec_perm(vector signed char __a,
4854 vector signed char __b,
4855 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004856#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004857 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4858 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004859 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00004860 return (vector signed char)__builtin_altivec_vperm_4si((vector int)__b,
4861 (vector int)__a, __d);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004862#else
Bill Seurer703e8482015-06-09 14:39:47 +00004863 return (vector signed char)__builtin_altivec_vperm_4si((vector int)__a,
4864 (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004865#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004866}
4867
Bill Seurer703e8482015-06-09 14:39:47 +00004868static vector unsigned char __ATTRS_o_ai vec_perm(vector unsigned char __a,
4869 vector unsigned char __b,
4870 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004871#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004872 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4873 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004874 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00004875 return (vector unsigned char)__builtin_altivec_vperm_4si(
4876 (vector int)__b, (vector int)__a, __d);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004877#else
Bill Seurer703e8482015-06-09 14:39:47 +00004878 return (vector unsigned char)__builtin_altivec_vperm_4si(
4879 (vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004880#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004881}
4882
Bill Seurer703e8482015-06-09 14:39:47 +00004883static vector bool char __ATTRS_o_ai vec_perm(vector bool char __a,
4884 vector bool char __b,
4885 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004886#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004887 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4888 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004889 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00004890 return (vector bool char)__builtin_altivec_vperm_4si((vector int)__b,
4891 (vector int)__a, __d);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004892#else
Bill Seurer703e8482015-06-09 14:39:47 +00004893 return (vector bool char)__builtin_altivec_vperm_4si((vector int)__a,
4894 (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004895#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004896}
4897
Bill Seurer703e8482015-06-09 14:39:47 +00004898static vector short __ATTRS_o_ai vec_perm(vector short __a, vector short __b,
4899 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004900#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004901 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4902 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004903 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00004904 return (vector short)__builtin_altivec_vperm_4si((vector int)__b,
4905 (vector int)__a, __d);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004906#else
Bill Seurer703e8482015-06-09 14:39:47 +00004907 return (vector short)__builtin_altivec_vperm_4si((vector int)__a,
4908 (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004909#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004910}
4911
Bill Seurer703e8482015-06-09 14:39:47 +00004912static vector unsigned short __ATTRS_o_ai vec_perm(vector unsigned short __a,
4913 vector unsigned short __b,
4914 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004915#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004916 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4917 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004918 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00004919 return (vector unsigned short)__builtin_altivec_vperm_4si(
4920 (vector int)__b, (vector int)__a, __d);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004921#else
Bill Seurer703e8482015-06-09 14:39:47 +00004922 return (vector unsigned short)__builtin_altivec_vperm_4si(
4923 (vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004924#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004925}
4926
Bill Seurer703e8482015-06-09 14:39:47 +00004927static vector bool short __ATTRS_o_ai vec_perm(vector bool short __a,
4928 vector bool short __b,
4929 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004930#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004931 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4932 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004933 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00004934 return (vector bool short)__builtin_altivec_vperm_4si((vector int)__b,
4935 (vector int)__a, __d);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004936#else
Bill Seurer703e8482015-06-09 14:39:47 +00004937 return (vector bool short)__builtin_altivec_vperm_4si((vector int)__a,
4938 (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004939#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004940}
4941
Bill Seurer703e8482015-06-09 14:39:47 +00004942static vector pixel __ATTRS_o_ai vec_perm(vector pixel __a, vector pixel __b,
4943 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004944#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004945 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4946 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004947 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00004948 return (vector pixel)__builtin_altivec_vperm_4si((vector int)__b,
4949 (vector int)__a, __d);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004950#else
Bill Seurer703e8482015-06-09 14:39:47 +00004951 return (vector pixel)__builtin_altivec_vperm_4si((vector int)__a,
4952 (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004953#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004954}
4955
Bill Seurer703e8482015-06-09 14:39:47 +00004956static vector int __ATTRS_o_ai vec_perm(vector int __a, vector int __b,
4957 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004958#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004959 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4960 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004961 __d = vec_xor(__c, __d);
4962 return (vector int)__builtin_altivec_vperm_4si(__b, __a, __d);
4963#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004964 return (vector int)__builtin_altivec_vperm_4si(__a, __b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004965#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004966}
4967
Bill Seurer703e8482015-06-09 14:39:47 +00004968static vector unsigned int __ATTRS_o_ai vec_perm(vector unsigned int __a,
4969 vector unsigned int __b,
4970 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004971#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004972 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4973 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004974 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00004975 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__b,
4976 (vector int)__a, __d);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004977#else
Bill Seurer703e8482015-06-09 14:39:47 +00004978 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__a,
4979 (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004980#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004981}
4982
Bill Seurer703e8482015-06-09 14:39:47 +00004983static vector bool int __ATTRS_o_ai vec_perm(vector bool int __a,
4984 vector bool int __b,
4985 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004986#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004987 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4988 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004989 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00004990 return (vector bool int)__builtin_altivec_vperm_4si((vector int)__b,
4991 (vector int)__a, __d);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004992#else
Bill Seurer703e8482015-06-09 14:39:47 +00004993 return (vector bool int)__builtin_altivec_vperm_4si((vector int)__a,
4994 (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004995#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004996}
4997
Bill Seurer703e8482015-06-09 14:39:47 +00004998static vector float __ATTRS_o_ai vec_perm(vector float __a, vector float __b,
4999 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005000#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00005001 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
5002 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005003 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00005004 return (vector float)__builtin_altivec_vperm_4si((vector int)__b,
5005 (vector int)__a, __d);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005006#else
Bill Seurer703e8482015-06-09 14:39:47 +00005007 return (vector float)__builtin_altivec_vperm_4si((vector int)__a,
5008 (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005009#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005010}
5011
Bill Schmidt8ff672d2014-11-14 13:10:13 +00005012#ifdef __VSX__
Bill Seurer703e8482015-06-09 14:39:47 +00005013static vector long long __ATTRS_o_ai vec_perm(vector long long __a,
5014 vector long long __b,
5015 vector unsigned char __c) {
Bill Schmidt8ff672d2014-11-14 13:10:13 +00005016#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00005017 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
5018 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidt8ff672d2014-11-14 13:10:13 +00005019 __d = vec_xor(__c, __d);
5020 return (vector long long)__builtin_altivec_vperm_4si(__b, __a, __d);
5021#else
5022 return (vector long long)__builtin_altivec_vperm_4si(__a, __b, __c);
5023#endif
5024}
5025
Eric Christopherc67e1b62014-12-10 00:57:43 +00005026static vector unsigned long long __ATTRS_o_ai
Bill Schmidt8ff672d2014-11-14 13:10:13 +00005027vec_perm(vector unsigned long long __a, vector unsigned long long __b,
Bill Seurer703e8482015-06-09 14:39:47 +00005028 vector unsigned char __c) {
Bill Schmidt8ff672d2014-11-14 13:10:13 +00005029#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00005030 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
5031 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidt8ff672d2014-11-14 13:10:13 +00005032 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00005033 return (vector unsigned long long)__builtin_altivec_vperm_4si(
5034 (vector int)__b, (vector int)__a, __d);
Bill Schmidt8ff672d2014-11-14 13:10:13 +00005035#else
Bill Seurer703e8482015-06-09 14:39:47 +00005036 return (vector unsigned long long)__builtin_altivec_vperm_4si(
5037 (vector int)__a, (vector int)__b, __c);
Bill Schmidt8ff672d2014-11-14 13:10:13 +00005038#endif
5039}
5040
Bill Seurer703e8482015-06-09 14:39:47 +00005041static vector double __ATTRS_o_ai vec_perm(vector double __a, vector double __b,
5042 vector unsigned char __c) {
Bill Schmidt8ff672d2014-11-14 13:10:13 +00005043#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00005044 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
5045 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidt8ff672d2014-11-14 13:10:13 +00005046 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00005047 return (vector double)__builtin_altivec_vperm_4si((vector int)__b,
5048 (vector int)__a, __d);
Bill Schmidt8ff672d2014-11-14 13:10:13 +00005049#else
Bill Seurer703e8482015-06-09 14:39:47 +00005050 return (vector double)__builtin_altivec_vperm_4si((vector int)__a,
5051 (vector int)__b, __c);
Bill Schmidt8ff672d2014-11-14 13:10:13 +00005052#endif
5053}
5054#endif
5055
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005056/* vec_vperm */
5057
Bill Seurer703e8482015-06-09 14:39:47 +00005058static vector signed char __ATTRS_o_ai vec_vperm(vector signed char __a,
5059 vector signed char __b,
5060 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005061 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005062}
5063
Bill Seurer703e8482015-06-09 14:39:47 +00005064static vector unsigned char __ATTRS_o_ai vec_vperm(vector unsigned char __a,
5065 vector unsigned char __b,
5066 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005067 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005068}
5069
Bill Seurer703e8482015-06-09 14:39:47 +00005070static vector bool char __ATTRS_o_ai vec_vperm(vector bool char __a,
5071 vector bool char __b,
5072 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005073 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00005074}
5075
Bill Seurer703e8482015-06-09 14:39:47 +00005076static vector short __ATTRS_o_ai vec_vperm(vector short __a, vector short __b,
5077 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005078 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005079}
5080
Bill Seurer703e8482015-06-09 14:39:47 +00005081static vector unsigned short __ATTRS_o_ai vec_vperm(vector unsigned short __a,
5082 vector unsigned short __b,
5083 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005084 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005085}
5086
Bill Seurer703e8482015-06-09 14:39:47 +00005087static vector bool short __ATTRS_o_ai vec_vperm(vector bool short __a,
5088 vector bool short __b,
5089 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005090 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00005091}
5092
Bill Seurer703e8482015-06-09 14:39:47 +00005093static vector pixel __ATTRS_o_ai vec_vperm(vector pixel __a, vector pixel __b,
5094 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005095 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00005096}
5097
Bill Seurer703e8482015-06-09 14:39:47 +00005098static vector int __ATTRS_o_ai vec_vperm(vector int __a, vector int __b,
5099 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005100 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005101}
5102
Bill Seurer703e8482015-06-09 14:39:47 +00005103static vector unsigned int __ATTRS_o_ai vec_vperm(vector unsigned int __a,
5104 vector unsigned int __b,
5105 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005106 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005107}
5108
Bill Seurer703e8482015-06-09 14:39:47 +00005109static vector bool int __ATTRS_o_ai vec_vperm(vector bool int __a,
5110 vector bool int __b,
5111 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005112 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00005113}
5114
Bill Seurer703e8482015-06-09 14:39:47 +00005115static vector float __ATTRS_o_ai vec_vperm(vector float __a, vector float __b,
5116 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005117 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005118}
5119
Bill Schmidt8ff672d2014-11-14 13:10:13 +00005120#ifdef __VSX__
Bill Seurer703e8482015-06-09 14:39:47 +00005121static vector long long __ATTRS_o_ai vec_vperm(vector long long __a,
5122 vector long long __b,
5123 vector unsigned char __c) {
Bill Schmidt8ff672d2014-11-14 13:10:13 +00005124 return vec_perm(__a, __b, __c);
5125}
5126
5127static vector unsigned long long __ATTRS_o_ai
5128vec_vperm(vector unsigned long long __a, vector unsigned long long __b,
Bill Seurer703e8482015-06-09 14:39:47 +00005129 vector unsigned char __c) {
Bill Schmidt8ff672d2014-11-14 13:10:13 +00005130 return vec_perm(__a, __b, __c);
5131}
5132
Bill Seurer703e8482015-06-09 14:39:47 +00005133static vector double __ATTRS_o_ai vec_vperm(vector double __a,
5134 vector double __b,
5135 vector unsigned char __c) {
Bill Schmidt8ff672d2014-11-14 13:10:13 +00005136 return vec_perm(__a, __b, __c);
5137}
5138#endif
5139
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005140/* vec_re */
5141
Ulrich Weigand9936f132012-10-31 18:17:07 +00005142static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00005143vec_re(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005144 return __builtin_altivec_vrefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005145}
5146
5147/* vec_vrefp */
5148
Ulrich Weigand9936f132012-10-31 18:17:07 +00005149static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00005150vec_vrefp(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005151 return __builtin_altivec_vrefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005152}
5153
5154/* vec_rl */
5155
Bill Seurer703e8482015-06-09 14:39:47 +00005156static vector signed char __ATTRS_o_ai vec_rl(vector signed char __a,
5157 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005158 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005159}
5160
Bill Seurer703e8482015-06-09 14:39:47 +00005161static vector unsigned char __ATTRS_o_ai vec_rl(vector unsigned char __a,
5162 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005163 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005164}
5165
Bill Seurer703e8482015-06-09 14:39:47 +00005166static vector short __ATTRS_o_ai vec_rl(vector short __a,
5167 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005168 return __builtin_altivec_vrlh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005169}
5170
Bill Seurer703e8482015-06-09 14:39:47 +00005171static vector unsigned short __ATTRS_o_ai vec_rl(vector unsigned short __a,
5172 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005173 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005174}
5175
Bill Seurer703e8482015-06-09 14:39:47 +00005176static vector int __ATTRS_o_ai vec_rl(vector int __a, vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005177 return __builtin_altivec_vrlw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005178}
5179
Bill Seurer703e8482015-06-09 14:39:47 +00005180static vector unsigned int __ATTRS_o_ai vec_rl(vector unsigned int __a,
5181 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005182 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005183}
5184
Kit Barton8553bec2015-03-11 15:57:19 +00005185#ifdef __POWER8_VECTOR__
5186static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00005187vec_rl(vector signed long long __a, vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00005188 return __builtin_altivec_vrld(__a, __b);
5189}
5190
5191static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00005192vec_rl(vector unsigned long long __a, vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00005193 return __builtin_altivec_vrld(__a, __b);
5194}
5195#endif
5196
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005197/* vec_vrlb */
5198
Bill Seurer703e8482015-06-09 14:39:47 +00005199static vector signed char __ATTRS_o_ai vec_vrlb(vector signed char __a,
5200 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005201 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005202}
5203
Bill Seurer703e8482015-06-09 14:39:47 +00005204static vector unsigned char __ATTRS_o_ai vec_vrlb(vector unsigned char __a,
5205 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005206 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005207}
5208
5209/* vec_vrlh */
5210
Bill Seurer703e8482015-06-09 14:39:47 +00005211static vector short __ATTRS_o_ai vec_vrlh(vector short __a,
5212 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005213 return __builtin_altivec_vrlh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005214}
5215
Bill Seurer703e8482015-06-09 14:39:47 +00005216static vector unsigned short __ATTRS_o_ai vec_vrlh(vector unsigned short __a,
5217 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005218 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005219}
5220
5221/* vec_vrlw */
5222
Bill Seurer703e8482015-06-09 14:39:47 +00005223static vector int __ATTRS_o_ai vec_vrlw(vector int __a,
5224 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005225 return __builtin_altivec_vrlw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005226}
5227
Bill Seurer703e8482015-06-09 14:39:47 +00005228static vector unsigned int __ATTRS_o_ai vec_vrlw(vector unsigned int __a,
5229 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005230 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005231}
5232
5233/* vec_round */
5234
5235static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00005236vec_round(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005237 return __builtin_altivec_vrfin(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005238}
5239
5240/* vec_vrfin */
5241
5242static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00005243vec_vrfin(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005244 return __builtin_altivec_vrfin(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005245}
5246
5247/* vec_rsqrte */
5248
5249static __vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00005250vec_rsqrte(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005251 return __builtin_altivec_vrsqrtefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005252}
5253
5254/* vec_vrsqrtefp */
5255
5256static __vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00005257vec_vrsqrtefp(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005258 return __builtin_altivec_vrsqrtefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005259}
5260
5261/* vec_sel */
5262
5263#define __builtin_altivec_vsel_4si vec_sel
5264
Bill Seurer703e8482015-06-09 14:39:47 +00005265static vector signed char __ATTRS_o_ai vec_sel(vector signed char __a,
5266 vector signed char __b,
5267 vector unsigned char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005268 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005269}
5270
Bill Seurer703e8482015-06-09 14:39:47 +00005271static vector signed char __ATTRS_o_ai vec_sel(vector signed char __a,
5272 vector signed char __b,
5273 vector bool char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005274 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005275}
5276
Bill Seurer703e8482015-06-09 14:39:47 +00005277static vector unsigned char __ATTRS_o_ai vec_sel(vector unsigned char __a,
5278 vector unsigned char __b,
5279 vector unsigned char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005280 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005281}
5282
Bill Seurer703e8482015-06-09 14:39:47 +00005283static vector unsigned char __ATTRS_o_ai vec_sel(vector unsigned char __a,
5284 vector unsigned char __b,
5285 vector bool char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005286 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005287}
5288
Bill Seurer703e8482015-06-09 14:39:47 +00005289static vector bool char __ATTRS_o_ai vec_sel(vector bool char __a,
5290 vector bool char __b,
5291 vector unsigned char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005292 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005293}
5294
Bill Seurer703e8482015-06-09 14:39:47 +00005295static vector bool char __ATTRS_o_ai vec_sel(vector bool char __a,
5296 vector bool char __b,
5297 vector bool char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005298 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005299}
5300
Bill Seurer703e8482015-06-09 14:39:47 +00005301static vector short __ATTRS_o_ai vec_sel(vector short __a, vector short __b,
5302 vector unsigned short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005303 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005304}
5305
Bill Seurer703e8482015-06-09 14:39:47 +00005306static vector short __ATTRS_o_ai vec_sel(vector short __a, vector short __b,
5307 vector bool short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005308 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005309}
5310
Bill Seurer703e8482015-06-09 14:39:47 +00005311static vector unsigned short __ATTRS_o_ai vec_sel(vector unsigned short __a,
5312 vector unsigned short __b,
5313 vector unsigned short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005314 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005315}
5316
Bill Seurer703e8482015-06-09 14:39:47 +00005317static vector unsigned short __ATTRS_o_ai vec_sel(vector unsigned short __a,
5318 vector unsigned short __b,
5319 vector bool short __c) {
5320 return (__a & ~(vector unsigned short)__c) |
5321 (__b & (vector unsigned short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005322}
5323
Bill Seurer703e8482015-06-09 14:39:47 +00005324static vector bool short __ATTRS_o_ai vec_sel(vector bool short __a,
5325 vector bool short __b,
5326 vector unsigned short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005327 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005328}
5329
Bill Seurer703e8482015-06-09 14:39:47 +00005330static vector bool short __ATTRS_o_ai vec_sel(vector bool short __a,
5331 vector bool short __b,
5332 vector bool short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005333 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005334}
5335
Bill Seurer703e8482015-06-09 14:39:47 +00005336static vector int __ATTRS_o_ai vec_sel(vector int __a, vector int __b,
5337 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005338 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005339}
5340
Bill Seurer703e8482015-06-09 14:39:47 +00005341static vector int __ATTRS_o_ai vec_sel(vector int __a, vector int __b,
5342 vector bool int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005343 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005344}
5345
Bill Seurer703e8482015-06-09 14:39:47 +00005346static vector unsigned int __ATTRS_o_ai vec_sel(vector unsigned int __a,
5347 vector unsigned int __b,
5348 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005349 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005350}
5351
Bill Seurer703e8482015-06-09 14:39:47 +00005352static vector unsigned int __ATTRS_o_ai vec_sel(vector unsigned int __a,
5353 vector unsigned int __b,
5354 vector bool int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005355 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005356}
5357
Bill Seurer703e8482015-06-09 14:39:47 +00005358static vector bool int __ATTRS_o_ai vec_sel(vector bool int __a,
5359 vector bool int __b,
5360 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005361 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005362}
5363
Bill Seurer703e8482015-06-09 14:39:47 +00005364static vector bool int __ATTRS_o_ai vec_sel(vector bool int __a,
5365 vector bool int __b,
5366 vector bool int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005367 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005368}
5369
Bill Seurer703e8482015-06-09 14:39:47 +00005370static vector float __ATTRS_o_ai vec_sel(vector float __a, vector float __b,
5371 vector unsigned int __c) {
5372 vector int __res = ((vector int)__a & ~(vector int)__c) |
5373 ((vector int)__b & (vector int)__c);
David Blaikie3302f2b2013-01-16 23:08:36 +00005374 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005375}
5376
Bill Seurer703e8482015-06-09 14:39:47 +00005377static vector float __ATTRS_o_ai vec_sel(vector float __a, vector float __b,
5378 vector bool int __c) {
5379 vector int __res = ((vector int)__a & ~(vector int)__c) |
5380 ((vector int)__b & (vector int)__c);
David Blaikie3302f2b2013-01-16 23:08:36 +00005381 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00005382}
5383
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005384/* vec_vsel */
5385
Bill Seurer703e8482015-06-09 14:39:47 +00005386static vector signed char __ATTRS_o_ai vec_vsel(vector signed char __a,
5387 vector signed char __b,
5388 vector unsigned char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005389 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005390}
5391
Bill Seurer703e8482015-06-09 14:39:47 +00005392static vector signed char __ATTRS_o_ai vec_vsel(vector signed char __a,
5393 vector signed char __b,
5394 vector bool char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005395 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005396}
5397
Bill Seurer703e8482015-06-09 14:39:47 +00005398static vector unsigned char __ATTRS_o_ai vec_vsel(vector unsigned char __a,
5399 vector unsigned char __b,
5400 vector unsigned char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005401 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005402}
5403
Bill Seurer703e8482015-06-09 14:39:47 +00005404static vector unsigned char __ATTRS_o_ai vec_vsel(vector unsigned char __a,
5405 vector unsigned char __b,
5406 vector bool char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005407 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005408}
5409
Bill Seurer703e8482015-06-09 14:39:47 +00005410static vector bool char __ATTRS_o_ai vec_vsel(vector bool char __a,
5411 vector bool char __b,
5412 vector unsigned char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005413 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005414}
5415
Bill Seurer703e8482015-06-09 14:39:47 +00005416static vector bool char __ATTRS_o_ai vec_vsel(vector bool char __a,
5417 vector bool char __b,
5418 vector bool char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005419 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005420}
5421
Bill Seurer703e8482015-06-09 14:39:47 +00005422static vector short __ATTRS_o_ai vec_vsel(vector short __a, vector short __b,
5423 vector unsigned short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005424 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005425}
5426
Bill Seurer703e8482015-06-09 14:39:47 +00005427static vector short __ATTRS_o_ai vec_vsel(vector short __a, vector short __b,
5428 vector bool short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005429 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005430}
5431
Bill Seurer703e8482015-06-09 14:39:47 +00005432static vector unsigned short __ATTRS_o_ai vec_vsel(vector unsigned short __a,
5433 vector unsigned short __b,
5434 vector unsigned short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005435 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005436}
5437
Bill Seurer703e8482015-06-09 14:39:47 +00005438static vector unsigned short __ATTRS_o_ai vec_vsel(vector unsigned short __a,
5439 vector unsigned short __b,
5440 vector bool short __c) {
5441 return (__a & ~(vector unsigned short)__c) |
5442 (__b & (vector unsigned short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005443}
5444
Bill Seurer703e8482015-06-09 14:39:47 +00005445static vector bool short __ATTRS_o_ai vec_vsel(vector bool short __a,
5446 vector bool short __b,
5447 vector unsigned short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005448 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005449}
5450
Bill Seurer703e8482015-06-09 14:39:47 +00005451static vector bool short __ATTRS_o_ai vec_vsel(vector bool short __a,
5452 vector bool short __b,
5453 vector bool short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005454 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005455}
5456
Bill Seurer703e8482015-06-09 14:39:47 +00005457static vector int __ATTRS_o_ai vec_vsel(vector int __a, vector int __b,
5458 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005459 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005460}
5461
Bill Seurer703e8482015-06-09 14:39:47 +00005462static vector int __ATTRS_o_ai vec_vsel(vector int __a, vector int __b,
5463 vector bool int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005464 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005465}
5466
Bill Seurer703e8482015-06-09 14:39:47 +00005467static vector unsigned int __ATTRS_o_ai vec_vsel(vector unsigned int __a,
5468 vector unsigned int __b,
5469 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005470 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005471}
5472
Bill Seurer703e8482015-06-09 14:39:47 +00005473static vector unsigned int __ATTRS_o_ai vec_vsel(vector unsigned int __a,
5474 vector unsigned int __b,
5475 vector bool int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005476 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005477}
5478
Bill Seurer703e8482015-06-09 14:39:47 +00005479static vector bool int __ATTRS_o_ai vec_vsel(vector bool int __a,
5480 vector bool int __b,
5481 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005482 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005483}
5484
Bill Seurer703e8482015-06-09 14:39:47 +00005485static vector bool int __ATTRS_o_ai vec_vsel(vector bool int __a,
5486 vector bool int __b,
5487 vector bool int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005488 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005489}
5490
Bill Seurer703e8482015-06-09 14:39:47 +00005491static vector float __ATTRS_o_ai vec_vsel(vector float __a, vector float __b,
5492 vector unsigned int __c) {
5493 vector int __res = ((vector int)__a & ~(vector int)__c) |
5494 ((vector int)__b & (vector int)__c);
David Blaikie3302f2b2013-01-16 23:08:36 +00005495 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005496}
5497
Bill Seurer703e8482015-06-09 14:39:47 +00005498static vector float __ATTRS_o_ai vec_vsel(vector float __a, vector float __b,
5499 vector bool int __c) {
5500 vector int __res = ((vector int)__a & ~(vector int)__c) |
5501 ((vector int)__b & (vector int)__c);
David Blaikie3302f2b2013-01-16 23:08:36 +00005502 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00005503}
5504
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005505/* vec_sl */
5506
Bill Seurer703e8482015-06-09 14:39:47 +00005507static vector signed char __ATTRS_o_ai vec_sl(vector signed char __a,
5508 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005509 return __a << (vector signed char)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005510}
5511
Bill Seurer703e8482015-06-09 14:39:47 +00005512static vector unsigned char __ATTRS_o_ai vec_sl(vector unsigned char __a,
5513 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005514 return __a << __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005515}
5516
Bill Seurer703e8482015-06-09 14:39:47 +00005517static vector short __ATTRS_o_ai vec_sl(vector short __a,
5518 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005519 return __a << (vector short)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005520}
5521
Bill Seurer703e8482015-06-09 14:39:47 +00005522static vector unsigned short __ATTRS_o_ai vec_sl(vector unsigned short __a,
5523 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005524 return __a << __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005525}
5526
Bill Seurer703e8482015-06-09 14:39:47 +00005527static vector int __ATTRS_o_ai vec_sl(vector int __a, vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005528 return __a << (vector int)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005529}
5530
Bill Seurer703e8482015-06-09 14:39:47 +00005531static vector unsigned int __ATTRS_o_ai vec_sl(vector unsigned int __a,
5532 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005533 return __a << __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005534}
5535
Kit Barton8553bec2015-03-11 15:57:19 +00005536#ifdef __POWER8_VECTOR__
5537static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00005538vec_sl(vector signed long long __a, vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00005539 return __a << (vector long long)__b;
5540}
5541
5542static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00005543vec_sl(vector unsigned long long __a, vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00005544 return __a << __b;
5545}
5546#endif
5547
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005548/* vec_vslb */
5549
5550#define __builtin_altivec_vslb vec_vslb
5551
Bill Seurer703e8482015-06-09 14:39:47 +00005552static vector signed char __ATTRS_o_ai vec_vslb(vector signed char __a,
5553 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005554 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005555}
5556
Bill Seurer703e8482015-06-09 14:39:47 +00005557static vector unsigned char __ATTRS_o_ai vec_vslb(vector unsigned char __a,
5558 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005559 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005560}
5561
5562/* vec_vslh */
5563
5564#define __builtin_altivec_vslh vec_vslh
5565
Bill Seurer703e8482015-06-09 14:39:47 +00005566static vector short __ATTRS_o_ai vec_vslh(vector short __a,
5567 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005568 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005569}
5570
Bill Seurer703e8482015-06-09 14:39:47 +00005571static vector unsigned short __ATTRS_o_ai vec_vslh(vector unsigned short __a,
5572 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005573 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005574}
5575
5576/* vec_vslw */
5577
5578#define __builtin_altivec_vslw vec_vslw
5579
Bill Seurer703e8482015-06-09 14:39:47 +00005580static vector int __ATTRS_o_ai vec_vslw(vector int __a,
5581 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005582 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005583}
5584
Bill Seurer703e8482015-06-09 14:39:47 +00005585static vector unsigned int __ATTRS_o_ai vec_vslw(vector unsigned int __a,
5586 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005587 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005588}
5589
5590/* vec_sld */
5591
5592#define __builtin_altivec_vsldoi_4si vec_sld
5593
Bill Seurer703e8482015-06-09 14:39:47 +00005594static vector signed char __ATTRS_o_ai vec_sld(vector signed char __a,
5595 vector signed char __b,
5596 unsigned char __c) {
5597 return vec_perm(
5598 __a, __b,
5599 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5600 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5601 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005602}
5603
Bill Seurer703e8482015-06-09 14:39:47 +00005604static vector unsigned char __ATTRS_o_ai vec_sld(vector unsigned char __a,
5605 vector unsigned char __b,
5606 unsigned char __c) {
5607 return vec_perm(
5608 __a, __b,
5609 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5610 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5611 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005612}
5613
Bill Seurer703e8482015-06-09 14:39:47 +00005614static vector short __ATTRS_o_ai vec_sld(vector short __a, vector short __b,
5615 unsigned char __c) {
5616 return vec_perm(
5617 __a, __b,
5618 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5619 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5620 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005621}
5622
Bill Seurer703e8482015-06-09 14:39:47 +00005623static vector unsigned short __ATTRS_o_ai vec_sld(vector unsigned short __a,
5624 vector unsigned short __b,
5625 unsigned char __c) {
5626 return vec_perm(
5627 __a, __b,
5628 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5629 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5630 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Yartsev9e968982010-08-19 03:00:09 +00005631}
5632
Bill Seurer703e8482015-06-09 14:39:47 +00005633static vector pixel __ATTRS_o_ai vec_sld(vector pixel __a, vector pixel __b,
5634 unsigned char __c) {
5635 return vec_perm(
5636 __a, __b,
5637 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5638 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5639 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005640}
5641
Bill Seurer703e8482015-06-09 14:39:47 +00005642static vector int __ATTRS_o_ai vec_sld(vector int __a, vector int __b,
5643 unsigned char __c) {
5644 return vec_perm(
5645 __a, __b,
5646 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5647 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5648 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005649}
5650
Bill Seurer703e8482015-06-09 14:39:47 +00005651static vector unsigned int __ATTRS_o_ai vec_sld(vector unsigned int __a,
5652 vector unsigned int __b,
5653 unsigned char __c) {
5654 return vec_perm(
5655 __a, __b,
5656 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5657 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5658 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005659}
5660
Bill Seurer703e8482015-06-09 14:39:47 +00005661static vector float __ATTRS_o_ai vec_sld(vector float __a, vector float __b,
5662 unsigned char __c) {
5663 return vec_perm(
5664 __a, __b,
5665 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5666 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5667 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005668}
5669
5670/* vec_vsldoi */
5671
Bill Seurer703e8482015-06-09 14:39:47 +00005672static vector signed char __ATTRS_o_ai vec_vsldoi(vector signed char __a,
5673 vector signed char __b,
5674 unsigned char __c) {
5675 return vec_perm(
5676 __a, __b,
5677 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5678 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5679 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005680}
5681
Bill Seurer703e8482015-06-09 14:39:47 +00005682static vector unsigned char __ATTRS_o_ai vec_vsldoi(vector unsigned char __a,
5683 vector unsigned char __b,
5684 unsigned char __c) {
5685 return vec_perm(
5686 __a, __b,
5687 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5688 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5689 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005690}
5691
Bill Seurer703e8482015-06-09 14:39:47 +00005692static vector short __ATTRS_o_ai vec_vsldoi(vector short __a, vector short __b,
5693 unsigned char __c) {
5694 return vec_perm(
5695 __a, __b,
5696 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5697 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5698 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005699}
5700
Bill Seurer703e8482015-06-09 14:39:47 +00005701static vector unsigned short __ATTRS_o_ai vec_vsldoi(vector unsigned short __a,
5702 vector unsigned short __b,
5703 unsigned char __c) {
5704 return vec_perm(
5705 __a, __b,
5706 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5707 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5708 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Yartsev9e968982010-08-19 03:00:09 +00005709}
5710
Bill Seurer703e8482015-06-09 14:39:47 +00005711static vector pixel __ATTRS_o_ai vec_vsldoi(vector pixel __a, vector pixel __b,
5712 unsigned char __c) {
5713 return vec_perm(
5714 __a, __b,
5715 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5716 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5717 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005718}
5719
Bill Seurer703e8482015-06-09 14:39:47 +00005720static vector int __ATTRS_o_ai vec_vsldoi(vector int __a, vector int __b,
5721 unsigned char __c) {
5722 return vec_perm(
5723 __a, __b,
5724 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5725 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5726 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005727}
5728
Bill Seurer703e8482015-06-09 14:39:47 +00005729static vector unsigned int __ATTRS_o_ai vec_vsldoi(vector unsigned int __a,
5730 vector unsigned int __b,
5731 unsigned char __c) {
5732 return vec_perm(
5733 __a, __b,
5734 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5735 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5736 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005737}
5738
Bill Seurer703e8482015-06-09 14:39:47 +00005739static vector float __ATTRS_o_ai vec_vsldoi(vector float __a, vector float __b,
5740 unsigned char __c) {
5741 return vec_perm(
5742 __a, __b,
5743 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5744 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5745 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005746}
5747
5748/* vec_sll */
5749
Bill Seurer703e8482015-06-09 14:39:47 +00005750static vector signed char __ATTRS_o_ai vec_sll(vector signed char __a,
5751 vector unsigned char __b) {
5752 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
5753 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005754}
5755
Bill Seurer703e8482015-06-09 14:39:47 +00005756static vector signed char __ATTRS_o_ai vec_sll(vector signed char __a,
5757 vector unsigned short __b) {
5758 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
5759 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005760}
5761
Bill Seurer703e8482015-06-09 14:39:47 +00005762static vector signed char __ATTRS_o_ai vec_sll(vector signed char __a,
5763 vector unsigned int __b) {
5764 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
5765 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005766}
5767
Bill Seurer703e8482015-06-09 14:39:47 +00005768static vector unsigned char __ATTRS_o_ai vec_sll(vector unsigned char __a,
5769 vector unsigned char __b) {
5770 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
5771 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005772}
5773
Bill Seurer703e8482015-06-09 14:39:47 +00005774static vector unsigned char __ATTRS_o_ai vec_sll(vector unsigned char __a,
5775 vector unsigned short __b) {
5776 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
5777 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005778}
5779
Bill Seurer703e8482015-06-09 14:39:47 +00005780static vector unsigned char __ATTRS_o_ai vec_sll(vector unsigned char __a,
5781 vector unsigned int __b) {
5782 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
5783 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005784}
5785
Bill Seurer703e8482015-06-09 14:39:47 +00005786static vector bool char __ATTRS_o_ai vec_sll(vector bool char __a,
5787 vector unsigned char __b) {
5788 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
5789 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005790}
5791
Bill Seurer703e8482015-06-09 14:39:47 +00005792static vector bool char __ATTRS_o_ai vec_sll(vector bool char __a,
5793 vector unsigned short __b) {
5794 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
5795 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005796}
5797
Bill Seurer703e8482015-06-09 14:39:47 +00005798static vector bool char __ATTRS_o_ai vec_sll(vector bool char __a,
5799 vector unsigned int __b) {
5800 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
5801 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005802}
5803
Bill Seurer703e8482015-06-09 14:39:47 +00005804static vector short __ATTRS_o_ai vec_sll(vector short __a,
5805 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005806 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005807}
5808
Bill Seurer703e8482015-06-09 14:39:47 +00005809static vector short __ATTRS_o_ai vec_sll(vector short __a,
5810 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005811 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005812}
5813
Bill Seurer703e8482015-06-09 14:39:47 +00005814static vector short __ATTRS_o_ai vec_sll(vector short __a,
5815 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005816 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005817}
5818
Bill Seurer703e8482015-06-09 14:39:47 +00005819static vector unsigned short __ATTRS_o_ai vec_sll(vector unsigned short __a,
5820 vector unsigned char __b) {
5821 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
5822 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005823}
5824
Bill Seurer703e8482015-06-09 14:39:47 +00005825static vector unsigned short __ATTRS_o_ai vec_sll(vector unsigned short __a,
5826 vector unsigned short __b) {
5827 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
5828 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005829}
5830
Bill Seurer703e8482015-06-09 14:39:47 +00005831static vector unsigned short __ATTRS_o_ai vec_sll(vector unsigned short __a,
5832 vector unsigned int __b) {
5833 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
5834 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005835}
5836
Bill Seurer703e8482015-06-09 14:39:47 +00005837static vector bool short __ATTRS_o_ai vec_sll(vector bool short __a,
5838 vector unsigned char __b) {
5839 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
5840 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005841}
5842
Bill Seurer703e8482015-06-09 14:39:47 +00005843static vector bool short __ATTRS_o_ai vec_sll(vector bool short __a,
5844 vector unsigned short __b) {
5845 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
5846 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005847}
5848
Bill Seurer703e8482015-06-09 14:39:47 +00005849static vector bool short __ATTRS_o_ai vec_sll(vector bool short __a,
5850 vector unsigned int __b) {
5851 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
5852 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005853}
5854
Bill Seurer703e8482015-06-09 14:39:47 +00005855static vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
5856 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005857 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005858}
5859
Bill Seurer703e8482015-06-09 14:39:47 +00005860static vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
5861 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005862 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005863}
5864
Bill Seurer703e8482015-06-09 14:39:47 +00005865static vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
5866 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005867 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005868}
5869
Bill Seurer703e8482015-06-09 14:39:47 +00005870static vector int __ATTRS_o_ai vec_sll(vector int __a,
5871 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005872 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005873}
5874
Bill Seurer703e8482015-06-09 14:39:47 +00005875static vector int __ATTRS_o_ai vec_sll(vector int __a,
5876 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005877 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005878}
5879
Bill Seurer703e8482015-06-09 14:39:47 +00005880static vector int __ATTRS_o_ai vec_sll(vector int __a,
5881 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005882 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005883}
5884
Bill Seurer703e8482015-06-09 14:39:47 +00005885static vector unsigned int __ATTRS_o_ai vec_sll(vector unsigned int __a,
5886 vector unsigned char __b) {
5887 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
5888 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005889}
5890
Bill Seurer703e8482015-06-09 14:39:47 +00005891static vector unsigned int __ATTRS_o_ai vec_sll(vector unsigned int __a,
5892 vector unsigned short __b) {
5893 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
5894 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005895}
5896
Bill Seurer703e8482015-06-09 14:39:47 +00005897static vector unsigned int __ATTRS_o_ai vec_sll(vector unsigned int __a,
5898 vector unsigned int __b) {
5899 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
5900 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005901}
5902
Bill Seurer703e8482015-06-09 14:39:47 +00005903static vector bool int __ATTRS_o_ai vec_sll(vector bool int __a,
5904 vector unsigned char __b) {
5905 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
5906 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005907}
5908
Bill Seurer703e8482015-06-09 14:39:47 +00005909static vector bool int __ATTRS_o_ai vec_sll(vector bool int __a,
5910 vector unsigned short __b) {
5911 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
5912 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005913}
5914
Bill Seurer703e8482015-06-09 14:39:47 +00005915static vector bool int __ATTRS_o_ai vec_sll(vector bool int __a,
5916 vector unsigned int __b) {
5917 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
5918 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005919}
5920
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005921/* vec_vsl */
5922
Bill Seurer703e8482015-06-09 14:39:47 +00005923static vector signed char __ATTRS_o_ai vec_vsl(vector signed char __a,
5924 vector unsigned char __b) {
5925 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
5926 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005927}
5928
Bill Seurer703e8482015-06-09 14:39:47 +00005929static vector signed char __ATTRS_o_ai vec_vsl(vector signed char __a,
5930 vector unsigned short __b) {
5931 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
5932 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005933}
5934
Bill Seurer703e8482015-06-09 14:39:47 +00005935static vector signed char __ATTRS_o_ai vec_vsl(vector signed char __a,
5936 vector unsigned int __b) {
5937 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
5938 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005939}
5940
Bill Seurer703e8482015-06-09 14:39:47 +00005941static vector unsigned char __ATTRS_o_ai vec_vsl(vector unsigned char __a,
5942 vector unsigned char __b) {
5943 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
5944 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005945}
5946
Bill Seurer703e8482015-06-09 14:39:47 +00005947static vector unsigned char __ATTRS_o_ai vec_vsl(vector unsigned char __a,
5948 vector unsigned short __b) {
5949 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
5950 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005951}
5952
Bill Seurer703e8482015-06-09 14:39:47 +00005953static vector unsigned char __ATTRS_o_ai vec_vsl(vector unsigned char __a,
5954 vector unsigned int __b) {
5955 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
5956 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005957}
5958
Bill Seurer703e8482015-06-09 14:39:47 +00005959static vector bool char __ATTRS_o_ai vec_vsl(vector bool char __a,
5960 vector unsigned char __b) {
5961 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
5962 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005963}
5964
Bill Seurer703e8482015-06-09 14:39:47 +00005965static vector bool char __ATTRS_o_ai vec_vsl(vector bool char __a,
5966 vector unsigned short __b) {
5967 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
5968 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005969}
5970
Bill Seurer703e8482015-06-09 14:39:47 +00005971static vector bool char __ATTRS_o_ai vec_vsl(vector bool char __a,
5972 vector unsigned int __b) {
5973 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
5974 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005975}
5976
Bill Seurer703e8482015-06-09 14:39:47 +00005977static vector short __ATTRS_o_ai vec_vsl(vector short __a,
5978 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005979 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005980}
5981
Bill Seurer703e8482015-06-09 14:39:47 +00005982static vector short __ATTRS_o_ai vec_vsl(vector short __a,
5983 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005984 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005985}
5986
Bill Seurer703e8482015-06-09 14:39:47 +00005987static vector short __ATTRS_o_ai vec_vsl(vector short __a,
5988 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005989 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005990}
5991
Bill Seurer703e8482015-06-09 14:39:47 +00005992static vector unsigned short __ATTRS_o_ai vec_vsl(vector unsigned short __a,
5993 vector unsigned char __b) {
5994 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
5995 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005996}
5997
Bill Seurer703e8482015-06-09 14:39:47 +00005998static vector unsigned short __ATTRS_o_ai vec_vsl(vector unsigned short __a,
5999 vector unsigned short __b) {
6000 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
6001 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006002}
6003
Bill Seurer703e8482015-06-09 14:39:47 +00006004static vector unsigned short __ATTRS_o_ai vec_vsl(vector unsigned short __a,
6005 vector unsigned int __b) {
6006 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
6007 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006008}
6009
Bill Seurer703e8482015-06-09 14:39:47 +00006010static vector bool short __ATTRS_o_ai vec_vsl(vector bool short __a,
6011 vector unsigned char __b) {
6012 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
6013 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006014}
6015
Bill Seurer703e8482015-06-09 14:39:47 +00006016static vector bool short __ATTRS_o_ai vec_vsl(vector bool short __a,
6017 vector unsigned short __b) {
6018 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
6019 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006020}
6021
Bill Seurer703e8482015-06-09 14:39:47 +00006022static vector bool short __ATTRS_o_ai vec_vsl(vector bool short __a,
6023 vector unsigned int __b) {
6024 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
6025 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006026}
6027
Bill Seurer703e8482015-06-09 14:39:47 +00006028static vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
6029 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006030 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006031}
6032
Bill Seurer703e8482015-06-09 14:39:47 +00006033static vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
6034 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006035 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006036}
6037
Bill Seurer703e8482015-06-09 14:39:47 +00006038static vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
6039 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006040 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006041}
6042
Bill Seurer703e8482015-06-09 14:39:47 +00006043static vector int __ATTRS_o_ai vec_vsl(vector int __a,
6044 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006045 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006046}
6047
Bill Seurer703e8482015-06-09 14:39:47 +00006048static vector int __ATTRS_o_ai vec_vsl(vector int __a,
6049 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006050 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006051}
6052
Bill Seurer703e8482015-06-09 14:39:47 +00006053static vector int __ATTRS_o_ai vec_vsl(vector int __a,
6054 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006055 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006056}
6057
Bill Seurer703e8482015-06-09 14:39:47 +00006058static vector unsigned int __ATTRS_o_ai vec_vsl(vector unsigned int __a,
6059 vector unsigned char __b) {
6060 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
6061 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006062}
6063
Bill Seurer703e8482015-06-09 14:39:47 +00006064static vector unsigned int __ATTRS_o_ai vec_vsl(vector unsigned int __a,
6065 vector unsigned short __b) {
6066 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
6067 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006068}
6069
Bill Seurer703e8482015-06-09 14:39:47 +00006070static vector unsigned int __ATTRS_o_ai vec_vsl(vector unsigned int __a,
6071 vector unsigned int __b) {
6072 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
6073 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006074}
6075
Bill Seurer703e8482015-06-09 14:39:47 +00006076static vector bool int __ATTRS_o_ai vec_vsl(vector bool int __a,
6077 vector unsigned char __b) {
6078 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
6079 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006080}
6081
Bill Seurer703e8482015-06-09 14:39:47 +00006082static vector bool int __ATTRS_o_ai vec_vsl(vector bool int __a,
6083 vector unsigned short __b) {
6084 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
6085 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006086}
6087
Bill Seurer703e8482015-06-09 14:39:47 +00006088static vector bool int __ATTRS_o_ai vec_vsl(vector bool int __a,
6089 vector unsigned int __b) {
6090 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
6091 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006092}
6093
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006094/* vec_slo */
6095
Bill Seurer703e8482015-06-09 14:39:47 +00006096static vector signed char __ATTRS_o_ai vec_slo(vector signed char __a,
6097 vector signed char __b) {
6098 return (vector signed char)__builtin_altivec_vslo((vector int)__a,
6099 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006100}
6101
Bill Seurer703e8482015-06-09 14:39:47 +00006102static vector signed char __ATTRS_o_ai vec_slo(vector signed char __a,
6103 vector unsigned char __b) {
6104 return (vector signed char)__builtin_altivec_vslo((vector int)__a,
6105 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006106}
6107
Bill Seurer703e8482015-06-09 14:39:47 +00006108static vector unsigned char __ATTRS_o_ai vec_slo(vector unsigned char __a,
6109 vector signed char __b) {
6110 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
6111 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006112}
6113
Bill Seurer703e8482015-06-09 14:39:47 +00006114static vector unsigned char __ATTRS_o_ai vec_slo(vector unsigned char __a,
6115 vector unsigned char __b) {
6116 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
6117 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006118}
6119
Bill Seurer703e8482015-06-09 14:39:47 +00006120static vector short __ATTRS_o_ai vec_slo(vector short __a,
6121 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006122 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006123}
6124
Bill Seurer703e8482015-06-09 14:39:47 +00006125static vector short __ATTRS_o_ai vec_slo(vector short __a,
6126 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006127 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006128}
6129
Bill Seurer703e8482015-06-09 14:39:47 +00006130static vector unsigned short __ATTRS_o_ai vec_slo(vector unsigned short __a,
6131 vector signed char __b) {
6132 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
6133 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006134}
6135
Bill Seurer703e8482015-06-09 14:39:47 +00006136static vector unsigned short __ATTRS_o_ai vec_slo(vector unsigned short __a,
6137 vector unsigned char __b) {
6138 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
6139 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006140}
6141
Bill Seurer703e8482015-06-09 14:39:47 +00006142static vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
6143 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006144 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006145}
6146
Bill Seurer703e8482015-06-09 14:39:47 +00006147static vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
6148 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006149 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006150}
6151
Bill Seurer703e8482015-06-09 14:39:47 +00006152static vector int __ATTRS_o_ai vec_slo(vector int __a, vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006153 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006154}
6155
Bill Seurer703e8482015-06-09 14:39:47 +00006156static vector int __ATTRS_o_ai vec_slo(vector int __a,
6157 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006158 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006159}
6160
Bill Seurer703e8482015-06-09 14:39:47 +00006161static vector unsigned int __ATTRS_o_ai vec_slo(vector unsigned int __a,
6162 vector signed char __b) {
6163 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
6164 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006165}
6166
Bill Seurer703e8482015-06-09 14:39:47 +00006167static vector unsigned int __ATTRS_o_ai vec_slo(vector unsigned int __a,
6168 vector unsigned char __b) {
6169 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
6170 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006171}
6172
Bill Seurer703e8482015-06-09 14:39:47 +00006173static vector float __ATTRS_o_ai vec_slo(vector float __a,
6174 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006175 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006176}
6177
Bill Seurer703e8482015-06-09 14:39:47 +00006178static vector float __ATTRS_o_ai vec_slo(vector float __a,
6179 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006180 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006181}
6182
6183/* vec_vslo */
6184
Bill Seurer703e8482015-06-09 14:39:47 +00006185static vector signed char __ATTRS_o_ai vec_vslo(vector signed char __a,
6186 vector signed char __b) {
6187 return (vector signed char)__builtin_altivec_vslo((vector int)__a,
6188 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006189}
6190
Bill Seurer703e8482015-06-09 14:39:47 +00006191static vector signed char __ATTRS_o_ai vec_vslo(vector signed char __a,
6192 vector unsigned char __b) {
6193 return (vector signed char)__builtin_altivec_vslo((vector int)__a,
6194 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006195}
6196
Bill Seurer703e8482015-06-09 14:39:47 +00006197static vector unsigned char __ATTRS_o_ai vec_vslo(vector unsigned char __a,
6198 vector signed char __b) {
6199 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
6200 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006201}
6202
Bill Seurer703e8482015-06-09 14:39:47 +00006203static vector unsigned char __ATTRS_o_ai vec_vslo(vector unsigned char __a,
6204 vector unsigned char __b) {
6205 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
6206 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006207}
6208
Bill Seurer703e8482015-06-09 14:39:47 +00006209static vector short __ATTRS_o_ai vec_vslo(vector short __a,
6210 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006211 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006212}
6213
Bill Seurer703e8482015-06-09 14:39:47 +00006214static vector short __ATTRS_o_ai vec_vslo(vector short __a,
6215 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006216 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006217}
6218
Bill Seurer703e8482015-06-09 14:39:47 +00006219static vector unsigned short __ATTRS_o_ai vec_vslo(vector unsigned short __a,
6220 vector signed char __b) {
6221 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
6222 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006223}
6224
Bill Seurer703e8482015-06-09 14:39:47 +00006225static vector unsigned short __ATTRS_o_ai vec_vslo(vector unsigned short __a,
6226 vector unsigned char __b) {
6227 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
6228 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006229}
6230
Bill Seurer703e8482015-06-09 14:39:47 +00006231static vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
6232 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006233 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006234}
6235
Bill Seurer703e8482015-06-09 14:39:47 +00006236static vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
6237 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006238 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006239}
6240
Bill Seurer703e8482015-06-09 14:39:47 +00006241static vector int __ATTRS_o_ai vec_vslo(vector int __a,
6242 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006243 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006244}
6245
Bill Seurer703e8482015-06-09 14:39:47 +00006246static vector int __ATTRS_o_ai vec_vslo(vector int __a,
6247 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006248 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006249}
6250
Bill Seurer703e8482015-06-09 14:39:47 +00006251static vector unsigned int __ATTRS_o_ai vec_vslo(vector unsigned int __a,
6252 vector signed char __b) {
6253 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
6254 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006255}
6256
Bill Seurer703e8482015-06-09 14:39:47 +00006257static vector unsigned int __ATTRS_o_ai vec_vslo(vector unsigned int __a,
6258 vector unsigned char __b) {
6259 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
6260 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006261}
6262
Bill Seurer703e8482015-06-09 14:39:47 +00006263static vector float __ATTRS_o_ai vec_vslo(vector float __a,
6264 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006265 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006266}
6267
Bill Seurer703e8482015-06-09 14:39:47 +00006268static vector float __ATTRS_o_ai vec_vslo(vector float __a,
6269 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006270 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006271}
6272
6273/* vec_splat */
6274
Bill Seurer703e8482015-06-09 14:39:47 +00006275static vector signed char __ATTRS_o_ai vec_splat(vector signed char __a,
6276 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006277 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006278}
6279
Bill Seurer703e8482015-06-09 14:39:47 +00006280static vector unsigned char __ATTRS_o_ai vec_splat(vector unsigned char __a,
6281 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006282 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Yartsev9e968982010-08-19 03:00:09 +00006283}
6284
Bill Seurer703e8482015-06-09 14:39:47 +00006285static vector bool char __ATTRS_o_ai vec_splat(vector bool char __a,
6286 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006287 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006288}
6289
Bill Seurer703e8482015-06-09 14:39:47 +00006290static vector short __ATTRS_o_ai vec_splat(vector short __a,
6291 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006292 __b *= 2;
Bill Seurer703e8482015-06-09 14:39:47 +00006293 unsigned char b1 = __b + 1;
6294 return vec_perm(__a, __a,
6295 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
6296 __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006297}
6298
Bill Seurer703e8482015-06-09 14:39:47 +00006299static vector unsigned short __ATTRS_o_ai vec_splat(vector unsigned short __a,
6300 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006301 __b *= 2;
Bill Seurer703e8482015-06-09 14:39:47 +00006302 unsigned char b1 = __b + 1;
6303 return vec_perm(__a, __a,
6304 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
6305 __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00006306}
6307
Bill Seurer703e8482015-06-09 14:39:47 +00006308static vector bool short __ATTRS_o_ai vec_splat(vector bool short __a,
6309 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006310 __b *= 2;
Bill Seurer703e8482015-06-09 14:39:47 +00006311 unsigned char b1 = __b + 1;
6312 return vec_perm(__a, __a,
6313 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
6314 __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00006315}
6316
Bill Seurer703e8482015-06-09 14:39:47 +00006317static vector pixel __ATTRS_o_ai vec_splat(vector pixel __a,
6318 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006319 __b *= 2;
Bill Seurer703e8482015-06-09 14:39:47 +00006320 unsigned char b1 = __b + 1;
6321 return vec_perm(__a, __a,
6322 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
6323 __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006324}
6325
Bill Seurer703e8482015-06-09 14:39:47 +00006326static vector int __ATTRS_o_ai vec_splat(vector int __a, unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006327 __b *= 4;
Bill Seurer703e8482015-06-09 14:39:47 +00006328 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
6329 return vec_perm(__a, __a,
6330 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
6331 b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006332}
6333
Bill Seurer703e8482015-06-09 14:39:47 +00006334static vector unsigned int __ATTRS_o_ai vec_splat(vector unsigned int __a,
6335 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006336 __b *= 4;
Bill Seurer703e8482015-06-09 14:39:47 +00006337 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
6338 return vec_perm(__a, __a,
6339 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
6340 b1, b2, b3, __b, b1, b2, b3));
Anton Yartsev9e968982010-08-19 03:00:09 +00006341}
6342
Bill Seurer703e8482015-06-09 14:39:47 +00006343static vector bool int __ATTRS_o_ai vec_splat(vector bool int __a,
6344 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006345 __b *= 4;
Bill Seurer703e8482015-06-09 14:39:47 +00006346 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
6347 return vec_perm(__a, __a,
6348 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
6349 b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006350}
6351
Bill Seurer703e8482015-06-09 14:39:47 +00006352static vector float __ATTRS_o_ai vec_splat(vector float __a,
6353 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006354 __b *= 4;
Bill Seurer703e8482015-06-09 14:39:47 +00006355 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
6356 return vec_perm(__a, __a,
6357 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
6358 b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006359}
6360
6361/* vec_vspltb */
6362
6363#define __builtin_altivec_vspltb vec_vspltb
6364
Bill Seurer703e8482015-06-09 14:39:47 +00006365static vector signed char __ATTRS_o_ai vec_vspltb(vector signed char __a,
6366 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006367 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006368}
6369
Bill Seurer703e8482015-06-09 14:39:47 +00006370static vector unsigned char __ATTRS_o_ai vec_vspltb(vector unsigned char __a,
6371 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006372 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Yartsev9e968982010-08-19 03:00:09 +00006373}
6374
Bill Seurer703e8482015-06-09 14:39:47 +00006375static vector bool char __ATTRS_o_ai vec_vspltb(vector bool char __a,
6376 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006377 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006378}
6379
6380/* vec_vsplth */
6381
6382#define __builtin_altivec_vsplth vec_vsplth
6383
Bill Seurer703e8482015-06-09 14:39:47 +00006384static vector short __ATTRS_o_ai vec_vsplth(vector short __a,
6385 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006386 __b *= 2;
Bill Seurer703e8482015-06-09 14:39:47 +00006387 unsigned char b1 = __b + 1;
6388 return vec_perm(__a, __a,
6389 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
6390 __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006391}
6392
Bill Seurer703e8482015-06-09 14:39:47 +00006393static vector unsigned short __ATTRS_o_ai vec_vsplth(vector unsigned short __a,
6394 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006395 __b *= 2;
Bill Seurer703e8482015-06-09 14:39:47 +00006396 unsigned char b1 = __b + 1;
6397 return vec_perm(__a, __a,
6398 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
6399 __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00006400}
6401
Bill Seurer703e8482015-06-09 14:39:47 +00006402static vector bool short __ATTRS_o_ai vec_vsplth(vector bool short __a,
6403 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006404 __b *= 2;
Bill Seurer703e8482015-06-09 14:39:47 +00006405 unsigned char b1 = __b + 1;
6406 return vec_perm(__a, __a,
6407 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
6408 __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00006409}
6410
Bill Seurer703e8482015-06-09 14:39:47 +00006411static vector pixel __ATTRS_o_ai vec_vsplth(vector pixel __a,
6412 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006413 __b *= 2;
Bill Seurer703e8482015-06-09 14:39:47 +00006414 unsigned char b1 = __b + 1;
6415 return vec_perm(__a, __a,
6416 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
6417 __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006418}
6419
6420/* vec_vspltw */
6421
6422#define __builtin_altivec_vspltw vec_vspltw
6423
Bill Seurer703e8482015-06-09 14:39:47 +00006424static vector int __ATTRS_o_ai vec_vspltw(vector int __a, unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006425 __b *= 4;
Bill Seurer703e8482015-06-09 14:39:47 +00006426 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
6427 return vec_perm(__a, __a,
6428 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
6429 b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006430}
6431
Bill Seurer703e8482015-06-09 14:39:47 +00006432static vector unsigned int __ATTRS_o_ai vec_vspltw(vector unsigned int __a,
6433 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006434 __b *= 4;
Bill Seurer703e8482015-06-09 14:39:47 +00006435 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
6436 return vec_perm(__a, __a,
6437 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
6438 b1, b2, b3, __b, b1, b2, b3));
Anton Yartsev9e968982010-08-19 03:00:09 +00006439}
6440
Bill Seurer703e8482015-06-09 14:39:47 +00006441static vector bool int __ATTRS_o_ai vec_vspltw(vector bool int __a,
6442 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006443 __b *= 4;
Bill Seurer703e8482015-06-09 14:39:47 +00006444 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
6445 return vec_perm(__a, __a,
6446 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
6447 b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006448}
6449
Bill Seurer703e8482015-06-09 14:39:47 +00006450static vector float __ATTRS_o_ai vec_vspltw(vector float __a,
6451 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006452 __b *= 4;
Bill Seurer703e8482015-06-09 14:39:47 +00006453 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
6454 return vec_perm(__a, __a,
6455 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
6456 b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006457}
6458
6459/* vec_splat_s8 */
6460
6461#define __builtin_altivec_vspltisb vec_splat_s8
6462
6463// FIXME: parameter should be treated as 5-bit signed literal
Bill Seurer703e8482015-06-09 14:39:47 +00006464static vector signed char __ATTRS_o_ai vec_splat_s8(signed char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006465 return (vector signed char)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006466}
6467
6468/* vec_vspltisb */
6469
6470// FIXME: parameter should be treated as 5-bit signed literal
Bill Seurer703e8482015-06-09 14:39:47 +00006471static vector signed char __ATTRS_o_ai vec_vspltisb(signed char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006472 return (vector signed char)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006473}
6474
6475/* vec_splat_s16 */
6476
6477#define __builtin_altivec_vspltish vec_splat_s16
6478
6479// FIXME: parameter should be treated as 5-bit signed literal
Bill Seurer703e8482015-06-09 14:39:47 +00006480static vector short __ATTRS_o_ai vec_splat_s16(signed char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006481 return (vector short)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006482}
6483
6484/* vec_vspltish */
6485
6486// FIXME: parameter should be treated as 5-bit signed literal
Bill Seurer703e8482015-06-09 14:39:47 +00006487static vector short __ATTRS_o_ai vec_vspltish(signed char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006488 return (vector short)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006489}
6490
6491/* vec_splat_s32 */
6492
6493#define __builtin_altivec_vspltisw vec_splat_s32
6494
6495// FIXME: parameter should be treated as 5-bit signed literal
Bill Seurer703e8482015-06-09 14:39:47 +00006496static vector int __ATTRS_o_ai vec_splat_s32(signed char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006497 return (vector int)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006498}
6499
6500/* vec_vspltisw */
6501
6502// FIXME: parameter should be treated as 5-bit signed literal
Bill Seurer703e8482015-06-09 14:39:47 +00006503static vector int __ATTRS_o_ai vec_vspltisw(signed char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006504 return (vector int)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006505}
6506
6507/* vec_splat_u8 */
6508
6509// FIXME: parameter should be treated as 5-bit signed literal
Bill Seurer703e8482015-06-09 14:39:47 +00006510static vector unsigned char __ATTRS_o_ai vec_splat_u8(unsigned char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006511 return (vector unsigned char)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006512}
6513
6514/* vec_splat_u16 */
6515
6516// FIXME: parameter should be treated as 5-bit signed literal
Bill Seurer703e8482015-06-09 14:39:47 +00006517static vector unsigned short __ATTRS_o_ai vec_splat_u16(signed char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006518 return (vector unsigned short)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006519}
6520
6521/* vec_splat_u32 */
6522
6523// FIXME: parameter should be treated as 5-bit signed literal
Bill Seurer703e8482015-06-09 14:39:47 +00006524static vector unsigned int __ATTRS_o_ai vec_splat_u32(signed char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006525 return (vector unsigned int)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006526}
6527
6528/* vec_sr */
6529
Bill Seurer703e8482015-06-09 14:39:47 +00006530static vector signed char __ATTRS_o_ai vec_sr(vector signed char __a,
6531 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006532 return __a >> (vector signed char)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006533}
6534
Bill Seurer703e8482015-06-09 14:39:47 +00006535static vector unsigned char __ATTRS_o_ai vec_sr(vector unsigned char __a,
6536 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006537 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006538}
6539
Bill Seurer703e8482015-06-09 14:39:47 +00006540static vector short __ATTRS_o_ai vec_sr(vector short __a,
6541 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006542 return __a >> (vector short)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006543}
6544
Bill Seurer703e8482015-06-09 14:39:47 +00006545static vector unsigned short __ATTRS_o_ai vec_sr(vector unsigned short __a,
6546 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006547 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006548}
6549
Bill Seurer703e8482015-06-09 14:39:47 +00006550static vector int __ATTRS_o_ai vec_sr(vector int __a, vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006551 return __a >> (vector int)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006552}
6553
Bill Seurer703e8482015-06-09 14:39:47 +00006554static vector unsigned int __ATTRS_o_ai vec_sr(vector unsigned int __a,
6555 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006556 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006557}
6558
Kit Barton8553bec2015-03-11 15:57:19 +00006559#ifdef __POWER8_VECTOR__
6560static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00006561vec_sr(vector signed long long __a, vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00006562 return __a >> (vector long long)__b;
6563}
6564
6565static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00006566vec_sr(vector unsigned long long __a, vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00006567 return __a >> __b;
6568}
6569#endif
6570
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006571/* vec_vsrb */
6572
6573#define __builtin_altivec_vsrb vec_vsrb
6574
Bill Seurer703e8482015-06-09 14:39:47 +00006575static vector signed char __ATTRS_o_ai vec_vsrb(vector signed char __a,
6576 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006577 return __a >> (vector signed char)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006578}
6579
Bill Seurer703e8482015-06-09 14:39:47 +00006580static vector unsigned char __ATTRS_o_ai vec_vsrb(vector unsigned char __a,
6581 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006582 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006583}
6584
6585/* vec_vsrh */
6586
6587#define __builtin_altivec_vsrh vec_vsrh
6588
Bill Seurer703e8482015-06-09 14:39:47 +00006589static vector short __ATTRS_o_ai vec_vsrh(vector short __a,
6590 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006591 return __a >> (vector short)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006592}
6593
Bill Seurer703e8482015-06-09 14:39:47 +00006594static vector unsigned short __ATTRS_o_ai vec_vsrh(vector unsigned short __a,
6595 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006596 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006597}
6598
6599/* vec_vsrw */
6600
6601#define __builtin_altivec_vsrw vec_vsrw
6602
Bill Seurer703e8482015-06-09 14:39:47 +00006603static vector int __ATTRS_o_ai vec_vsrw(vector int __a,
6604 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006605 return __a >> (vector int)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006606}
6607
Bill Seurer703e8482015-06-09 14:39:47 +00006608static vector unsigned int __ATTRS_o_ai vec_vsrw(vector unsigned int __a,
6609 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006610 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006611}
6612
6613/* vec_sra */
6614
Bill Seurer703e8482015-06-09 14:39:47 +00006615static vector signed char __ATTRS_o_ai vec_sra(vector signed char __a,
6616 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006617 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006618}
6619
Bill Seurer703e8482015-06-09 14:39:47 +00006620static vector unsigned char __ATTRS_o_ai vec_sra(vector unsigned char __a,
6621 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006622 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006623}
6624
Bill Seurer703e8482015-06-09 14:39:47 +00006625static vector short __ATTRS_o_ai vec_sra(vector short __a,
6626 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006627 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006628}
6629
Bill Seurer703e8482015-06-09 14:39:47 +00006630static vector unsigned short __ATTRS_o_ai vec_sra(vector unsigned short __a,
6631 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006632 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006633}
6634
Bill Seurer703e8482015-06-09 14:39:47 +00006635static vector int __ATTRS_o_ai vec_sra(vector int __a,
6636 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006637 return __builtin_altivec_vsraw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006638}
6639
Bill Seurer703e8482015-06-09 14:39:47 +00006640static vector unsigned int __ATTRS_o_ai vec_sra(vector unsigned int __a,
6641 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006642 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006643}
6644
Kit Barton8553bec2015-03-11 15:57:19 +00006645#ifdef __POWER8_VECTOR__
6646static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00006647vec_sra(vector signed long long __a, vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00006648 return __a >> __b;
6649}
6650
6651static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00006652vec_sra(vector unsigned long long __a, vector unsigned long long __b) {
6653 return (vector unsigned long long)((vector signed long long)__a >> __b);
Kit Barton8553bec2015-03-11 15:57:19 +00006654}
6655#endif
6656
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006657/* vec_vsrab */
6658
Bill Seurer703e8482015-06-09 14:39:47 +00006659static vector signed char __ATTRS_o_ai vec_vsrab(vector signed char __a,
6660 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006661 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006662}
6663
Bill Seurer703e8482015-06-09 14:39:47 +00006664static vector unsigned char __ATTRS_o_ai vec_vsrab(vector unsigned char __a,
6665 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006666 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006667}
6668
6669/* vec_vsrah */
6670
Bill Seurer703e8482015-06-09 14:39:47 +00006671static vector short __ATTRS_o_ai vec_vsrah(vector short __a,
6672 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006673 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006674}
6675
Bill Seurer703e8482015-06-09 14:39:47 +00006676static vector unsigned short __ATTRS_o_ai vec_vsrah(vector unsigned short __a,
6677 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006678 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006679}
6680
6681/* vec_vsraw */
6682
Bill Seurer703e8482015-06-09 14:39:47 +00006683static vector int __ATTRS_o_ai vec_vsraw(vector int __a,
6684 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006685 return __builtin_altivec_vsraw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006686}
6687
Bill Seurer703e8482015-06-09 14:39:47 +00006688static vector unsigned int __ATTRS_o_ai vec_vsraw(vector unsigned int __a,
6689 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006690 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006691}
6692
6693/* vec_srl */
6694
Bill Seurer703e8482015-06-09 14:39:47 +00006695static vector signed char __ATTRS_o_ai vec_srl(vector signed char __a,
6696 vector unsigned char __b) {
6697 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
6698 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006699}
6700
Bill Seurer703e8482015-06-09 14:39:47 +00006701static vector signed char __ATTRS_o_ai vec_srl(vector signed char __a,
6702 vector unsigned short __b) {
6703 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
6704 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006705}
6706
Bill Seurer703e8482015-06-09 14:39:47 +00006707static vector signed char __ATTRS_o_ai vec_srl(vector signed char __a,
6708 vector unsigned int __b) {
6709 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
6710 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006711}
6712
Bill Seurer703e8482015-06-09 14:39:47 +00006713static vector unsigned char __ATTRS_o_ai vec_srl(vector unsigned char __a,
6714 vector unsigned char __b) {
6715 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
6716 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006717}
6718
Bill Seurer703e8482015-06-09 14:39:47 +00006719static vector unsigned char __ATTRS_o_ai vec_srl(vector unsigned char __a,
6720 vector unsigned short __b) {
6721 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
6722 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006723}
6724
Bill Seurer703e8482015-06-09 14:39:47 +00006725static vector unsigned char __ATTRS_o_ai vec_srl(vector unsigned char __a,
6726 vector unsigned int __b) {
6727 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
6728 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006729}
6730
Bill Seurer703e8482015-06-09 14:39:47 +00006731static vector bool char __ATTRS_o_ai vec_srl(vector bool char __a,
6732 vector unsigned char __b) {
6733 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
6734 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006735}
6736
Bill Seurer703e8482015-06-09 14:39:47 +00006737static vector bool char __ATTRS_o_ai vec_srl(vector bool char __a,
6738 vector unsigned short __b) {
6739 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
6740 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006741}
6742
Bill Seurer703e8482015-06-09 14:39:47 +00006743static vector bool char __ATTRS_o_ai vec_srl(vector bool char __a,
6744 vector unsigned int __b) {
6745 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
6746 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006747}
6748
Bill Seurer703e8482015-06-09 14:39:47 +00006749static vector short __ATTRS_o_ai vec_srl(vector short __a,
6750 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006751 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006752}
6753
Bill Seurer703e8482015-06-09 14:39:47 +00006754static vector short __ATTRS_o_ai vec_srl(vector short __a,
6755 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006756 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006757}
6758
Bill Seurer703e8482015-06-09 14:39:47 +00006759static vector short __ATTRS_o_ai vec_srl(vector short __a,
6760 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006761 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006762}
6763
Bill Seurer703e8482015-06-09 14:39:47 +00006764static vector unsigned short __ATTRS_o_ai vec_srl(vector unsigned short __a,
6765 vector unsigned char __b) {
6766 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
6767 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006768}
6769
Bill Seurer703e8482015-06-09 14:39:47 +00006770static vector unsigned short __ATTRS_o_ai vec_srl(vector unsigned short __a,
6771 vector unsigned short __b) {
6772 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
6773 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006774}
6775
Bill Seurer703e8482015-06-09 14:39:47 +00006776static vector unsigned short __ATTRS_o_ai vec_srl(vector unsigned short __a,
6777 vector unsigned int __b) {
6778 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
6779 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006780}
6781
Bill Seurer703e8482015-06-09 14:39:47 +00006782static vector bool short __ATTRS_o_ai vec_srl(vector bool short __a,
6783 vector unsigned char __b) {
6784 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
6785 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006786}
6787
Bill Seurer703e8482015-06-09 14:39:47 +00006788static vector bool short __ATTRS_o_ai vec_srl(vector bool short __a,
6789 vector unsigned short __b) {
6790 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
6791 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006792}
6793
Bill Seurer703e8482015-06-09 14:39:47 +00006794static vector bool short __ATTRS_o_ai vec_srl(vector bool short __a,
6795 vector unsigned int __b) {
6796 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
6797 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006798}
6799
Bill Seurer703e8482015-06-09 14:39:47 +00006800static vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
6801 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006802 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006803}
6804
Bill Seurer703e8482015-06-09 14:39:47 +00006805static vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
6806 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006807 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006808}
6809
Bill Seurer703e8482015-06-09 14:39:47 +00006810static vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
6811 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006812 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006813}
6814
Bill Seurer703e8482015-06-09 14:39:47 +00006815static vector int __ATTRS_o_ai vec_srl(vector int __a,
6816 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006817 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006818}
6819
Bill Seurer703e8482015-06-09 14:39:47 +00006820static vector int __ATTRS_o_ai vec_srl(vector int __a,
6821 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006822 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006823}
6824
Bill Seurer703e8482015-06-09 14:39:47 +00006825static vector int __ATTRS_o_ai vec_srl(vector int __a,
6826 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006827 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006828}
6829
Bill Seurer703e8482015-06-09 14:39:47 +00006830static vector unsigned int __ATTRS_o_ai vec_srl(vector unsigned int __a,
6831 vector unsigned char __b) {
6832 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
6833 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006834}
6835
Bill Seurer703e8482015-06-09 14:39:47 +00006836static vector unsigned int __ATTRS_o_ai vec_srl(vector unsigned int __a,
6837 vector unsigned short __b) {
6838 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
6839 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006840}
6841
Bill Seurer703e8482015-06-09 14:39:47 +00006842static vector unsigned int __ATTRS_o_ai vec_srl(vector unsigned int __a,
6843 vector unsigned int __b) {
6844 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
6845 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006846}
6847
Bill Seurer703e8482015-06-09 14:39:47 +00006848static vector bool int __ATTRS_o_ai vec_srl(vector bool int __a,
6849 vector unsigned char __b) {
6850 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
6851 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006852}
6853
Bill Seurer703e8482015-06-09 14:39:47 +00006854static vector bool int __ATTRS_o_ai vec_srl(vector bool int __a,
6855 vector unsigned short __b) {
6856 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
6857 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006858}
6859
Bill Seurer703e8482015-06-09 14:39:47 +00006860static vector bool int __ATTRS_o_ai vec_srl(vector bool int __a,
6861 vector unsigned int __b) {
6862 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
6863 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006864}
6865
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006866/* vec_vsr */
6867
Bill Seurer703e8482015-06-09 14:39:47 +00006868static vector signed char __ATTRS_o_ai vec_vsr(vector signed char __a,
6869 vector unsigned char __b) {
6870 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
6871 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006872}
6873
Bill Seurer703e8482015-06-09 14:39:47 +00006874static vector signed char __ATTRS_o_ai vec_vsr(vector signed char __a,
6875 vector unsigned short __b) {
6876 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
6877 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006878}
6879
Bill Seurer703e8482015-06-09 14:39:47 +00006880static vector signed char __ATTRS_o_ai vec_vsr(vector signed char __a,
6881 vector unsigned int __b) {
6882 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
6883 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006884}
6885
Bill Seurer703e8482015-06-09 14:39:47 +00006886static vector unsigned char __ATTRS_o_ai vec_vsr(vector unsigned char __a,
6887 vector unsigned char __b) {
6888 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
6889 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006890}
6891
Bill Seurer703e8482015-06-09 14:39:47 +00006892static vector unsigned char __ATTRS_o_ai vec_vsr(vector unsigned char __a,
6893 vector unsigned short __b) {
6894 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
6895 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006896}
6897
Bill Seurer703e8482015-06-09 14:39:47 +00006898static vector unsigned char __ATTRS_o_ai vec_vsr(vector unsigned char __a,
6899 vector unsigned int __b) {
6900 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
6901 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006902}
6903
Bill Seurer703e8482015-06-09 14:39:47 +00006904static vector bool char __ATTRS_o_ai vec_vsr(vector bool char __a,
6905 vector unsigned char __b) {
6906 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
6907 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006908}
6909
Bill Seurer703e8482015-06-09 14:39:47 +00006910static vector bool char __ATTRS_o_ai vec_vsr(vector bool char __a,
6911 vector unsigned short __b) {
6912 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
6913 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006914}
6915
Bill Seurer703e8482015-06-09 14:39:47 +00006916static vector bool char __ATTRS_o_ai vec_vsr(vector bool char __a,
6917 vector unsigned int __b) {
6918 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
6919 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006920}
6921
Bill Seurer703e8482015-06-09 14:39:47 +00006922static vector short __ATTRS_o_ai vec_vsr(vector short __a,
6923 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006924 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006925}
6926
Bill Seurer703e8482015-06-09 14:39:47 +00006927static vector short __ATTRS_o_ai vec_vsr(vector short __a,
6928 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006929 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006930}
6931
Bill Seurer703e8482015-06-09 14:39:47 +00006932static vector short __ATTRS_o_ai vec_vsr(vector short __a,
6933 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006934 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006935}
6936
Bill Seurer703e8482015-06-09 14:39:47 +00006937static vector unsigned short __ATTRS_o_ai vec_vsr(vector unsigned short __a,
6938 vector unsigned char __b) {
6939 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
6940 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006941}
6942
Bill Seurer703e8482015-06-09 14:39:47 +00006943static vector unsigned short __ATTRS_o_ai vec_vsr(vector unsigned short __a,
6944 vector unsigned short __b) {
6945 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
6946 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006947}
6948
Bill Seurer703e8482015-06-09 14:39:47 +00006949static vector unsigned short __ATTRS_o_ai vec_vsr(vector unsigned short __a,
6950 vector unsigned int __b) {
6951 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
6952 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006953}
6954
Bill Seurer703e8482015-06-09 14:39:47 +00006955static vector bool short __ATTRS_o_ai vec_vsr(vector bool short __a,
6956 vector unsigned char __b) {
6957 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
6958 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006959}
6960
Bill Seurer703e8482015-06-09 14:39:47 +00006961static vector bool short __ATTRS_o_ai vec_vsr(vector bool short __a,
6962 vector unsigned short __b) {
6963 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
6964 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006965}
6966
Bill Seurer703e8482015-06-09 14:39:47 +00006967static vector bool short __ATTRS_o_ai vec_vsr(vector bool short __a,
6968 vector unsigned int __b) {
6969 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
6970 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006971}
6972
Bill Seurer703e8482015-06-09 14:39:47 +00006973static vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
6974 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006975 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006976}
6977
Bill Seurer703e8482015-06-09 14:39:47 +00006978static vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
6979 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006980 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006981}
6982
Bill Seurer703e8482015-06-09 14:39:47 +00006983static vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
6984 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006985 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006986}
6987
Bill Seurer703e8482015-06-09 14:39:47 +00006988static vector int __ATTRS_o_ai vec_vsr(vector int __a,
6989 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006990 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006991}
6992
Bill Seurer703e8482015-06-09 14:39:47 +00006993static vector int __ATTRS_o_ai vec_vsr(vector int __a,
6994 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006995 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006996}
6997
Bill Seurer703e8482015-06-09 14:39:47 +00006998static vector int __ATTRS_o_ai vec_vsr(vector int __a,
6999 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007000 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007001}
7002
Bill Seurer703e8482015-06-09 14:39:47 +00007003static vector unsigned int __ATTRS_o_ai vec_vsr(vector unsigned int __a,
7004 vector unsigned char __b) {
7005 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
7006 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007007}
7008
Bill Seurer703e8482015-06-09 14:39:47 +00007009static vector unsigned int __ATTRS_o_ai vec_vsr(vector unsigned int __a,
7010 vector unsigned short __b) {
7011 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
7012 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007013}
7014
Bill Seurer703e8482015-06-09 14:39:47 +00007015static vector unsigned int __ATTRS_o_ai vec_vsr(vector unsigned int __a,
7016 vector unsigned int __b) {
7017 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
7018 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007019}
7020
Bill Seurer703e8482015-06-09 14:39:47 +00007021static vector bool int __ATTRS_o_ai vec_vsr(vector bool int __a,
7022 vector unsigned char __b) {
7023 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
7024 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007025}
7026
Bill Seurer703e8482015-06-09 14:39:47 +00007027static vector bool int __ATTRS_o_ai vec_vsr(vector bool int __a,
7028 vector unsigned short __b) {
7029 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
7030 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007031}
7032
Bill Seurer703e8482015-06-09 14:39:47 +00007033static vector bool int __ATTRS_o_ai vec_vsr(vector bool int __a,
7034 vector unsigned int __b) {
7035 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
7036 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007037}
7038
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007039/* vec_sro */
7040
Bill Seurer703e8482015-06-09 14:39:47 +00007041static vector signed char __ATTRS_o_ai vec_sro(vector signed char __a,
7042 vector signed char __b) {
7043 return (vector signed char)__builtin_altivec_vsro((vector int)__a,
7044 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007045}
7046
Bill Seurer703e8482015-06-09 14:39:47 +00007047static vector signed char __ATTRS_o_ai vec_sro(vector signed char __a,
7048 vector unsigned char __b) {
7049 return (vector signed char)__builtin_altivec_vsro((vector int)__a,
7050 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007051}
7052
Bill Seurer703e8482015-06-09 14:39:47 +00007053static vector unsigned char __ATTRS_o_ai vec_sro(vector unsigned char __a,
7054 vector signed char __b) {
7055 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
7056 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007057}
7058
Bill Seurer703e8482015-06-09 14:39:47 +00007059static vector unsigned char __ATTRS_o_ai vec_sro(vector unsigned char __a,
7060 vector unsigned char __b) {
7061 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
7062 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007063}
7064
Bill Seurer703e8482015-06-09 14:39:47 +00007065static vector short __ATTRS_o_ai vec_sro(vector short __a,
7066 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007067 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007068}
7069
Bill Seurer703e8482015-06-09 14:39:47 +00007070static vector short __ATTRS_o_ai vec_sro(vector short __a,
7071 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007072 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007073}
7074
Bill Seurer703e8482015-06-09 14:39:47 +00007075static vector unsigned short __ATTRS_o_ai vec_sro(vector unsigned short __a,
7076 vector signed char __b) {
7077 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
7078 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007079}
7080
Bill Seurer703e8482015-06-09 14:39:47 +00007081static vector unsigned short __ATTRS_o_ai vec_sro(vector unsigned short __a,
7082 vector unsigned char __b) {
7083 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
7084 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007085}
7086
Bill Seurer703e8482015-06-09 14:39:47 +00007087static vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
7088 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007089 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007090}
7091
Bill Seurer703e8482015-06-09 14:39:47 +00007092static vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
7093 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007094 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007095}
7096
Bill Seurer703e8482015-06-09 14:39:47 +00007097static vector int __ATTRS_o_ai vec_sro(vector int __a, vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007098 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007099}
7100
Bill Seurer703e8482015-06-09 14:39:47 +00007101static vector int __ATTRS_o_ai vec_sro(vector int __a,
7102 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007103 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007104}
7105
Bill Seurer703e8482015-06-09 14:39:47 +00007106static vector unsigned int __ATTRS_o_ai vec_sro(vector unsigned int __a,
7107 vector signed char __b) {
7108 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
7109 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007110}
7111
Bill Seurer703e8482015-06-09 14:39:47 +00007112static vector unsigned int __ATTRS_o_ai vec_sro(vector unsigned int __a,
7113 vector unsigned char __b) {
7114 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
7115 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007116}
7117
Bill Seurer703e8482015-06-09 14:39:47 +00007118static vector float __ATTRS_o_ai vec_sro(vector float __a,
7119 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007120 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007121}
7122
Bill Seurer703e8482015-06-09 14:39:47 +00007123static vector float __ATTRS_o_ai vec_sro(vector float __a,
7124 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007125 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007126}
7127
7128/* vec_vsro */
7129
Bill Seurer703e8482015-06-09 14:39:47 +00007130static vector signed char __ATTRS_o_ai vec_vsro(vector signed char __a,
7131 vector signed char __b) {
7132 return (vector signed char)__builtin_altivec_vsro((vector int)__a,
7133 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007134}
7135
Bill Seurer703e8482015-06-09 14:39:47 +00007136static vector signed char __ATTRS_o_ai vec_vsro(vector signed char __a,
7137 vector unsigned char __b) {
7138 return (vector signed char)__builtin_altivec_vsro((vector int)__a,
7139 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007140}
7141
Bill Seurer703e8482015-06-09 14:39:47 +00007142static vector unsigned char __ATTRS_o_ai vec_vsro(vector unsigned char __a,
7143 vector signed char __b) {
7144 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
7145 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007146}
7147
Bill Seurer703e8482015-06-09 14:39:47 +00007148static vector unsigned char __ATTRS_o_ai vec_vsro(vector unsigned char __a,
7149 vector unsigned char __b) {
7150 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
7151 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007152}
7153
Bill Seurer703e8482015-06-09 14:39:47 +00007154static vector short __ATTRS_o_ai vec_vsro(vector short __a,
7155 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007156 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007157}
7158
Bill Seurer703e8482015-06-09 14:39:47 +00007159static vector short __ATTRS_o_ai vec_vsro(vector short __a,
7160 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007161 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007162}
7163
Bill Seurer703e8482015-06-09 14:39:47 +00007164static vector unsigned short __ATTRS_o_ai vec_vsro(vector unsigned short __a,
7165 vector signed char __b) {
7166 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
7167 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007168}
7169
Bill Seurer703e8482015-06-09 14:39:47 +00007170static vector unsigned short __ATTRS_o_ai vec_vsro(vector unsigned short __a,
7171 vector unsigned char __b) {
7172 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
7173 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007174}
7175
Bill Seurer703e8482015-06-09 14:39:47 +00007176static vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
7177 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007178 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007179}
7180
Bill Seurer703e8482015-06-09 14:39:47 +00007181static vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
7182 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007183 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007184}
7185
Bill Seurer703e8482015-06-09 14:39:47 +00007186static vector int __ATTRS_o_ai vec_vsro(vector int __a,
7187 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007188 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007189}
7190
Bill Seurer703e8482015-06-09 14:39:47 +00007191static vector int __ATTRS_o_ai vec_vsro(vector int __a,
7192 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007193 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007194}
7195
Bill Seurer703e8482015-06-09 14:39:47 +00007196static vector unsigned int __ATTRS_o_ai vec_vsro(vector unsigned int __a,
7197 vector signed char __b) {
7198 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
7199 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007200}
7201
Bill Seurer703e8482015-06-09 14:39:47 +00007202static vector unsigned int __ATTRS_o_ai vec_vsro(vector unsigned int __a,
7203 vector unsigned char __b) {
7204 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
7205 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007206}
7207
Bill Seurer703e8482015-06-09 14:39:47 +00007208static vector float __ATTRS_o_ai vec_vsro(vector float __a,
7209 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007210 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007211}
7212
Bill Seurer703e8482015-06-09 14:39:47 +00007213static vector float __ATTRS_o_ai vec_vsro(vector float __a,
7214 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007215 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007216}
7217
7218/* vec_st */
7219
Bill Seurer703e8482015-06-09 14:39:47 +00007220static void __ATTRS_o_ai vec_st(vector signed char __a, int __b,
7221 vector signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007222 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007223}
7224
Bill Seurer703e8482015-06-09 14:39:47 +00007225static void __ATTRS_o_ai vec_st(vector signed char __a, int __b,
7226 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007227 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007228}
7229
Bill Seurer703e8482015-06-09 14:39:47 +00007230static void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b,
7231 vector unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007232 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007233}
7234
Bill Seurer703e8482015-06-09 14:39:47 +00007235static void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b,
7236 unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007237 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007238}
7239
Bill Seurer703e8482015-06-09 14:39:47 +00007240static void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
7241 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007242 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007243}
7244
Bill Seurer703e8482015-06-09 14:39:47 +00007245static void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
7246 unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007247 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007248}
7249
Bill Seurer703e8482015-06-09 14:39:47 +00007250static void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
7251 vector bool char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007252 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007253}
7254
Bill Seurer703e8482015-06-09 14:39:47 +00007255static void __ATTRS_o_ai vec_st(vector short __a, int __b, vector short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007256 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007257}
7258
Bill Seurer703e8482015-06-09 14:39:47 +00007259static void __ATTRS_o_ai vec_st(vector short __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007260 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007261}
7262
Bill Seurer703e8482015-06-09 14:39:47 +00007263static void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b,
7264 vector unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007265 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007266}
7267
Bill Seurer703e8482015-06-09 14:39:47 +00007268static void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b,
7269 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007270 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007271}
7272
Bill Seurer703e8482015-06-09 14:39:47 +00007273static void __ATTRS_o_ai vec_st(vector bool short __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007274 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007275}
7276
Bill Seurer703e8482015-06-09 14:39:47 +00007277static void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
7278 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007279 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007280}
7281
Bill Seurer703e8482015-06-09 14:39:47 +00007282static void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
7283 vector bool short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007284 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007285}
7286
Bill Seurer703e8482015-06-09 14:39:47 +00007287static void __ATTRS_o_ai vec_st(vector pixel __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007288 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007289}
7290
Bill Seurer703e8482015-06-09 14:39:47 +00007291static void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
7292 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007293 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007294}
7295
Bill Seurer703e8482015-06-09 14:39:47 +00007296static void __ATTRS_o_ai vec_st(vector pixel __a, int __b, vector pixel *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007297 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007298}
7299
Bill Seurer703e8482015-06-09 14:39:47 +00007300static void __ATTRS_o_ai vec_st(vector int __a, int __b, vector int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007301 __builtin_altivec_stvx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007302}
7303
Bill Seurer703e8482015-06-09 14:39:47 +00007304static void __ATTRS_o_ai vec_st(vector int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007305 __builtin_altivec_stvx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007306}
7307
Bill Seurer703e8482015-06-09 14:39:47 +00007308static void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b,
7309 vector unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007310 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007311}
7312
Bill Seurer703e8482015-06-09 14:39:47 +00007313static void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b,
7314 unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007315 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007316}
7317
Bill Seurer703e8482015-06-09 14:39:47 +00007318static void __ATTRS_o_ai vec_st(vector bool int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007319 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007320}
7321
Bill Seurer703e8482015-06-09 14:39:47 +00007322static void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
7323 unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007324 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007325}
7326
Bill Seurer703e8482015-06-09 14:39:47 +00007327static void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
7328 vector bool int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007329 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007330}
7331
Bill Seurer703e8482015-06-09 14:39:47 +00007332static void __ATTRS_o_ai vec_st(vector float __a, int __b, vector float *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007333 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007334}
7335
Bill Seurer703e8482015-06-09 14:39:47 +00007336static void __ATTRS_o_ai vec_st(vector float __a, int __b, float *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007337 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007338}
7339
7340/* vec_stvx */
7341
Bill Seurer703e8482015-06-09 14:39:47 +00007342static void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b,
7343 vector signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007344 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007345}
7346
Bill Seurer703e8482015-06-09 14:39:47 +00007347static void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b,
7348 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007349 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007350}
7351
Bill Seurer703e8482015-06-09 14:39:47 +00007352static void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b,
7353 vector unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007354 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007355}
7356
Bill Seurer703e8482015-06-09 14:39:47 +00007357static void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b,
7358 unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007359 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007360}
7361
Bill Seurer703e8482015-06-09 14:39:47 +00007362static void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
7363 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007364 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007365}
7366
Bill Seurer703e8482015-06-09 14:39:47 +00007367static void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
7368 unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007369 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007370}
7371
Bill Seurer703e8482015-06-09 14:39:47 +00007372static void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
7373 vector bool char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007374 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007375}
7376
Bill Seurer703e8482015-06-09 14:39:47 +00007377static void __ATTRS_o_ai vec_stvx(vector short __a, int __b,
7378 vector short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007379 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007380}
7381
Bill Seurer703e8482015-06-09 14:39:47 +00007382static void __ATTRS_o_ai vec_stvx(vector short __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007383 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007384}
7385
Bill Seurer703e8482015-06-09 14:39:47 +00007386static void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b,
7387 vector unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007388 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007389}
7390
Bill Seurer703e8482015-06-09 14:39:47 +00007391static void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b,
7392 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007393 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007394}
7395
Bill Seurer703e8482015-06-09 14:39:47 +00007396static void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007397 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007398}
7399
Bill Seurer703e8482015-06-09 14:39:47 +00007400static void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
7401 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007402 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007403}
7404
Bill Seurer703e8482015-06-09 14:39:47 +00007405static void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
7406 vector bool short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007407 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007408}
7409
Bill Seurer703e8482015-06-09 14:39:47 +00007410static void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007411 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007412}
7413
Bill Seurer703e8482015-06-09 14:39:47 +00007414static void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
7415 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007416 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007417}
7418
Bill Seurer703e8482015-06-09 14:39:47 +00007419static void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
7420 vector pixel *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007421 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007422}
7423
Bill Seurer703e8482015-06-09 14:39:47 +00007424static void __ATTRS_o_ai vec_stvx(vector int __a, int __b, vector int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007425 __builtin_altivec_stvx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007426}
7427
Bill Seurer703e8482015-06-09 14:39:47 +00007428static void __ATTRS_o_ai vec_stvx(vector int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007429 __builtin_altivec_stvx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007430}
7431
Bill Seurer703e8482015-06-09 14:39:47 +00007432static void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b,
7433 vector unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007434 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007435}
7436
Bill Seurer703e8482015-06-09 14:39:47 +00007437static void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b,
7438 unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007439 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007440}
7441
Bill Seurer703e8482015-06-09 14:39:47 +00007442static void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007443 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007444}
7445
Bill Seurer703e8482015-06-09 14:39:47 +00007446static void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
7447 unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007448 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007449}
7450
Bill Seurer703e8482015-06-09 14:39:47 +00007451static void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
7452 vector bool int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007453 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007454}
7455
Bill Seurer703e8482015-06-09 14:39:47 +00007456static void __ATTRS_o_ai vec_stvx(vector float __a, int __b,
7457 vector float *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007458 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007459}
7460
Bill Seurer703e8482015-06-09 14:39:47 +00007461static void __ATTRS_o_ai vec_stvx(vector float __a, int __b, float *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007462 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007463}
7464
7465/* vec_ste */
7466
Bill Seurer703e8482015-06-09 14:39:47 +00007467static void __ATTRS_o_ai vec_ste(vector signed char __a, int __b,
7468 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007469 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007470}
7471
Bill Seurer703e8482015-06-09 14:39:47 +00007472static void __ATTRS_o_ai vec_ste(vector unsigned char __a, int __b,
7473 unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007474 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007475}
7476
Bill Seurer703e8482015-06-09 14:39:47 +00007477static void __ATTRS_o_ai vec_ste(vector bool char __a, int __b,
7478 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007479 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007480}
7481
Bill Seurer703e8482015-06-09 14:39:47 +00007482static void __ATTRS_o_ai vec_ste(vector bool char __a, int __b,
7483 unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007484 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007485}
7486
Bill Seurer703e8482015-06-09 14:39:47 +00007487static void __ATTRS_o_ai vec_ste(vector short __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007488 __builtin_altivec_stvehx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007489}
7490
Bill Seurer703e8482015-06-09 14:39:47 +00007491static void __ATTRS_o_ai vec_ste(vector unsigned short __a, int __b,
7492 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007493 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007494}
7495
Bill Seurer703e8482015-06-09 14:39:47 +00007496static void __ATTRS_o_ai vec_ste(vector bool short __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007497 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007498}
7499
Bill Seurer703e8482015-06-09 14:39:47 +00007500static void __ATTRS_o_ai vec_ste(vector bool short __a, int __b,
7501 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007502 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007503}
7504
Bill Seurer703e8482015-06-09 14:39:47 +00007505static void __ATTRS_o_ai vec_ste(vector pixel __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007506 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007507}
7508
Bill Seurer703e8482015-06-09 14:39:47 +00007509static void __ATTRS_o_ai vec_ste(vector pixel __a, int __b,
7510 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007511 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007512}
7513
Bill Seurer703e8482015-06-09 14:39:47 +00007514static void __ATTRS_o_ai vec_ste(vector int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007515 __builtin_altivec_stvewx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007516}
7517
Bill Seurer703e8482015-06-09 14:39:47 +00007518static void __ATTRS_o_ai vec_ste(vector unsigned int __a, int __b,
7519 unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007520 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007521}
7522
Bill Seurer703e8482015-06-09 14:39:47 +00007523static void __ATTRS_o_ai vec_ste(vector bool int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007524 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007525}
7526
Bill Seurer703e8482015-06-09 14:39:47 +00007527static void __ATTRS_o_ai vec_ste(vector bool int __a, int __b,
7528 unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007529 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007530}
7531
Bill Seurer703e8482015-06-09 14:39:47 +00007532static void __ATTRS_o_ai vec_ste(vector float __a, int __b, float *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007533 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007534}
7535
7536/* vec_stvebx */
7537
Bill Seurer703e8482015-06-09 14:39:47 +00007538static void __ATTRS_o_ai vec_stvebx(vector signed char __a, int __b,
7539 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007540 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007541}
7542
Bill Seurer703e8482015-06-09 14:39:47 +00007543static void __ATTRS_o_ai vec_stvebx(vector unsigned char __a, int __b,
7544 unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007545 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007546}
7547
Bill Seurer703e8482015-06-09 14:39:47 +00007548static void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b,
7549 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007550 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007551}
7552
Bill Seurer703e8482015-06-09 14:39:47 +00007553static void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b,
7554 unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007555 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007556}
7557
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007558/* vec_stvehx */
7559
Bill Seurer703e8482015-06-09 14:39:47 +00007560static void __ATTRS_o_ai vec_stvehx(vector short __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007561 __builtin_altivec_stvehx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007562}
7563
Bill Seurer703e8482015-06-09 14:39:47 +00007564static void __ATTRS_o_ai vec_stvehx(vector unsigned short __a, int __b,
7565 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007566 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007567}
7568
Bill Seurer703e8482015-06-09 14:39:47 +00007569static void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b,
7570 short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007571 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007572}
7573
Bill Seurer703e8482015-06-09 14:39:47 +00007574static void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b,
7575 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007576 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007577}
7578
Bill Seurer703e8482015-06-09 14:39:47 +00007579static void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007580 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007581}
7582
Bill Seurer703e8482015-06-09 14:39:47 +00007583static void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b,
7584 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007585 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007586}
7587
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007588/* vec_stvewx */
7589
Bill Seurer703e8482015-06-09 14:39:47 +00007590static void __ATTRS_o_ai vec_stvewx(vector int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007591 __builtin_altivec_stvewx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007592}
7593
Bill Seurer703e8482015-06-09 14:39:47 +00007594static void __ATTRS_o_ai vec_stvewx(vector unsigned int __a, int __b,
7595 unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007596 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007597}
7598
Bill Seurer703e8482015-06-09 14:39:47 +00007599static void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007600 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007601}
7602
Bill Seurer703e8482015-06-09 14:39:47 +00007603static void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b,
7604 unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007605 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007606}
7607
Bill Seurer703e8482015-06-09 14:39:47 +00007608static void __ATTRS_o_ai vec_stvewx(vector float __a, int __b, float *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007609 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007610}
7611
7612/* vec_stl */
7613
Bill Seurer703e8482015-06-09 14:39:47 +00007614static void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
7615 vector signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007616 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007617}
7618
Bill Seurer703e8482015-06-09 14:39:47 +00007619static void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
7620 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007621 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007622}
7623
Bill Seurer703e8482015-06-09 14:39:47 +00007624static void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
7625 vector unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007626 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007627}
7628
Bill Seurer703e8482015-06-09 14:39:47 +00007629static void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
7630 unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007631 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007632}
7633
Bill Seurer703e8482015-06-09 14:39:47 +00007634static void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
7635 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007636 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007637}
7638
Bill Seurer703e8482015-06-09 14:39:47 +00007639static void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
7640 unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007641 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007642}
7643
Bill Seurer703e8482015-06-09 14:39:47 +00007644static void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
7645 vector bool char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007646 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007647}
7648
Bill Seurer703e8482015-06-09 14:39:47 +00007649static void __ATTRS_o_ai vec_stl(vector short __a, int __b, vector short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007650 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007651}
7652
Bill Seurer703e8482015-06-09 14:39:47 +00007653static void __ATTRS_o_ai vec_stl(vector short __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007654 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007655}
7656
Bill Seurer703e8482015-06-09 14:39:47 +00007657static void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
7658 vector unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007659 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007660}
7661
Bill Seurer703e8482015-06-09 14:39:47 +00007662static void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
7663 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007664 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007665}
7666
Bill Seurer703e8482015-06-09 14:39:47 +00007667static void __ATTRS_o_ai vec_stl(vector bool short __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007668 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007669}
7670
Bill Seurer703e8482015-06-09 14:39:47 +00007671static void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
7672 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007673 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007674}
7675
Bill Seurer703e8482015-06-09 14:39:47 +00007676static void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
7677 vector bool short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007678 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007679}
7680
Bill Seurer703e8482015-06-09 14:39:47 +00007681static void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007682 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007683}
7684
Bill Seurer703e8482015-06-09 14:39:47 +00007685static void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
7686 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007687 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007688}
7689
Bill Seurer703e8482015-06-09 14:39:47 +00007690static void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, vector pixel *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007691 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007692}
7693
Bill Seurer703e8482015-06-09 14:39:47 +00007694static void __ATTRS_o_ai vec_stl(vector int __a, int __b, vector int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007695 __builtin_altivec_stvxl(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007696}
7697
Bill Seurer703e8482015-06-09 14:39:47 +00007698static void __ATTRS_o_ai vec_stl(vector int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007699 __builtin_altivec_stvxl(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007700}
7701
Bill Seurer703e8482015-06-09 14:39:47 +00007702static void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
7703 vector unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007704 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007705}
7706
Bill Seurer703e8482015-06-09 14:39:47 +00007707static void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
7708 unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007709 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007710}
7711
Bill Seurer703e8482015-06-09 14:39:47 +00007712static void __ATTRS_o_ai vec_stl(vector bool int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007713 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007714}
7715
Bill Seurer703e8482015-06-09 14:39:47 +00007716static void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
7717 unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007718 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007719}
7720
Bill Seurer703e8482015-06-09 14:39:47 +00007721static void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
7722 vector bool int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007723 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007724}
7725
Bill Seurer703e8482015-06-09 14:39:47 +00007726static void __ATTRS_o_ai vec_stl(vector float __a, int __b, vector float *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007727 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007728}
7729
Bill Seurer703e8482015-06-09 14:39:47 +00007730static void __ATTRS_o_ai vec_stl(vector float __a, int __b, float *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007731 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007732}
7733
7734/* vec_stvxl */
7735
Bill Seurer703e8482015-06-09 14:39:47 +00007736static void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
7737 vector signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007738 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007739}
7740
Bill Seurer703e8482015-06-09 14:39:47 +00007741static void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
7742 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007743 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007744}
7745
Bill Seurer703e8482015-06-09 14:39:47 +00007746static void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
7747 vector unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007748 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007749}
7750
Bill Seurer703e8482015-06-09 14:39:47 +00007751static void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
7752 unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007753 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007754}
7755
Bill Seurer703e8482015-06-09 14:39:47 +00007756static void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
7757 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007758 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007759}
7760
Bill Seurer703e8482015-06-09 14:39:47 +00007761static void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
7762 unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007763 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007764}
7765
Bill Seurer703e8482015-06-09 14:39:47 +00007766static void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
7767 vector bool char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007768 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007769}
7770
Bill Seurer703e8482015-06-09 14:39:47 +00007771static void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
7772 vector short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007773 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007774}
7775
Bill Seurer703e8482015-06-09 14:39:47 +00007776static void __ATTRS_o_ai vec_stvxl(vector short __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007777 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007778}
7779
Bill Seurer703e8482015-06-09 14:39:47 +00007780static void __ATTRS_o_ai vec_stvxl(vector unsigned short __a, int __b,
7781 vector unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007782 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007783}
7784
Bill Seurer703e8482015-06-09 14:39:47 +00007785static void __ATTRS_o_ai vec_stvxl(vector unsigned short __a, int __b,
7786 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007787 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007788}
7789
Bill Seurer703e8482015-06-09 14:39:47 +00007790static void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007791 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007792}
7793
Bill Seurer703e8482015-06-09 14:39:47 +00007794static void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
7795 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007796 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007797}
7798
Bill Seurer703e8482015-06-09 14:39:47 +00007799static void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
7800 vector bool short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007801 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007802}
7803
Bill Seurer703e8482015-06-09 14:39:47 +00007804static void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007805 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007806}
7807
Bill Seurer703e8482015-06-09 14:39:47 +00007808static void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
7809 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007810 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007811}
7812
Bill Seurer703e8482015-06-09 14:39:47 +00007813static void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
7814 vector pixel *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007815 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007816}
7817
Bill Seurer703e8482015-06-09 14:39:47 +00007818static void __ATTRS_o_ai vec_stvxl(vector int __a, int __b, vector int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007819 __builtin_altivec_stvxl(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007820}
7821
Bill Seurer703e8482015-06-09 14:39:47 +00007822static void __ATTRS_o_ai vec_stvxl(vector int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007823 __builtin_altivec_stvxl(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007824}
7825
Bill Seurer703e8482015-06-09 14:39:47 +00007826static void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
7827 vector unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007828 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007829}
7830
Bill Seurer703e8482015-06-09 14:39:47 +00007831static void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
7832 unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007833 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007834}
7835
Bill Seurer703e8482015-06-09 14:39:47 +00007836static void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007837 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007838}
7839
Bill Seurer703e8482015-06-09 14:39:47 +00007840static void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
7841 unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007842 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007843}
7844
Bill Seurer703e8482015-06-09 14:39:47 +00007845static void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
7846 vector bool int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007847 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007848}
7849
Bill Seurer703e8482015-06-09 14:39:47 +00007850static void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
7851 vector float *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007852 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007853}
7854
Bill Seurer703e8482015-06-09 14:39:47 +00007855static void __ATTRS_o_ai vec_stvxl(vector float __a, int __b, float *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007856 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007857}
7858
7859/* vec_sub */
7860
Bill Seurer703e8482015-06-09 14:39:47 +00007861static vector signed char __ATTRS_o_ai vec_sub(vector signed char __a,
7862 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007863 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007864}
7865
Bill Seurer703e8482015-06-09 14:39:47 +00007866static vector signed char __ATTRS_o_ai vec_sub(vector bool char __a,
7867 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007868 return (vector signed char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007869}
7870
Bill Seurer703e8482015-06-09 14:39:47 +00007871static vector signed char __ATTRS_o_ai vec_sub(vector signed char __a,
7872 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007873 return __a - (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007874}
7875
Bill Seurer703e8482015-06-09 14:39:47 +00007876static vector unsigned char __ATTRS_o_ai vec_sub(vector unsigned char __a,
7877 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007878 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007879}
7880
Bill Seurer703e8482015-06-09 14:39:47 +00007881static vector unsigned char __ATTRS_o_ai vec_sub(vector bool char __a,
7882 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007883 return (vector unsigned char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007884}
7885
Bill Seurer703e8482015-06-09 14:39:47 +00007886static vector unsigned char __ATTRS_o_ai vec_sub(vector unsigned char __a,
7887 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007888 return __a - (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007889}
7890
Bill Seurer703e8482015-06-09 14:39:47 +00007891static vector short __ATTRS_o_ai vec_sub(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007892 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007893}
7894
Bill Seurer703e8482015-06-09 14:39:47 +00007895static vector short __ATTRS_o_ai vec_sub(vector bool short __a,
7896 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007897 return (vector short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007898}
7899
Bill Seurer703e8482015-06-09 14:39:47 +00007900static vector short __ATTRS_o_ai vec_sub(vector short __a,
7901 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007902 return __a - (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007903}
7904
Bill Seurer703e8482015-06-09 14:39:47 +00007905static vector unsigned short __ATTRS_o_ai vec_sub(vector unsigned short __a,
7906 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007907 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007908}
7909
Bill Seurer703e8482015-06-09 14:39:47 +00007910static vector unsigned short __ATTRS_o_ai vec_sub(vector bool short __a,
7911 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007912 return (vector unsigned short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007913}
7914
Bill Seurer703e8482015-06-09 14:39:47 +00007915static vector unsigned short __ATTRS_o_ai vec_sub(vector unsigned short __a,
7916 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007917 return __a - (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007918}
7919
Bill Seurer703e8482015-06-09 14:39:47 +00007920static vector int __ATTRS_o_ai vec_sub(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007921 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007922}
7923
Bill Seurer703e8482015-06-09 14:39:47 +00007924static vector int __ATTRS_o_ai vec_sub(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007925 return (vector int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007926}
7927
Bill Seurer703e8482015-06-09 14:39:47 +00007928static vector int __ATTRS_o_ai vec_sub(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007929 return __a - (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007930}
7931
Bill Seurer703e8482015-06-09 14:39:47 +00007932static vector unsigned int __ATTRS_o_ai vec_sub(vector unsigned int __a,
7933 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007934 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007935}
7936
Bill Seurer703e8482015-06-09 14:39:47 +00007937static vector unsigned int __ATTRS_o_ai vec_sub(vector bool int __a,
7938 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007939 return (vector unsigned int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007940}
7941
Bill Seurer703e8482015-06-09 14:39:47 +00007942static vector unsigned int __ATTRS_o_ai vec_sub(vector unsigned int __a,
7943 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007944 return __a - (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007945}
7946
Kit Barton5944ee212015-05-25 15:52:45 +00007947#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
Bill Seurer703e8482015-06-09 14:39:47 +00007948static vector signed __int128 __ATTRS_o_ai vec_sub(vector signed __int128 __a,
7949 vector signed __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +00007950 return __a - __b;
7951}
7952
7953static vector unsigned __int128 __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00007954vec_sub(vector unsigned __int128 __a, vector unsigned __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +00007955 return __a - __b;
7956}
7957#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
7958
Bill Seurer703e8482015-06-09 14:39:47 +00007959static vector float __ATTRS_o_ai vec_sub(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007960 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007961}
7962
7963/* vec_vsububm */
7964
7965#define __builtin_altivec_vsububm vec_vsububm
7966
Bill Seurer703e8482015-06-09 14:39:47 +00007967static vector signed char __ATTRS_o_ai vec_vsububm(vector signed char __a,
7968 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007969 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007970}
7971
Bill Seurer703e8482015-06-09 14:39:47 +00007972static vector signed char __ATTRS_o_ai vec_vsububm(vector bool char __a,
7973 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007974 return (vector signed char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007975}
7976
Bill Seurer703e8482015-06-09 14:39:47 +00007977static vector signed char __ATTRS_o_ai vec_vsububm(vector signed char __a,
7978 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007979 return __a - (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007980}
7981
Bill Seurer703e8482015-06-09 14:39:47 +00007982static vector unsigned char __ATTRS_o_ai vec_vsububm(vector unsigned char __a,
7983 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007984 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007985}
7986
Bill Seurer703e8482015-06-09 14:39:47 +00007987static vector unsigned char __ATTRS_o_ai vec_vsububm(vector bool char __a,
7988 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007989 return (vector unsigned char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007990}
7991
Bill Seurer703e8482015-06-09 14:39:47 +00007992static vector unsigned char __ATTRS_o_ai vec_vsububm(vector unsigned char __a,
7993 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007994 return __a - (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007995}
7996
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007997/* vec_vsubuhm */
7998
7999#define __builtin_altivec_vsubuhm vec_vsubuhm
8000
Bill Seurer703e8482015-06-09 14:39:47 +00008001static vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
8002 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008003 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008004}
8005
Bill Seurer703e8482015-06-09 14:39:47 +00008006static vector short __ATTRS_o_ai vec_vsubuhm(vector bool short __a,
8007 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008008 return (vector short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008009}
8010
Bill Seurer703e8482015-06-09 14:39:47 +00008011static vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
8012 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008013 return __a - (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008014}
8015
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008016static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008017vec_vsubuhm(vector unsigned short __a, vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008018 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008019}
8020
Anton Yartsevfc83c602010-08-19 03:21:36 +00008021static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008022vec_vsubuhm(vector bool short __a, vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008023 return (vector unsigned short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008024}
8025
Bill Seurer703e8482015-06-09 14:39:47 +00008026static vector unsigned short __ATTRS_o_ai vec_vsubuhm(vector unsigned short __a,
8027 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008028 return __a - (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008029}
8030
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008031/* vec_vsubuwm */
8032
8033#define __builtin_altivec_vsubuwm vec_vsubuwm
8034
Bill Seurer703e8482015-06-09 14:39:47 +00008035static vector int __ATTRS_o_ai vec_vsubuwm(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008036 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008037}
8038
Bill Seurer703e8482015-06-09 14:39:47 +00008039static vector int __ATTRS_o_ai vec_vsubuwm(vector bool int __a,
8040 vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008041 return (vector int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008042}
8043
Bill Seurer703e8482015-06-09 14:39:47 +00008044static vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
8045 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008046 return __a - (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008047}
8048
Bill Seurer703e8482015-06-09 14:39:47 +00008049static vector unsigned int __ATTRS_o_ai vec_vsubuwm(vector unsigned int __a,
8050 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008051 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008052}
8053
Bill Seurer703e8482015-06-09 14:39:47 +00008054static vector unsigned int __ATTRS_o_ai vec_vsubuwm(vector bool int __a,
8055 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008056 return (vector unsigned int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008057}
8058
Bill Seurer703e8482015-06-09 14:39:47 +00008059static vector unsigned int __ATTRS_o_ai vec_vsubuwm(vector unsigned int __a,
8060 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008061 return __a - (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008062}
8063
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008064/* vec_vsubfp */
8065
8066#define __builtin_altivec_vsubfp vec_vsubfp
8067
8068static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00008069vec_vsubfp(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008070 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008071}
8072
8073/* vec_subc */
8074
Bill Seurer703e8482015-06-09 14:39:47 +00008075static vector unsigned int __ATTRS_o_ai vec_subc(vector unsigned int __a,
8076 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008077 return __builtin_altivec_vsubcuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008078}
8079
Kit Barton5944ee212015-05-25 15:52:45 +00008080#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
8081static vector unsigned __int128 __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008082vec_subc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +00008083 return __builtin_altivec_vsubcuq(__a, __b);
8084}
8085
8086static vector signed __int128 __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008087vec_subc(vector signed __int128 __a, vector signed __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +00008088 return __builtin_altivec_vsubcuq(__a, __b);
8089}
8090#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
8091
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008092/* vec_vsubcuw */
8093
8094static vector unsigned int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00008095vec_vsubcuw(vector unsigned int __a, vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008096 return __builtin_altivec_vsubcuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008097}
8098
8099/* vec_subs */
8100
Bill Seurer703e8482015-06-09 14:39:47 +00008101static vector signed char __ATTRS_o_ai vec_subs(vector signed char __a,
8102 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008103 return __builtin_altivec_vsubsbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008104}
8105
Bill Seurer703e8482015-06-09 14:39:47 +00008106static vector signed char __ATTRS_o_ai vec_subs(vector bool char __a,
8107 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008108 return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008109}
8110
Bill Seurer703e8482015-06-09 14:39:47 +00008111static vector signed char __ATTRS_o_ai vec_subs(vector signed char __a,
8112 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008113 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008114}
8115
Bill Seurer703e8482015-06-09 14:39:47 +00008116static vector unsigned char __ATTRS_o_ai vec_subs(vector unsigned char __a,
8117 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008118 return __builtin_altivec_vsububs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008119}
8120
Bill Seurer703e8482015-06-09 14:39:47 +00008121static vector unsigned char __ATTRS_o_ai vec_subs(vector bool char __a,
8122 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008123 return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008124}
8125
Bill Seurer703e8482015-06-09 14:39:47 +00008126static vector unsigned char __ATTRS_o_ai vec_subs(vector unsigned char __a,
8127 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008128 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008129}
8130
Bill Seurer703e8482015-06-09 14:39:47 +00008131static vector short __ATTRS_o_ai vec_subs(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008132 return __builtin_altivec_vsubshs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008133}
8134
Bill Seurer703e8482015-06-09 14:39:47 +00008135static vector short __ATTRS_o_ai vec_subs(vector bool short __a,
8136 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008137 return __builtin_altivec_vsubshs((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008138}
8139
Bill Seurer703e8482015-06-09 14:39:47 +00008140static vector short __ATTRS_o_ai vec_subs(vector short __a,
8141 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008142 return __builtin_altivec_vsubshs(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008143}
8144
Bill Seurer703e8482015-06-09 14:39:47 +00008145static vector unsigned short __ATTRS_o_ai vec_subs(vector unsigned short __a,
8146 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008147 return __builtin_altivec_vsubuhs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008148}
8149
Bill Seurer703e8482015-06-09 14:39:47 +00008150static vector unsigned short __ATTRS_o_ai vec_subs(vector bool short __a,
8151 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008152 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008153}
8154
Bill Seurer703e8482015-06-09 14:39:47 +00008155static vector unsigned short __ATTRS_o_ai vec_subs(vector unsigned short __a,
8156 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008157 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008158}
8159
Bill Seurer703e8482015-06-09 14:39:47 +00008160static vector int __ATTRS_o_ai vec_subs(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008161 return __builtin_altivec_vsubsws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008162}
8163
Bill Seurer703e8482015-06-09 14:39:47 +00008164static vector int __ATTRS_o_ai vec_subs(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008165 return __builtin_altivec_vsubsws((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008166}
8167
Bill Seurer703e8482015-06-09 14:39:47 +00008168static vector int __ATTRS_o_ai vec_subs(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008169 return __builtin_altivec_vsubsws(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008170}
8171
Bill Seurer703e8482015-06-09 14:39:47 +00008172static vector unsigned int __ATTRS_o_ai vec_subs(vector unsigned int __a,
8173 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008174 return __builtin_altivec_vsubuws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008175}
8176
Bill Seurer703e8482015-06-09 14:39:47 +00008177static vector unsigned int __ATTRS_o_ai vec_subs(vector bool int __a,
8178 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008179 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008180}
8181
Bill Seurer703e8482015-06-09 14:39:47 +00008182static vector unsigned int __ATTRS_o_ai vec_subs(vector unsigned int __a,
8183 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008184 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008185}
8186
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008187/* vec_vsubsbs */
8188
Bill Seurer703e8482015-06-09 14:39:47 +00008189static vector signed char __ATTRS_o_ai vec_vsubsbs(vector signed char __a,
8190 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008191 return __builtin_altivec_vsubsbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008192}
8193
Bill Seurer703e8482015-06-09 14:39:47 +00008194static vector signed char __ATTRS_o_ai vec_vsubsbs(vector bool char __a,
8195 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008196 return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008197}
8198
Bill Seurer703e8482015-06-09 14:39:47 +00008199static vector signed char __ATTRS_o_ai vec_vsubsbs(vector signed char __a,
8200 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008201 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008202}
8203
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008204/* vec_vsububs */
8205
Bill Seurer703e8482015-06-09 14:39:47 +00008206static vector unsigned char __ATTRS_o_ai vec_vsububs(vector unsigned char __a,
8207 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008208 return __builtin_altivec_vsububs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008209}
8210
Bill Seurer703e8482015-06-09 14:39:47 +00008211static vector unsigned char __ATTRS_o_ai vec_vsububs(vector bool char __a,
8212 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008213 return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008214}
8215
Bill Seurer703e8482015-06-09 14:39:47 +00008216static vector unsigned char __ATTRS_o_ai vec_vsububs(vector unsigned char __a,
8217 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008218 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008219}
8220
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008221/* vec_vsubshs */
8222
Bill Seurer703e8482015-06-09 14:39:47 +00008223static vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
8224 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008225 return __builtin_altivec_vsubshs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008226}
8227
Bill Seurer703e8482015-06-09 14:39:47 +00008228static vector short __ATTRS_o_ai vec_vsubshs(vector bool short __a,
8229 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008230 return __builtin_altivec_vsubshs((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008231}
8232
Bill Seurer703e8482015-06-09 14:39:47 +00008233static vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
8234 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008235 return __builtin_altivec_vsubshs(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008236}
8237
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008238/* vec_vsubuhs */
8239
Anton Yartsevfc83c602010-08-19 03:21:36 +00008240static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008241vec_vsubuhs(vector unsigned short __a, vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008242 return __builtin_altivec_vsubuhs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008243}
8244
Anton Yartsevfc83c602010-08-19 03:21:36 +00008245static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008246vec_vsubuhs(vector bool short __a, vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008247 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008248}
8249
Bill Seurer703e8482015-06-09 14:39:47 +00008250static vector unsigned short __ATTRS_o_ai vec_vsubuhs(vector unsigned short __a,
8251 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008252 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008253}
8254
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008255/* vec_vsubsws */
8256
Bill Seurer703e8482015-06-09 14:39:47 +00008257static vector int __ATTRS_o_ai vec_vsubsws(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008258 return __builtin_altivec_vsubsws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008259}
8260
Bill Seurer703e8482015-06-09 14:39:47 +00008261static vector int __ATTRS_o_ai vec_vsubsws(vector bool int __a,
8262 vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008263 return __builtin_altivec_vsubsws((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008264}
8265
Bill Seurer703e8482015-06-09 14:39:47 +00008266static vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
8267 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008268 return __builtin_altivec_vsubsws(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008269}
8270
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008271/* vec_vsubuws */
8272
Bill Seurer703e8482015-06-09 14:39:47 +00008273static vector unsigned int __ATTRS_o_ai vec_vsubuws(vector unsigned int __a,
8274 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008275 return __builtin_altivec_vsubuws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008276}
8277
Bill Seurer703e8482015-06-09 14:39:47 +00008278static vector unsigned int __ATTRS_o_ai vec_vsubuws(vector bool int __a,
8279 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008280 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008281}
8282
Bill Seurer703e8482015-06-09 14:39:47 +00008283static vector unsigned int __ATTRS_o_ai vec_vsubuws(vector unsigned int __a,
8284 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008285 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008286}
8287
Kit Barton5944ee212015-05-25 15:52:45 +00008288#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
8289/* vec_vsubuqm */
8290
8291static vector signed __int128 __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008292vec_vsubuqm(vector signed __int128 __a, vector signed __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +00008293 return __a - __b;
8294}
8295
8296static vector unsigned __int128 __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008297vec_vsubuqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +00008298 return __a - __b;
8299}
8300
8301/* vec_vsubeuqm */
8302
8303static vector signed __int128 __ATTRS_o_ai
8304vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b,
Bill Seurer703e8482015-06-09 14:39:47 +00008305 vector signed __int128 __c) {
Kit Barton5944ee212015-05-25 15:52:45 +00008306 return __builtin_altivec_vsubeuqm(__a, __b, __c);
8307}
8308
8309static vector unsigned __int128 __ATTRS_o_ai
8310vec_vsubeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
Bill Seurer703e8482015-06-09 14:39:47 +00008311 vector unsigned __int128 __c) {
Kit Barton5944ee212015-05-25 15:52:45 +00008312 return __builtin_altivec_vsubeuqm(__a, __b, __c);
8313}
8314
8315/* vec_vsubcuq */
8316
8317static vector signed __int128 __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008318vec_vsubcuq(vector signed __int128 __a, vector signed __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +00008319 return __builtin_altivec_vsubcuq(__a, __b);
8320}
8321
8322static vector unsigned __int128 __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008323vec_vsubcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +00008324 return __builtin_altivec_vsubcuq(__a, __b);
8325}
8326
8327/* vec_vsubecuq */
8328
8329static vector signed __int128 __ATTRS_o_ai
8330vec_vsubecuq(vector signed __int128 __a, vector signed __int128 __b,
Bill Seurer703e8482015-06-09 14:39:47 +00008331 vector signed __int128 __c) {
Kit Barton5944ee212015-05-25 15:52:45 +00008332 return __builtin_altivec_vsubecuq(__a, __b, __c);
8333}
8334
8335static vector unsigned __int128 __ATTRS_o_ai
8336vec_vsubecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
Bill Seurer703e8482015-06-09 14:39:47 +00008337 vector unsigned __int128 __c) {
Kit Barton5944ee212015-05-25 15:52:45 +00008338 return __builtin_altivec_vsubecuq(__a, __b, __c);
8339}
8340#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
8341
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008342/* vec_sum4s */
8343
Bill Seurer703e8482015-06-09 14:39:47 +00008344static vector int __ATTRS_o_ai vec_sum4s(vector signed char __a,
8345 vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008346 return __builtin_altivec_vsum4sbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008347}
8348
Bill Seurer703e8482015-06-09 14:39:47 +00008349static vector unsigned int __ATTRS_o_ai vec_sum4s(vector unsigned char __a,
8350 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008351 return __builtin_altivec_vsum4ubs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008352}
8353
Bill Seurer703e8482015-06-09 14:39:47 +00008354static vector int __ATTRS_o_ai vec_sum4s(vector signed short __a,
8355 vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008356 return __builtin_altivec_vsum4shs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008357}
8358
8359/* vec_vsum4sbs */
8360
8361static vector int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00008362vec_vsum4sbs(vector signed char __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008363 return __builtin_altivec_vsum4sbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008364}
8365
8366/* vec_vsum4ubs */
8367
8368static vector unsigned int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00008369vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008370 return __builtin_altivec_vsum4ubs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008371}
8372
8373/* vec_vsum4shs */
8374
8375static vector int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00008376vec_vsum4shs(vector signed short __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008377 return __builtin_altivec_vsum4shs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008378}
8379
8380/* vec_sum2s */
8381
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008382/* The vsum2sws instruction has a big-endian bias, so that the second
8383 input vector and the result always reference big-endian elements
8384 1 and 3 (little-endian element 0 and 2). For ease of porting the
8385 programmer wants elements 1 and 3 in both cases, so for little
8386 endian we must perform some permutes. */
8387
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008388static vector signed int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00008389vec_sum2s(vector int __a, vector int __b) {
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008390#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00008391 vector int __c = (vector signed int)vec_perm(
8392 __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
8393 8, 9, 10, 11));
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008394 __c = __builtin_altivec_vsum2sws(__a, __c);
Bill Seurer703e8482015-06-09 14:39:47 +00008395 return (vector signed int)vec_perm(
8396 __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
8397 8, 9, 10, 11));
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008398#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008399 return __builtin_altivec_vsum2sws(__a, __b);
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008400#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008401}
8402
8403/* vec_vsum2sws */
8404
8405static vector signed int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00008406vec_vsum2sws(vector int __a, vector int __b) {
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008407#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00008408 vector int __c = (vector signed int)vec_perm(
8409 __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
8410 8, 9, 10, 11));
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008411 __c = __builtin_altivec_vsum2sws(__a, __c);
Bill Seurer703e8482015-06-09 14:39:47 +00008412 return (vector signed int)vec_perm(
8413 __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
8414 8, 9, 10, 11));
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008415#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008416 return __builtin_altivec_vsum2sws(__a, __b);
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008417#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008418}
8419
8420/* vec_sums */
8421
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008422/* The vsumsws instruction has a big-endian bias, so that the second
8423 input vector and the result always reference big-endian element 3
8424 (little-endian element 0). For ease of porting the programmer
8425 wants element 3 in both cases, so for little endian we must perform
8426 some permutes. */
8427
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008428static vector signed int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00008429vec_sums(vector signed int __a, vector signed int __b) {
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008430#ifdef __LITTLE_ENDIAN__
Bill Schmidtccbe0a82014-08-04 23:21:26 +00008431 __b = (vector signed int)vec_splat(__b, 3);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008432 __b = __builtin_altivec_vsumsws(__a, __b);
Bill Schmidtccbe0a82014-08-04 23:21:26 +00008433 return (vector signed int)(0, 0, 0, __b[0]);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008434#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008435 return __builtin_altivec_vsumsws(__a, __b);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008436#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008437}
8438
8439/* vec_vsumsws */
8440
8441static vector signed int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00008442vec_vsumsws(vector signed int __a, vector signed int __b) {
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008443#ifdef __LITTLE_ENDIAN__
Bill Schmidtccbe0a82014-08-04 23:21:26 +00008444 __b = (vector signed int)vec_splat(__b, 3);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008445 __b = __builtin_altivec_vsumsws(__a, __b);
Bill Schmidtccbe0a82014-08-04 23:21:26 +00008446 return (vector signed int)(0, 0, 0, __b[0]);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008447#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008448 return __builtin_altivec_vsumsws(__a, __b);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008449#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008450}
8451
8452/* vec_trunc */
8453
8454static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00008455vec_trunc(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008456 return __builtin_altivec_vrfiz(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008457}
8458
8459/* vec_vrfiz */
8460
8461static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00008462vec_vrfiz(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008463 return __builtin_altivec_vrfiz(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008464}
8465
8466/* vec_unpackh */
8467
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008468/* The vector unpack instructions all have a big-endian bias, so for
8469 little endian we must reverse the meanings of "high" and "low." */
8470
Bill Seurer703e8482015-06-09 14:39:47 +00008471static vector short __ATTRS_o_ai vec_unpackh(vector signed char __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008472#ifdef __LITTLE_ENDIAN__
8473 return __builtin_altivec_vupklsb((vector char)__a);
8474#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008475 return __builtin_altivec_vupkhsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008476#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008477}
8478
Bill Seurer703e8482015-06-09 14:39:47 +00008479static vector bool short __ATTRS_o_ai vec_unpackh(vector bool char __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008480#ifdef __LITTLE_ENDIAN__
8481 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
8482#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008483 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008484#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008485}
8486
Bill Seurer703e8482015-06-09 14:39:47 +00008487static vector int __ATTRS_o_ai vec_unpackh(vector short __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008488#ifdef __LITTLE_ENDIAN__
8489 return __builtin_altivec_vupklsh(__a);
8490#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008491 return __builtin_altivec_vupkhsh(__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008492#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008493}
8494
Bill Seurer703e8482015-06-09 14:39:47 +00008495static vector bool int __ATTRS_o_ai vec_unpackh(vector bool short __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008496#ifdef __LITTLE_ENDIAN__
8497 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
8498#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008499 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008500#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008501}
8502
Bill Seurer703e8482015-06-09 14:39:47 +00008503static vector unsigned int __ATTRS_o_ai vec_unpackh(vector pixel __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008504#ifdef __LITTLE_ENDIAN__
8505 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
8506#else
8507 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
8508#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008509}
8510
Bill Schmidt41e14c42015-05-16 01:02:25 +00008511#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +00008512static vector long long __ATTRS_o_ai vec_unpackh(vector int __a) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00008513#ifdef __LITTLE_ENDIAN__
8514 return __builtin_altivec_vupklsw(__a);
8515#else
8516 return __builtin_altivec_vupkhsw(__a);
8517#endif
8518}
8519
Bill Seurer703e8482015-06-09 14:39:47 +00008520static vector bool long long __ATTRS_o_ai vec_unpackh(vector bool int __a) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00008521#ifdef __LITTLE_ENDIAN__
8522 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
8523#else
8524 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
8525#endif
8526}
8527#endif
8528
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008529/* vec_vupkhsb */
8530
Bill Seurer703e8482015-06-09 14:39:47 +00008531static vector short __ATTRS_o_ai vec_vupkhsb(vector signed char __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008532#ifdef __LITTLE_ENDIAN__
8533 return __builtin_altivec_vupklsb((vector char)__a);
8534#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008535 return __builtin_altivec_vupkhsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008536#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008537}
8538
Bill Seurer703e8482015-06-09 14:39:47 +00008539static vector bool short __ATTRS_o_ai vec_vupkhsb(vector bool char __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008540#ifdef __LITTLE_ENDIAN__
8541 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
8542#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008543 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008544#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008545}
8546
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008547/* vec_vupkhsh */
8548
Bill Seurer703e8482015-06-09 14:39:47 +00008549static vector int __ATTRS_o_ai vec_vupkhsh(vector short __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008550#ifdef __LITTLE_ENDIAN__
8551 return __builtin_altivec_vupklsh(__a);
8552#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008553 return __builtin_altivec_vupkhsh(__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008554#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008555}
8556
Bill Seurer703e8482015-06-09 14:39:47 +00008557static vector bool int __ATTRS_o_ai vec_vupkhsh(vector bool short __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008558#ifdef __LITTLE_ENDIAN__
8559 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
8560#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008561 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008562#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008563}
8564
Bill Seurer703e8482015-06-09 14:39:47 +00008565static vector unsigned int __ATTRS_o_ai vec_vupkhsh(vector pixel __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008566#ifdef __LITTLE_ENDIAN__
8567 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
8568#else
8569 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
8570#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008571}
8572
Bill Schmidt41e14c42015-05-16 01:02:25 +00008573/* vec_vupkhsw */
8574
8575#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +00008576static vector long long __ATTRS_o_ai vec_vupkhsw(vector int __a) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00008577#ifdef __LITTLE_ENDIAN__
8578 return __builtin_altivec_vupklsw(__a);
8579#else
8580 return __builtin_altivec_vupkhsw(__a);
8581#endif
8582}
8583
Bill Seurer703e8482015-06-09 14:39:47 +00008584static vector bool long long __ATTRS_o_ai vec_vupkhsw(vector bool int __a) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00008585#ifdef __LITTLE_ENDIAN__
8586 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
8587#else
8588 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
8589#endif
8590}
8591#endif
8592
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008593/* vec_unpackl */
8594
Bill Seurer703e8482015-06-09 14:39:47 +00008595static vector short __ATTRS_o_ai vec_unpackl(vector signed char __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008596#ifdef __LITTLE_ENDIAN__
8597 return __builtin_altivec_vupkhsb((vector char)__a);
8598#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008599 return __builtin_altivec_vupklsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008600#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008601}
8602
Bill Seurer703e8482015-06-09 14:39:47 +00008603static vector bool short __ATTRS_o_ai vec_unpackl(vector bool char __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008604#ifdef __LITTLE_ENDIAN__
8605 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
8606#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008607 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008608#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008609}
8610
Bill Seurer703e8482015-06-09 14:39:47 +00008611static vector int __ATTRS_o_ai vec_unpackl(vector short __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008612#ifdef __LITTLE_ENDIAN__
8613 return __builtin_altivec_vupkhsh(__a);
8614#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008615 return __builtin_altivec_vupklsh(__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008616#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008617}
8618
Bill Seurer703e8482015-06-09 14:39:47 +00008619static vector bool int __ATTRS_o_ai vec_unpackl(vector bool short __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008620#ifdef __LITTLE_ENDIAN__
8621 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
8622#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008623 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008624#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008625}
8626
Bill Seurer703e8482015-06-09 14:39:47 +00008627static vector unsigned int __ATTRS_o_ai vec_unpackl(vector pixel __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008628#ifdef __LITTLE_ENDIAN__
8629 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
8630#else
8631 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
8632#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008633}
8634
Bill Schmidt41e14c42015-05-16 01:02:25 +00008635#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +00008636static vector long long __ATTRS_o_ai vec_unpackl(vector int __a) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00008637#ifdef __LITTLE_ENDIAN__
8638 return __builtin_altivec_vupkhsw(__a);
8639#else
8640 return __builtin_altivec_vupklsw(__a);
8641#endif
8642}
8643
Bill Seurer703e8482015-06-09 14:39:47 +00008644static vector bool long long __ATTRS_o_ai vec_unpackl(vector bool int __a) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00008645#ifdef __LITTLE_ENDIAN__
8646 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
8647#else
8648 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
8649#endif
8650}
8651#endif
8652
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008653/* vec_vupklsb */
8654
Bill Seurer703e8482015-06-09 14:39:47 +00008655static vector short __ATTRS_o_ai vec_vupklsb(vector signed char __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008656#ifdef __LITTLE_ENDIAN__
8657 return __builtin_altivec_vupkhsb((vector char)__a);
8658#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008659 return __builtin_altivec_vupklsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008660#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008661}
8662
Bill Seurer703e8482015-06-09 14:39:47 +00008663static vector bool short __ATTRS_o_ai vec_vupklsb(vector bool char __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008664#ifdef __LITTLE_ENDIAN__
8665 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
8666#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008667 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008668#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008669}
8670
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008671/* vec_vupklsh */
8672
Bill Seurer703e8482015-06-09 14:39:47 +00008673static vector int __ATTRS_o_ai vec_vupklsh(vector short __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008674#ifdef __LITTLE_ENDIAN__
8675 return __builtin_altivec_vupkhsh(__a);
8676#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008677 return __builtin_altivec_vupklsh(__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008678#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008679}
8680
Bill Seurer703e8482015-06-09 14:39:47 +00008681static vector bool int __ATTRS_o_ai vec_vupklsh(vector bool short __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008682#ifdef __LITTLE_ENDIAN__
8683 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
8684#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008685 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008686#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008687}
8688
Bill Seurer703e8482015-06-09 14:39:47 +00008689static vector unsigned int __ATTRS_o_ai vec_vupklsh(vector pixel __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008690#ifdef __LITTLE_ENDIAN__
8691 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
8692#else
8693 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
8694#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008695}
8696
Bill Schmidt41e14c42015-05-16 01:02:25 +00008697/* vec_vupklsw */
8698
8699#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +00008700static vector long long __ATTRS_o_ai vec_vupklsw(vector int __a) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00008701#ifdef __LITTLE_ENDIAN__
8702 return __builtin_altivec_vupkhsw(__a);
8703#else
8704 return __builtin_altivec_vupklsw(__a);
8705#endif
8706}
8707
Bill Seurer703e8482015-06-09 14:39:47 +00008708static vector bool long long __ATTRS_o_ai vec_vupklsw(vector bool int __a) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00008709#ifdef __LITTLE_ENDIAN__
8710 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
8711#else
8712 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
8713#endif
8714}
8715#endif
8716
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008717/* vec_vsx_ld */
8718
8719#ifdef __VSX__
8720
Bill Seurer703e8482015-06-09 14:39:47 +00008721static vector signed int __ATTRS_o_ai vec_vsx_ld(int __a,
8722 const vector signed int *__b) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008723 return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
8724}
8725
8726static vector unsigned int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008727vec_vsx_ld(int __a, const vector unsigned int *__b) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008728 return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
8729}
8730
Bill Seurer703e8482015-06-09 14:39:47 +00008731static vector float __ATTRS_o_ai vec_vsx_ld(int __a, const vector float *__b) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008732 return (vector float)__builtin_vsx_lxvw4x(__a, __b);
8733}
8734
8735static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008736vec_vsx_ld(int __a, const vector signed long long *__b) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008737 return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b);
8738}
8739
8740static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008741vec_vsx_ld(int __a, const vector unsigned long long *__b) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008742 return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b);
8743}
8744
Bill Seurer703e8482015-06-09 14:39:47 +00008745static vector double __ATTRS_o_ai vec_vsx_ld(int __a,
8746 const vector double *__b) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008747 return (vector double)__builtin_vsx_lxvd2x(__a, __b);
8748}
8749
8750#endif
8751
8752/* vec_vsx_st */
8753
8754#ifdef __VSX__
8755
Bill Seurer703e8482015-06-09 14:39:47 +00008756static void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
8757 vector signed int *__c) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008758 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
8759}
8760
Bill Seurer703e8482015-06-09 14:39:47 +00008761static void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
8762 vector unsigned int *__c) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008763 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
8764}
8765
Bill Seurer703e8482015-06-09 14:39:47 +00008766static void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
8767 vector float *__c) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008768 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
8769}
8770
Bill Seurer703e8482015-06-09 14:39:47 +00008771static void __ATTRS_o_ai vec_vsx_st(vector signed long long __a, int __b,
8772 vector signed long long *__c) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008773 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
8774}
8775
Bill Seurer703e8482015-06-09 14:39:47 +00008776static void __ATTRS_o_ai vec_vsx_st(vector unsigned long long __a, int __b,
8777 vector unsigned long long *__c) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008778 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
8779}
8780
Bill Seurer703e8482015-06-09 14:39:47 +00008781static void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
8782 vector double *__c) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008783 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
8784}
8785
8786#endif
8787
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008788/* vec_xor */
8789
8790#define __builtin_altivec_vxor vec_xor
8791
Bill Seurer703e8482015-06-09 14:39:47 +00008792static vector signed char __ATTRS_o_ai vec_xor(vector signed char __a,
8793 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008794 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008795}
8796
Bill Seurer703e8482015-06-09 14:39:47 +00008797static vector signed char __ATTRS_o_ai vec_xor(vector bool char __a,
8798 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008799 return (vector signed char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008800}
8801
Bill Seurer703e8482015-06-09 14:39:47 +00008802static vector signed char __ATTRS_o_ai vec_xor(vector signed char __a,
8803 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008804 return __a ^ (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008805}
8806
Bill Seurer703e8482015-06-09 14:39:47 +00008807static vector unsigned char __ATTRS_o_ai vec_xor(vector unsigned char __a,
8808 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008809 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008810}
8811
Bill Seurer703e8482015-06-09 14:39:47 +00008812static vector unsigned char __ATTRS_o_ai vec_xor(vector bool char __a,
8813 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008814 return (vector unsigned char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008815}
8816
Bill Seurer703e8482015-06-09 14:39:47 +00008817static vector unsigned char __ATTRS_o_ai vec_xor(vector unsigned char __a,
8818 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008819 return __a ^ (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008820}
8821
Bill Seurer703e8482015-06-09 14:39:47 +00008822static vector bool char __ATTRS_o_ai vec_xor(vector bool char __a,
8823 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008824 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008825}
8826
Bill Seurer703e8482015-06-09 14:39:47 +00008827static vector short __ATTRS_o_ai vec_xor(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008828 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008829}
8830
Bill Seurer703e8482015-06-09 14:39:47 +00008831static vector short __ATTRS_o_ai vec_xor(vector bool short __a,
8832 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008833 return (vector short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008834}
8835
Bill Seurer703e8482015-06-09 14:39:47 +00008836static vector short __ATTRS_o_ai vec_xor(vector short __a,
8837 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008838 return __a ^ (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008839}
8840
Bill Seurer703e8482015-06-09 14:39:47 +00008841static vector unsigned short __ATTRS_o_ai vec_xor(vector unsigned short __a,
8842 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008843 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008844}
8845
Bill Seurer703e8482015-06-09 14:39:47 +00008846static vector unsigned short __ATTRS_o_ai vec_xor(vector bool short __a,
8847 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008848 return (vector unsigned short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008849}
8850
Bill Seurer703e8482015-06-09 14:39:47 +00008851static vector unsigned short __ATTRS_o_ai vec_xor(vector unsigned short __a,
8852 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008853 return __a ^ (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008854}
8855
Bill Seurer703e8482015-06-09 14:39:47 +00008856static vector bool short __ATTRS_o_ai vec_xor(vector bool short __a,
8857 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008858 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008859}
8860
Bill Seurer703e8482015-06-09 14:39:47 +00008861static vector int __ATTRS_o_ai vec_xor(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008862 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008863}
8864
Bill Seurer703e8482015-06-09 14:39:47 +00008865static vector int __ATTRS_o_ai vec_xor(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008866 return (vector int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008867}
8868
Bill Seurer703e8482015-06-09 14:39:47 +00008869static vector int __ATTRS_o_ai vec_xor(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008870 return __a ^ (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008871}
8872
Bill Seurer703e8482015-06-09 14:39:47 +00008873static vector unsigned int __ATTRS_o_ai vec_xor(vector unsigned int __a,
8874 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008875 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008876}
8877
Bill Seurer703e8482015-06-09 14:39:47 +00008878static vector unsigned int __ATTRS_o_ai vec_xor(vector bool int __a,
8879 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008880 return (vector unsigned int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008881}
8882
Bill Seurer703e8482015-06-09 14:39:47 +00008883static vector unsigned int __ATTRS_o_ai vec_xor(vector unsigned int __a,
8884 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008885 return __a ^ (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008886}
8887
Bill Seurer703e8482015-06-09 14:39:47 +00008888static vector bool int __ATTRS_o_ai vec_xor(vector bool int __a,
8889 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008890 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008891}
8892
Bill Seurer703e8482015-06-09 14:39:47 +00008893static vector float __ATTRS_o_ai vec_xor(vector float __a, vector float __b) {
8894 vector unsigned int __res =
8895 (vector unsigned int)__a ^ (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00008896 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008897}
8898
Bill Seurer703e8482015-06-09 14:39:47 +00008899static vector float __ATTRS_o_ai vec_xor(vector bool int __a,
8900 vector float __b) {
8901 vector unsigned int __res =
8902 (vector unsigned int)__a ^ (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00008903 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008904}
8905
Bill Seurer703e8482015-06-09 14:39:47 +00008906static vector float __ATTRS_o_ai vec_xor(vector float __a,
8907 vector bool int __b) {
8908 vector unsigned int __res =
8909 (vector unsigned int)__a ^ (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00008910 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008911}
8912
Bill Seurer8be14f12015-06-04 18:45:44 +00008913#ifdef __VSX__
8914static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008915vec_xor(vector signed long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00008916 return __a ^ __b;
8917}
8918
8919static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008920vec_xor(vector bool long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00008921 return (vector signed long long)__a ^ __b;
8922}
8923
Bill Seurer703e8482015-06-09 14:39:47 +00008924static vector signed long long __ATTRS_o_ai vec_xor(vector signed long long __a,
8925 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00008926 return __a ^ (vector signed long long)__b;
8927}
8928
8929static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008930vec_xor(vector unsigned long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00008931 return __a ^ __b;
8932}
8933
8934static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008935vec_xor(vector bool long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00008936 return (vector unsigned long long)__a ^ __b;
8937}
8938
8939static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008940vec_xor(vector unsigned long long __a, vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00008941 return __a ^ (vector unsigned long long)__b;
8942}
8943
Bill Seurer703e8482015-06-09 14:39:47 +00008944static vector bool long long __ATTRS_o_ai vec_xor(vector bool long long __a,
8945 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00008946 return __a ^ __b;
8947}
8948#endif
8949
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008950/* vec_vxor */
8951
Bill Seurer703e8482015-06-09 14:39:47 +00008952static vector signed char __ATTRS_o_ai vec_vxor(vector signed char __a,
8953 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008954 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008955}
8956
Bill Seurer703e8482015-06-09 14:39:47 +00008957static vector signed char __ATTRS_o_ai vec_vxor(vector bool char __a,
8958 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008959 return (vector signed char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008960}
8961
Bill Seurer703e8482015-06-09 14:39:47 +00008962static vector signed char __ATTRS_o_ai vec_vxor(vector signed char __a,
8963 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008964 return __a ^ (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008965}
8966
Bill Seurer703e8482015-06-09 14:39:47 +00008967static vector unsigned char __ATTRS_o_ai vec_vxor(vector unsigned char __a,
8968 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008969 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008970}
8971
Bill Seurer703e8482015-06-09 14:39:47 +00008972static vector unsigned char __ATTRS_o_ai vec_vxor(vector bool char __a,
8973 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008974 return (vector unsigned char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008975}
8976
Bill Seurer703e8482015-06-09 14:39:47 +00008977static vector unsigned char __ATTRS_o_ai vec_vxor(vector unsigned char __a,
8978 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008979 return __a ^ (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008980}
8981
Bill Seurer703e8482015-06-09 14:39:47 +00008982static vector bool char __ATTRS_o_ai vec_vxor(vector bool char __a,
8983 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008984 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008985}
8986
Bill Seurer703e8482015-06-09 14:39:47 +00008987static vector short __ATTRS_o_ai vec_vxor(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008988 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008989}
8990
Bill Seurer703e8482015-06-09 14:39:47 +00008991static vector short __ATTRS_o_ai vec_vxor(vector bool short __a,
8992 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008993 return (vector short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008994}
8995
Bill Seurer703e8482015-06-09 14:39:47 +00008996static vector short __ATTRS_o_ai vec_vxor(vector short __a,
8997 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008998 return __a ^ (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008999}
9000
Bill Seurer703e8482015-06-09 14:39:47 +00009001static vector unsigned short __ATTRS_o_ai vec_vxor(vector unsigned short __a,
9002 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009003 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009004}
9005
Bill Seurer703e8482015-06-09 14:39:47 +00009006static vector unsigned short __ATTRS_o_ai vec_vxor(vector bool short __a,
9007 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009008 return (vector unsigned short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009009}
9010
Bill Seurer703e8482015-06-09 14:39:47 +00009011static vector unsigned short __ATTRS_o_ai vec_vxor(vector unsigned short __a,
9012 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009013 return __a ^ (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009014}
9015
Bill Seurer703e8482015-06-09 14:39:47 +00009016static vector bool short __ATTRS_o_ai vec_vxor(vector bool short __a,
9017 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009018 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009019}
9020
Bill Seurer703e8482015-06-09 14:39:47 +00009021static vector int __ATTRS_o_ai vec_vxor(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009022 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009023}
9024
Bill Seurer703e8482015-06-09 14:39:47 +00009025static vector int __ATTRS_o_ai vec_vxor(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009026 return (vector int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009027}
9028
Bill Seurer703e8482015-06-09 14:39:47 +00009029static vector int __ATTRS_o_ai vec_vxor(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009030 return __a ^ (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009031}
9032
Bill Seurer703e8482015-06-09 14:39:47 +00009033static vector unsigned int __ATTRS_o_ai vec_vxor(vector unsigned int __a,
9034 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009035 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009036}
9037
Bill Seurer703e8482015-06-09 14:39:47 +00009038static vector unsigned int __ATTRS_o_ai vec_vxor(vector bool int __a,
9039 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009040 return (vector unsigned int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009041}
9042
Bill Seurer703e8482015-06-09 14:39:47 +00009043static vector unsigned int __ATTRS_o_ai vec_vxor(vector unsigned int __a,
9044 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009045 return __a ^ (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009046}
9047
Bill Seurer703e8482015-06-09 14:39:47 +00009048static vector bool int __ATTRS_o_ai vec_vxor(vector bool int __a,
9049 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009050 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009051}
9052
Bill Seurer703e8482015-06-09 14:39:47 +00009053static vector float __ATTRS_o_ai vec_vxor(vector float __a, vector float __b) {
9054 vector unsigned int __res =
9055 (vector unsigned int)__a ^ (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00009056 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009057}
Chris Lattnerdad40622010-04-14 03:54:58 +00009058
Bill Seurer703e8482015-06-09 14:39:47 +00009059static vector float __ATTRS_o_ai vec_vxor(vector bool int __a,
9060 vector float __b) {
9061 vector unsigned int __res =
9062 (vector unsigned int)__a ^ (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00009063 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009064}
9065
Bill Seurer703e8482015-06-09 14:39:47 +00009066static vector float __ATTRS_o_ai vec_vxor(vector float __a,
9067 vector bool int __b) {
9068 vector unsigned int __res =
9069 (vector unsigned int)__a ^ (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00009070 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009071}
9072
Bill Seurer8be14f12015-06-04 18:45:44 +00009073#ifdef __VSX__
9074static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009075vec_vxor(vector signed long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00009076 return __a ^ __b;
9077}
9078
9079static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009080vec_vxor(vector bool long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00009081 return (vector signed long long)__a ^ __b;
9082}
9083
9084static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009085vec_vxor(vector signed long long __a, vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00009086 return __a ^ (vector signed long long)__b;
9087}
9088
9089static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009090vec_vxor(vector unsigned long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00009091 return __a ^ __b;
9092}
9093
9094static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009095vec_vxor(vector bool long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00009096 return (vector unsigned long long)__a ^ __b;
9097}
9098
9099static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009100vec_vxor(vector unsigned long long __a, vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00009101 return __a ^ (vector unsigned long long)__b;
9102}
9103
Bill Seurer703e8482015-06-09 14:39:47 +00009104static vector bool long long __ATTRS_o_ai vec_vxor(vector bool long long __a,
9105 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00009106 return __a ^ __b;
9107}
9108#endif
9109
Anton Yartsev79d6af32010-09-18 00:39:16 +00009110/* ------------------------ extensions for CBEA ----------------------------- */
Anton Yartsev73d40232010-10-14 14:37:46 +00009111
9112/* vec_extract */
9113
Bill Seurer703e8482015-06-09 14:39:47 +00009114static signed char __ATTRS_o_ai vec_extract(vector signed char __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009115 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009116}
9117
Bill Seurer703e8482015-06-09 14:39:47 +00009118static unsigned char __ATTRS_o_ai vec_extract(vector unsigned char __a,
9119 int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009120 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009121}
9122
Bill Seurer703e8482015-06-09 14:39:47 +00009123static short __ATTRS_o_ai vec_extract(vector short __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009124 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009125}
9126
Bill Seurer703e8482015-06-09 14:39:47 +00009127static unsigned short __ATTRS_o_ai vec_extract(vector unsigned short __a,
9128 int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009129 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009130}
9131
Bill Seurer703e8482015-06-09 14:39:47 +00009132static int __ATTRS_o_ai vec_extract(vector int __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009133 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009134}
9135
Bill Seurer703e8482015-06-09 14:39:47 +00009136static unsigned int __ATTRS_o_ai vec_extract(vector unsigned int __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009137 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009138}
9139
Bill Seurer703e8482015-06-09 14:39:47 +00009140static float __ATTRS_o_ai vec_extract(vector float __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009141 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009142}
9143
9144/* vec_insert */
9145
Bill Seurer703e8482015-06-09 14:39:47 +00009146static vector signed char __ATTRS_o_ai vec_insert(signed char __a,
9147 vector signed char __b,
9148 int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009149 __b[__c] = __a;
9150 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009151}
9152
Bill Seurer703e8482015-06-09 14:39:47 +00009153static vector unsigned char __ATTRS_o_ai vec_insert(unsigned char __a,
9154 vector unsigned char __b,
9155 int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009156 __b[__c] = __a;
9157 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009158}
9159
Bill Seurer703e8482015-06-09 14:39:47 +00009160static vector short __ATTRS_o_ai vec_insert(short __a, vector short __b,
9161 int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009162 __b[__c] = __a;
9163 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009164}
9165
Bill Seurer703e8482015-06-09 14:39:47 +00009166static vector unsigned short __ATTRS_o_ai vec_insert(unsigned short __a,
9167 vector unsigned short __b,
9168 int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009169 __b[__c] = __a;
9170 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009171}
9172
Bill Seurer703e8482015-06-09 14:39:47 +00009173static vector int __ATTRS_o_ai vec_insert(int __a, vector int __b, int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009174 __b[__c] = __a;
9175 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009176}
9177
Bill Seurer703e8482015-06-09 14:39:47 +00009178static vector unsigned int __ATTRS_o_ai vec_insert(unsigned int __a,
9179 vector unsigned int __b,
9180 int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009181 __b[__c] = __a;
9182 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009183}
9184
Bill Seurer703e8482015-06-09 14:39:47 +00009185static vector float __ATTRS_o_ai vec_insert(float __a, vector float __b,
9186 int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009187 __b[__c] = __a;
9188 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009189}
9190
9191/* vec_lvlx */
9192
Bill Seurer703e8482015-06-09 14:39:47 +00009193static vector signed char __ATTRS_o_ai vec_lvlx(int __a,
9194 const signed char *__b) {
9195 return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009196 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009197}
9198
Bill Seurer703e8482015-06-09 14:39:47 +00009199static vector signed char __ATTRS_o_ai vec_lvlx(int __a,
9200 const vector signed char *__b) {
9201 return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009202 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009203}
9204
Bill Seurer703e8482015-06-09 14:39:47 +00009205static vector unsigned char __ATTRS_o_ai vec_lvlx(int __a,
9206 const unsigned char *__b) {
9207 return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009208 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009209}
9210
9211static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009212vec_lvlx(int __a, const vector unsigned char *__b) {
9213 return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009214 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009215}
9216
Bill Seurer703e8482015-06-09 14:39:47 +00009217static vector bool char __ATTRS_o_ai vec_lvlx(int __a,
9218 const vector bool char *__b) {
9219 return vec_perm(vec_ld(__a, __b), (vector bool char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009220 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009221}
9222
Bill Seurer703e8482015-06-09 14:39:47 +00009223static vector short __ATTRS_o_ai vec_lvlx(int __a, const short *__b) {
9224 return vec_perm(vec_ld(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009225}
9226
Bill Seurer703e8482015-06-09 14:39:47 +00009227static vector short __ATTRS_o_ai vec_lvlx(int __a, const vector short *__b) {
9228 return vec_perm(vec_ld(__a, __b), (vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009229 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009230}
9231
Bill Seurer703e8482015-06-09 14:39:47 +00009232static vector unsigned short __ATTRS_o_ai vec_lvlx(int __a,
9233 const unsigned short *__b) {
9234 return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009235 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009236}
9237
9238static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009239vec_lvlx(int __a, const vector unsigned short *__b) {
9240 return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009241 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009242}
9243
Bill Seurer703e8482015-06-09 14:39:47 +00009244static vector bool short __ATTRS_o_ai vec_lvlx(int __a,
9245 const vector bool short *__b) {
9246 return vec_perm(vec_ld(__a, __b), (vector bool short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009247 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009248}
9249
Bill Seurer703e8482015-06-09 14:39:47 +00009250static vector pixel __ATTRS_o_ai vec_lvlx(int __a, const vector pixel *__b) {
9251 return vec_perm(vec_ld(__a, __b), (vector pixel)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009252 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009253}
9254
Bill Seurer703e8482015-06-09 14:39:47 +00009255static vector int __ATTRS_o_ai vec_lvlx(int __a, const int *__b) {
9256 return vec_perm(vec_ld(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009257}
9258
Bill Seurer703e8482015-06-09 14:39:47 +00009259static vector int __ATTRS_o_ai vec_lvlx(int __a, const vector int *__b) {
9260 return vec_perm(vec_ld(__a, __b), (vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009261 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009262}
9263
Bill Seurer703e8482015-06-09 14:39:47 +00009264static vector unsigned int __ATTRS_o_ai vec_lvlx(int __a,
9265 const unsigned int *__b) {
9266 return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009267 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009268}
9269
9270static vector unsigned int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009271vec_lvlx(int __a, const vector unsigned int *__b) {
9272 return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009273 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009274}
9275
Bill Seurer703e8482015-06-09 14:39:47 +00009276static vector bool int __ATTRS_o_ai vec_lvlx(int __a,
9277 const vector bool int *__b) {
9278 return vec_perm(vec_ld(__a, __b), (vector bool int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009279 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009280}
9281
Bill Seurer703e8482015-06-09 14:39:47 +00009282static vector float __ATTRS_o_ai vec_lvlx(int __a, const float *__b) {
9283 return vec_perm(vec_ld(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009284}
9285
Bill Seurer703e8482015-06-09 14:39:47 +00009286static vector float __ATTRS_o_ai vec_lvlx(int __a, const vector float *__b) {
9287 return vec_perm(vec_ld(__a, __b), (vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009288 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009289}
9290
9291/* vec_lvlxl */
9292
Bill Seurer703e8482015-06-09 14:39:47 +00009293static vector signed char __ATTRS_o_ai vec_lvlxl(int __a,
9294 const signed char *__b) {
9295 return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009296 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009297}
9298
9299static vector signed char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009300vec_lvlxl(int __a, const vector signed char *__b) {
9301 return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009302 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009303}
9304
Bill Seurer703e8482015-06-09 14:39:47 +00009305static vector unsigned char __ATTRS_o_ai vec_lvlxl(int __a,
9306 const unsigned char *__b) {
9307 return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009308 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009309}
9310
9311static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009312vec_lvlxl(int __a, const vector unsigned char *__b) {
9313 return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009314 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009315}
9316
Bill Seurer703e8482015-06-09 14:39:47 +00009317static vector bool char __ATTRS_o_ai vec_lvlxl(int __a,
9318 const vector bool char *__b) {
9319 return vec_perm(vec_ldl(__a, __b), (vector bool char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009320 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009321}
9322
Bill Seurer703e8482015-06-09 14:39:47 +00009323static vector short __ATTRS_o_ai vec_lvlxl(int __a, const short *__b) {
9324 return vec_perm(vec_ldl(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009325}
9326
Bill Seurer703e8482015-06-09 14:39:47 +00009327static vector short __ATTRS_o_ai vec_lvlxl(int __a, const vector short *__b) {
9328 return vec_perm(vec_ldl(__a, __b), (vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009329 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009330}
9331
Bill Seurer703e8482015-06-09 14:39:47 +00009332static vector unsigned short __ATTRS_o_ai vec_lvlxl(int __a,
9333 const unsigned short *__b) {
9334 return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009335 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009336}
9337
9338static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009339vec_lvlxl(int __a, const vector unsigned short *__b) {
9340 return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009341 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009342}
9343
Bill Seurer703e8482015-06-09 14:39:47 +00009344static vector bool short __ATTRS_o_ai vec_lvlxl(int __a,
9345 const vector bool short *__b) {
9346 return vec_perm(vec_ldl(__a, __b), (vector bool short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009347 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009348}
9349
Bill Seurer703e8482015-06-09 14:39:47 +00009350static vector pixel __ATTRS_o_ai vec_lvlxl(int __a, const vector pixel *__b) {
9351 return vec_perm(vec_ldl(__a, __b), (vector pixel)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009352 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009353}
9354
Bill Seurer703e8482015-06-09 14:39:47 +00009355static vector int __ATTRS_o_ai vec_lvlxl(int __a, const int *__b) {
9356 return vec_perm(vec_ldl(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009357}
9358
Bill Seurer703e8482015-06-09 14:39:47 +00009359static vector int __ATTRS_o_ai vec_lvlxl(int __a, const vector int *__b) {
9360 return vec_perm(vec_ldl(__a, __b), (vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009361 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009362}
9363
Bill Seurer703e8482015-06-09 14:39:47 +00009364static vector unsigned int __ATTRS_o_ai vec_lvlxl(int __a,
9365 const unsigned int *__b) {
9366 return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009367 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009368}
9369
9370static vector unsigned int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009371vec_lvlxl(int __a, const vector unsigned int *__b) {
9372 return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009373 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009374}
9375
Bill Seurer703e8482015-06-09 14:39:47 +00009376static vector bool int __ATTRS_o_ai vec_lvlxl(int __a,
9377 const vector bool int *__b) {
9378 return vec_perm(vec_ldl(__a, __b), (vector bool int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009379 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009380}
9381
Bill Seurer703e8482015-06-09 14:39:47 +00009382static vector float __ATTRS_o_ai vec_lvlxl(int __a, const float *__b) {
9383 return vec_perm(vec_ldl(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009384}
9385
Bill Seurer703e8482015-06-09 14:39:47 +00009386static vector float __ATTRS_o_ai vec_lvlxl(int __a, vector float *__b) {
9387 return vec_perm(vec_ldl(__a, __b), (vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009388 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009389}
9390
9391/* vec_lvrx */
9392
Bill Seurer703e8482015-06-09 14:39:47 +00009393static vector signed char __ATTRS_o_ai vec_lvrx(int __a,
9394 const signed char *__b) {
9395 return vec_perm((vector signed char)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009396 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009397}
9398
Bill Seurer703e8482015-06-09 14:39:47 +00009399static vector signed char __ATTRS_o_ai vec_lvrx(int __a,
9400 const vector signed char *__b) {
9401 return vec_perm((vector signed char)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009402 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009403}
9404
Bill Seurer703e8482015-06-09 14:39:47 +00009405static vector unsigned char __ATTRS_o_ai vec_lvrx(int __a,
9406 const unsigned char *__b) {
9407 return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009408 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009409}
9410
9411static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009412vec_lvrx(int __a, const vector unsigned char *__b) {
9413 return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009414 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009415}
9416
Bill Seurer703e8482015-06-09 14:39:47 +00009417static vector bool char __ATTRS_o_ai vec_lvrx(int __a,
9418 const vector bool char *__b) {
9419 return vec_perm((vector bool char)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009420 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009421}
9422
Bill Seurer703e8482015-06-09 14:39:47 +00009423static vector short __ATTRS_o_ai vec_lvrx(int __a, const short *__b) {
9424 return vec_perm((vector short)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009425}
9426
Bill Seurer703e8482015-06-09 14:39:47 +00009427static vector short __ATTRS_o_ai vec_lvrx(int __a, const vector short *__b) {
9428 return vec_perm((vector short)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009429 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009430}
9431
Bill Seurer703e8482015-06-09 14:39:47 +00009432static vector unsigned short __ATTRS_o_ai vec_lvrx(int __a,
9433 const unsigned short *__b) {
9434 return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009435 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009436}
9437
9438static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009439vec_lvrx(int __a, const vector unsigned short *__b) {
9440 return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009441 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009442}
9443
Bill Seurer703e8482015-06-09 14:39:47 +00009444static vector bool short __ATTRS_o_ai vec_lvrx(int __a,
9445 const vector bool short *__b) {
9446 return vec_perm((vector bool short)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009447 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009448}
9449
Bill Seurer703e8482015-06-09 14:39:47 +00009450static vector pixel __ATTRS_o_ai vec_lvrx(int __a, const vector pixel *__b) {
9451 return vec_perm((vector pixel)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009452 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009453}
9454
Bill Seurer703e8482015-06-09 14:39:47 +00009455static vector int __ATTRS_o_ai vec_lvrx(int __a, const int *__b) {
9456 return vec_perm((vector int)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009457}
9458
Bill Seurer703e8482015-06-09 14:39:47 +00009459static vector int __ATTRS_o_ai vec_lvrx(int __a, const vector int *__b) {
9460 return vec_perm((vector int)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009461 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009462}
9463
Bill Seurer703e8482015-06-09 14:39:47 +00009464static vector unsigned int __ATTRS_o_ai vec_lvrx(int __a,
9465 const unsigned int *__b) {
9466 return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009467 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009468}
9469
9470static vector unsigned int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009471vec_lvrx(int __a, const vector unsigned int *__b) {
9472 return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009473 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009474}
9475
Bill Seurer703e8482015-06-09 14:39:47 +00009476static vector bool int __ATTRS_o_ai vec_lvrx(int __a,
9477 const vector bool int *__b) {
9478 return vec_perm((vector bool int)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009479 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009480}
9481
Bill Seurer703e8482015-06-09 14:39:47 +00009482static vector float __ATTRS_o_ai vec_lvrx(int __a, const float *__b) {
9483 return vec_perm((vector float)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009484}
9485
Bill Seurer703e8482015-06-09 14:39:47 +00009486static vector float __ATTRS_o_ai vec_lvrx(int __a, const vector float *__b) {
9487 return vec_perm((vector float)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009488 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009489}
9490
9491/* vec_lvrxl */
9492
Bill Seurer703e8482015-06-09 14:39:47 +00009493static vector signed char __ATTRS_o_ai vec_lvrxl(int __a,
9494 const signed char *__b) {
9495 return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009496 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009497}
9498
9499static vector signed char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009500vec_lvrxl(int __a, const vector signed char *__b) {
9501 return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009502 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009503}
9504
Bill Seurer703e8482015-06-09 14:39:47 +00009505static vector unsigned char __ATTRS_o_ai vec_lvrxl(int __a,
9506 const unsigned char *__b) {
9507 return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009508 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009509}
9510
9511static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009512vec_lvrxl(int __a, const vector unsigned char *__b) {
9513 return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009514 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009515}
9516
Bill Seurer703e8482015-06-09 14:39:47 +00009517static vector bool char __ATTRS_o_ai vec_lvrxl(int __a,
9518 const vector bool char *__b) {
9519 return vec_perm((vector bool char)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009520 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009521}
9522
Bill Seurer703e8482015-06-09 14:39:47 +00009523static vector short __ATTRS_o_ai vec_lvrxl(int __a, const short *__b) {
9524 return vec_perm((vector short)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009525}
9526
Bill Seurer703e8482015-06-09 14:39:47 +00009527static vector short __ATTRS_o_ai vec_lvrxl(int __a, const vector short *__b) {
9528 return vec_perm((vector short)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009529 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009530}
9531
Bill Seurer703e8482015-06-09 14:39:47 +00009532static vector unsigned short __ATTRS_o_ai vec_lvrxl(int __a,
9533 const unsigned short *__b) {
9534 return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009535 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009536}
9537
9538static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009539vec_lvrxl(int __a, const vector unsigned short *__b) {
9540 return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009541 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009542}
9543
Bill Seurer703e8482015-06-09 14:39:47 +00009544static vector bool short __ATTRS_o_ai vec_lvrxl(int __a,
9545 const vector bool short *__b) {
9546 return vec_perm((vector bool short)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009547 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009548}
9549
Bill Seurer703e8482015-06-09 14:39:47 +00009550static vector pixel __ATTRS_o_ai vec_lvrxl(int __a, const vector pixel *__b) {
9551 return vec_perm((vector pixel)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009552 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009553}
9554
Bill Seurer703e8482015-06-09 14:39:47 +00009555static vector int __ATTRS_o_ai vec_lvrxl(int __a, const int *__b) {
9556 return vec_perm((vector int)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009557}
9558
Bill Seurer703e8482015-06-09 14:39:47 +00009559static vector int __ATTRS_o_ai vec_lvrxl(int __a, const vector int *__b) {
9560 return vec_perm((vector int)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009561 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009562}
9563
Bill Seurer703e8482015-06-09 14:39:47 +00009564static vector unsigned int __ATTRS_o_ai vec_lvrxl(int __a,
9565 const unsigned int *__b) {
9566 return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009567 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009568}
9569
9570static vector unsigned int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009571vec_lvrxl(int __a, const vector unsigned int *__b) {
9572 return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009573 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009574}
9575
Bill Seurer703e8482015-06-09 14:39:47 +00009576static vector bool int __ATTRS_o_ai vec_lvrxl(int __a,
9577 const vector bool int *__b) {
9578 return vec_perm((vector bool int)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009579 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009580}
9581
Bill Seurer703e8482015-06-09 14:39:47 +00009582static vector float __ATTRS_o_ai vec_lvrxl(int __a, const float *__b) {
9583 return vec_perm((vector float)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009584}
9585
Bill Seurer703e8482015-06-09 14:39:47 +00009586static vector float __ATTRS_o_ai vec_lvrxl(int __a, const vector float *__b) {
9587 return vec_perm((vector float)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009588 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009589}
9590
9591/* vec_stvlx */
9592
Bill Seurer703e8482015-06-09 14:39:47 +00009593static void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
9594 signed char *__c) {
9595 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9596 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009597}
9598
Bill Seurer703e8482015-06-09 14:39:47 +00009599static void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
9600 vector signed char *__c) {
9601 return vec_st(
9602 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9603 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009604}
9605
Bill Seurer703e8482015-06-09 14:39:47 +00009606static void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
9607 unsigned char *__c) {
9608 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9609 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009610}
9611
Bill Seurer703e8482015-06-09 14:39:47 +00009612static void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
9613 vector unsigned char *__c) {
9614 return vec_st(
9615 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9616 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009617}
9618
Bill Seurer703e8482015-06-09 14:39:47 +00009619static void __ATTRS_o_ai vec_stvlx(vector bool char __a, int __b,
9620 vector bool char *__c) {
9621 return vec_st(
9622 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9623 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009624}
9625
Bill Seurer703e8482015-06-09 14:39:47 +00009626static void __ATTRS_o_ai vec_stvlx(vector short __a, int __b, short *__c) {
9627 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9628 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009629}
9630
Bill Seurer703e8482015-06-09 14:39:47 +00009631static void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
9632 vector short *__c) {
9633 return vec_st(
9634 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9635 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009636}
9637
Bill Seurer703e8482015-06-09 14:39:47 +00009638static void __ATTRS_o_ai vec_stvlx(vector unsigned short __a, int __b,
9639 unsigned short *__c) {
9640 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9641 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009642}
9643
Bill Seurer703e8482015-06-09 14:39:47 +00009644static void __ATTRS_o_ai vec_stvlx(vector unsigned short __a, int __b,
9645 vector unsigned short *__c) {
9646 return vec_st(
9647 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9648 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009649}
9650
Bill Seurer703e8482015-06-09 14:39:47 +00009651static void __ATTRS_o_ai vec_stvlx(vector bool short __a, int __b,
9652 vector bool short *__c) {
9653 return vec_st(
9654 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9655 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009656}
9657
Bill Seurer703e8482015-06-09 14:39:47 +00009658static void __ATTRS_o_ai vec_stvlx(vector pixel __a, int __b,
9659 vector pixel *__c) {
9660 return vec_st(
9661 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9662 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009663}
9664
Bill Seurer703e8482015-06-09 14:39:47 +00009665static void __ATTRS_o_ai vec_stvlx(vector int __a, int __b, int *__c) {
9666 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9667 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009668}
9669
Bill Seurer703e8482015-06-09 14:39:47 +00009670static void __ATTRS_o_ai vec_stvlx(vector int __a, int __b, vector int *__c) {
9671 return vec_st(
9672 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9673 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009674}
9675
Bill Seurer703e8482015-06-09 14:39:47 +00009676static void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
9677 unsigned int *__c) {
9678 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9679 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009680}
9681
Bill Seurer703e8482015-06-09 14:39:47 +00009682static void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
9683 vector unsigned int *__c) {
9684 return vec_st(
9685 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9686 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009687}
9688
Bill Seurer703e8482015-06-09 14:39:47 +00009689static void __ATTRS_o_ai vec_stvlx(vector bool int __a, int __b,
9690 vector bool int *__c) {
9691 return vec_st(
9692 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9693 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009694}
9695
Bill Seurer703e8482015-06-09 14:39:47 +00009696static void __ATTRS_o_ai vec_stvlx(vector float __a, int __b,
9697 vector float *__c) {
9698 return vec_st(
9699 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9700 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009701}
9702
9703/* vec_stvlxl */
9704
Bill Seurer703e8482015-06-09 14:39:47 +00009705static void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
9706 signed char *__c) {
9707 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9708 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009709}
9710
Bill Seurer703e8482015-06-09 14:39:47 +00009711static void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
9712 vector signed char *__c) {
9713 return vec_stl(
9714 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9715 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009716}
9717
Bill Seurer703e8482015-06-09 14:39:47 +00009718static void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a, int __b,
9719 unsigned char *__c) {
9720 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9721 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009722}
9723
Bill Seurer703e8482015-06-09 14:39:47 +00009724static void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a, int __b,
9725 vector unsigned char *__c) {
9726 return vec_stl(
9727 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9728 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009729}
9730
Bill Seurer703e8482015-06-09 14:39:47 +00009731static void __ATTRS_o_ai vec_stvlxl(vector bool char __a, int __b,
9732 vector bool char *__c) {
9733 return vec_stl(
9734 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9735 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009736}
9737
Bill Seurer703e8482015-06-09 14:39:47 +00009738static void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b, short *__c) {
9739 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9740 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009741}
9742
Bill Seurer703e8482015-06-09 14:39:47 +00009743static void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
9744 vector short *__c) {
9745 return vec_stl(
9746 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9747 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009748}
9749
Bill Seurer703e8482015-06-09 14:39:47 +00009750static void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a, int __b,
9751 unsigned short *__c) {
9752 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9753 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009754}
9755
Bill Seurer703e8482015-06-09 14:39:47 +00009756static void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a, int __b,
9757 vector unsigned short *__c) {
9758 return vec_stl(
9759 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9760 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009761}
9762
Bill Seurer703e8482015-06-09 14:39:47 +00009763static void __ATTRS_o_ai vec_stvlxl(vector bool short __a, int __b,
9764 vector bool short *__c) {
9765 return vec_stl(
9766 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9767 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009768}
9769
Bill Seurer703e8482015-06-09 14:39:47 +00009770static void __ATTRS_o_ai vec_stvlxl(vector pixel __a, int __b,
9771 vector pixel *__c) {
9772 return vec_stl(
9773 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9774 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009775}
9776
Bill Seurer703e8482015-06-09 14:39:47 +00009777static void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b, int *__c) {
9778 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9779 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009780}
9781
Bill Seurer703e8482015-06-09 14:39:47 +00009782static void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b, vector int *__c) {
9783 return vec_stl(
9784 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9785 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009786}
9787
Bill Seurer703e8482015-06-09 14:39:47 +00009788static void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
9789 unsigned int *__c) {
9790 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9791 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009792}
9793
Bill Seurer703e8482015-06-09 14:39:47 +00009794static void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
9795 vector unsigned int *__c) {
9796 return vec_stl(
9797 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9798 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009799}
9800
Bill Seurer703e8482015-06-09 14:39:47 +00009801static void __ATTRS_o_ai vec_stvlxl(vector bool int __a, int __b,
9802 vector bool int *__c) {
9803 return vec_stl(
9804 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9805 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009806}
9807
Bill Seurer703e8482015-06-09 14:39:47 +00009808static void __ATTRS_o_ai vec_stvlxl(vector float __a, int __b,
9809 vector float *__c) {
9810 return vec_stl(
9811 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9812 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009813}
9814
9815/* vec_stvrx */
9816
Bill Seurer703e8482015-06-09 14:39:47 +00009817static void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
9818 signed char *__c) {
9819 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
9820 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009821}
9822
Bill Seurer703e8482015-06-09 14:39:47 +00009823static void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
9824 vector signed char *__c) {
9825 return vec_st(
9826 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9827 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009828}
9829
Bill Seurer703e8482015-06-09 14:39:47 +00009830static void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
9831 unsigned char *__c) {
9832 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
9833 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009834}
9835
Bill Seurer703e8482015-06-09 14:39:47 +00009836static void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
9837 vector unsigned char *__c) {
9838 return vec_st(
9839 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9840 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009841}
9842
Bill Seurer703e8482015-06-09 14:39:47 +00009843static void __ATTRS_o_ai vec_stvrx(vector bool char __a, int __b,
9844 vector bool char *__c) {
9845 return vec_st(
9846 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9847 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009848}
9849
Bill Seurer703e8482015-06-09 14:39:47 +00009850static void __ATTRS_o_ai vec_stvrx(vector short __a, int __b, short *__c) {
9851 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
9852 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009853}
9854
Bill Seurer703e8482015-06-09 14:39:47 +00009855static void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
9856 vector short *__c) {
9857 return vec_st(
9858 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9859 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009860}
9861
Bill Seurer703e8482015-06-09 14:39:47 +00009862static void __ATTRS_o_ai vec_stvrx(vector unsigned short __a, int __b,
9863 unsigned short *__c) {
9864 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
9865 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009866}
9867
Bill Seurer703e8482015-06-09 14:39:47 +00009868static void __ATTRS_o_ai vec_stvrx(vector unsigned short __a, int __b,
9869 vector unsigned short *__c) {
9870 return vec_st(
9871 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9872 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009873}
9874
Bill Seurer703e8482015-06-09 14:39:47 +00009875static void __ATTRS_o_ai vec_stvrx(vector bool short __a, int __b,
9876 vector bool short *__c) {
9877 return vec_st(
9878 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9879 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009880}
9881
Bill Seurer703e8482015-06-09 14:39:47 +00009882static void __ATTRS_o_ai vec_stvrx(vector pixel __a, int __b,
9883 vector pixel *__c) {
9884 return vec_st(
9885 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9886 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009887}
9888
Bill Seurer703e8482015-06-09 14:39:47 +00009889static void __ATTRS_o_ai vec_stvrx(vector int __a, int __b, int *__c) {
9890 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
9891 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009892}
9893
Bill Seurer703e8482015-06-09 14:39:47 +00009894static void __ATTRS_o_ai vec_stvrx(vector int __a, int __b, vector int *__c) {
9895 return vec_st(
9896 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9897 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009898}
9899
Bill Seurer703e8482015-06-09 14:39:47 +00009900static void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
9901 unsigned int *__c) {
9902 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
9903 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009904}
9905
Bill Seurer703e8482015-06-09 14:39:47 +00009906static void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
9907 vector unsigned int *__c) {
9908 return vec_st(
9909 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9910 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009911}
9912
Bill Seurer703e8482015-06-09 14:39:47 +00009913static void __ATTRS_o_ai vec_stvrx(vector bool int __a, int __b,
9914 vector bool int *__c) {
9915 return vec_st(
9916 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9917 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009918}
9919
Bill Seurer703e8482015-06-09 14:39:47 +00009920static void __ATTRS_o_ai vec_stvrx(vector float __a, int __b,
9921 vector float *__c) {
9922 return vec_st(
9923 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9924 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009925}
9926
9927/* vec_stvrxl */
9928
Bill Seurer703e8482015-06-09 14:39:47 +00009929static void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
9930 signed char *__c) {
9931 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
9932 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009933}
9934
Bill Seurer703e8482015-06-09 14:39:47 +00009935static void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
9936 vector signed char *__c) {
9937 return vec_stl(
9938 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9939 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009940}
9941
Bill Seurer703e8482015-06-09 14:39:47 +00009942static void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a, int __b,
9943 unsigned char *__c) {
9944 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
9945 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009946}
9947
Bill Seurer703e8482015-06-09 14:39:47 +00009948static void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a, int __b,
9949 vector unsigned char *__c) {
9950 return vec_stl(
9951 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9952 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009953}
9954
Bill Seurer703e8482015-06-09 14:39:47 +00009955static void __ATTRS_o_ai vec_stvrxl(vector bool char __a, int __b,
9956 vector bool char *__c) {
9957 return vec_stl(
9958 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9959 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009960}
9961
Bill Seurer703e8482015-06-09 14:39:47 +00009962static void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b, short *__c) {
9963 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
9964 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009965}
9966
Bill Seurer703e8482015-06-09 14:39:47 +00009967static void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
9968 vector short *__c) {
9969 return vec_stl(
9970 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9971 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009972}
9973
Bill Seurer703e8482015-06-09 14:39:47 +00009974static void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a, int __b,
9975 unsigned short *__c) {
9976 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
9977 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009978}
9979
Bill Seurer703e8482015-06-09 14:39:47 +00009980static void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a, int __b,
9981 vector unsigned short *__c) {
9982 return vec_stl(
9983 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9984 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009985}
9986
Bill Seurer703e8482015-06-09 14:39:47 +00009987static void __ATTRS_o_ai vec_stvrxl(vector bool short __a, int __b,
9988 vector bool short *__c) {
9989 return vec_stl(
9990 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9991 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009992}
9993
Bill Seurer703e8482015-06-09 14:39:47 +00009994static void __ATTRS_o_ai vec_stvrxl(vector pixel __a, int __b,
9995 vector pixel *__c) {
9996 return vec_stl(
9997 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9998 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009999}
10000
Bill Seurer703e8482015-06-09 14:39:47 +000010001static void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b, int *__c) {
10002 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
10003 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010004}
10005
Bill Seurer703e8482015-06-09 14:39:47 +000010006static void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b, vector int *__c) {
10007 return vec_stl(
10008 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
10009 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010010}
10011
Bill Seurer703e8482015-06-09 14:39:47 +000010012static void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
10013 unsigned int *__c) {
10014 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
10015 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010016}
10017
Bill Seurer703e8482015-06-09 14:39:47 +000010018static void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
10019 vector unsigned int *__c) {
10020 return vec_stl(
10021 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
10022 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010023}
10024
Bill Seurer703e8482015-06-09 14:39:47 +000010025static void __ATTRS_o_ai vec_stvrxl(vector bool int __a, int __b,
10026 vector bool int *__c) {
10027 return vec_stl(
10028 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
10029 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010030}
10031
Bill Seurer703e8482015-06-09 14:39:47 +000010032static void __ATTRS_o_ai vec_stvrxl(vector float __a, int __b,
10033 vector float *__c) {
10034 return vec_stl(
10035 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
10036 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010037}
10038
10039/* vec_promote */
10040
Bill Seurer703e8482015-06-09 14:39:47 +000010041static vector signed char __ATTRS_o_ai vec_promote(signed char __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010042 vector signed char __res = (vector signed char)(0);
10043 __res[__b] = __a;
10044 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010045}
10046
Bill Seurer703e8482015-06-09 14:39:47 +000010047static vector unsigned char __ATTRS_o_ai vec_promote(unsigned char __a,
10048 int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010049 vector unsigned char __res = (vector unsigned char)(0);
10050 __res[__b] = __a;
10051 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010052}
10053
Bill Seurer703e8482015-06-09 14:39:47 +000010054static vector short __ATTRS_o_ai vec_promote(short __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010055 vector short __res = (vector short)(0);
10056 __res[__b] = __a;
10057 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010058}
10059
Bill Seurer703e8482015-06-09 14:39:47 +000010060static vector unsigned short __ATTRS_o_ai vec_promote(unsigned short __a,
10061 int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010062 vector unsigned short __res = (vector unsigned short)(0);
10063 __res[__b] = __a;
10064 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010065}
10066
Bill Seurer703e8482015-06-09 14:39:47 +000010067static vector int __ATTRS_o_ai vec_promote(int __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010068 vector int __res = (vector int)(0);
10069 __res[__b] = __a;
10070 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010071}
10072
Bill Seurer703e8482015-06-09 14:39:47 +000010073static vector unsigned int __ATTRS_o_ai vec_promote(unsigned int __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010074 vector unsigned int __res = (vector unsigned int)(0);
10075 __res[__b] = __a;
10076 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010077}
10078
Bill Seurer703e8482015-06-09 14:39:47 +000010079static vector float __ATTRS_o_ai vec_promote(float __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010080 vector float __res = (vector float)(0);
10081 __res[__b] = __a;
10082 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010083}
10084
10085/* vec_splats */
10086
Bill Seurer703e8482015-06-09 14:39:47 +000010087static vector signed char __ATTRS_o_ai vec_splats(signed char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010088 return (vector signed char)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010089}
10090
Bill Seurer703e8482015-06-09 14:39:47 +000010091static vector unsigned char __ATTRS_o_ai vec_splats(unsigned char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010092 return (vector unsigned char)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010093}
10094
Bill Seurer703e8482015-06-09 14:39:47 +000010095static vector short __ATTRS_o_ai vec_splats(short __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010096 return (vector short)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010097}
10098
Bill Seurer703e8482015-06-09 14:39:47 +000010099static vector unsigned short __ATTRS_o_ai vec_splats(unsigned short __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010100 return (vector unsigned short)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010101}
10102
Bill Seurer703e8482015-06-09 14:39:47 +000010103static vector int __ATTRS_o_ai vec_splats(int __a) { return (vector int)(__a); }
Anton Yartsev73d40232010-10-14 14:37:46 +000010104
Bill Seurer703e8482015-06-09 14:39:47 +000010105static vector unsigned int __ATTRS_o_ai vec_splats(unsigned int __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010106 return (vector unsigned int)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010107}
10108
Bill Seurer703e8482015-06-09 14:39:47 +000010109static vector float __ATTRS_o_ai vec_splats(float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010110 return (vector float)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010111}
10112
Anton Yartsev79d6af32010-09-18 00:39:16 +000010113/* ----------------------------- predicates --------------------------------- */
Chris Lattnerdad40622010-04-14 03:54:58 +000010114
Chris Lattnerdad40622010-04-14 03:54:58 +000010115/* vec_all_eq */
10116
Bill Seurer703e8482015-06-09 14:39:47 +000010117static int __ATTRS_o_ai vec_all_eq(vector signed char __a,
10118 vector signed char __b) {
10119 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
10120 (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010121}
10122
Bill Seurer703e8482015-06-09 14:39:47 +000010123static int __ATTRS_o_ai vec_all_eq(vector signed char __a,
10124 vector bool char __b) {
10125 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
10126 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010127}
10128
Bill Seurer703e8482015-06-09 14:39:47 +000010129static int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
10130 vector unsigned char __b) {
10131 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
10132 (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010133}
10134
Bill Seurer703e8482015-06-09 14:39:47 +000010135static int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
10136 vector bool char __b) {
10137 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
10138 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010139}
10140
Bill Seurer703e8482015-06-09 14:39:47 +000010141static int __ATTRS_o_ai vec_all_eq(vector bool char __a,
10142 vector signed char __b) {
10143 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
10144 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010145}
10146
Bill Seurer703e8482015-06-09 14:39:47 +000010147static int __ATTRS_o_ai vec_all_eq(vector bool char __a,
10148 vector unsigned char __b) {
10149 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
10150 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010151}
10152
Bill Seurer703e8482015-06-09 14:39:47 +000010153static int __ATTRS_o_ai vec_all_eq(vector bool char __a, vector bool char __b) {
10154 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
10155 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010156}
10157
Bill Seurer703e8482015-06-09 14:39:47 +000010158static int __ATTRS_o_ai vec_all_eq(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010159 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010160}
10161
Bill Seurer703e8482015-06-09 14:39:47 +000010162static int __ATTRS_o_ai vec_all_eq(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010163 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010164}
10165
Bill Seurer703e8482015-06-09 14:39:47 +000010166static int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
10167 vector unsigned short __b) {
10168 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
10169 (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010170}
10171
Bill Seurer703e8482015-06-09 14:39:47 +000010172static int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
10173 vector bool short __b) {
10174 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
10175 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010176}
10177
Bill Seurer703e8482015-06-09 14:39:47 +000010178static int __ATTRS_o_ai vec_all_eq(vector bool short __a, vector short __b) {
10179 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
10180 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010181}
10182
Bill Seurer703e8482015-06-09 14:39:47 +000010183static int __ATTRS_o_ai vec_all_eq(vector bool short __a,
10184 vector unsigned short __b) {
10185 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
10186 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010187}
10188
Bill Seurer703e8482015-06-09 14:39:47 +000010189static int __ATTRS_o_ai vec_all_eq(vector bool short __a,
10190 vector bool short __b) {
10191 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
10192 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010193}
10194
Bill Seurer703e8482015-06-09 14:39:47 +000010195static int __ATTRS_o_ai vec_all_eq(vector pixel __a, vector pixel __b) {
10196 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
10197 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010198}
10199
Bill Seurer703e8482015-06-09 14:39:47 +000010200static int __ATTRS_o_ai vec_all_eq(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010201 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010202}
10203
Bill Seurer703e8482015-06-09 14:39:47 +000010204static int __ATTRS_o_ai vec_all_eq(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010205 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010206}
10207
Bill Seurer703e8482015-06-09 14:39:47 +000010208static int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
10209 vector unsigned int __b) {
10210 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
10211 (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010212}
10213
Bill Seurer703e8482015-06-09 14:39:47 +000010214static int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
10215 vector bool int __b) {
10216 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
10217 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010218}
10219
Bill Seurer703e8482015-06-09 14:39:47 +000010220static int __ATTRS_o_ai vec_all_eq(vector bool int __a, vector int __b) {
10221 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
10222 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010223}
10224
Bill Seurer703e8482015-06-09 14:39:47 +000010225static int __ATTRS_o_ai vec_all_eq(vector bool int __a,
10226 vector unsigned int __b) {
10227 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
10228 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010229}
10230
Bill Seurer703e8482015-06-09 14:39:47 +000010231static int __ATTRS_o_ai vec_all_eq(vector bool int __a, vector bool int __b) {
10232 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
10233 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010234}
10235
Kit Barton8553bec2015-03-11 15:57:19 +000010236#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000010237static int __ATTRS_o_ai vec_all_eq(vector signed long long __a,
10238 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010239 return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, __b);
10240}
10241
Bill Seurer703e8482015-06-09 14:39:47 +000010242static int __ATTRS_o_ai vec_all_eq(vector long long __a,
10243 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010244 return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, (vector long long)__b);
10245}
10246
Bill Seurer703e8482015-06-09 14:39:47 +000010247static int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
10248 vector unsigned long long __b) {
10249 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000010250 (vector long long)__b);
10251}
10252
Bill Seurer703e8482015-06-09 14:39:47 +000010253static int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
10254 vector bool long long __b) {
10255 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000010256 (vector long long)__b);
10257}
10258
Bill Seurer703e8482015-06-09 14:39:47 +000010259static int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
10260 vector long long __b) {
10261 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000010262 (vector long long)__b);
10263}
10264
Bill Seurer703e8482015-06-09 14:39:47 +000010265static int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
10266 vector unsigned long long __b) {
10267 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000010268 (vector long long)__b);
10269}
10270
Bill Seurer703e8482015-06-09 14:39:47 +000010271static int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
10272 vector bool long long __b) {
10273 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000010274 (vector long long)__b);
10275}
10276#endif
10277
Bill Seurer703e8482015-06-09 14:39:47 +000010278static int __ATTRS_o_ai vec_all_eq(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010279 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010280}
10281
10282/* vec_all_ge */
10283
Bill Seurer703e8482015-06-09 14:39:47 +000010284static int __ATTRS_o_ai vec_all_ge(vector signed char __a,
10285 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010286 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010287}
10288
Bill Seurer703e8482015-06-09 14:39:47 +000010289static int __ATTRS_o_ai vec_all_ge(vector signed char __a,
10290 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010291 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010292}
10293
Bill Seurer703e8482015-06-09 14:39:47 +000010294static int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
10295 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010296 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010297}
10298
Bill Seurer703e8482015-06-09 14:39:47 +000010299static int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
10300 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010301 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010302}
10303
Bill Seurer703e8482015-06-09 14:39:47 +000010304static int __ATTRS_o_ai vec_all_ge(vector bool char __a,
10305 vector signed char __b) {
10306 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010307 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010308}
10309
Bill Seurer703e8482015-06-09 14:39:47 +000010310static int __ATTRS_o_ai vec_all_ge(vector bool char __a,
10311 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010312 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010313}
10314
Bill Seurer703e8482015-06-09 14:39:47 +000010315static int __ATTRS_o_ai vec_all_ge(vector bool char __a, vector bool char __b) {
10316 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010317 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010318}
10319
Bill Seurer703e8482015-06-09 14:39:47 +000010320static int __ATTRS_o_ai vec_all_ge(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010321 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010322}
10323
Bill Seurer703e8482015-06-09 14:39:47 +000010324static int __ATTRS_o_ai vec_all_ge(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010325 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010326}
10327
Bill Seurer703e8482015-06-09 14:39:47 +000010328static int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
10329 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010330 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010331}
10332
Bill Seurer703e8482015-06-09 14:39:47 +000010333static int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
10334 vector bool short __b) {
10335 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
10336 __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010337}
10338
Bill Seurer703e8482015-06-09 14:39:47 +000010339static int __ATTRS_o_ai vec_all_ge(vector bool short __a, vector short __b) {
10340 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010341 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010342}
10343
Bill Seurer703e8482015-06-09 14:39:47 +000010344static int __ATTRS_o_ai vec_all_ge(vector bool short __a,
10345 vector unsigned short __b) {
10346 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010347 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010348}
10349
Bill Seurer703e8482015-06-09 14:39:47 +000010350static int __ATTRS_o_ai vec_all_ge(vector bool short __a,
10351 vector bool short __b) {
10352 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
10353 (vector unsigned short)__a);
10354}
10355
10356static int __ATTRS_o_ai vec_all_ge(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010357 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010358}
10359
Bill Seurer703e8482015-06-09 14:39:47 +000010360static int __ATTRS_o_ai vec_all_ge(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010361 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010362}
10363
Bill Seurer703e8482015-06-09 14:39:47 +000010364static int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
10365 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010366 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010367}
10368
Bill Seurer703e8482015-06-09 14:39:47 +000010369static int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
10370 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010371 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010372}
10373
Bill Seurer703e8482015-06-09 14:39:47 +000010374static int __ATTRS_o_ai vec_all_ge(vector bool int __a, vector int __b) {
10375 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010376 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010377}
10378
Bill Seurer703e8482015-06-09 14:39:47 +000010379static int __ATTRS_o_ai vec_all_ge(vector bool int __a,
10380 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010381 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010382}
10383
Bill Seurer703e8482015-06-09 14:39:47 +000010384static int __ATTRS_o_ai vec_all_ge(vector bool int __a, vector bool int __b) {
10385 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010386 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010387}
10388
Kit Barton8553bec2015-03-11 15:57:19 +000010389#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000010390static int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
10391 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010392 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, __a);
10393}
Bill Seurer703e8482015-06-09 14:39:47 +000010394static int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
10395 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010396 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__b,
10397 __a);
10398}
10399
Bill Seurer703e8482015-06-09 14:39:47 +000010400static int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
10401 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010402 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, __a);
10403}
10404
Bill Seurer703e8482015-06-09 14:39:47 +000010405static int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
10406 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010407 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
10408 __a);
10409}
10410
Bill Seurer703e8482015-06-09 14:39:47 +000010411static int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
10412 vector signed long long __b) {
10413 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
Kit Barton8553bec2015-03-11 15:57:19 +000010414 (vector unsigned long long)__a);
10415}
10416
Bill Seurer703e8482015-06-09 14:39:47 +000010417static int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
10418 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010419 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b,
10420 (vector unsigned long long)__a);
10421}
10422
Bill Seurer703e8482015-06-09 14:39:47 +000010423static int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
10424 vector bool long long __b) {
10425 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
Kit Barton8553bec2015-03-11 15:57:19 +000010426 (vector unsigned long long)__a);
10427}
10428#endif
10429
Bill Seurer703e8482015-06-09 14:39:47 +000010430static int __ATTRS_o_ai vec_all_ge(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010431 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010432}
10433
10434/* vec_all_gt */
10435
Bill Seurer703e8482015-06-09 14:39:47 +000010436static int __ATTRS_o_ai vec_all_gt(vector signed char __a,
10437 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010438 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010439}
10440
Bill Seurer703e8482015-06-09 14:39:47 +000010441static int __ATTRS_o_ai vec_all_gt(vector signed char __a,
10442 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010443 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010444}
10445
Bill Seurer703e8482015-06-09 14:39:47 +000010446static int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
10447 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010448 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010449}
10450
Bill Seurer703e8482015-06-09 14:39:47 +000010451static int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
10452 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010453 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010454}
10455
Bill Seurer703e8482015-06-09 14:39:47 +000010456static int __ATTRS_o_ai vec_all_gt(vector bool char __a,
10457 vector signed char __b) {
10458 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010459 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010460}
10461
Bill Seurer703e8482015-06-09 14:39:47 +000010462static int __ATTRS_o_ai vec_all_gt(vector bool char __a,
10463 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010464 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010465}
10466
Bill Seurer703e8482015-06-09 14:39:47 +000010467static int __ATTRS_o_ai vec_all_gt(vector bool char __a, vector bool char __b) {
10468 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010469 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010470}
10471
Bill Seurer703e8482015-06-09 14:39:47 +000010472static int __ATTRS_o_ai vec_all_gt(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010473 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010474}
10475
Bill Seurer703e8482015-06-09 14:39:47 +000010476static int __ATTRS_o_ai vec_all_gt(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010477 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010478}
10479
Bill Seurer703e8482015-06-09 14:39:47 +000010480static int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
10481 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010482 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010483}
10484
Bill Seurer703e8482015-06-09 14:39:47 +000010485static int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
10486 vector bool short __b) {
10487 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010488 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010489}
10490
Bill Seurer703e8482015-06-09 14:39:47 +000010491static int __ATTRS_o_ai vec_all_gt(vector bool short __a, vector short __b) {
10492 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010493 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010494}
10495
Bill Seurer703e8482015-06-09 14:39:47 +000010496static int __ATTRS_o_ai vec_all_gt(vector bool short __a,
10497 vector unsigned short __b) {
10498 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
10499 __b);
10500}
10501
10502static int __ATTRS_o_ai vec_all_gt(vector bool short __a,
10503 vector bool short __b) {
10504 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
10505 (vector unsigned short)__b);
10506}
10507
10508static int __ATTRS_o_ai vec_all_gt(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010509 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010510}
10511
Bill Seurer703e8482015-06-09 14:39:47 +000010512static int __ATTRS_o_ai vec_all_gt(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010513 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010514}
10515
Bill Seurer703e8482015-06-09 14:39:47 +000010516static int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
10517 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010518 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010519}
10520
Bill Seurer703e8482015-06-09 14:39:47 +000010521static int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
10522 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010523 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010524}
10525
Bill Seurer703e8482015-06-09 14:39:47 +000010526static int __ATTRS_o_ai vec_all_gt(vector bool int __a, vector int __b) {
10527 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010528 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010529}
10530
Bill Seurer703e8482015-06-09 14:39:47 +000010531static int __ATTRS_o_ai vec_all_gt(vector bool int __a,
10532 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010533 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010534}
10535
Bill Seurer703e8482015-06-09 14:39:47 +000010536static int __ATTRS_o_ai vec_all_gt(vector bool int __a, vector bool int __b) {
10537 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010538 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010539}
10540
Kit Barton8553bec2015-03-11 15:57:19 +000010541#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000010542static int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
10543 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010544 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, __b);
10545}
Bill Seurer703e8482015-06-09 14:39:47 +000010546static int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
10547 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010548 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a,
10549 (vector signed long long)__b);
10550}
10551
Bill Seurer703e8482015-06-09 14:39:47 +000010552static int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
10553 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010554 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, __b);
10555}
10556
Bill Seurer703e8482015-06-09 14:39:47 +000010557static int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
10558 vector bool long long __b) {
10559 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a,
Kit Barton8553bec2015-03-11 15:57:19 +000010560 (vector unsigned long long)__b);
10561}
10562
Bill Seurer703e8482015-06-09 14:39:47 +000010563static int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
10564 vector signed long long __b) {
10565 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000010566 (vector unsigned long long)__b);
10567}
10568
Bill Seurer703e8482015-06-09 14:39:47 +000010569static int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
10570 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010571 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
10572 __b);
10573}
10574
Bill Seurer703e8482015-06-09 14:39:47 +000010575static int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
10576 vector bool long long __b) {
10577 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000010578 (vector unsigned long long)__b);
10579}
10580#endif
10581
Bill Seurer703e8482015-06-09 14:39:47 +000010582static int __ATTRS_o_ai vec_all_gt(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010583 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010584}
10585
10586/* vec_all_in */
10587
10588static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000010589vec_all_in(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010590 return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010591}
10592
10593/* vec_all_le */
10594
Bill Seurer703e8482015-06-09 14:39:47 +000010595static int __ATTRS_o_ai vec_all_le(vector signed char __a,
10596 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010597 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010598}
10599
Bill Seurer703e8482015-06-09 14:39:47 +000010600static int __ATTRS_o_ai vec_all_le(vector signed char __a,
10601 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010602 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010603}
10604
Bill Seurer703e8482015-06-09 14:39:47 +000010605static int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
10606 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010607 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010608}
10609
Bill Seurer703e8482015-06-09 14:39:47 +000010610static int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
10611 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010612 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010613}
10614
Bill Seurer703e8482015-06-09 14:39:47 +000010615static int __ATTRS_o_ai vec_all_le(vector bool char __a,
10616 vector signed char __b) {
10617 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010618 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010619}
10620
Bill Seurer703e8482015-06-09 14:39:47 +000010621static int __ATTRS_o_ai vec_all_le(vector bool char __a,
10622 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010623 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010624}
10625
Bill Seurer703e8482015-06-09 14:39:47 +000010626static int __ATTRS_o_ai vec_all_le(vector bool char __a, vector bool char __b) {
10627 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010628 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010629}
10630
Bill Seurer703e8482015-06-09 14:39:47 +000010631static int __ATTRS_o_ai vec_all_le(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010632 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010633}
10634
Bill Seurer703e8482015-06-09 14:39:47 +000010635static int __ATTRS_o_ai vec_all_le(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010636 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010637}
10638
Bill Seurer703e8482015-06-09 14:39:47 +000010639static int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
10640 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010641 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010642}
10643
Bill Seurer703e8482015-06-09 14:39:47 +000010644static int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
10645 vector bool short __b) {
10646 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010647 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010648}
10649
Bill Seurer703e8482015-06-09 14:39:47 +000010650static int __ATTRS_o_ai vec_all_le(vector bool short __a, vector short __b) {
10651 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010652 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010653}
10654
Bill Seurer703e8482015-06-09 14:39:47 +000010655static int __ATTRS_o_ai vec_all_le(vector bool short __a,
10656 vector unsigned short __b) {
10657 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
10658 __b);
10659}
10660
10661static int __ATTRS_o_ai vec_all_le(vector bool short __a,
10662 vector bool short __b) {
10663 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
10664 (vector unsigned short)__b);
10665}
10666
10667static int __ATTRS_o_ai vec_all_le(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010668 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010669}
10670
Bill Seurer703e8482015-06-09 14:39:47 +000010671static int __ATTRS_o_ai vec_all_le(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010672 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010673}
10674
Bill Seurer703e8482015-06-09 14:39:47 +000010675static int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
10676 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010677 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010678}
10679
Bill Seurer703e8482015-06-09 14:39:47 +000010680static int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
10681 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010682 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010683}
10684
Bill Seurer703e8482015-06-09 14:39:47 +000010685static int __ATTRS_o_ai vec_all_le(vector bool int __a, vector int __b) {
10686 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010687 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010688}
10689
Bill Seurer703e8482015-06-09 14:39:47 +000010690static int __ATTRS_o_ai vec_all_le(vector bool int __a,
10691 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010692 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010693}
10694
Bill Seurer703e8482015-06-09 14:39:47 +000010695static int __ATTRS_o_ai vec_all_le(vector bool int __a, vector bool int __b) {
10696 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010697 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010698}
10699
Kit Barton8553bec2015-03-11 15:57:19 +000010700#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000010701static int __ATTRS_o_ai vec_all_le(vector signed long long __a,
10702 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010703 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, __b);
10704}
10705
Bill Seurer703e8482015-06-09 14:39:47 +000010706static int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
10707 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010708 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, __b);
10709}
10710
Bill Seurer703e8482015-06-09 14:39:47 +000010711static int __ATTRS_o_ai vec_all_le(vector signed long long __a,
10712 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010713 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a,
10714 (vector signed long long)__b);
10715}
10716
Bill Seurer703e8482015-06-09 14:39:47 +000010717static int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
10718 vector bool long long __b) {
10719 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a,
Kit Barton8553bec2015-03-11 15:57:19 +000010720 (vector unsigned long long)__b);
10721}
10722
Bill Seurer703e8482015-06-09 14:39:47 +000010723static int __ATTRS_o_ai vec_all_le(vector bool long long __a,
10724 vector signed long long __b) {
10725 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000010726 (vector unsigned long long)__b);
10727}
10728
Bill Seurer703e8482015-06-09 14:39:47 +000010729static int __ATTRS_o_ai vec_all_le(vector bool long long __a,
10730 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010731 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
10732 __b);
10733}
10734
Bill Seurer703e8482015-06-09 14:39:47 +000010735static int __ATTRS_o_ai vec_all_le(vector bool long long __a,
10736 vector bool long long __b) {
10737 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000010738 (vector unsigned long long)__b);
10739}
10740#endif
10741
Bill Seurer703e8482015-06-09 14:39:47 +000010742static int __ATTRS_o_ai vec_all_le(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010743 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010744}
10745
10746/* vec_all_lt */
10747
Bill Seurer703e8482015-06-09 14:39:47 +000010748static int __ATTRS_o_ai vec_all_lt(vector signed char __a,
10749 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010750 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010751}
10752
Bill Seurer703e8482015-06-09 14:39:47 +000010753static int __ATTRS_o_ai vec_all_lt(vector signed char __a,
10754 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010755 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010756}
10757
Bill Seurer703e8482015-06-09 14:39:47 +000010758static int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
10759 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010760 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010761}
10762
Bill Seurer703e8482015-06-09 14:39:47 +000010763static int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
10764 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010765 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010766}
10767
Bill Seurer703e8482015-06-09 14:39:47 +000010768static int __ATTRS_o_ai vec_all_lt(vector bool char __a,
10769 vector signed char __b) {
10770 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010771 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010772}
10773
Bill Seurer703e8482015-06-09 14:39:47 +000010774static int __ATTRS_o_ai vec_all_lt(vector bool char __a,
10775 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010776 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010777}
10778
Bill Seurer703e8482015-06-09 14:39:47 +000010779static int __ATTRS_o_ai vec_all_lt(vector bool char __a, vector bool char __b) {
10780 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010781 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010782}
10783
Bill Seurer703e8482015-06-09 14:39:47 +000010784static int __ATTRS_o_ai vec_all_lt(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010785 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010786}
10787
Bill Seurer703e8482015-06-09 14:39:47 +000010788static int __ATTRS_o_ai vec_all_lt(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010789 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010790}
10791
Bill Seurer703e8482015-06-09 14:39:47 +000010792static int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
10793 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010794 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010795}
10796
Bill Seurer703e8482015-06-09 14:39:47 +000010797static int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
10798 vector bool short __b) {
10799 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
10800 __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010801}
10802
Bill Seurer703e8482015-06-09 14:39:47 +000010803static int __ATTRS_o_ai vec_all_lt(vector bool short __a, vector short __b) {
10804 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010805 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010806}
10807
Bill Seurer703e8482015-06-09 14:39:47 +000010808static int __ATTRS_o_ai vec_all_lt(vector bool short __a,
10809 vector unsigned short __b) {
10810 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010811 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010812}
10813
Bill Seurer703e8482015-06-09 14:39:47 +000010814static int __ATTRS_o_ai vec_all_lt(vector bool short __a,
10815 vector bool short __b) {
10816 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
10817 (vector unsigned short)__a);
10818}
10819
10820static int __ATTRS_o_ai vec_all_lt(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010821 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010822}
10823
Bill Seurer703e8482015-06-09 14:39:47 +000010824static int __ATTRS_o_ai vec_all_lt(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010825 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010826}
10827
Bill Seurer703e8482015-06-09 14:39:47 +000010828static int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
10829 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010830 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010831}
10832
Bill Seurer703e8482015-06-09 14:39:47 +000010833static int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
10834 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010835 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010836}
10837
Bill Seurer703e8482015-06-09 14:39:47 +000010838static int __ATTRS_o_ai vec_all_lt(vector bool int __a, vector int __b) {
10839 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010840 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010841}
10842
Bill Seurer703e8482015-06-09 14:39:47 +000010843static int __ATTRS_o_ai vec_all_lt(vector bool int __a,
10844 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010845 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010846}
10847
Bill Seurer703e8482015-06-09 14:39:47 +000010848static int __ATTRS_o_ai vec_all_lt(vector bool int __a, vector bool int __b) {
10849 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010850 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010851}
10852
Kit Barton8553bec2015-03-11 15:57:19 +000010853#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000010854static int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
10855 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010856 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, __a);
10857}
10858
Bill Seurer703e8482015-06-09 14:39:47 +000010859static int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
10860 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010861 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, __a);
10862}
10863
Bill Seurer703e8482015-06-09 14:39:47 +000010864static int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
10865 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010866 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__b,
10867 __a);
10868}
10869
Bill Seurer703e8482015-06-09 14:39:47 +000010870static int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
10871 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010872 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
10873 __a);
10874}
10875
Bill Seurer703e8482015-06-09 14:39:47 +000010876static int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
10877 vector signed long long __b) {
10878 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
Kit Barton8553bec2015-03-11 15:57:19 +000010879 (vector unsigned long long)__a);
10880}
10881
Bill Seurer703e8482015-06-09 14:39:47 +000010882static int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
10883 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010884 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b,
10885 (vector unsigned long long)__a);
10886}
10887
Bill Seurer703e8482015-06-09 14:39:47 +000010888static int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
10889 vector bool long long __b) {
10890 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
Kit Barton8553bec2015-03-11 15:57:19 +000010891 (vector unsigned long long)__a);
10892}
10893#endif
10894
Bill Seurer703e8482015-06-09 14:39:47 +000010895static int __ATTRS_o_ai vec_all_lt(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010896 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010897}
10898
10899/* vec_all_nan */
10900
Bill Seurer703e8482015-06-09 14:39:47 +000010901static int __attribute__((__always_inline__)) vec_all_nan(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010902 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010903}
10904
10905/* vec_all_ne */
10906
Bill Seurer703e8482015-06-09 14:39:47 +000010907static int __ATTRS_o_ai vec_all_ne(vector signed char __a,
10908 vector signed char __b) {
10909 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
10910 (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010911}
10912
Bill Seurer703e8482015-06-09 14:39:47 +000010913static int __ATTRS_o_ai vec_all_ne(vector signed char __a,
10914 vector bool char __b) {
10915 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
10916 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010917}
10918
Bill Seurer703e8482015-06-09 14:39:47 +000010919static int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
10920 vector unsigned char __b) {
10921 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
10922 (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010923}
10924
Bill Seurer703e8482015-06-09 14:39:47 +000010925static int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
10926 vector bool char __b) {
10927 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
10928 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010929}
10930
Bill Seurer703e8482015-06-09 14:39:47 +000010931static int __ATTRS_o_ai vec_all_ne(vector bool char __a,
10932 vector signed char __b) {
10933 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
10934 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010935}
10936
Bill Seurer703e8482015-06-09 14:39:47 +000010937static int __ATTRS_o_ai vec_all_ne(vector bool char __a,
10938 vector unsigned char __b) {
10939 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
10940 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010941}
10942
Bill Seurer703e8482015-06-09 14:39:47 +000010943static int __ATTRS_o_ai vec_all_ne(vector bool char __a, vector bool char __b) {
10944 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
10945 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010946}
10947
Bill Seurer703e8482015-06-09 14:39:47 +000010948static int __ATTRS_o_ai vec_all_ne(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010949 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010950}
10951
Bill Seurer703e8482015-06-09 14:39:47 +000010952static int __ATTRS_o_ai vec_all_ne(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010953 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010954}
10955
Bill Seurer703e8482015-06-09 14:39:47 +000010956static int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
10957 vector unsigned short __b) {
10958 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
10959 (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010960}
10961
Bill Seurer703e8482015-06-09 14:39:47 +000010962static int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
10963 vector bool short __b) {
10964 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
10965 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010966}
10967
Bill Seurer703e8482015-06-09 14:39:47 +000010968static int __ATTRS_o_ai vec_all_ne(vector bool short __a, vector short __b) {
10969 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
10970 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010971}
10972
Bill Seurer703e8482015-06-09 14:39:47 +000010973static int __ATTRS_o_ai vec_all_ne(vector bool short __a,
10974 vector unsigned short __b) {
10975 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
10976 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010977}
10978
Bill Seurer703e8482015-06-09 14:39:47 +000010979static int __ATTRS_o_ai vec_all_ne(vector bool short __a,
10980 vector bool short __b) {
10981 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
10982 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010983}
10984
Bill Seurer703e8482015-06-09 14:39:47 +000010985static int __ATTRS_o_ai vec_all_ne(vector pixel __a, vector pixel __b) {
10986 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
10987 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010988}
10989
Bill Seurer703e8482015-06-09 14:39:47 +000010990static int __ATTRS_o_ai vec_all_ne(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010991 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010992}
10993
Bill Seurer703e8482015-06-09 14:39:47 +000010994static int __ATTRS_o_ai vec_all_ne(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010995 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010996}
10997
Bill Seurer703e8482015-06-09 14:39:47 +000010998static int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
10999 vector unsigned int __b) {
11000 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
11001 (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011002}
11003
Bill Seurer703e8482015-06-09 14:39:47 +000011004static int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
11005 vector bool int __b) {
11006 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
11007 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011008}
11009
Bill Seurer703e8482015-06-09 14:39:47 +000011010static int __ATTRS_o_ai vec_all_ne(vector bool int __a, vector int __b) {
11011 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
11012 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011013}
11014
Bill Seurer703e8482015-06-09 14:39:47 +000011015static int __ATTRS_o_ai vec_all_ne(vector bool int __a,
11016 vector unsigned int __b) {
11017 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
11018 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011019}
11020
Bill Seurer703e8482015-06-09 14:39:47 +000011021static int __ATTRS_o_ai vec_all_ne(vector bool int __a, vector bool int __b) {
11022 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
11023 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011024}
11025
Kit Barton8553bec2015-03-11 15:57:19 +000011026#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000011027static int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
11028 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011029 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, __b);
11030}
11031
Bill Seurer703e8482015-06-09 14:39:47 +000011032static int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
11033 vector unsigned long long __b) {
11034 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000011035 (vector long long)__b);
11036}
11037
Bill Seurer703e8482015-06-09 14:39:47 +000011038static int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
11039 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011040 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a,
11041 (vector signed long long)__b);
11042}
11043
Bill Seurer703e8482015-06-09 14:39:47 +000011044static int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
11045 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011046 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
11047 (vector signed long long)__b);
11048}
11049
Bill Seurer703e8482015-06-09 14:39:47 +000011050static int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
11051 vector signed long long __b) {
11052 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000011053 (vector signed long long)__b);
11054}
11055
Bill Seurer703e8482015-06-09 14:39:47 +000011056static int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
11057 vector unsigned long long __b) {
11058 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
11059 (vector signed long long)__b);
11060}
11061
11062static int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
11063 vector bool long long __b) {
11064 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000011065 (vector signed long long)__b);
11066}
11067#endif
11068
Bill Seurer703e8482015-06-09 14:39:47 +000011069static int __ATTRS_o_ai vec_all_ne(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011070 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011071}
11072
11073/* vec_all_nge */
11074
11075static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000011076vec_all_nge(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011077 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011078}
11079
11080/* vec_all_ngt */
11081
11082static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000011083vec_all_ngt(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011084 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011085}
11086
11087/* vec_all_nle */
11088
11089static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000011090vec_all_nle(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011091 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011092}
11093
11094/* vec_all_nlt */
11095
11096static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000011097vec_all_nlt(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011098 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011099}
11100
11101/* vec_all_numeric */
11102
11103static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000011104vec_all_numeric(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011105 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011106}
11107
11108/* vec_any_eq */
11109
Bill Seurer703e8482015-06-09 14:39:47 +000011110static int __ATTRS_o_ai vec_any_eq(vector signed char __a,
11111 vector signed char __b) {
11112 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
11113 (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011114}
11115
Bill Seurer703e8482015-06-09 14:39:47 +000011116static int __ATTRS_o_ai vec_any_eq(vector signed char __a,
11117 vector bool char __b) {
11118 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
11119 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011120}
11121
Bill Seurer703e8482015-06-09 14:39:47 +000011122static int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
11123 vector unsigned char __b) {
11124 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
11125 (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011126}
11127
Bill Seurer703e8482015-06-09 14:39:47 +000011128static int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
11129 vector bool char __b) {
11130 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
11131 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011132}
11133
Bill Seurer703e8482015-06-09 14:39:47 +000011134static int __ATTRS_o_ai vec_any_eq(vector bool char __a,
11135 vector signed char __b) {
11136 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
11137 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011138}
11139
Bill Seurer703e8482015-06-09 14:39:47 +000011140static int __ATTRS_o_ai vec_any_eq(vector bool char __a,
11141 vector unsigned char __b) {
11142 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
11143 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011144}
11145
Bill Seurer703e8482015-06-09 14:39:47 +000011146static int __ATTRS_o_ai vec_any_eq(vector bool char __a, vector bool char __b) {
11147 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
11148 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011149}
11150
Bill Seurer703e8482015-06-09 14:39:47 +000011151static int __ATTRS_o_ai vec_any_eq(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011152 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011153}
11154
Bill Seurer703e8482015-06-09 14:39:47 +000011155static int __ATTRS_o_ai vec_any_eq(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011156 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011157}
11158
Bill Seurer703e8482015-06-09 14:39:47 +000011159static int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
11160 vector unsigned short __b) {
11161 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011162 (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011163}
11164
Bill Seurer703e8482015-06-09 14:39:47 +000011165static int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
11166 vector bool short __b) {
11167 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011168 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011169}
11170
Bill Seurer703e8482015-06-09 14:39:47 +000011171static int __ATTRS_o_ai vec_any_eq(vector bool short __a, vector short __b) {
11172 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011173 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011174}
11175
Bill Seurer703e8482015-06-09 14:39:47 +000011176static int __ATTRS_o_ai vec_any_eq(vector bool short __a,
11177 vector unsigned short __b) {
11178 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011179 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011180}
11181
Bill Seurer703e8482015-06-09 14:39:47 +000011182static int __ATTRS_o_ai vec_any_eq(vector bool short __a,
11183 vector bool short __b) {
11184 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011185 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011186}
11187
Bill Seurer703e8482015-06-09 14:39:47 +000011188static int __ATTRS_o_ai vec_any_eq(vector pixel __a, vector pixel __b) {
11189 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011190 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011191}
11192
Bill Seurer703e8482015-06-09 14:39:47 +000011193static int __ATTRS_o_ai vec_any_eq(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011194 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011195}
11196
Bill Seurer703e8482015-06-09 14:39:47 +000011197static int __ATTRS_o_ai vec_any_eq(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011198 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011199}
11200
Bill Seurer703e8482015-06-09 14:39:47 +000011201static int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
11202 vector unsigned int __b) {
11203 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
11204 (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011205}
11206
Bill Seurer703e8482015-06-09 14:39:47 +000011207static int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
11208 vector bool int __b) {
11209 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
11210 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011211}
11212
Bill Seurer703e8482015-06-09 14:39:47 +000011213static int __ATTRS_o_ai vec_any_eq(vector bool int __a, vector int __b) {
11214 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
11215 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011216}
11217
Bill Seurer703e8482015-06-09 14:39:47 +000011218static int __ATTRS_o_ai vec_any_eq(vector bool int __a,
11219 vector unsigned int __b) {
11220 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
11221 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011222}
11223
Bill Seurer703e8482015-06-09 14:39:47 +000011224static int __ATTRS_o_ai vec_any_eq(vector bool int __a, vector bool int __b) {
11225 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
11226 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011227}
11228
Kit Barton8553bec2015-03-11 15:57:19 +000011229#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000011230static int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
11231 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011232 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, __b);
11233}
11234
Bill Seurer703e8482015-06-09 14:39:47 +000011235static int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
11236 vector unsigned long long __b) {
11237 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector long long)__a,
11238 (vector long long)__b);
Kit Barton8553bec2015-03-11 15:57:19 +000011239}
11240
Bill Seurer703e8482015-06-09 14:39:47 +000011241static int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
11242 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011243 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a,
11244 (vector signed long long)__b);
11245}
11246
Bill Seurer703e8482015-06-09 14:39:47 +000011247static int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
11248 vector bool long long __b) {
11249 return __builtin_altivec_vcmpequd_p(
11250 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
Kit Barton8553bec2015-03-11 15:57:19 +000011251}
11252
Bill Seurer703e8482015-06-09 14:39:47 +000011253static int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
11254 vector signed long long __b) {
11255 return __builtin_altivec_vcmpequd_p(
11256 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
Kit Barton8553bec2015-03-11 15:57:19 +000011257}
11258
Bill Seurer703e8482015-06-09 14:39:47 +000011259static int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
11260 vector unsigned long long __b) {
11261 return __builtin_altivec_vcmpequd_p(
11262 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
Kit Barton8553bec2015-03-11 15:57:19 +000011263}
11264
Bill Seurer703e8482015-06-09 14:39:47 +000011265static int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
11266 vector bool long long __b) {
11267 return __builtin_altivec_vcmpequd_p(
11268 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
Kit Barton8553bec2015-03-11 15:57:19 +000011269}
11270#endif
11271
Bill Seurer703e8482015-06-09 14:39:47 +000011272static int __ATTRS_o_ai vec_any_eq(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011273 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011274}
11275
11276/* vec_any_ge */
11277
Bill Seurer703e8482015-06-09 14:39:47 +000011278static int __ATTRS_o_ai vec_any_ge(vector signed char __a,
11279 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011280 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011281}
11282
Bill Seurer703e8482015-06-09 14:39:47 +000011283static int __ATTRS_o_ai vec_any_ge(vector signed char __a,
11284 vector bool char __b) {
11285 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b,
11286 __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011287}
11288
Bill Seurer703e8482015-06-09 14:39:47 +000011289static int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
11290 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011291 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011292}
11293
Bill Seurer703e8482015-06-09 14:39:47 +000011294static int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
11295 vector bool char __b) {
11296 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
11297 __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011298}
11299
Bill Seurer703e8482015-06-09 14:39:47 +000011300static int __ATTRS_o_ai vec_any_ge(vector bool char __a,
11301 vector signed char __b) {
11302 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011303 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011304}
11305
Bill Seurer703e8482015-06-09 14:39:47 +000011306static int __ATTRS_o_ai vec_any_ge(vector bool char __a,
11307 vector unsigned char __b) {
11308 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011309 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011310}
11311
Bill Seurer703e8482015-06-09 14:39:47 +000011312static int __ATTRS_o_ai vec_any_ge(vector bool char __a, vector bool char __b) {
11313 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
11314 (vector unsigned char)__a);
11315}
11316
11317static int __ATTRS_o_ai vec_any_ge(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011318 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011319}
11320
Bill Seurer703e8482015-06-09 14:39:47 +000011321static int __ATTRS_o_ai vec_any_ge(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011322 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011323}
11324
Bill Seurer703e8482015-06-09 14:39:47 +000011325static int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
11326 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011327 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011328}
11329
Bill Seurer703e8482015-06-09 14:39:47 +000011330static int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
11331 vector bool short __b) {
11332 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
11333 __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011334}
11335
Bill Seurer703e8482015-06-09 14:39:47 +000011336static int __ATTRS_o_ai vec_any_ge(vector bool short __a, vector short __b) {
11337 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011338 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011339}
11340
Bill Seurer703e8482015-06-09 14:39:47 +000011341static int __ATTRS_o_ai vec_any_ge(vector bool short __a,
11342 vector unsigned short __b) {
11343 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011344 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011345}
11346
Bill Seurer703e8482015-06-09 14:39:47 +000011347static int __ATTRS_o_ai vec_any_ge(vector bool short __a,
11348 vector bool short __b) {
11349 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
11350 (vector unsigned short)__a);
11351}
11352
11353static int __ATTRS_o_ai vec_any_ge(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011354 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011355}
11356
Bill Seurer703e8482015-06-09 14:39:47 +000011357static int __ATTRS_o_ai vec_any_ge(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011358 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011359}
11360
Bill Seurer703e8482015-06-09 14:39:47 +000011361static int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
11362 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011363 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011364}
11365
Bill Seurer703e8482015-06-09 14:39:47 +000011366static int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
11367 vector bool int __b) {
11368 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
11369 __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011370}
11371
Bill Seurer703e8482015-06-09 14:39:47 +000011372static int __ATTRS_o_ai vec_any_ge(vector bool int __a, vector int __b) {
11373 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011374 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011375}
11376
Bill Seurer703e8482015-06-09 14:39:47 +000011377static int __ATTRS_o_ai vec_any_ge(vector bool int __a,
11378 vector unsigned int __b) {
11379 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b,
11380 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011381}
11382
Bill Seurer703e8482015-06-09 14:39:47 +000011383static int __ATTRS_o_ai vec_any_ge(vector bool int __a, vector bool int __b) {
11384 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011385 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011386}
11387
Kit Barton8553bec2015-03-11 15:57:19 +000011388#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000011389static int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
11390 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011391 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, __a);
11392}
11393
Bill Seurer703e8482015-06-09 14:39:47 +000011394static int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
11395 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011396 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, __a);
11397}
11398
Bill Seurer703e8482015-06-09 14:39:47 +000011399static int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
11400 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011401 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV,
11402 (vector signed long long)__b, __a);
11403}
11404
Bill Seurer703e8482015-06-09 14:39:47 +000011405static int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
11406 vector bool long long __b) {
11407 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
Kit Barton8553bec2015-03-11 15:57:19 +000011408 (vector unsigned long long)__b, __a);
11409}
11410
Bill Seurer703e8482015-06-09 14:39:47 +000011411static int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
11412 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011413 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
11414 (vector unsigned long long)__b,
11415 (vector unsigned long long)__a);
11416}
11417
Bill Seurer703e8482015-06-09 14:39:47 +000011418static int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
11419 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011420 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b,
11421 (vector unsigned long long)__a);
11422}
11423
Bill Seurer703e8482015-06-09 14:39:47 +000011424static int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
11425 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011426 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
11427 (vector unsigned long long)__b,
11428 (vector unsigned long long)__a);
11429}
11430#endif
11431
Bill Seurer703e8482015-06-09 14:39:47 +000011432static int __ATTRS_o_ai vec_any_ge(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011433 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011434}
11435
11436/* vec_any_gt */
11437
Bill Seurer703e8482015-06-09 14:39:47 +000011438static int __ATTRS_o_ai vec_any_gt(vector signed char __a,
11439 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011440 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011441}
11442
Bill Seurer703e8482015-06-09 14:39:47 +000011443static int __ATTRS_o_ai vec_any_gt(vector signed char __a,
11444 vector bool char __b) {
11445 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a,
11446 (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011447}
11448
Bill Seurer703e8482015-06-09 14:39:47 +000011449static int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
11450 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011451 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011452}
11453
Bill Seurer703e8482015-06-09 14:39:47 +000011454static int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
11455 vector bool char __b) {
11456 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011457 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011458}
11459
Bill Seurer703e8482015-06-09 14:39:47 +000011460static int __ATTRS_o_ai vec_any_gt(vector bool char __a,
11461 vector signed char __b) {
11462 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011463 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011464}
11465
Bill Seurer703e8482015-06-09 14:39:47 +000011466static int __ATTRS_o_ai vec_any_gt(vector bool char __a,
11467 vector unsigned char __b) {
11468 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
11469 __b);
11470}
11471
11472static int __ATTRS_o_ai vec_any_gt(vector bool char __a, vector bool char __b) {
11473 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
11474 (vector unsigned char)__b);
11475}
11476
11477static int __ATTRS_o_ai vec_any_gt(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011478 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011479}
11480
Bill Seurer703e8482015-06-09 14:39:47 +000011481static int __ATTRS_o_ai vec_any_gt(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011482 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011483}
11484
Bill Seurer703e8482015-06-09 14:39:47 +000011485static int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
11486 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011487 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011488}
11489
Bill Seurer703e8482015-06-09 14:39:47 +000011490static int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
11491 vector bool short __b) {
11492 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011493 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011494}
11495
Bill Seurer703e8482015-06-09 14:39:47 +000011496static int __ATTRS_o_ai vec_any_gt(vector bool short __a, vector short __b) {
11497 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011498 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011499}
11500
Bill Seurer703e8482015-06-09 14:39:47 +000011501static int __ATTRS_o_ai vec_any_gt(vector bool short __a,
11502 vector unsigned short __b) {
11503 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
11504 __b);
11505}
11506
11507static int __ATTRS_o_ai vec_any_gt(vector bool short __a,
11508 vector bool short __b) {
11509 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
11510 (vector unsigned short)__b);
11511}
11512
11513static int __ATTRS_o_ai vec_any_gt(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011514 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011515}
11516
Bill Seurer703e8482015-06-09 14:39:47 +000011517static int __ATTRS_o_ai vec_any_gt(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011518 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011519}
11520
Bill Seurer703e8482015-06-09 14:39:47 +000011521static int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
11522 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011523 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011524}
11525
Bill Seurer703e8482015-06-09 14:39:47 +000011526static int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
11527 vector bool int __b) {
11528 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011529 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011530}
11531
Bill Seurer703e8482015-06-09 14:39:47 +000011532static int __ATTRS_o_ai vec_any_gt(vector bool int __a, vector int __b) {
11533 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
11534 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011535}
11536
Bill Seurer703e8482015-06-09 14:39:47 +000011537static int __ATTRS_o_ai vec_any_gt(vector bool int __a,
11538 vector unsigned int __b) {
11539 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
11540 __b);
11541}
11542
11543static int __ATTRS_o_ai vec_any_gt(vector bool int __a, vector bool int __b) {
11544 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011545 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011546}
11547
Kit Barton8553bec2015-03-11 15:57:19 +000011548#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000011549static int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
11550 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011551 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, __b);
11552}
11553
Bill Seurer703e8482015-06-09 14:39:47 +000011554static int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
11555 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011556 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, __b);
11557}
11558
Bill Seurer703e8482015-06-09 14:39:47 +000011559static int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
11560 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011561 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a,
11562 (vector signed long long)__b);
11563}
11564
Bill Seurer703e8482015-06-09 14:39:47 +000011565static int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
11566 vector bool long long __b) {
11567 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a,
Kit Barton8553bec2015-03-11 15:57:19 +000011568 (vector unsigned long long)__b);
11569}
11570
Bill Seurer703e8482015-06-09 14:39:47 +000011571static int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
11572 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011573 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
11574 (vector unsigned long long)__a,
11575 (vector unsigned long long)__b);
11576}
11577
Bill Seurer703e8482015-06-09 14:39:47 +000011578static int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
11579 vector unsigned long long __b) {
11580 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
Kit Barton8553bec2015-03-11 15:57:19 +000011581 (vector unsigned long long)__a, __b);
11582}
11583
Bill Seurer703e8482015-06-09 14:39:47 +000011584static int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
11585 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011586 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
11587 (vector unsigned long long)__a,
11588 (vector unsigned long long)__b);
11589}
11590#endif
11591
Bill Seurer703e8482015-06-09 14:39:47 +000011592static int __ATTRS_o_ai vec_any_gt(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011593 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011594}
11595
11596/* vec_any_le */
11597
Bill Seurer703e8482015-06-09 14:39:47 +000011598static int __ATTRS_o_ai vec_any_le(vector signed char __a,
11599 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011600 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011601}
11602
Bill Seurer703e8482015-06-09 14:39:47 +000011603static int __ATTRS_o_ai vec_any_le(vector signed char __a,
11604 vector bool char __b) {
11605 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a,
11606 (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011607}
11608
Bill Seurer703e8482015-06-09 14:39:47 +000011609static int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
11610 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011611 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011612}
11613
Bill Seurer703e8482015-06-09 14:39:47 +000011614static int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
11615 vector bool char __b) {
11616 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011617 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011618}
11619
Bill Seurer703e8482015-06-09 14:39:47 +000011620static int __ATTRS_o_ai vec_any_le(vector bool char __a,
11621 vector signed char __b) {
11622 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011623 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011624}
11625
Bill Seurer703e8482015-06-09 14:39:47 +000011626static int __ATTRS_o_ai vec_any_le(vector bool char __a,
11627 vector unsigned char __b) {
11628 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
11629 __b);
11630}
11631
11632static int __ATTRS_o_ai vec_any_le(vector bool char __a, vector bool char __b) {
11633 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
11634 (vector unsigned char)__b);
11635}
11636
11637static int __ATTRS_o_ai vec_any_le(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011638 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011639}
11640
Bill Seurer703e8482015-06-09 14:39:47 +000011641static int __ATTRS_o_ai vec_any_le(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011642 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011643}
11644
Bill Seurer703e8482015-06-09 14:39:47 +000011645static int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
11646 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011647 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011648}
11649
Bill Seurer703e8482015-06-09 14:39:47 +000011650static int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
11651 vector bool short __b) {
11652 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011653 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011654}
11655
Bill Seurer703e8482015-06-09 14:39:47 +000011656static int __ATTRS_o_ai vec_any_le(vector bool short __a, vector short __b) {
11657 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011658 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011659}
11660
Bill Seurer703e8482015-06-09 14:39:47 +000011661static int __ATTRS_o_ai vec_any_le(vector bool short __a,
11662 vector unsigned short __b) {
11663 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
11664 __b);
11665}
11666
11667static int __ATTRS_o_ai vec_any_le(vector bool short __a,
11668 vector bool short __b) {
11669 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
11670 (vector unsigned short)__b);
11671}
11672
11673static int __ATTRS_o_ai vec_any_le(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011674 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011675}
11676
Bill Seurer703e8482015-06-09 14:39:47 +000011677static int __ATTRS_o_ai vec_any_le(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011678 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011679}
11680
Bill Seurer703e8482015-06-09 14:39:47 +000011681static int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
11682 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011683 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011684}
11685
Bill Seurer703e8482015-06-09 14:39:47 +000011686static int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
11687 vector bool int __b) {
11688 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011689 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011690}
11691
Bill Seurer703e8482015-06-09 14:39:47 +000011692static int __ATTRS_o_ai vec_any_le(vector bool int __a, vector int __b) {
11693 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
11694 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011695}
11696
Bill Seurer703e8482015-06-09 14:39:47 +000011697static int __ATTRS_o_ai vec_any_le(vector bool int __a,
11698 vector unsigned int __b) {
11699 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
11700 __b);
11701}
11702
11703static int __ATTRS_o_ai vec_any_le(vector bool int __a, vector bool int __b) {
11704 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011705 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011706}
11707
Kit Barton8553bec2015-03-11 15:57:19 +000011708#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000011709static int __ATTRS_o_ai vec_any_le(vector signed long long __a,
11710 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011711 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, __b);
11712}
11713
Bill Seurer703e8482015-06-09 14:39:47 +000011714static int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
11715 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011716 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, __b);
11717}
11718
Bill Seurer703e8482015-06-09 14:39:47 +000011719static int __ATTRS_o_ai vec_any_le(vector signed long long __a,
11720 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011721 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a,
11722 (vector signed long long)__b);
11723}
11724
Bill Seurer703e8482015-06-09 14:39:47 +000011725static int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
11726 vector bool long long __b) {
11727 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a,
Kit Barton8553bec2015-03-11 15:57:19 +000011728 (vector unsigned long long)__b);
11729}
11730
Bill Seurer703e8482015-06-09 14:39:47 +000011731static int __ATTRS_o_ai vec_any_le(vector bool long long __a,
11732 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011733 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
11734 (vector unsigned long long)__a,
11735 (vector unsigned long long)__b);
11736}
11737
Bill Seurer703e8482015-06-09 14:39:47 +000011738static int __ATTRS_o_ai vec_any_le(vector bool long long __a,
11739 vector unsigned long long __b) {
11740 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
Kit Barton8553bec2015-03-11 15:57:19 +000011741 (vector unsigned long long)__a, __b);
11742}
11743
Bill Seurer703e8482015-06-09 14:39:47 +000011744static int __ATTRS_o_ai vec_any_le(vector bool long long __a,
11745 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011746 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
11747 (vector unsigned long long)__a,
11748 (vector unsigned long long)__b);
11749}
11750#endif
11751
Bill Seurer703e8482015-06-09 14:39:47 +000011752static int __ATTRS_o_ai vec_any_le(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011753 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011754}
11755
11756/* vec_any_lt */
11757
Bill Seurer703e8482015-06-09 14:39:47 +000011758static int __ATTRS_o_ai vec_any_lt(vector signed char __a,
11759 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011760 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011761}
11762
Bill Seurer703e8482015-06-09 14:39:47 +000011763static int __ATTRS_o_ai vec_any_lt(vector signed char __a,
11764 vector bool char __b) {
11765 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b,
11766 __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011767}
11768
Bill Seurer703e8482015-06-09 14:39:47 +000011769static int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
11770 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011771 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011772}
11773
Bill Seurer703e8482015-06-09 14:39:47 +000011774static int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
11775 vector bool char __b) {
11776 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
11777 __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011778}
11779
Bill Seurer703e8482015-06-09 14:39:47 +000011780static int __ATTRS_o_ai vec_any_lt(vector bool char __a,
11781 vector signed char __b) {
11782 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011783 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011784}
11785
Bill Seurer703e8482015-06-09 14:39:47 +000011786static int __ATTRS_o_ai vec_any_lt(vector bool char __a,
11787 vector unsigned char __b) {
11788 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011789 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011790}
11791
Bill Seurer703e8482015-06-09 14:39:47 +000011792static int __ATTRS_o_ai vec_any_lt(vector bool char __a, vector bool char __b) {
11793 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
11794 (vector unsigned char)__a);
11795}
11796
11797static int __ATTRS_o_ai vec_any_lt(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011798 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011799}
11800
Bill Seurer703e8482015-06-09 14:39:47 +000011801static int __ATTRS_o_ai vec_any_lt(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011802 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011803}
11804
Bill Seurer703e8482015-06-09 14:39:47 +000011805static int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
11806 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011807 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011808}
11809
Bill Seurer703e8482015-06-09 14:39:47 +000011810static int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
11811 vector bool short __b) {
11812 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
11813 __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011814}
11815
Bill Seurer703e8482015-06-09 14:39:47 +000011816static int __ATTRS_o_ai vec_any_lt(vector bool short __a, vector short __b) {
11817 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011818 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011819}
11820
Bill Seurer703e8482015-06-09 14:39:47 +000011821static int __ATTRS_o_ai vec_any_lt(vector bool short __a,
11822 vector unsigned short __b) {
11823 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011824 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011825}
11826
Bill Seurer703e8482015-06-09 14:39:47 +000011827static int __ATTRS_o_ai vec_any_lt(vector bool short __a,
11828 vector bool short __b) {
11829 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
11830 (vector unsigned short)__a);
11831}
11832
11833static int __ATTRS_o_ai vec_any_lt(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011834 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011835}
11836
Bill Seurer703e8482015-06-09 14:39:47 +000011837static int __ATTRS_o_ai vec_any_lt(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011838 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011839}
11840
Bill Seurer703e8482015-06-09 14:39:47 +000011841static int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
11842 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011843 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011844}
11845
Bill Seurer703e8482015-06-09 14:39:47 +000011846static int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
11847 vector bool int __b) {
11848 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
11849 __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011850}
11851
Bill Seurer703e8482015-06-09 14:39:47 +000011852static int __ATTRS_o_ai vec_any_lt(vector bool int __a, vector int __b) {
11853 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011854 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011855}
11856
Bill Seurer703e8482015-06-09 14:39:47 +000011857static int __ATTRS_o_ai vec_any_lt(vector bool int __a,
11858 vector unsigned int __b) {
11859 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b,
11860 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011861}
11862
Bill Seurer703e8482015-06-09 14:39:47 +000011863static int __ATTRS_o_ai vec_any_lt(vector bool int __a, vector bool int __b) {
11864 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011865 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011866}
11867
Kit Barton8553bec2015-03-11 15:57:19 +000011868#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000011869static int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
11870 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011871 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, __a);
11872}
11873
Bill Seurer703e8482015-06-09 14:39:47 +000011874static int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
11875 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011876 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, __a);
11877}
11878
Bill Seurer703e8482015-06-09 14:39:47 +000011879static int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
11880 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011881 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV,
11882 (vector signed long long)__b, __a);
11883}
11884
Bill Seurer703e8482015-06-09 14:39:47 +000011885static int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
11886 vector bool long long __b) {
11887 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
Kit Barton8553bec2015-03-11 15:57:19 +000011888 (vector unsigned long long)__b, __a);
11889}
11890
Bill Seurer703e8482015-06-09 14:39:47 +000011891static int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
11892 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011893 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
11894 (vector unsigned long long)__b,
11895 (vector unsigned long long)__a);
11896}
11897
Bill Seurer703e8482015-06-09 14:39:47 +000011898static int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
11899 vector unsigned long long __b) {
11900 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b,
Kit Barton8553bec2015-03-11 15:57:19 +000011901 (vector unsigned long long)__a);
11902}
11903
Bill Seurer703e8482015-06-09 14:39:47 +000011904static int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
11905 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011906 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
11907 (vector unsigned long long)__b,
11908 (vector unsigned long long)__a);
11909}
11910#endif
11911
Bill Seurer703e8482015-06-09 14:39:47 +000011912static int __ATTRS_o_ai vec_any_lt(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011913 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011914}
11915
11916/* vec_any_nan */
11917
Bill Seurer703e8482015-06-09 14:39:47 +000011918static int __attribute__((__always_inline__)) vec_any_nan(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011919 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011920}
11921
11922/* vec_any_ne */
11923
Bill Seurer703e8482015-06-09 14:39:47 +000011924static int __ATTRS_o_ai vec_any_ne(vector signed char __a,
11925 vector signed char __b) {
11926 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
11927 (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011928}
11929
Bill Seurer703e8482015-06-09 14:39:47 +000011930static int __ATTRS_o_ai vec_any_ne(vector signed char __a,
11931 vector bool char __b) {
11932 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
11933 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011934}
11935
Bill Seurer703e8482015-06-09 14:39:47 +000011936static int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
11937 vector unsigned char __b) {
11938 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
11939 (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011940}
11941
Bill Seurer703e8482015-06-09 14:39:47 +000011942static int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
11943 vector bool char __b) {
11944 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
11945 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011946}
11947
Bill Seurer703e8482015-06-09 14:39:47 +000011948static int __ATTRS_o_ai vec_any_ne(vector bool char __a,
11949 vector signed char __b) {
11950 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
11951 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011952}
11953
Bill Seurer703e8482015-06-09 14:39:47 +000011954static int __ATTRS_o_ai vec_any_ne(vector bool char __a,
11955 vector unsigned char __b) {
11956 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
11957 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011958}
11959
Bill Seurer703e8482015-06-09 14:39:47 +000011960static int __ATTRS_o_ai vec_any_ne(vector bool char __a, vector bool char __b) {
11961 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
11962 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011963}
11964
Bill Seurer703e8482015-06-09 14:39:47 +000011965static int __ATTRS_o_ai vec_any_ne(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011966 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011967}
11968
Bill Seurer703e8482015-06-09 14:39:47 +000011969static int __ATTRS_o_ai vec_any_ne(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011970 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011971}
11972
Bill Seurer703e8482015-06-09 14:39:47 +000011973static int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
11974 vector unsigned short __b) {
11975 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011976 (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011977}
11978
Bill Seurer703e8482015-06-09 14:39:47 +000011979static int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
11980 vector bool short __b) {
11981 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011982 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011983}
11984
Bill Seurer703e8482015-06-09 14:39:47 +000011985static int __ATTRS_o_ai vec_any_ne(vector bool short __a, vector short __b) {
11986 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011987 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011988}
11989
Bill Seurer703e8482015-06-09 14:39:47 +000011990static int __ATTRS_o_ai vec_any_ne(vector bool short __a,
11991 vector unsigned short __b) {
11992 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011993 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011994}
11995
Bill Seurer703e8482015-06-09 14:39:47 +000011996static int __ATTRS_o_ai vec_any_ne(vector bool short __a,
11997 vector bool short __b) {
11998 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011999 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012000}
12001
Bill Seurer703e8482015-06-09 14:39:47 +000012002static int __ATTRS_o_ai vec_any_ne(vector pixel __a, vector pixel __b) {
12003 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000012004 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012005}
12006
Bill Seurer703e8482015-06-09 14:39:47 +000012007static int __ATTRS_o_ai vec_any_ne(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000012008 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012009}
12010
Bill Seurer703e8482015-06-09 14:39:47 +000012011static int __ATTRS_o_ai vec_any_ne(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000012012 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012013}
12014
Bill Seurer703e8482015-06-09 14:39:47 +000012015static int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
12016 vector unsigned int __b) {
12017 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
12018 (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012019}
12020
Bill Seurer703e8482015-06-09 14:39:47 +000012021static int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
12022 vector bool int __b) {
12023 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
12024 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012025}
12026
Bill Seurer703e8482015-06-09 14:39:47 +000012027static int __ATTRS_o_ai vec_any_ne(vector bool int __a, vector int __b) {
12028 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
12029 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012030}
12031
Bill Seurer703e8482015-06-09 14:39:47 +000012032static int __ATTRS_o_ai vec_any_ne(vector bool int __a,
12033 vector unsigned int __b) {
12034 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
12035 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012036}
12037
Bill Seurer703e8482015-06-09 14:39:47 +000012038static int __ATTRS_o_ai vec_any_ne(vector bool int __a, vector bool int __b) {
12039 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
12040 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012041}
12042
Kit Barton8553bec2015-03-11 15:57:19 +000012043#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000012044static int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
12045 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000012046 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, __b);
12047}
12048
Bill Seurer703e8482015-06-09 14:39:47 +000012049static int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
12050 vector unsigned long long __b) {
12051 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector long long)__a,
12052 (vector long long)__b);
Kit Barton8553bec2015-03-11 15:57:19 +000012053}
12054
Bill Seurer703e8482015-06-09 14:39:47 +000012055static int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
12056 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000012057 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a,
12058 (vector signed long long)__b);
12059}
12060
Bill Seurer703e8482015-06-09 14:39:47 +000012061static int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
12062 vector bool long long __b) {
12063 return __builtin_altivec_vcmpequd_p(
12064 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
Kit Barton8553bec2015-03-11 15:57:19 +000012065}
12066
Bill Seurer703e8482015-06-09 14:39:47 +000012067static int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
12068 vector signed long long __b) {
12069 return __builtin_altivec_vcmpequd_p(
12070 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
Kit Barton8553bec2015-03-11 15:57:19 +000012071}
12072
Bill Seurer703e8482015-06-09 14:39:47 +000012073static int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
12074 vector unsigned long long __b) {
12075 return __builtin_altivec_vcmpequd_p(
12076 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
Kit Barton8553bec2015-03-11 15:57:19 +000012077}
12078
Bill Seurer703e8482015-06-09 14:39:47 +000012079static int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
12080 vector bool long long __b) {
12081 return __builtin_altivec_vcmpequd_p(
12082 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
Kit Barton8553bec2015-03-11 15:57:19 +000012083}
12084#endif
12085
Bill Seurer703e8482015-06-09 14:39:47 +000012086static int __ATTRS_o_ai vec_any_ne(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000012087 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012088}
12089
12090/* vec_any_nge */
12091
12092static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000012093vec_any_nge(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000012094 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012095}
12096
12097/* vec_any_ngt */
12098
12099static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000012100vec_any_ngt(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000012101 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012102}
12103
12104/* vec_any_nle */
12105
12106static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000012107vec_any_nle(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000012108 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012109}
12110
12111/* vec_any_nlt */
12112
12113static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000012114vec_any_nlt(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000012115 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012116}
12117
12118/* vec_any_numeric */
12119
12120static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000012121vec_any_numeric(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +000012122 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012123}
12124
12125/* vec_any_out */
12126
12127static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000012128vec_any_out(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000012129 return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012130}
12131
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012132/* Power 8 Crypto functions
12133Note: We diverge from the current GCC implementation with regard
12134to cryptography and related functions as follows:
12135- Only the SHA and AES instructions and builtins are disabled by -mno-crypto
12136- The remaining ones are only available on Power8 and up so
12137 require -mpower8-vector
12138The justification for this is that export requirements require that
12139Category:Vector.Crypto is optional (i.e. compliant hardware may not provide
12140support). As a result, we need to be able to turn off support for those.
12141The remaining ones (currently controlled by -mcrypto for GCC) still
12142need to be provided on compliant hardware even if Vector.Crypto is not
12143provided.
12144FIXME: the naming convention for the builtins will be adjusted due
12145to the inconsistency (__builtin_crypto_ prefix on builtins that cannot be
12146removed with -mno-crypto). This is under development.
12147*/
12148#ifdef __CRYPTO__
12149static vector unsigned long long __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000012150__builtin_crypto_vsbox(vector unsigned long long __a) {
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012151 return __builtin_altivec_crypto_vsbox(__a);
12152}
12153
12154static vector unsigned long long __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000012155__builtin_crypto_vcipher(vector unsigned long long __a,
12156 vector unsigned long long __b) {
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012157 return __builtin_altivec_crypto_vcipher(__a, __b);
12158}
12159
12160static vector unsigned long long __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000012161__builtin_crypto_vcipherlast(vector unsigned long long __a,
12162 vector unsigned long long __b) {
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012163 return __builtin_altivec_crypto_vcipherlast(__a, __b);
12164}
12165
12166static vector unsigned long long __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000012167__builtin_crypto_vncipher(vector unsigned long long __a,
12168 vector unsigned long long __b) {
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012169 return __builtin_altivec_crypto_vncipher(__a, __b);
12170}
12171
12172static vector unsigned long long __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000012173__builtin_crypto_vncipherlast(vector unsigned long long __a,
12174 vector unsigned long long __b) {
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012175 return __builtin_altivec_crypto_vncipherlast(__a, __b);
12176}
12177
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012178#define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad
12179#define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw
12180#endif
12181
12182#ifdef __POWER8_VECTOR__
12183static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +000012184__builtin_crypto_vpermxor(vector unsigned char __a, vector unsigned char __b,
12185 vector unsigned char __c) {
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012186 return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
12187}
12188
12189static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +000012190__builtin_crypto_vpermxor(vector unsigned short __a, vector unsigned short __b,
12191 vector unsigned short __c) {
12192 return (vector unsigned short)__builtin_altivec_crypto_vpermxor(
12193 (vector unsigned char)__a, (vector unsigned char)__b,
12194 (vector unsigned char)__c);
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012195}
12196
Bill Seurer703e8482015-06-09 14:39:47 +000012197static vector unsigned int __ATTRS_o_ai __builtin_crypto_vpermxor(
12198 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
12199 return (vector unsigned int)__builtin_altivec_crypto_vpermxor(
12200 (vector unsigned char)__a, (vector unsigned char)__b,
12201 (vector unsigned char)__c);
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012202}
12203
Bill Seurer703e8482015-06-09 14:39:47 +000012204static vector unsigned long long __ATTRS_o_ai __builtin_crypto_vpermxor(
12205 vector unsigned long long __a, vector unsigned long long __b,
12206 vector unsigned long long __c) {
12207 return (vector unsigned long long)__builtin_altivec_crypto_vpermxor(
12208 (vector unsigned char)__a, (vector unsigned char)__b,
12209 (vector unsigned char)__c);
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012210}
12211
12212static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +000012213__builtin_crypto_vpmsumb(vector unsigned char __a, vector unsigned char __b) {
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012214 return __builtin_altivec_crypto_vpmsumb(__a, __b);
12215}
12216
12217static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +000012218__builtin_crypto_vpmsumb(vector unsigned short __a, vector unsigned short __b) {
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012219 return __builtin_altivec_crypto_vpmsumh(__a, __b);
12220}
12221
12222static vector unsigned int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +000012223__builtin_crypto_vpmsumb(vector unsigned int __a, vector unsigned int __b) {
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012224 return __builtin_altivec_crypto_vpmsumw(__a, __b);
12225}
12226
Bill Seurer703e8482015-06-09 14:39:47 +000012227static vector unsigned long long __ATTRS_o_ai __builtin_crypto_vpmsumb(
12228 vector unsigned long long __a, vector unsigned long long __b) {
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012229 return __builtin_altivec_crypto_vpmsumd(__a, __b);
12230}
Nemanja Ivanovicb17f1122015-06-11 06:25:36 +000012231
12232static vector signed char __ATTRS_o_ai vec_vgbbd (vector signed char __a)
12233{
12234 return __builtin_altivec_vgbbd((vector unsigned char) __a);
12235}
12236
12237static vector unsigned char __ATTRS_o_ai vec_vgbbd (vector unsigned char __a)
12238{
12239 return __builtin_altivec_vgbbd(__a);
12240}
12241
12242static vector long long __ATTRS_o_ai
12243vec_vbpermq (vector signed char __a, vector signed char __b)
12244{
12245 return __builtin_altivec_vbpermq((vector unsigned char) __a,
12246 (vector unsigned char) __b);
12247}
12248
12249static vector long long __ATTRS_o_ai
12250vec_vbpermq (vector unsigned char __a, vector unsigned char __b)
12251{
12252 return __builtin_altivec_vbpermq(__a, __b);
12253}
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012254#endif
12255
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012256#undef __ATTRS_o_ai
Chris Lattnerdad40622010-04-14 03:54:58 +000012257
12258#endif /* __ALTIVEC_H */