blob: be0a1dbc118b9eee5b8d74866d0dcbc728f4b5e9 [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
Chris Lattnerdad40622010-04-14 03:54:58 +00003183/* vec_mfvscr */
3184
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003185static vector unsigned short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003186vec_mfvscr(void) {
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003187 return __builtin_altivec_mfvscr();
3188}
Chris Lattnerdad40622010-04-14 03:54:58 +00003189
3190/* vec_min */
3191
Bill Seurer703e8482015-06-09 14:39:47 +00003192static vector signed char __ATTRS_o_ai vec_min(vector signed char __a,
3193 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003194 return __builtin_altivec_vminsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003195}
3196
Bill Seurer703e8482015-06-09 14:39:47 +00003197static vector signed char __ATTRS_o_ai vec_min(vector bool char __a,
3198 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003199 return __builtin_altivec_vminsb((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003200}
3201
Bill Seurer703e8482015-06-09 14:39:47 +00003202static vector signed char __ATTRS_o_ai vec_min(vector signed char __a,
3203 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003204 return __builtin_altivec_vminsb(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003205}
3206
Bill Seurer703e8482015-06-09 14:39:47 +00003207static vector unsigned char __ATTRS_o_ai vec_min(vector unsigned char __a,
3208 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003209 return __builtin_altivec_vminub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003210}
3211
Bill Seurer703e8482015-06-09 14:39:47 +00003212static vector unsigned char __ATTRS_o_ai vec_min(vector bool char __a,
3213 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003214 return __builtin_altivec_vminub((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003215}
3216
Bill Seurer703e8482015-06-09 14:39:47 +00003217static vector unsigned char __ATTRS_o_ai vec_min(vector unsigned char __a,
3218 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003219 return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003220}
3221
Bill Seurer703e8482015-06-09 14:39:47 +00003222static vector short __ATTRS_o_ai vec_min(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003223 return __builtin_altivec_vminsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003224}
3225
Bill Seurer703e8482015-06-09 14:39:47 +00003226static vector short __ATTRS_o_ai vec_min(vector bool short __a,
3227 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003228 return __builtin_altivec_vminsh((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003229}
3230
Bill Seurer703e8482015-06-09 14:39:47 +00003231static vector short __ATTRS_o_ai vec_min(vector short __a,
3232 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003233 return __builtin_altivec_vminsh(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003234}
3235
Bill Seurer703e8482015-06-09 14:39:47 +00003236static vector unsigned short __ATTRS_o_ai vec_min(vector unsigned short __a,
3237 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003238 return __builtin_altivec_vminuh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003239}
3240
Bill Seurer703e8482015-06-09 14:39:47 +00003241static vector unsigned short __ATTRS_o_ai vec_min(vector bool short __a,
3242 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003243 return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003244}
3245
Bill Seurer703e8482015-06-09 14:39:47 +00003246static vector unsigned short __ATTRS_o_ai vec_min(vector unsigned short __a,
3247 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003248 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003249}
3250
Bill Seurer703e8482015-06-09 14:39:47 +00003251static vector int __ATTRS_o_ai vec_min(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003252 return __builtin_altivec_vminsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003253}
3254
Bill Seurer703e8482015-06-09 14:39:47 +00003255static vector int __ATTRS_o_ai vec_min(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003256 return __builtin_altivec_vminsw((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003257}
3258
Bill Seurer703e8482015-06-09 14:39:47 +00003259static vector int __ATTRS_o_ai vec_min(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003260 return __builtin_altivec_vminsw(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003261}
3262
Bill Seurer703e8482015-06-09 14:39:47 +00003263static vector unsigned int __ATTRS_o_ai vec_min(vector unsigned int __a,
3264 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003265 return __builtin_altivec_vminuw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003266}
3267
Bill Seurer703e8482015-06-09 14:39:47 +00003268static vector unsigned int __ATTRS_o_ai vec_min(vector bool int __a,
3269 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003270 return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003271}
3272
Bill Seurer703e8482015-06-09 14:39:47 +00003273static vector unsigned int __ATTRS_o_ai vec_min(vector unsigned int __a,
3274 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003275 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003276}
3277
Kit Barton8553bec2015-03-11 15:57:19 +00003278#ifdef __POWER8_VECTOR__
3279static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003280vec_min(vector signed long long __a, vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00003281 return __builtin_altivec_vminsd(__a, __b);
3282}
3283
Bill Seurer8be14f12015-06-04 18:45:44 +00003284static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003285vec_min(vector bool long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00003286 return __builtin_altivec_vminsd((vector signed long long)__a, __b);
3287}
3288
Bill Seurer703e8482015-06-09 14:39:47 +00003289static vector signed long long __ATTRS_o_ai vec_min(vector signed long long __a,
3290 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00003291 return __builtin_altivec_vminsd(__a, (vector signed long long)__b);
3292}
3293
Kit Barton8553bec2015-03-11 15:57:19 +00003294static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003295vec_min(vector unsigned long long __a, vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00003296 return __builtin_altivec_vminud(__a, __b);
3297}
Bill Seurer8be14f12015-06-04 18:45:44 +00003298
3299static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003300vec_min(vector bool long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00003301 return __builtin_altivec_vminud((vector unsigned long long)__a, __b);
3302}
3303
3304static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003305vec_min(vector unsigned long long __a, vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00003306 return __builtin_altivec_vminud(__a, (vector unsigned long long)__b);
3307}
Kit Barton8553bec2015-03-11 15:57:19 +00003308#endif
3309
Bill Seurer703e8482015-06-09 14:39:47 +00003310static vector float __ATTRS_o_ai vec_min(vector float __a, vector float __b) {
Bill Schmidt691e01d2014-10-31 19:19:24 +00003311#ifdef __VSX__
3312 return __builtin_vsx_xvminsp(__a, __b);
3313#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003314 return __builtin_altivec_vminfp(__a, __b);
Bill Schmidt691e01d2014-10-31 19:19:24 +00003315#endif
Chris Lattnerdad40622010-04-14 03:54:58 +00003316}
3317
Bill Schmidt691e01d2014-10-31 19:19:24 +00003318#ifdef __VSX__
Bill Seurer703e8482015-06-09 14:39:47 +00003319static vector double __ATTRS_o_ai vec_min(vector double __a,
3320 vector double __b) {
Bill Schmidt691e01d2014-10-31 19:19:24 +00003321 return __builtin_vsx_xvmindp(__a, __b);
3322}
3323#endif
3324
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003325/* vec_vminsb */
3326
Bill Seurer703e8482015-06-09 14:39:47 +00003327static vector signed char __ATTRS_o_ai vec_vminsb(vector signed char __a,
3328 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003329 return __builtin_altivec_vminsb(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003330}
3331
Bill Seurer703e8482015-06-09 14:39:47 +00003332static vector signed char __ATTRS_o_ai vec_vminsb(vector bool char __a,
3333 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003334 return __builtin_altivec_vminsb((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003335}
3336
Bill Seurer703e8482015-06-09 14:39:47 +00003337static vector signed char __ATTRS_o_ai vec_vminsb(vector signed char __a,
3338 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003339 return __builtin_altivec_vminsb(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003340}
3341
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003342/* vec_vminub */
3343
Bill Seurer703e8482015-06-09 14:39:47 +00003344static vector unsigned char __ATTRS_o_ai vec_vminub(vector unsigned char __a,
3345 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003346 return __builtin_altivec_vminub(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003347}
3348
Bill Seurer703e8482015-06-09 14:39:47 +00003349static vector unsigned char __ATTRS_o_ai vec_vminub(vector bool char __a,
3350 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003351 return __builtin_altivec_vminub((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003352}
3353
Bill Seurer703e8482015-06-09 14:39:47 +00003354static vector unsigned char __ATTRS_o_ai vec_vminub(vector unsigned char __a,
3355 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003356 return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003357}
3358
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003359/* vec_vminsh */
3360
Bill Seurer703e8482015-06-09 14:39:47 +00003361static vector short __ATTRS_o_ai vec_vminsh(vector short __a,
3362 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003363 return __builtin_altivec_vminsh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003364}
3365
Bill Seurer703e8482015-06-09 14:39:47 +00003366static vector short __ATTRS_o_ai vec_vminsh(vector bool short __a,
3367 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003368 return __builtin_altivec_vminsh((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003369}
3370
Bill Seurer703e8482015-06-09 14:39:47 +00003371static vector short __ATTRS_o_ai vec_vminsh(vector short __a,
3372 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003373 return __builtin_altivec_vminsh(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003374}
3375
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003376/* vec_vminuh */
3377
Anton Yartsevfc83c602010-08-19 03:21:36 +00003378static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003379vec_vminuh(vector unsigned short __a, vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003380 return __builtin_altivec_vminuh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003381}
3382
Anton Yartsevfc83c602010-08-19 03:21:36 +00003383static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003384vec_vminuh(vector bool short __a, vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003385 return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003386}
3387
Bill Seurer703e8482015-06-09 14:39:47 +00003388static vector unsigned short __ATTRS_o_ai vec_vminuh(vector unsigned short __a,
3389 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003390 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003391}
3392
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003393/* vec_vminsw */
3394
Bill Seurer703e8482015-06-09 14:39:47 +00003395static vector int __ATTRS_o_ai vec_vminsw(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003396 return __builtin_altivec_vminsw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003397}
3398
Bill Seurer703e8482015-06-09 14:39:47 +00003399static vector int __ATTRS_o_ai vec_vminsw(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003400 return __builtin_altivec_vminsw((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003401}
3402
Bill Seurer703e8482015-06-09 14:39:47 +00003403static vector int __ATTRS_o_ai vec_vminsw(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003404 return __builtin_altivec_vminsw(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003405}
3406
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003407/* vec_vminuw */
3408
Bill Seurer703e8482015-06-09 14:39:47 +00003409static vector unsigned int __ATTRS_o_ai vec_vminuw(vector unsigned int __a,
3410 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003411 return __builtin_altivec_vminuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003412}
3413
Bill Seurer703e8482015-06-09 14:39:47 +00003414static vector unsigned int __ATTRS_o_ai vec_vminuw(vector bool int __a,
3415 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003416 return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003417}
3418
Bill Seurer703e8482015-06-09 14:39:47 +00003419static vector unsigned int __ATTRS_o_ai vec_vminuw(vector unsigned int __a,
3420 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003421 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003422}
3423
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003424/* vec_vminfp */
3425
3426static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003427vec_vminfp(vector float __a, vector float __b) {
Bill Schmidt691e01d2014-10-31 19:19:24 +00003428#ifdef __VSX__
3429 return __builtin_vsx_xvminsp(__a, __b);
3430#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003431 return __builtin_altivec_vminfp(__a, __b);
Bill Schmidt691e01d2014-10-31 19:19:24 +00003432#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003433}
3434
3435/* vec_mladd */
3436
3437#define __builtin_altivec_vmladduhm vec_mladd
3438
Bill Seurer703e8482015-06-09 14:39:47 +00003439static vector short __ATTRS_o_ai vec_mladd(vector short __a, vector short __b,
3440 vector short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003441 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003442}
3443
Bill Seurer703e8482015-06-09 14:39:47 +00003444static vector short __ATTRS_o_ai vec_mladd(vector short __a,
3445 vector unsigned short __b,
3446 vector unsigned short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003447 return __a * (vector short)__b + (vector short)__c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003448}
3449
Bill Seurer703e8482015-06-09 14:39:47 +00003450static vector short __ATTRS_o_ai vec_mladd(vector unsigned short __a,
3451 vector short __b, vector short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003452 return (vector short)__a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003453}
3454
Bill Seurer703e8482015-06-09 14:39:47 +00003455static vector unsigned short __ATTRS_o_ai vec_mladd(vector unsigned short __a,
3456 vector unsigned short __b,
3457 vector unsigned short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003458 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003459}
3460
3461/* vec_vmladduhm */
3462
Bill Seurer703e8482015-06-09 14:39:47 +00003463static vector short __ATTRS_o_ai vec_vmladduhm(vector short __a,
3464 vector short __b,
3465 vector short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003466 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003467}
3468
Bill Seurer703e8482015-06-09 14:39:47 +00003469static vector short __ATTRS_o_ai vec_vmladduhm(vector short __a,
3470 vector unsigned short __b,
3471 vector unsigned short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003472 return __a * (vector short)__b + (vector short)__c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003473}
3474
Bill Seurer703e8482015-06-09 14:39:47 +00003475static vector short __ATTRS_o_ai vec_vmladduhm(vector unsigned short __a,
3476 vector short __b,
3477 vector short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003478 return (vector short)__a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003479}
3480
3481static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003482vec_vmladduhm(vector unsigned short __a, vector unsigned short __b,
3483 vector unsigned short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003484 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003485}
3486
3487/* vec_mradds */
3488
3489static vector short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003490vec_mradds(vector short __a, vector short __b, vector short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003491 return __builtin_altivec_vmhraddshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003492}
3493
3494/* vec_vmhraddshs */
3495
3496static vector short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003497vec_vmhraddshs(vector short __a, vector short __b, vector short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003498 return __builtin_altivec_vmhraddshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003499}
3500
3501/* vec_msum */
3502
Bill Seurer703e8482015-06-09 14:39:47 +00003503static vector int __ATTRS_o_ai vec_msum(vector signed char __a,
3504 vector unsigned char __b,
3505 vector int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003506 return __builtin_altivec_vmsummbm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003507}
3508
Bill Seurer703e8482015-06-09 14:39:47 +00003509static vector unsigned int __ATTRS_o_ai vec_msum(vector unsigned char __a,
3510 vector unsigned char __b,
3511 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003512 return __builtin_altivec_vmsumubm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003513}
3514
Bill Seurer703e8482015-06-09 14:39:47 +00003515static vector int __ATTRS_o_ai vec_msum(vector short __a, vector short __b,
3516 vector int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003517 return __builtin_altivec_vmsumshm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003518}
3519
Bill Seurer703e8482015-06-09 14:39:47 +00003520static vector unsigned int __ATTRS_o_ai vec_msum(vector unsigned short __a,
3521 vector unsigned short __b,
3522 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003523 return __builtin_altivec_vmsumuhm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003524}
3525
3526/* vec_vmsummbm */
3527
3528static vector int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003529vec_vmsummbm(vector signed char __a, vector unsigned char __b, vector int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003530 return __builtin_altivec_vmsummbm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003531}
3532
3533/* vec_vmsumubm */
3534
3535static vector unsigned int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003536vec_vmsumubm(vector unsigned char __a, vector unsigned char __b,
3537 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003538 return __builtin_altivec_vmsumubm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003539}
3540
3541/* vec_vmsumshm */
3542
3543static vector int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003544vec_vmsumshm(vector short __a, vector short __b, vector int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003545 return __builtin_altivec_vmsumshm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003546}
3547
3548/* vec_vmsumuhm */
3549
3550static vector unsigned int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003551vec_vmsumuhm(vector unsigned short __a, vector unsigned short __b,
3552 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003553 return __builtin_altivec_vmsumuhm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003554}
3555
3556/* vec_msums */
3557
Bill Seurer703e8482015-06-09 14:39:47 +00003558static vector int __ATTRS_o_ai vec_msums(vector short __a, vector short __b,
3559 vector int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003560 return __builtin_altivec_vmsumshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003561}
3562
Bill Seurer703e8482015-06-09 14:39:47 +00003563static vector unsigned int __ATTRS_o_ai vec_msums(vector unsigned short __a,
3564 vector unsigned short __b,
3565 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003566 return __builtin_altivec_vmsumuhs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003567}
3568
3569/* vec_vmsumshs */
3570
3571static vector int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003572vec_vmsumshs(vector short __a, vector short __b, vector int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003573 return __builtin_altivec_vmsumshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003574}
3575
3576/* vec_vmsumuhs */
3577
3578static vector unsigned int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003579vec_vmsumuhs(vector unsigned short __a, vector unsigned short __b,
3580 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003581 return __builtin_altivec_vmsumuhs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003582}
3583
Chris Lattnerdad40622010-04-14 03:54:58 +00003584/* vec_mtvscr */
3585
Bill Seurer703e8482015-06-09 14:39:47 +00003586static void __ATTRS_o_ai vec_mtvscr(vector signed char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003587 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003588}
3589
Bill Seurer703e8482015-06-09 14:39:47 +00003590static void __ATTRS_o_ai vec_mtvscr(vector unsigned char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003591 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003592}
3593
Bill Seurer703e8482015-06-09 14:39:47 +00003594static void __ATTRS_o_ai vec_mtvscr(vector bool char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003595 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003596}
3597
Bill Seurer703e8482015-06-09 14:39:47 +00003598static void __ATTRS_o_ai vec_mtvscr(vector short __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003599 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003600}
3601
Bill Seurer703e8482015-06-09 14:39:47 +00003602static void __ATTRS_o_ai vec_mtvscr(vector unsigned short __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003603 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003604}
3605
Bill Seurer703e8482015-06-09 14:39:47 +00003606static void __ATTRS_o_ai vec_mtvscr(vector bool short __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003607 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003608}
3609
Bill Seurer703e8482015-06-09 14:39:47 +00003610static void __ATTRS_o_ai vec_mtvscr(vector pixel __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003611 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003612}
3613
Bill Seurer703e8482015-06-09 14:39:47 +00003614static void __ATTRS_o_ai vec_mtvscr(vector int __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003615 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003616}
3617
Bill Seurer703e8482015-06-09 14:39:47 +00003618static void __ATTRS_o_ai vec_mtvscr(vector unsigned int __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003619 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003620}
3621
Bill Seurer703e8482015-06-09 14:39:47 +00003622static void __ATTRS_o_ai vec_mtvscr(vector bool int __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003623 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003624}
3625
Bill Seurer703e8482015-06-09 14:39:47 +00003626static void __ATTRS_o_ai vec_mtvscr(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003627 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003628}
3629
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003630/* The vmulos* and vmules* instructions have a big endian bias, so
3631 we must reverse the meaning of "even" and "odd" for little endian. */
3632
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003633/* vec_mule */
3634
Bill Seurer703e8482015-06-09 14:39:47 +00003635static vector short __ATTRS_o_ai vec_mule(vector signed char __a,
3636 vector signed char __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003637#ifdef __LITTLE_ENDIAN__
3638 return __builtin_altivec_vmulosb(__a, __b);
3639#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003640 return __builtin_altivec_vmulesb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003641#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003642}
3643
Bill Seurer703e8482015-06-09 14:39:47 +00003644static vector unsigned short __ATTRS_o_ai vec_mule(vector unsigned char __a,
3645 vector unsigned char __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003646#ifdef __LITTLE_ENDIAN__
3647 return __builtin_altivec_vmuloub(__a, __b);
3648#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003649 return __builtin_altivec_vmuleub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003650#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003651}
3652
Bill Seurer703e8482015-06-09 14:39:47 +00003653static vector int __ATTRS_o_ai vec_mule(vector short __a, vector short __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003654#ifdef __LITTLE_ENDIAN__
3655 return __builtin_altivec_vmulosh(__a, __b);
3656#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003657 return __builtin_altivec_vmulesh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003658#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003659}
3660
Bill Seurer703e8482015-06-09 14:39:47 +00003661static vector unsigned int __ATTRS_o_ai vec_mule(vector unsigned short __a,
3662 vector unsigned short __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003663#ifdef __LITTLE_ENDIAN__
3664 return __builtin_altivec_vmulouh(__a, __b);
3665#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003666 return __builtin_altivec_vmuleuh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003667#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003668}
3669
Kit Barton8553bec2015-03-11 15:57:19 +00003670#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +00003671static vector signed long long __ATTRS_o_ai vec_mule(vector signed int __a,
3672 vector signed int __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00003673#ifdef __LITTLE_ENDIAN__
3674 return __builtin_altivec_vmulosw(__a, __b);
3675#else
3676 return __builtin_altivec_vmulesw(__a, __b);
3677#endif
3678}
3679
3680static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003681vec_mule(vector unsigned int __a, vector unsigned int __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00003682#ifdef __LITTLE_ENDIAN__
3683 return __builtin_altivec_vmulouw(__a, __b);
3684#else
3685 return __builtin_altivec_vmuleuw(__a, __b);
3686#endif
3687}
3688#endif
3689
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003690/* vec_vmulesb */
3691
3692static vector short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003693vec_vmulesb(vector signed char __a, vector signed char __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003694#ifdef __LITTLE_ENDIAN__
3695 return __builtin_altivec_vmulosb(__a, __b);
3696#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003697 return __builtin_altivec_vmulesb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003698#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003699}
3700
3701/* vec_vmuleub */
3702
3703static vector unsigned short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003704vec_vmuleub(vector unsigned char __a, vector unsigned char __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003705#ifdef __LITTLE_ENDIAN__
3706 return __builtin_altivec_vmuloub(__a, __b);
3707#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003708 return __builtin_altivec_vmuleub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003709#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003710}
3711
3712/* vec_vmulesh */
3713
3714static vector int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003715vec_vmulesh(vector short __a, vector short __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003716#ifdef __LITTLE_ENDIAN__
3717 return __builtin_altivec_vmulosh(__a, __b);
3718#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003719 return __builtin_altivec_vmulesh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003720#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003721}
3722
3723/* vec_vmuleuh */
3724
3725static vector unsigned int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003726vec_vmuleuh(vector unsigned short __a, vector unsigned short __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003727#ifdef __LITTLE_ENDIAN__
3728 return __builtin_altivec_vmulouh(__a, __b);
3729#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003730 return __builtin_altivec_vmuleuh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003731#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003732}
3733
3734/* vec_mulo */
3735
Bill Seurer703e8482015-06-09 14:39:47 +00003736static vector short __ATTRS_o_ai vec_mulo(vector signed char __a,
3737 vector signed char __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003738#ifdef __LITTLE_ENDIAN__
3739 return __builtin_altivec_vmulesb(__a, __b);
3740#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003741 return __builtin_altivec_vmulosb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003742#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003743}
3744
Bill Seurer703e8482015-06-09 14:39:47 +00003745static vector unsigned short __ATTRS_o_ai vec_mulo(vector unsigned char __a,
3746 vector unsigned char __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003747#ifdef __LITTLE_ENDIAN__
3748 return __builtin_altivec_vmuleub(__a, __b);
3749#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003750 return __builtin_altivec_vmuloub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003751#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003752}
3753
Bill Seurer703e8482015-06-09 14:39:47 +00003754static vector int __ATTRS_o_ai vec_mulo(vector short __a, vector short __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003755#ifdef __LITTLE_ENDIAN__
3756 return __builtin_altivec_vmulesh(__a, __b);
3757#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003758 return __builtin_altivec_vmulosh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003759#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003760}
3761
Bill Seurer703e8482015-06-09 14:39:47 +00003762static vector unsigned int __ATTRS_o_ai vec_mulo(vector unsigned short __a,
3763 vector unsigned short __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003764#ifdef __LITTLE_ENDIAN__
3765 return __builtin_altivec_vmuleuh(__a, __b);
3766#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003767 return __builtin_altivec_vmulouh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003768#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003769}
3770
Kit Barton8553bec2015-03-11 15:57:19 +00003771#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +00003772static vector signed long long __ATTRS_o_ai vec_mulo(vector signed int __a,
3773 vector signed int __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00003774#ifdef __LITTLE_ENDIAN__
3775 return __builtin_altivec_vmulesw(__a, __b);
3776#else
3777 return __builtin_altivec_vmulosw(__a, __b);
3778#endif
3779}
3780
3781static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003782vec_mulo(vector unsigned int __a, vector unsigned int __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00003783#ifdef __LITTLE_ENDIAN__
3784 return __builtin_altivec_vmuleuw(__a, __b);
3785#else
3786 return __builtin_altivec_vmulouw(__a, __b);
3787#endif
3788}
3789#endif
3790
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003791/* vec_vmulosb */
3792
3793static vector short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003794vec_vmulosb(vector signed char __a, vector signed char __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003795#ifdef __LITTLE_ENDIAN__
3796 return __builtin_altivec_vmulesb(__a, __b);
3797#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003798 return __builtin_altivec_vmulosb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003799#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003800}
3801
3802/* vec_vmuloub */
3803
3804static vector unsigned short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003805vec_vmuloub(vector unsigned char __a, vector unsigned char __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003806#ifdef __LITTLE_ENDIAN__
3807 return __builtin_altivec_vmuleub(__a, __b);
3808#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003809 return __builtin_altivec_vmuloub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003810#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003811}
3812
3813/* vec_vmulosh */
3814
3815static vector int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003816vec_vmulosh(vector short __a, vector short __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003817#ifdef __LITTLE_ENDIAN__
3818 return __builtin_altivec_vmulesh(__a, __b);
3819#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003820 return __builtin_altivec_vmulosh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003821#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003822}
3823
3824/* vec_vmulouh */
3825
3826static vector unsigned int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003827vec_vmulouh(vector unsigned short __a, vector unsigned short __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003828#ifdef __LITTLE_ENDIAN__
3829 return __builtin_altivec_vmuleuh(__a, __b);
3830#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003831 return __builtin_altivec_vmulouh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003832#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003833}
3834
3835/* vec_nmsub */
3836
3837static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003838vec_nmsub(vector float __a, vector float __b, vector float __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003839 return __builtin_altivec_vnmsubfp(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003840}
3841
3842/* vec_vnmsubfp */
3843
3844static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003845vec_vnmsubfp(vector float __a, vector float __b, vector float __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003846 return __builtin_altivec_vnmsubfp(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003847}
3848
3849/* vec_nor */
3850
3851#define __builtin_altivec_vnor vec_nor
3852
Bill Seurer703e8482015-06-09 14:39:47 +00003853static vector signed char __ATTRS_o_ai vec_nor(vector signed char __a,
3854 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003855 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003856}
3857
Bill Seurer703e8482015-06-09 14:39:47 +00003858static vector unsigned char __ATTRS_o_ai vec_nor(vector unsigned char __a,
3859 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003860 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003861}
3862
Bill Seurer703e8482015-06-09 14:39:47 +00003863static vector bool char __ATTRS_o_ai vec_nor(vector bool char __a,
3864 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003865 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003866}
3867
Bill Seurer703e8482015-06-09 14:39:47 +00003868static vector short __ATTRS_o_ai vec_nor(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003869 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003870}
3871
Bill Seurer703e8482015-06-09 14:39:47 +00003872static vector unsigned short __ATTRS_o_ai vec_nor(vector unsigned short __a,
3873 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003874 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003875}
3876
Bill Seurer703e8482015-06-09 14:39:47 +00003877static vector bool short __ATTRS_o_ai vec_nor(vector bool short __a,
3878 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003879 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003880}
3881
Bill Seurer703e8482015-06-09 14:39:47 +00003882static vector int __ATTRS_o_ai vec_nor(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003883 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003884}
3885
Bill Seurer703e8482015-06-09 14:39:47 +00003886static vector unsigned int __ATTRS_o_ai vec_nor(vector unsigned int __a,
3887 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003888 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003889}
3890
Bill Seurer703e8482015-06-09 14:39:47 +00003891static vector bool int __ATTRS_o_ai vec_nor(vector bool int __a,
3892 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003893 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003894}
3895
Bill Seurer703e8482015-06-09 14:39:47 +00003896static vector float __ATTRS_o_ai vec_nor(vector float __a, vector float __b) {
3897 vector unsigned int __res =
3898 ~((vector unsigned int)__a | (vector unsigned int)__b);
David Blaikie3302f2b2013-01-16 23:08:36 +00003899 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003900}
3901
3902/* vec_vnor */
3903
Bill Seurer703e8482015-06-09 14:39:47 +00003904static vector signed char __ATTRS_o_ai vec_vnor(vector signed char __a,
3905 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003906 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003907}
3908
Bill Seurer703e8482015-06-09 14:39:47 +00003909static vector unsigned char __ATTRS_o_ai vec_vnor(vector unsigned char __a,
3910 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003911 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003912}
3913
Bill Seurer703e8482015-06-09 14:39:47 +00003914static vector bool char __ATTRS_o_ai vec_vnor(vector bool char __a,
3915 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003916 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003917}
3918
Bill Seurer703e8482015-06-09 14:39:47 +00003919static vector short __ATTRS_o_ai vec_vnor(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003920 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003921}
3922
Bill Seurer703e8482015-06-09 14:39:47 +00003923static vector unsigned short __ATTRS_o_ai vec_vnor(vector unsigned short __a,
3924 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003925 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003926}
3927
Bill Seurer703e8482015-06-09 14:39:47 +00003928static vector bool short __ATTRS_o_ai vec_vnor(vector bool short __a,
3929 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003930 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003931}
3932
Bill Seurer703e8482015-06-09 14:39:47 +00003933static vector int __ATTRS_o_ai vec_vnor(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003934 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003935}
3936
Bill Seurer703e8482015-06-09 14:39:47 +00003937static vector unsigned int __ATTRS_o_ai vec_vnor(vector unsigned int __a,
3938 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003939 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003940}
3941
Bill Seurer703e8482015-06-09 14:39:47 +00003942static vector bool int __ATTRS_o_ai vec_vnor(vector bool int __a,
3943 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003944 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003945}
3946
Bill Seurer703e8482015-06-09 14:39:47 +00003947static vector float __ATTRS_o_ai vec_vnor(vector float __a, vector float __b) {
3948 vector unsigned int __res =
3949 ~((vector unsigned int)__a | (vector unsigned int)__b);
David Blaikie3302f2b2013-01-16 23:08:36 +00003950 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003951}
3952
Bill Seurer8be14f12015-06-04 18:45:44 +00003953#ifdef __VSX__
3954static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003955vec_nor(vector signed long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00003956 return ~(__a | __b);
3957}
3958
3959static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003960vec_nor(vector unsigned long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00003961 return ~(__a | __b);
3962}
3963
Bill Seurer703e8482015-06-09 14:39:47 +00003964static vector bool long long __ATTRS_o_ai vec_nor(vector bool long long __a,
3965 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00003966 return ~(__a | __b);
3967}
3968#endif
3969
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003970/* vec_or */
3971
3972#define __builtin_altivec_vor vec_or
3973
Bill Seurer703e8482015-06-09 14:39:47 +00003974static vector signed char __ATTRS_o_ai vec_or(vector signed char __a,
3975 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003976 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003977}
3978
Bill Seurer703e8482015-06-09 14:39:47 +00003979static vector signed char __ATTRS_o_ai vec_or(vector bool char __a,
3980 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003981 return (vector signed char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003982}
3983
Bill Seurer703e8482015-06-09 14:39:47 +00003984static vector signed char __ATTRS_o_ai vec_or(vector signed char __a,
3985 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003986 return __a | (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003987}
3988
Bill Seurer703e8482015-06-09 14:39:47 +00003989static vector unsigned char __ATTRS_o_ai vec_or(vector unsigned char __a,
3990 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003991 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003992}
3993
Bill Seurer703e8482015-06-09 14:39:47 +00003994static vector unsigned char __ATTRS_o_ai vec_or(vector bool char __a,
3995 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003996 return (vector unsigned char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003997}
3998
Bill Seurer703e8482015-06-09 14:39:47 +00003999static vector unsigned char __ATTRS_o_ai vec_or(vector unsigned char __a,
4000 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004001 return __a | (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004002}
4003
Bill Seurer703e8482015-06-09 14:39:47 +00004004static vector bool char __ATTRS_o_ai vec_or(vector bool char __a,
4005 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004006 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004007}
4008
Bill Seurer703e8482015-06-09 14:39:47 +00004009static vector short __ATTRS_o_ai vec_or(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004010 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004011}
4012
Bill Seurer703e8482015-06-09 14:39:47 +00004013static vector short __ATTRS_o_ai vec_or(vector bool short __a,
4014 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004015 return (vector short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004016}
4017
Bill Seurer703e8482015-06-09 14:39:47 +00004018static vector short __ATTRS_o_ai vec_or(vector short __a,
4019 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004020 return __a | (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004021}
4022
Bill Seurer703e8482015-06-09 14:39:47 +00004023static vector unsigned short __ATTRS_o_ai vec_or(vector unsigned short __a,
4024 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004025 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004026}
4027
Bill Seurer703e8482015-06-09 14:39:47 +00004028static vector unsigned short __ATTRS_o_ai vec_or(vector bool short __a,
4029 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004030 return (vector unsigned short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004031}
4032
Bill Seurer703e8482015-06-09 14:39:47 +00004033static vector unsigned short __ATTRS_o_ai vec_or(vector unsigned short __a,
4034 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004035 return __a | (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004036}
4037
Bill Seurer703e8482015-06-09 14:39:47 +00004038static vector bool short __ATTRS_o_ai vec_or(vector bool short __a,
4039 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004040 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004041}
4042
Bill Seurer703e8482015-06-09 14:39:47 +00004043static vector int __ATTRS_o_ai vec_or(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004044 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004045}
4046
Bill Seurer703e8482015-06-09 14:39:47 +00004047static vector int __ATTRS_o_ai vec_or(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004048 return (vector int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004049}
4050
Bill Seurer703e8482015-06-09 14:39:47 +00004051static vector int __ATTRS_o_ai vec_or(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004052 return __a | (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004053}
4054
Bill Seurer703e8482015-06-09 14:39:47 +00004055static vector unsigned int __ATTRS_o_ai vec_or(vector unsigned int __a,
4056 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004057 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004058}
4059
Bill Seurer703e8482015-06-09 14:39:47 +00004060static vector unsigned int __ATTRS_o_ai vec_or(vector bool int __a,
4061 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004062 return (vector unsigned int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004063}
4064
Bill Seurer703e8482015-06-09 14:39:47 +00004065static vector unsigned int __ATTRS_o_ai vec_or(vector unsigned int __a,
4066 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004067 return __a | (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004068}
4069
Bill Seurer703e8482015-06-09 14:39:47 +00004070static vector bool int __ATTRS_o_ai vec_or(vector bool int __a,
4071 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004072 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004073}
4074
Bill Seurer703e8482015-06-09 14:39:47 +00004075static vector float __ATTRS_o_ai vec_or(vector float __a, vector float __b) {
4076 vector unsigned int __res =
4077 (vector unsigned int)__a | (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00004078 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004079}
4080
Bill Seurer703e8482015-06-09 14:39:47 +00004081static vector float __ATTRS_o_ai vec_or(vector bool int __a, vector float __b) {
4082 vector unsigned int __res =
4083 (vector unsigned int)__a | (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00004084 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004085}
4086
Bill Seurer703e8482015-06-09 14:39:47 +00004087static vector float __ATTRS_o_ai vec_or(vector float __a, vector bool int __b) {
4088 vector unsigned int __res =
4089 (vector unsigned int)__a | (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00004090 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004091}
4092
Bill Seurer8be14f12015-06-04 18:45:44 +00004093#ifdef __VSX__
4094static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004095vec_or(vector signed long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004096 return __a | __b;
4097}
4098
4099static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004100vec_or(vector bool long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004101 return (vector signed long long)__a | __b;
4102}
4103
Bill Seurer703e8482015-06-09 14:39:47 +00004104static vector signed long long __ATTRS_o_ai vec_or(vector signed long long __a,
4105 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004106 return __a | (vector signed long long)__b;
4107}
4108
4109static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004110vec_or(vector unsigned long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004111 return __a | __b;
4112}
4113
4114static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004115vec_or(vector bool long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004116 return (vector unsigned long long)__a | __b;
4117}
4118
4119static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004120vec_or(vector unsigned long long __a, vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004121 return __a | (vector unsigned long long)__b;
4122}
4123
Bill Seurer703e8482015-06-09 14:39:47 +00004124static vector bool long long __ATTRS_o_ai vec_or(vector bool long long __a,
4125 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004126 return __a | __b;
4127}
4128#endif
4129
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004130/* vec_vor */
4131
Bill Seurer703e8482015-06-09 14:39:47 +00004132static vector signed char __ATTRS_o_ai vec_vor(vector signed char __a,
4133 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004134 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004135}
4136
Bill Seurer703e8482015-06-09 14:39:47 +00004137static vector signed char __ATTRS_o_ai vec_vor(vector bool char __a,
4138 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004139 return (vector signed char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004140}
4141
Bill Seurer703e8482015-06-09 14:39:47 +00004142static vector signed char __ATTRS_o_ai vec_vor(vector signed char __a,
4143 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004144 return __a | (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004145}
4146
Bill Seurer703e8482015-06-09 14:39:47 +00004147static vector unsigned char __ATTRS_o_ai vec_vor(vector unsigned char __a,
4148 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004149 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004150}
4151
Bill Seurer703e8482015-06-09 14:39:47 +00004152static vector unsigned char __ATTRS_o_ai vec_vor(vector bool char __a,
4153 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004154 return (vector unsigned char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004155}
4156
Bill Seurer703e8482015-06-09 14:39:47 +00004157static vector unsigned char __ATTRS_o_ai vec_vor(vector unsigned char __a,
4158 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004159 return __a | (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004160}
4161
Bill Seurer703e8482015-06-09 14:39:47 +00004162static vector bool char __ATTRS_o_ai vec_vor(vector bool char __a,
4163 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004164 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004165}
4166
Bill Seurer703e8482015-06-09 14:39:47 +00004167static vector short __ATTRS_o_ai vec_vor(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004168 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004169}
4170
Bill Seurer703e8482015-06-09 14:39:47 +00004171static vector short __ATTRS_o_ai vec_vor(vector bool short __a,
4172 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004173 return (vector short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004174}
4175
Bill Seurer703e8482015-06-09 14:39:47 +00004176static vector short __ATTRS_o_ai vec_vor(vector short __a,
4177 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004178 return __a | (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004179}
4180
Bill Seurer703e8482015-06-09 14:39:47 +00004181static vector unsigned short __ATTRS_o_ai vec_vor(vector unsigned short __a,
4182 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004183 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004184}
4185
Bill Seurer703e8482015-06-09 14:39:47 +00004186static vector unsigned short __ATTRS_o_ai vec_vor(vector bool short __a,
4187 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004188 return (vector unsigned short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004189}
4190
Bill Seurer703e8482015-06-09 14:39:47 +00004191static vector unsigned short __ATTRS_o_ai vec_vor(vector unsigned short __a,
4192 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004193 return __a | (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004194}
4195
Bill Seurer703e8482015-06-09 14:39:47 +00004196static vector bool short __ATTRS_o_ai vec_vor(vector bool short __a,
4197 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004198 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004199}
4200
Bill Seurer703e8482015-06-09 14:39:47 +00004201static vector int __ATTRS_o_ai vec_vor(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004202 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004203}
4204
Bill Seurer703e8482015-06-09 14:39:47 +00004205static vector int __ATTRS_o_ai vec_vor(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004206 return (vector int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004207}
4208
Bill Seurer703e8482015-06-09 14:39:47 +00004209static vector int __ATTRS_o_ai vec_vor(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004210 return __a | (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004211}
4212
Bill Seurer703e8482015-06-09 14:39:47 +00004213static vector unsigned int __ATTRS_o_ai vec_vor(vector unsigned int __a,
4214 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004215 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004216}
4217
Bill Seurer703e8482015-06-09 14:39:47 +00004218static vector unsigned int __ATTRS_o_ai vec_vor(vector bool int __a,
4219 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004220 return (vector unsigned int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004221}
4222
Bill Seurer703e8482015-06-09 14:39:47 +00004223static vector unsigned int __ATTRS_o_ai vec_vor(vector unsigned int __a,
4224 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004225 return __a | (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004226}
4227
Bill Seurer703e8482015-06-09 14:39:47 +00004228static vector bool int __ATTRS_o_ai vec_vor(vector bool int __a,
4229 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004230 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004231}
4232
Bill Seurer703e8482015-06-09 14:39:47 +00004233static vector float __ATTRS_o_ai vec_vor(vector float __a, vector float __b) {
4234 vector unsigned int __res =
4235 (vector unsigned int)__a | (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00004236 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004237}
4238
Bill Seurer703e8482015-06-09 14:39:47 +00004239static vector float __ATTRS_o_ai vec_vor(vector bool int __a,
4240 vector float __b) {
4241 vector unsigned int __res =
4242 (vector unsigned int)__a | (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00004243 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004244}
4245
Bill Seurer703e8482015-06-09 14:39:47 +00004246static vector float __ATTRS_o_ai vec_vor(vector float __a,
4247 vector bool int __b) {
4248 vector unsigned int __res =
4249 (vector unsigned int)__a | (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00004250 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004251}
4252
Bill Seurer8be14f12015-06-04 18:45:44 +00004253#ifdef __VSX__
4254static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004255vec_vor(vector signed long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004256 return __a | __b;
4257}
4258
4259static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004260vec_vor(vector bool long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004261 return (vector signed long long)__a | __b;
4262}
4263
Bill Seurer703e8482015-06-09 14:39:47 +00004264static vector signed long long __ATTRS_o_ai vec_vor(vector signed long long __a,
4265 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004266 return __a | (vector signed long long)__b;
4267}
4268
4269static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004270vec_vor(vector unsigned long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004271 return __a | __b;
4272}
4273
4274static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004275vec_vor(vector bool long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004276 return (vector unsigned long long)__a | __b;
4277}
4278
4279static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004280vec_vor(vector unsigned long long __a, vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004281 return __a | (vector unsigned long long)__b;
4282}
4283
Bill Seurer703e8482015-06-09 14:39:47 +00004284static vector bool long long __ATTRS_o_ai vec_vor(vector bool long long __a,
4285 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004286 return __a | __b;
4287}
4288#endif
4289
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004290/* vec_pack */
4291
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004292/* The various vector pack instructions have a big-endian bias, so for
4293 little endian we must handle reversed element numbering. */
4294
Bill Seurer703e8482015-06-09 14:39:47 +00004295static vector signed char __ATTRS_o_ai vec_pack(vector signed short __a,
4296 vector signed short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004297#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004298 return (vector signed char)vec_perm(
4299 __a, __b,
4300 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4301 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004302#else
Bill Seurer703e8482015-06-09 14:39:47 +00004303 return (vector signed char)vec_perm(
4304 __a, __b,
4305 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4306 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004307#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004308}
4309
Bill Seurer703e8482015-06-09 14:39:47 +00004310static vector unsigned char __ATTRS_o_ai vec_pack(vector unsigned short __a,
4311 vector unsigned short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004312#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004313 return (vector unsigned char)vec_perm(
4314 __a, __b,
4315 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4316 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004317#else
Bill Seurer703e8482015-06-09 14:39:47 +00004318 return (vector unsigned char)vec_perm(
4319 __a, __b,
4320 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4321 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004322#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004323}
4324
Bill Seurer703e8482015-06-09 14:39:47 +00004325static vector bool char __ATTRS_o_ai vec_pack(vector bool short __a,
4326 vector bool short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004327#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004328 return (vector bool char)vec_perm(
4329 __a, __b,
4330 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4331 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004332#else
Bill Seurer703e8482015-06-09 14:39:47 +00004333 return (vector bool char)vec_perm(
4334 __a, __b,
4335 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4336 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004337#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004338}
4339
Bill Seurer703e8482015-06-09 14:39:47 +00004340static vector short __ATTRS_o_ai vec_pack(vector int __a, vector int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004341#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004342 return (vector short)vec_perm(
4343 __a, __b,
4344 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4345 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004346#else
Bill Seurer703e8482015-06-09 14:39:47 +00004347 return (vector short)vec_perm(
4348 __a, __b,
4349 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4350 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004351#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004352}
4353
Bill Seurer703e8482015-06-09 14:39:47 +00004354static vector unsigned short __ATTRS_o_ai vec_pack(vector unsigned int __a,
4355 vector unsigned int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004356#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004357 return (vector unsigned short)vec_perm(
4358 __a, __b,
4359 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4360 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004361#else
Bill Seurer703e8482015-06-09 14:39:47 +00004362 return (vector unsigned short)vec_perm(
4363 __a, __b,
4364 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4365 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004366#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004367}
4368
Bill Seurer703e8482015-06-09 14:39:47 +00004369static vector bool short __ATTRS_o_ai vec_pack(vector bool int __a,
4370 vector bool int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004371#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004372 return (vector bool short)vec_perm(
4373 __a, __b,
4374 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4375 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004376#else
Bill Seurer703e8482015-06-09 14:39:47 +00004377 return (vector bool short)vec_perm(
4378 __a, __b,
4379 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4380 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004381#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004382}
4383
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004384/* vec_vpkuhum */
4385
4386#define __builtin_altivec_vpkuhum vec_vpkuhum
4387
Bill Seurer703e8482015-06-09 14:39:47 +00004388static vector signed char __ATTRS_o_ai vec_vpkuhum(vector signed short __a,
4389 vector signed short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004390#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004391 return (vector signed char)vec_perm(
4392 __a, __b,
4393 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4394 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004395#else
Bill Seurer703e8482015-06-09 14:39:47 +00004396 return (vector signed char)vec_perm(
4397 __a, __b,
4398 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4399 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004400#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004401}
4402
4403static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004404vec_vpkuhum(vector unsigned short __a, vector unsigned short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004405#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004406 return (vector unsigned char)vec_perm(
4407 __a, __b,
4408 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4409 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004410#else
Bill Seurer703e8482015-06-09 14:39:47 +00004411 return (vector unsigned char)vec_perm(
4412 __a, __b,
4413 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4414 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004415#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004416}
4417
Bill Seurer703e8482015-06-09 14:39:47 +00004418static vector bool char __ATTRS_o_ai vec_vpkuhum(vector bool short __a,
4419 vector bool short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004420#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004421 return (vector bool char)vec_perm(
4422 __a, __b,
4423 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4424 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004425#else
Bill Seurer703e8482015-06-09 14:39:47 +00004426 return (vector bool char)vec_perm(
4427 __a, __b,
4428 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4429 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004430#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004431}
4432
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004433/* vec_vpkuwum */
4434
4435#define __builtin_altivec_vpkuwum vec_vpkuwum
4436
Bill Seurer703e8482015-06-09 14:39:47 +00004437static vector short __ATTRS_o_ai vec_vpkuwum(vector int __a, vector int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004438#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004439 return (vector short)vec_perm(
4440 __a, __b,
4441 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4442 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004443#else
Bill Seurer703e8482015-06-09 14:39:47 +00004444 return (vector short)vec_perm(
4445 __a, __b,
4446 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4447 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004448#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004449}
4450
Bill Seurer703e8482015-06-09 14:39:47 +00004451static vector unsigned short __ATTRS_o_ai vec_vpkuwum(vector unsigned int __a,
4452 vector unsigned int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004453#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004454 return (vector unsigned short)vec_perm(
4455 __a, __b,
4456 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4457 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004458#else
Bill Seurer703e8482015-06-09 14:39:47 +00004459 return (vector unsigned short)vec_perm(
4460 __a, __b,
4461 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4462 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004463#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004464}
4465
Bill Seurer703e8482015-06-09 14:39:47 +00004466static vector bool short __ATTRS_o_ai vec_vpkuwum(vector bool int __a,
4467 vector bool int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004468#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004469 return (vector bool short)vec_perm(
4470 __a, __b,
4471 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4472 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004473#else
Bill Seurer703e8482015-06-09 14:39:47 +00004474 return (vector bool short)vec_perm(
4475 __a, __b,
4476 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4477 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004478#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004479}
4480
Bill Schmidt41e14c42015-05-16 01:02:25 +00004481/* vec_vpkudum */
4482
4483#ifdef __POWER8_VECTOR__
4484#define __builtin_altivec_vpkudum vec_vpkudum
4485
Bill Seurer703e8482015-06-09 14:39:47 +00004486static vector int __ATTRS_o_ai vec_vpkudum(vector long long __a,
4487 vector long long __b) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00004488#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004489 return (vector int)vec_perm(
4490 __a, __b,
4491 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
4492 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
Bill Schmidt41e14c42015-05-16 01:02:25 +00004493#else
Bill Seurer703e8482015-06-09 14:39:47 +00004494 return (vector int)vec_perm(
4495 __a, __b,
4496 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
4497 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
Bill Schmidt41e14c42015-05-16 01:02:25 +00004498#endif
4499}
4500
4501static vector unsigned int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004502vec_vpkudum(vector unsigned long long __a, vector unsigned long long __b) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00004503#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004504 return (vector unsigned int)vec_perm(
4505 __a, __b,
4506 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
4507 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
Bill Schmidt41e14c42015-05-16 01:02:25 +00004508#else
Bill Seurer703e8482015-06-09 14:39:47 +00004509 return (vector unsigned int)vec_perm(
4510 __a, __b,
4511 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
4512 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
Bill Schmidt41e14c42015-05-16 01:02:25 +00004513#endif
4514}
4515
Bill Seurer703e8482015-06-09 14:39:47 +00004516static vector bool int __ATTRS_o_ai vec_vpkudum(vector bool long long __a,
4517 vector bool long long __b) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00004518#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004519 return (vector bool int)vec_perm(
4520 (vector long long)__a, (vector long long)__b,
4521 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
4522 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
Bill Schmidt41e14c42015-05-16 01:02:25 +00004523#else
Bill Seurer703e8482015-06-09 14:39:47 +00004524 return (vector bool int)vec_perm(
4525 (vector long long)__a, (vector long long)__b,
4526 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
4527 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
Bill Schmidt41e14c42015-05-16 01:02:25 +00004528#endif
4529}
4530#endif
4531
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004532/* vec_packpx */
4533
4534static vector pixel __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00004535vec_packpx(vector unsigned int __a, vector unsigned int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004536#ifdef __LITTLE_ENDIAN__
4537 return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
4538#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004539 return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004540#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004541}
4542
4543/* vec_vpkpx */
4544
4545static vector pixel __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00004546vec_vpkpx(vector unsigned int __a, vector unsigned int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004547#ifdef __LITTLE_ENDIAN__
4548 return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
4549#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004550 return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004551#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004552}
4553
4554/* vec_packs */
4555
Bill Seurer703e8482015-06-09 14:39:47 +00004556static vector signed char __ATTRS_o_ai vec_packs(vector short __a,
4557 vector short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004558#ifdef __LITTLE_ENDIAN__
4559 return __builtin_altivec_vpkshss(__b, __a);
4560#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004561 return __builtin_altivec_vpkshss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004562#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004563}
4564
Bill Seurer703e8482015-06-09 14:39:47 +00004565static vector unsigned char __ATTRS_o_ai vec_packs(vector unsigned short __a,
4566 vector unsigned short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004567#ifdef __LITTLE_ENDIAN__
4568 return __builtin_altivec_vpkuhus(__b, __a);
4569#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004570 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004571#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004572}
4573
Bill Seurer703e8482015-06-09 14:39:47 +00004574static vector signed short __ATTRS_o_ai vec_packs(vector int __a,
4575 vector int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004576#ifdef __LITTLE_ENDIAN__
4577 return __builtin_altivec_vpkswss(__b, __a);
4578#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004579 return __builtin_altivec_vpkswss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004580#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004581}
4582
Bill Seurer703e8482015-06-09 14:39:47 +00004583static vector unsigned short __ATTRS_o_ai vec_packs(vector unsigned int __a,
4584 vector unsigned int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004585#ifdef __LITTLE_ENDIAN__
4586 return __builtin_altivec_vpkuwus(__b, __a);
4587#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004588 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004589#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004590}
4591
Bill Schmidt41e14c42015-05-16 01:02:25 +00004592#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +00004593static vector int __ATTRS_o_ai vec_packs(vector long long __a,
4594 vector long long __b) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00004595#ifdef __LITTLE_ENDIAN__
4596 return __builtin_altivec_vpksdss(__b, __a);
4597#else
4598 return __builtin_altivec_vpksdss(__a, __b);
4599#endif
4600}
4601
4602static vector unsigned int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004603vec_packs(vector unsigned long long __a, vector unsigned long long __b) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00004604#ifdef __LITTLE_ENDIAN__
4605 return __builtin_altivec_vpkudus(__b, __a);
4606#else
4607 return __builtin_altivec_vpkudus(__a, __b);
4608#endif
4609}
4610#endif
4611
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004612/* vec_vpkshss */
4613
4614static vector signed char __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00004615vec_vpkshss(vector short __a, vector short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004616#ifdef __LITTLE_ENDIAN__
4617 return __builtin_altivec_vpkshss(__b, __a);
4618#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004619 return __builtin_altivec_vpkshss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004620#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004621}
4622
Bill Schmidt41e14c42015-05-16 01:02:25 +00004623/* vec_vpksdss */
4624
4625#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +00004626static vector int __ATTRS_o_ai vec_vpksdss(vector long long __a,
4627 vector long long __b) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00004628#ifdef __LITTLE_ENDIAN__
4629 return __builtin_altivec_vpksdss(__b, __a);
4630#else
4631 return __builtin_altivec_vpksdss(__a, __b);
4632#endif
4633}
4634#endif
4635
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004636/* vec_vpkuhus */
4637
4638static vector unsigned char __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00004639vec_vpkuhus(vector unsigned short __a, vector unsigned short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004640#ifdef __LITTLE_ENDIAN__
4641 return __builtin_altivec_vpkuhus(__b, __a);
4642#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004643 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004644#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004645}
4646
Bill Schmidt41e14c42015-05-16 01:02:25 +00004647/* vec_vpkudus */
4648
4649#ifdef __POWER8_VECTOR__
4650static vector unsigned int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00004651vec_vpkudus(vector unsigned long long __a, vector unsigned long long __b) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00004652#ifdef __LITTLE_ENDIAN__
4653 return __builtin_altivec_vpkudus(__b, __a);
4654#else
4655 return __builtin_altivec_vpkudus(__a, __b);
4656#endif
4657}
4658#endif
4659
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004660/* vec_vpkswss */
4661
4662static vector signed short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00004663vec_vpkswss(vector int __a, vector int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004664#ifdef __LITTLE_ENDIAN__
4665 return __builtin_altivec_vpkswss(__b, __a);
4666#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004667 return __builtin_altivec_vpkswss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004668#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004669}
4670
4671/* vec_vpkuwus */
4672
4673static vector unsigned short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00004674vec_vpkuwus(vector unsigned int __a, vector unsigned int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004675#ifdef __LITTLE_ENDIAN__
4676 return __builtin_altivec_vpkuwus(__b, __a);
4677#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004678 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004679#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004680}
4681
4682/* vec_packsu */
4683
Bill Seurer703e8482015-06-09 14:39:47 +00004684static vector unsigned char __ATTRS_o_ai vec_packsu(vector short __a,
4685 vector short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004686#ifdef __LITTLE_ENDIAN__
4687 return __builtin_altivec_vpkshus(__b, __a);
4688#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004689 return __builtin_altivec_vpkshus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004690#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004691}
4692
Bill Seurer703e8482015-06-09 14:39:47 +00004693static vector unsigned char __ATTRS_o_ai vec_packsu(vector unsigned short __a,
4694 vector unsigned short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004695#ifdef __LITTLE_ENDIAN__
4696 return __builtin_altivec_vpkuhus(__b, __a);
4697#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004698 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004699#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004700}
4701
Bill Seurer703e8482015-06-09 14:39:47 +00004702static vector unsigned short __ATTRS_o_ai vec_packsu(vector int __a,
4703 vector int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004704#ifdef __LITTLE_ENDIAN__
4705 return __builtin_altivec_vpkswus(__b, __a);
4706#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004707 return __builtin_altivec_vpkswus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004708#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004709}
4710
Bill Seurer703e8482015-06-09 14:39:47 +00004711static vector unsigned short __ATTRS_o_ai vec_packsu(vector unsigned int __a,
4712 vector unsigned int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004713#ifdef __LITTLE_ENDIAN__
4714 return __builtin_altivec_vpkuwus(__b, __a);
4715#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004716 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004717#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004718}
4719
Bill Schmidt41e14c42015-05-16 01:02:25 +00004720#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +00004721static vector unsigned int __ATTRS_o_ai vec_packsu(vector long long __a,
4722 vector long long __b) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00004723#ifdef __LITTLE_ENDIAN__
4724 return __builtin_altivec_vpksdus(__b, __a);
4725#else
4726 return __builtin_altivec_vpksdus(__a, __b);
4727#endif
4728}
4729
4730static vector unsigned int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004731vec_packsu(vector unsigned long long __a, vector unsigned long long __b) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00004732#ifdef __LITTLE_ENDIAN__
4733 return __builtin_altivec_vpkudus(__b, __a);
4734#else
4735 return __builtin_altivec_vpkudus(__a, __b);
4736#endif
4737}
4738#endif
4739
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004740/* vec_vpkshus */
4741
Bill Seurer703e8482015-06-09 14:39:47 +00004742static vector unsigned char __ATTRS_o_ai vec_vpkshus(vector short __a,
4743 vector short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004744#ifdef __LITTLE_ENDIAN__
4745 return __builtin_altivec_vpkshus(__b, __a);
4746#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004747 return __builtin_altivec_vpkshus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004748#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004749}
4750
4751static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004752vec_vpkshus(vector unsigned short __a, vector unsigned short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004753#ifdef __LITTLE_ENDIAN__
4754 return __builtin_altivec_vpkuhus(__b, __a);
4755#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004756 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004757#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004758}
4759
4760/* vec_vpkswus */
4761
Bill Seurer703e8482015-06-09 14:39:47 +00004762static vector unsigned short __ATTRS_o_ai vec_vpkswus(vector int __a,
4763 vector int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004764#ifdef __LITTLE_ENDIAN__
4765 return __builtin_altivec_vpkswus(__b, __a);
4766#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004767 return __builtin_altivec_vpkswus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004768#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004769}
4770
Bill Seurer703e8482015-06-09 14:39:47 +00004771static vector unsigned short __ATTRS_o_ai vec_vpkswus(vector unsigned int __a,
4772 vector unsigned int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004773#ifdef __LITTLE_ENDIAN__
4774 return __builtin_altivec_vpkuwus(__b, __a);
4775#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004776 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004777#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004778}
4779
Bill Schmidt41e14c42015-05-16 01:02:25 +00004780/* vec_vpksdus */
4781
4782#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +00004783static vector unsigned int __ATTRS_o_ai vec_vpksdus(vector long long __a,
4784 vector long long __b) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00004785#ifdef __LITTLE_ENDIAN__
4786 return __builtin_altivec_vpksdus(__b, __a);
4787#else
4788 return __builtin_altivec_vpksdus(__a, __b);
4789#endif
4790}
4791#endif
4792
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004793/* vec_perm */
4794
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004795// The vperm instruction is defined architecturally with a big-endian bias.
4796// For little endian, we swap the input operands and invert the permute
4797// control vector. Only the rightmost 5 bits matter, so we could use
4798// a vector of all 31s instead of all 255s to perform the inversion.
4799// However, when the PCV is not a constant, using 255 has an advantage
4800// in that the vec_xor can be recognized as a vec_nor (and for P8 and
4801// later, possibly a vec_nand).
4802
Bill Seurer703e8482015-06-09 14:39:47 +00004803static vector signed char __ATTRS_o_ai vec_perm(vector signed char __a,
4804 vector signed char __b,
4805 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004806#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004807 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4808 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004809 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00004810 return (vector signed char)__builtin_altivec_vperm_4si((vector int)__b,
4811 (vector int)__a, __d);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004812#else
Bill Seurer703e8482015-06-09 14:39:47 +00004813 return (vector signed char)__builtin_altivec_vperm_4si((vector int)__a,
4814 (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004815#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004816}
4817
Bill Seurer703e8482015-06-09 14:39:47 +00004818static vector unsigned char __ATTRS_o_ai vec_perm(vector unsigned char __a,
4819 vector unsigned char __b,
4820 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004821#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004822 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4823 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004824 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00004825 return (vector unsigned char)__builtin_altivec_vperm_4si(
4826 (vector int)__b, (vector int)__a, __d);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004827#else
Bill Seurer703e8482015-06-09 14:39:47 +00004828 return (vector unsigned char)__builtin_altivec_vperm_4si(
4829 (vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004830#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004831}
4832
Bill Seurer703e8482015-06-09 14:39:47 +00004833static vector bool char __ATTRS_o_ai vec_perm(vector bool char __a,
4834 vector bool char __b,
4835 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004836#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004837 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4838 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004839 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00004840 return (vector bool char)__builtin_altivec_vperm_4si((vector int)__b,
4841 (vector int)__a, __d);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004842#else
Bill Seurer703e8482015-06-09 14:39:47 +00004843 return (vector bool char)__builtin_altivec_vperm_4si((vector int)__a,
4844 (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004845#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004846}
4847
Bill Seurer703e8482015-06-09 14:39:47 +00004848static vector short __ATTRS_o_ai vec_perm(vector short __a, vector short __b,
4849 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004850#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004851 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4852 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004853 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00004854 return (vector short)__builtin_altivec_vperm_4si((vector int)__b,
4855 (vector int)__a, __d);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004856#else
Bill Seurer703e8482015-06-09 14:39:47 +00004857 return (vector short)__builtin_altivec_vperm_4si((vector int)__a,
4858 (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004859#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004860}
4861
Bill Seurer703e8482015-06-09 14:39:47 +00004862static vector unsigned short __ATTRS_o_ai vec_perm(vector unsigned short __a,
4863 vector unsigned short __b,
4864 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004865#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004866 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4867 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004868 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00004869 return (vector unsigned short)__builtin_altivec_vperm_4si(
4870 (vector int)__b, (vector int)__a, __d);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004871#else
Bill Seurer703e8482015-06-09 14:39:47 +00004872 return (vector unsigned short)__builtin_altivec_vperm_4si(
4873 (vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004874#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004875}
4876
Bill Seurer703e8482015-06-09 14:39:47 +00004877static vector bool short __ATTRS_o_ai vec_perm(vector bool short __a,
4878 vector bool short __b,
4879 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004880#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004881 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4882 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004883 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00004884 return (vector bool short)__builtin_altivec_vperm_4si((vector int)__b,
4885 (vector int)__a, __d);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004886#else
Bill Seurer703e8482015-06-09 14:39:47 +00004887 return (vector bool short)__builtin_altivec_vperm_4si((vector int)__a,
4888 (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004889#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004890}
4891
Bill Seurer703e8482015-06-09 14:39:47 +00004892static vector pixel __ATTRS_o_ai vec_perm(vector pixel __a, vector pixel __b,
4893 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004894#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004895 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4896 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004897 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00004898 return (vector pixel)__builtin_altivec_vperm_4si((vector int)__b,
4899 (vector int)__a, __d);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004900#else
Bill Seurer703e8482015-06-09 14:39:47 +00004901 return (vector pixel)__builtin_altivec_vperm_4si((vector int)__a,
4902 (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004903#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004904}
4905
Bill Seurer703e8482015-06-09 14:39:47 +00004906static vector int __ATTRS_o_ai vec_perm(vector int __a, vector int __b,
4907 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004908#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004909 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4910 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004911 __d = vec_xor(__c, __d);
4912 return (vector int)__builtin_altivec_vperm_4si(__b, __a, __d);
4913#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004914 return (vector int)__builtin_altivec_vperm_4si(__a, __b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004915#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004916}
4917
Bill Seurer703e8482015-06-09 14:39:47 +00004918static vector unsigned int __ATTRS_o_ai vec_perm(vector unsigned int __a,
4919 vector unsigned int __b,
4920 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004921#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004922 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4923 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004924 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00004925 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__b,
4926 (vector int)__a, __d);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004927#else
Bill Seurer703e8482015-06-09 14:39:47 +00004928 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__a,
4929 (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004930#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004931}
4932
Bill Seurer703e8482015-06-09 14:39:47 +00004933static vector bool int __ATTRS_o_ai vec_perm(vector bool int __a,
4934 vector bool int __b,
4935 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004936#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004937 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4938 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004939 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00004940 return (vector bool int)__builtin_altivec_vperm_4si((vector int)__b,
4941 (vector int)__a, __d);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004942#else
Bill Seurer703e8482015-06-09 14:39:47 +00004943 return (vector bool int)__builtin_altivec_vperm_4si((vector int)__a,
4944 (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004945#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004946}
4947
Bill Seurer703e8482015-06-09 14:39:47 +00004948static vector float __ATTRS_o_ai vec_perm(vector float __a, vector float __b,
4949 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004950#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004951 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4952 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004953 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00004954 return (vector float)__builtin_altivec_vperm_4si((vector int)__b,
4955 (vector int)__a, __d);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004956#else
Bill Seurer703e8482015-06-09 14:39:47 +00004957 return (vector float)__builtin_altivec_vperm_4si((vector int)__a,
4958 (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004959#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004960}
4961
Bill Schmidt8ff672d2014-11-14 13:10:13 +00004962#ifdef __VSX__
Bill Seurer703e8482015-06-09 14:39:47 +00004963static vector long long __ATTRS_o_ai vec_perm(vector long long __a,
4964 vector long long __b,
4965 vector unsigned char __c) {
Bill Schmidt8ff672d2014-11-14 13:10:13 +00004966#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004967 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4968 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidt8ff672d2014-11-14 13:10:13 +00004969 __d = vec_xor(__c, __d);
4970 return (vector long long)__builtin_altivec_vperm_4si(__b, __a, __d);
4971#else
4972 return (vector long long)__builtin_altivec_vperm_4si(__a, __b, __c);
4973#endif
4974}
4975
Eric Christopherc67e1b62014-12-10 00:57:43 +00004976static vector unsigned long long __ATTRS_o_ai
Bill Schmidt8ff672d2014-11-14 13:10:13 +00004977vec_perm(vector unsigned long long __a, vector unsigned long long __b,
Bill Seurer703e8482015-06-09 14:39:47 +00004978 vector unsigned char __c) {
Bill Schmidt8ff672d2014-11-14 13:10:13 +00004979#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004980 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4981 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidt8ff672d2014-11-14 13:10:13 +00004982 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00004983 return (vector unsigned long long)__builtin_altivec_vperm_4si(
4984 (vector int)__b, (vector int)__a, __d);
Bill Schmidt8ff672d2014-11-14 13:10:13 +00004985#else
Bill Seurer703e8482015-06-09 14:39:47 +00004986 return (vector unsigned long long)__builtin_altivec_vperm_4si(
4987 (vector int)__a, (vector int)__b, __c);
Bill Schmidt8ff672d2014-11-14 13:10:13 +00004988#endif
4989}
4990
Bill Seurer703e8482015-06-09 14:39:47 +00004991static vector double __ATTRS_o_ai vec_perm(vector double __a, vector double __b,
4992 vector unsigned char __c) {
Bill Schmidt8ff672d2014-11-14 13:10:13 +00004993#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004994 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4995 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidt8ff672d2014-11-14 13:10:13 +00004996 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00004997 return (vector double)__builtin_altivec_vperm_4si((vector int)__b,
4998 (vector int)__a, __d);
Bill Schmidt8ff672d2014-11-14 13:10:13 +00004999#else
Bill Seurer703e8482015-06-09 14:39:47 +00005000 return (vector double)__builtin_altivec_vperm_4si((vector int)__a,
5001 (vector int)__b, __c);
Bill Schmidt8ff672d2014-11-14 13:10:13 +00005002#endif
5003}
5004#endif
5005
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005006/* vec_vperm */
5007
Bill Seurer703e8482015-06-09 14:39:47 +00005008static vector signed char __ATTRS_o_ai vec_vperm(vector signed char __a,
5009 vector signed char __b,
5010 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005011 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005012}
5013
Bill Seurer703e8482015-06-09 14:39:47 +00005014static vector unsigned char __ATTRS_o_ai vec_vperm(vector unsigned char __a,
5015 vector unsigned char __b,
5016 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005017 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005018}
5019
Bill Seurer703e8482015-06-09 14:39:47 +00005020static vector bool char __ATTRS_o_ai vec_vperm(vector bool char __a,
5021 vector bool char __b,
5022 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005023 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00005024}
5025
Bill Seurer703e8482015-06-09 14:39:47 +00005026static vector short __ATTRS_o_ai vec_vperm(vector short __a, vector short __b,
5027 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005028 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005029}
5030
Bill Seurer703e8482015-06-09 14:39:47 +00005031static vector unsigned short __ATTRS_o_ai vec_vperm(vector unsigned short __a,
5032 vector unsigned short __b,
5033 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005034 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005035}
5036
Bill Seurer703e8482015-06-09 14:39:47 +00005037static vector bool short __ATTRS_o_ai vec_vperm(vector bool short __a,
5038 vector bool short __b,
5039 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005040 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00005041}
5042
Bill Seurer703e8482015-06-09 14:39:47 +00005043static vector pixel __ATTRS_o_ai vec_vperm(vector pixel __a, vector pixel __b,
5044 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005045 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00005046}
5047
Bill Seurer703e8482015-06-09 14:39:47 +00005048static vector int __ATTRS_o_ai vec_vperm(vector int __a, vector int __b,
5049 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005050 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005051}
5052
Bill Seurer703e8482015-06-09 14:39:47 +00005053static vector unsigned int __ATTRS_o_ai vec_vperm(vector unsigned int __a,
5054 vector unsigned int __b,
5055 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005056 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005057}
5058
Bill Seurer703e8482015-06-09 14:39:47 +00005059static vector bool int __ATTRS_o_ai vec_vperm(vector bool int __a,
5060 vector bool int __b,
5061 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005062 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00005063}
5064
Bill Seurer703e8482015-06-09 14:39:47 +00005065static vector float __ATTRS_o_ai vec_vperm(vector float __a, vector float __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 Schmidt8ff672d2014-11-14 13:10:13 +00005070#ifdef __VSX__
Bill Seurer703e8482015-06-09 14:39:47 +00005071static vector long long __ATTRS_o_ai vec_vperm(vector long long __a,
5072 vector long long __b,
5073 vector unsigned char __c) {
Bill Schmidt8ff672d2014-11-14 13:10:13 +00005074 return vec_perm(__a, __b, __c);
5075}
5076
5077static vector unsigned long long __ATTRS_o_ai
5078vec_vperm(vector unsigned long long __a, vector unsigned long long __b,
Bill Seurer703e8482015-06-09 14:39:47 +00005079 vector unsigned char __c) {
Bill Schmidt8ff672d2014-11-14 13:10:13 +00005080 return vec_perm(__a, __b, __c);
5081}
5082
Bill Seurer703e8482015-06-09 14:39:47 +00005083static vector double __ATTRS_o_ai vec_vperm(vector double __a,
5084 vector double __b,
5085 vector unsigned char __c) {
Bill Schmidt8ff672d2014-11-14 13:10:13 +00005086 return vec_perm(__a, __b, __c);
5087}
5088#endif
5089
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005090/* vec_re */
5091
Ulrich Weigand9936f132012-10-31 18:17:07 +00005092static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00005093vec_re(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005094 return __builtin_altivec_vrefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005095}
5096
5097/* vec_vrefp */
5098
Ulrich Weigand9936f132012-10-31 18:17:07 +00005099static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00005100vec_vrefp(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005101 return __builtin_altivec_vrefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005102}
5103
5104/* vec_rl */
5105
Bill Seurer703e8482015-06-09 14:39:47 +00005106static vector signed char __ATTRS_o_ai vec_rl(vector signed char __a,
5107 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005108 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005109}
5110
Bill Seurer703e8482015-06-09 14:39:47 +00005111static vector unsigned char __ATTRS_o_ai vec_rl(vector unsigned char __a,
5112 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005113 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005114}
5115
Bill Seurer703e8482015-06-09 14:39:47 +00005116static vector short __ATTRS_o_ai vec_rl(vector short __a,
5117 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005118 return __builtin_altivec_vrlh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005119}
5120
Bill Seurer703e8482015-06-09 14:39:47 +00005121static vector unsigned short __ATTRS_o_ai vec_rl(vector unsigned short __a,
5122 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005123 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005124}
5125
Bill Seurer703e8482015-06-09 14:39:47 +00005126static vector int __ATTRS_o_ai vec_rl(vector int __a, vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005127 return __builtin_altivec_vrlw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005128}
5129
Bill Seurer703e8482015-06-09 14:39:47 +00005130static vector unsigned int __ATTRS_o_ai vec_rl(vector unsigned int __a,
5131 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005132 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005133}
5134
Kit Barton8553bec2015-03-11 15:57:19 +00005135#ifdef __POWER8_VECTOR__
5136static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00005137vec_rl(vector signed long long __a, vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00005138 return __builtin_altivec_vrld(__a, __b);
5139}
5140
5141static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00005142vec_rl(vector unsigned long long __a, vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00005143 return __builtin_altivec_vrld(__a, __b);
5144}
5145#endif
5146
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005147/* vec_vrlb */
5148
Bill Seurer703e8482015-06-09 14:39:47 +00005149static vector signed char __ATTRS_o_ai vec_vrlb(vector signed char __a,
5150 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005151 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005152}
5153
Bill Seurer703e8482015-06-09 14:39:47 +00005154static vector unsigned char __ATTRS_o_ai vec_vrlb(vector unsigned char __a,
5155 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005156 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005157}
5158
5159/* vec_vrlh */
5160
Bill Seurer703e8482015-06-09 14:39:47 +00005161static vector short __ATTRS_o_ai vec_vrlh(vector short __a,
5162 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005163 return __builtin_altivec_vrlh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005164}
5165
Bill Seurer703e8482015-06-09 14:39:47 +00005166static vector unsigned short __ATTRS_o_ai vec_vrlh(vector unsigned short __a,
5167 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005168 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005169}
5170
5171/* vec_vrlw */
5172
Bill Seurer703e8482015-06-09 14:39:47 +00005173static vector int __ATTRS_o_ai vec_vrlw(vector int __a,
5174 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005175 return __builtin_altivec_vrlw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005176}
5177
Bill Seurer703e8482015-06-09 14:39:47 +00005178static vector unsigned int __ATTRS_o_ai vec_vrlw(vector unsigned int __a,
5179 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005180 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005181}
5182
5183/* vec_round */
5184
5185static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00005186vec_round(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005187 return __builtin_altivec_vrfin(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005188}
5189
5190/* vec_vrfin */
5191
5192static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00005193vec_vrfin(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005194 return __builtin_altivec_vrfin(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005195}
5196
5197/* vec_rsqrte */
5198
5199static __vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00005200vec_rsqrte(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005201 return __builtin_altivec_vrsqrtefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005202}
5203
5204/* vec_vrsqrtefp */
5205
5206static __vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00005207vec_vrsqrtefp(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005208 return __builtin_altivec_vrsqrtefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005209}
5210
5211/* vec_sel */
5212
5213#define __builtin_altivec_vsel_4si vec_sel
5214
Bill Seurer703e8482015-06-09 14:39:47 +00005215static vector signed char __ATTRS_o_ai vec_sel(vector signed char __a,
5216 vector signed char __b,
5217 vector unsigned char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005218 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005219}
5220
Bill Seurer703e8482015-06-09 14:39:47 +00005221static vector signed char __ATTRS_o_ai vec_sel(vector signed char __a,
5222 vector signed char __b,
5223 vector bool char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005224 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005225}
5226
Bill Seurer703e8482015-06-09 14:39:47 +00005227static vector unsigned char __ATTRS_o_ai vec_sel(vector unsigned char __a,
5228 vector unsigned char __b,
5229 vector unsigned char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005230 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005231}
5232
Bill Seurer703e8482015-06-09 14:39:47 +00005233static vector unsigned char __ATTRS_o_ai vec_sel(vector unsigned char __a,
5234 vector unsigned char __b,
5235 vector bool char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005236 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005237}
5238
Bill Seurer703e8482015-06-09 14:39:47 +00005239static vector bool char __ATTRS_o_ai vec_sel(vector bool char __a,
5240 vector bool char __b,
5241 vector unsigned char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005242 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005243}
5244
Bill Seurer703e8482015-06-09 14:39:47 +00005245static vector bool char __ATTRS_o_ai vec_sel(vector bool char __a,
5246 vector bool char __b,
5247 vector bool char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005248 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005249}
5250
Bill Seurer703e8482015-06-09 14:39:47 +00005251static vector short __ATTRS_o_ai vec_sel(vector short __a, vector short __b,
5252 vector unsigned short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005253 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005254}
5255
Bill Seurer703e8482015-06-09 14:39:47 +00005256static vector short __ATTRS_o_ai vec_sel(vector short __a, vector short __b,
5257 vector bool short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005258 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005259}
5260
Bill Seurer703e8482015-06-09 14:39:47 +00005261static vector unsigned short __ATTRS_o_ai vec_sel(vector unsigned short __a,
5262 vector unsigned short __b,
5263 vector unsigned short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005264 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005265}
5266
Bill Seurer703e8482015-06-09 14:39:47 +00005267static vector unsigned short __ATTRS_o_ai vec_sel(vector unsigned short __a,
5268 vector unsigned short __b,
5269 vector bool short __c) {
5270 return (__a & ~(vector unsigned short)__c) |
5271 (__b & (vector unsigned short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005272}
5273
Bill Seurer703e8482015-06-09 14:39:47 +00005274static vector bool short __ATTRS_o_ai vec_sel(vector bool short __a,
5275 vector bool short __b,
5276 vector unsigned short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005277 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005278}
5279
Bill Seurer703e8482015-06-09 14:39:47 +00005280static vector bool short __ATTRS_o_ai vec_sel(vector bool short __a,
5281 vector bool short __b,
5282 vector bool short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005283 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005284}
5285
Bill Seurer703e8482015-06-09 14:39:47 +00005286static vector int __ATTRS_o_ai vec_sel(vector int __a, vector int __b,
5287 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005288 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005289}
5290
Bill Seurer703e8482015-06-09 14:39:47 +00005291static vector int __ATTRS_o_ai vec_sel(vector int __a, vector int __b,
5292 vector bool int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005293 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005294}
5295
Bill Seurer703e8482015-06-09 14:39:47 +00005296static vector unsigned int __ATTRS_o_ai vec_sel(vector unsigned int __a,
5297 vector unsigned int __b,
5298 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005299 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005300}
5301
Bill Seurer703e8482015-06-09 14:39:47 +00005302static vector unsigned int __ATTRS_o_ai vec_sel(vector unsigned int __a,
5303 vector unsigned int __b,
5304 vector bool int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005305 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005306}
5307
Bill Seurer703e8482015-06-09 14:39:47 +00005308static vector bool int __ATTRS_o_ai vec_sel(vector bool int __a,
5309 vector bool int __b,
5310 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005311 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005312}
5313
Bill Seurer703e8482015-06-09 14:39:47 +00005314static vector bool int __ATTRS_o_ai vec_sel(vector bool int __a,
5315 vector bool int __b,
5316 vector bool int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005317 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005318}
5319
Bill Seurer703e8482015-06-09 14:39:47 +00005320static vector float __ATTRS_o_ai vec_sel(vector float __a, vector float __b,
5321 vector unsigned int __c) {
5322 vector int __res = ((vector int)__a & ~(vector int)__c) |
5323 ((vector int)__b & (vector int)__c);
David Blaikie3302f2b2013-01-16 23:08:36 +00005324 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005325}
5326
Bill Seurer703e8482015-06-09 14:39:47 +00005327static vector float __ATTRS_o_ai vec_sel(vector float __a, vector float __b,
5328 vector bool int __c) {
5329 vector int __res = ((vector int)__a & ~(vector int)__c) |
5330 ((vector int)__b & (vector int)__c);
David Blaikie3302f2b2013-01-16 23:08:36 +00005331 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00005332}
5333
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005334/* vec_vsel */
5335
Bill Seurer703e8482015-06-09 14:39:47 +00005336static vector signed char __ATTRS_o_ai vec_vsel(vector signed char __a,
5337 vector signed char __b,
5338 vector unsigned char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005339 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005340}
5341
Bill Seurer703e8482015-06-09 14:39:47 +00005342static vector signed char __ATTRS_o_ai vec_vsel(vector signed char __a,
5343 vector signed char __b,
5344 vector bool char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005345 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005346}
5347
Bill Seurer703e8482015-06-09 14:39:47 +00005348static vector unsigned char __ATTRS_o_ai vec_vsel(vector unsigned char __a,
5349 vector unsigned char __b,
5350 vector unsigned char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005351 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005352}
5353
Bill Seurer703e8482015-06-09 14:39:47 +00005354static vector unsigned char __ATTRS_o_ai vec_vsel(vector unsigned char __a,
5355 vector unsigned char __b,
5356 vector bool char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005357 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005358}
5359
Bill Seurer703e8482015-06-09 14:39:47 +00005360static vector bool char __ATTRS_o_ai vec_vsel(vector bool char __a,
5361 vector bool char __b,
5362 vector unsigned char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005363 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005364}
5365
Bill Seurer703e8482015-06-09 14:39:47 +00005366static vector bool char __ATTRS_o_ai vec_vsel(vector bool char __a,
5367 vector bool char __b,
5368 vector bool char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005369 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005370}
5371
Bill Seurer703e8482015-06-09 14:39:47 +00005372static vector short __ATTRS_o_ai vec_vsel(vector short __a, vector short __b,
5373 vector unsigned short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005374 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005375}
5376
Bill Seurer703e8482015-06-09 14:39:47 +00005377static vector short __ATTRS_o_ai vec_vsel(vector short __a, vector short __b,
5378 vector bool short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005379 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005380}
5381
Bill Seurer703e8482015-06-09 14:39:47 +00005382static vector unsigned short __ATTRS_o_ai vec_vsel(vector unsigned short __a,
5383 vector unsigned short __b,
5384 vector unsigned short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005385 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005386}
5387
Bill Seurer703e8482015-06-09 14:39:47 +00005388static vector unsigned short __ATTRS_o_ai vec_vsel(vector unsigned short __a,
5389 vector unsigned short __b,
5390 vector bool short __c) {
5391 return (__a & ~(vector unsigned short)__c) |
5392 (__b & (vector unsigned short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005393}
5394
Bill Seurer703e8482015-06-09 14:39:47 +00005395static vector bool short __ATTRS_o_ai vec_vsel(vector bool short __a,
5396 vector bool short __b,
5397 vector unsigned short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005398 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005399}
5400
Bill Seurer703e8482015-06-09 14:39:47 +00005401static vector bool short __ATTRS_o_ai vec_vsel(vector bool short __a,
5402 vector bool short __b,
5403 vector bool short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005404 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005405}
5406
Bill Seurer703e8482015-06-09 14:39:47 +00005407static vector int __ATTRS_o_ai vec_vsel(vector int __a, vector int __b,
5408 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005409 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005410}
5411
Bill Seurer703e8482015-06-09 14:39:47 +00005412static vector int __ATTRS_o_ai vec_vsel(vector int __a, vector int __b,
5413 vector bool int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005414 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005415}
5416
Bill Seurer703e8482015-06-09 14:39:47 +00005417static vector unsigned int __ATTRS_o_ai vec_vsel(vector unsigned int __a,
5418 vector unsigned int __b,
5419 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005420 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005421}
5422
Bill Seurer703e8482015-06-09 14:39:47 +00005423static vector unsigned int __ATTRS_o_ai vec_vsel(vector unsigned int __a,
5424 vector unsigned int __b,
5425 vector bool int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005426 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005427}
5428
Bill Seurer703e8482015-06-09 14:39:47 +00005429static vector bool int __ATTRS_o_ai vec_vsel(vector bool int __a,
5430 vector bool int __b,
5431 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005432 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005433}
5434
Bill Seurer703e8482015-06-09 14:39:47 +00005435static vector bool int __ATTRS_o_ai vec_vsel(vector bool int __a,
5436 vector bool int __b,
5437 vector bool int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005438 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005439}
5440
Bill Seurer703e8482015-06-09 14:39:47 +00005441static vector float __ATTRS_o_ai vec_vsel(vector float __a, vector float __b,
5442 vector unsigned int __c) {
5443 vector int __res = ((vector int)__a & ~(vector int)__c) |
5444 ((vector int)__b & (vector int)__c);
David Blaikie3302f2b2013-01-16 23:08:36 +00005445 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005446}
5447
Bill Seurer703e8482015-06-09 14:39:47 +00005448static vector float __ATTRS_o_ai vec_vsel(vector float __a, vector float __b,
5449 vector bool int __c) {
5450 vector int __res = ((vector int)__a & ~(vector int)__c) |
5451 ((vector int)__b & (vector int)__c);
David Blaikie3302f2b2013-01-16 23:08:36 +00005452 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00005453}
5454
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005455/* vec_sl */
5456
Bill Seurer703e8482015-06-09 14:39:47 +00005457static vector signed char __ATTRS_o_ai vec_sl(vector signed char __a,
5458 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005459 return __a << (vector signed char)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005460}
5461
Bill Seurer703e8482015-06-09 14:39:47 +00005462static vector unsigned char __ATTRS_o_ai vec_sl(vector unsigned char __a,
5463 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005464 return __a << __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005465}
5466
Bill Seurer703e8482015-06-09 14:39:47 +00005467static vector short __ATTRS_o_ai vec_sl(vector short __a,
5468 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005469 return __a << (vector short)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005470}
5471
Bill Seurer703e8482015-06-09 14:39:47 +00005472static vector unsigned short __ATTRS_o_ai vec_sl(vector unsigned short __a,
5473 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005474 return __a << __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005475}
5476
Bill Seurer703e8482015-06-09 14:39:47 +00005477static vector int __ATTRS_o_ai vec_sl(vector int __a, vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005478 return __a << (vector int)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005479}
5480
Bill Seurer703e8482015-06-09 14:39:47 +00005481static vector unsigned int __ATTRS_o_ai vec_sl(vector unsigned int __a,
5482 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005483 return __a << __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005484}
5485
Kit Barton8553bec2015-03-11 15:57:19 +00005486#ifdef __POWER8_VECTOR__
5487static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00005488vec_sl(vector signed long long __a, vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00005489 return __a << (vector long long)__b;
5490}
5491
5492static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00005493vec_sl(vector unsigned long long __a, vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00005494 return __a << __b;
5495}
5496#endif
5497
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005498/* vec_vslb */
5499
5500#define __builtin_altivec_vslb vec_vslb
5501
Bill Seurer703e8482015-06-09 14:39:47 +00005502static vector signed char __ATTRS_o_ai vec_vslb(vector signed char __a,
5503 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005504 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005505}
5506
Bill Seurer703e8482015-06-09 14:39:47 +00005507static vector unsigned char __ATTRS_o_ai vec_vslb(vector unsigned char __a,
5508 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005509 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005510}
5511
5512/* vec_vslh */
5513
5514#define __builtin_altivec_vslh vec_vslh
5515
Bill Seurer703e8482015-06-09 14:39:47 +00005516static vector short __ATTRS_o_ai vec_vslh(vector short __a,
5517 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005518 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005519}
5520
Bill Seurer703e8482015-06-09 14:39:47 +00005521static vector unsigned short __ATTRS_o_ai vec_vslh(vector unsigned short __a,
5522 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005523 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005524}
5525
5526/* vec_vslw */
5527
5528#define __builtin_altivec_vslw vec_vslw
5529
Bill Seurer703e8482015-06-09 14:39:47 +00005530static vector int __ATTRS_o_ai vec_vslw(vector int __a,
5531 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005532 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005533}
5534
Bill Seurer703e8482015-06-09 14:39:47 +00005535static vector unsigned int __ATTRS_o_ai vec_vslw(vector unsigned int __a,
5536 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005537 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005538}
5539
5540/* vec_sld */
5541
5542#define __builtin_altivec_vsldoi_4si vec_sld
5543
Bill Seurer703e8482015-06-09 14:39:47 +00005544static vector signed char __ATTRS_o_ai vec_sld(vector signed char __a,
5545 vector signed char __b,
5546 unsigned char __c) {
5547 return vec_perm(
5548 __a, __b,
5549 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5550 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5551 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005552}
5553
Bill Seurer703e8482015-06-09 14:39:47 +00005554static vector unsigned char __ATTRS_o_ai vec_sld(vector unsigned char __a,
5555 vector unsigned char __b,
5556 unsigned char __c) {
5557 return vec_perm(
5558 __a, __b,
5559 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5560 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5561 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005562}
5563
Bill Seurer703e8482015-06-09 14:39:47 +00005564static vector short __ATTRS_o_ai vec_sld(vector short __a, vector short __b,
5565 unsigned char __c) {
5566 return vec_perm(
5567 __a, __b,
5568 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5569 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5570 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005571}
5572
Bill Seurer703e8482015-06-09 14:39:47 +00005573static vector unsigned short __ATTRS_o_ai vec_sld(vector unsigned short __a,
5574 vector unsigned short __b,
5575 unsigned char __c) {
5576 return vec_perm(
5577 __a, __b,
5578 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5579 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5580 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Yartsev9e968982010-08-19 03:00:09 +00005581}
5582
Bill Seurer703e8482015-06-09 14:39:47 +00005583static vector pixel __ATTRS_o_ai vec_sld(vector pixel __a, vector pixel __b,
5584 unsigned char __c) {
5585 return vec_perm(
5586 __a, __b,
5587 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5588 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5589 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005590}
5591
Bill Seurer703e8482015-06-09 14:39:47 +00005592static vector int __ATTRS_o_ai vec_sld(vector int __a, vector int __b,
5593 unsigned char __c) {
5594 return vec_perm(
5595 __a, __b,
5596 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5597 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5598 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005599}
5600
Bill Seurer703e8482015-06-09 14:39:47 +00005601static vector unsigned int __ATTRS_o_ai vec_sld(vector unsigned int __a,
5602 vector unsigned int __b,
5603 unsigned char __c) {
5604 return vec_perm(
5605 __a, __b,
5606 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5607 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5608 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005609}
5610
Bill Seurer703e8482015-06-09 14:39:47 +00005611static vector float __ATTRS_o_ai vec_sld(vector float __a, vector float __b,
5612 unsigned char __c) {
5613 return vec_perm(
5614 __a, __b,
5615 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5616 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5617 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005618}
5619
5620/* vec_vsldoi */
5621
Bill Seurer703e8482015-06-09 14:39:47 +00005622static vector signed char __ATTRS_o_ai vec_vsldoi(vector signed char __a,
5623 vector signed char __b,
5624 unsigned char __c) {
5625 return vec_perm(
5626 __a, __b,
5627 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5628 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5629 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005630}
5631
Bill Seurer703e8482015-06-09 14:39:47 +00005632static vector unsigned char __ATTRS_o_ai vec_vsldoi(vector unsigned char __a,
5633 vector unsigned char __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 short __ATTRS_o_ai vec_vsldoi(vector short __a, vector short __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 short __ATTRS_o_ai vec_vsldoi(vector unsigned short __a,
5652 vector unsigned short __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 Yartsev9e968982010-08-19 03:00:09 +00005659}
5660
Bill Seurer703e8482015-06-09 14:39:47 +00005661static vector pixel __ATTRS_o_ai vec_vsldoi(vector pixel __a, vector pixel __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
Bill Seurer703e8482015-06-09 14:39:47 +00005670static vector int __ATTRS_o_ai vec_vsldoi(vector int __a, vector int __b,
5671 unsigned char __c) {
5672 return vec_perm(
5673 __a, __b,
5674 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5675 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5676 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005677}
5678
Bill Seurer703e8482015-06-09 14:39:47 +00005679static vector unsigned int __ATTRS_o_ai vec_vsldoi(vector unsigned int __a,
5680 vector unsigned int __b,
5681 unsigned char __c) {
5682 return vec_perm(
5683 __a, __b,
5684 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5685 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5686 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005687}
5688
Bill Seurer703e8482015-06-09 14:39:47 +00005689static vector float __ATTRS_o_ai vec_vsldoi(vector float __a, vector float __b,
5690 unsigned char __c) {
5691 return vec_perm(
5692 __a, __b,
5693 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5694 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5695 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005696}
5697
5698/* vec_sll */
5699
Bill Seurer703e8482015-06-09 14:39:47 +00005700static vector signed char __ATTRS_o_ai vec_sll(vector signed char __a,
5701 vector unsigned char __b) {
5702 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
5703 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005704}
5705
Bill Seurer703e8482015-06-09 14:39:47 +00005706static vector signed char __ATTRS_o_ai vec_sll(vector signed char __a,
5707 vector unsigned short __b) {
5708 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
5709 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005710}
5711
Bill Seurer703e8482015-06-09 14:39:47 +00005712static vector signed char __ATTRS_o_ai vec_sll(vector signed char __a,
5713 vector unsigned int __b) {
5714 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
5715 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005716}
5717
Bill Seurer703e8482015-06-09 14:39:47 +00005718static vector unsigned char __ATTRS_o_ai vec_sll(vector unsigned char __a,
5719 vector unsigned char __b) {
5720 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
5721 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005722}
5723
Bill Seurer703e8482015-06-09 14:39:47 +00005724static vector unsigned char __ATTRS_o_ai vec_sll(vector unsigned char __a,
5725 vector unsigned short __b) {
5726 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
5727 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005728}
5729
Bill Seurer703e8482015-06-09 14:39:47 +00005730static vector unsigned char __ATTRS_o_ai vec_sll(vector unsigned char __a,
5731 vector unsigned int __b) {
5732 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
5733 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005734}
5735
Bill Seurer703e8482015-06-09 14:39:47 +00005736static vector bool char __ATTRS_o_ai vec_sll(vector bool char __a,
5737 vector unsigned char __b) {
5738 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
5739 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005740}
5741
Bill Seurer703e8482015-06-09 14:39:47 +00005742static vector bool char __ATTRS_o_ai vec_sll(vector bool char __a,
5743 vector unsigned short __b) {
5744 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
5745 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005746}
5747
Bill Seurer703e8482015-06-09 14:39:47 +00005748static vector bool char __ATTRS_o_ai vec_sll(vector bool char __a,
5749 vector unsigned int __b) {
5750 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
5751 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005752}
5753
Bill Seurer703e8482015-06-09 14:39:47 +00005754static vector short __ATTRS_o_ai vec_sll(vector short __a,
5755 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005756 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005757}
5758
Bill Seurer703e8482015-06-09 14:39:47 +00005759static vector short __ATTRS_o_ai vec_sll(vector short __a,
5760 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005761 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005762}
5763
Bill Seurer703e8482015-06-09 14:39:47 +00005764static vector short __ATTRS_o_ai vec_sll(vector short __a,
5765 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005766 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005767}
5768
Bill Seurer703e8482015-06-09 14:39:47 +00005769static vector unsigned short __ATTRS_o_ai vec_sll(vector unsigned short __a,
5770 vector unsigned char __b) {
5771 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
5772 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005773}
5774
Bill Seurer703e8482015-06-09 14:39:47 +00005775static vector unsigned short __ATTRS_o_ai vec_sll(vector unsigned short __a,
5776 vector unsigned short __b) {
5777 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
5778 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005779}
5780
Bill Seurer703e8482015-06-09 14:39:47 +00005781static vector unsigned short __ATTRS_o_ai vec_sll(vector unsigned short __a,
5782 vector unsigned int __b) {
5783 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
5784 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005785}
5786
Bill Seurer703e8482015-06-09 14:39:47 +00005787static vector bool short __ATTRS_o_ai vec_sll(vector bool short __a,
5788 vector unsigned char __b) {
5789 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
5790 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005791}
5792
Bill Seurer703e8482015-06-09 14:39:47 +00005793static vector bool short __ATTRS_o_ai vec_sll(vector bool short __a,
5794 vector unsigned short __b) {
5795 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
5796 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005797}
5798
Bill Seurer703e8482015-06-09 14:39:47 +00005799static vector bool short __ATTRS_o_ai vec_sll(vector bool short __a,
5800 vector unsigned int __b) {
5801 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
5802 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005803}
5804
Bill Seurer703e8482015-06-09 14:39:47 +00005805static vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
5806 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005807 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005808}
5809
Bill Seurer703e8482015-06-09 14:39:47 +00005810static vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
5811 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005812 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005813}
5814
Bill Seurer703e8482015-06-09 14:39:47 +00005815static vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
5816 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005817 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005818}
5819
Bill Seurer703e8482015-06-09 14:39:47 +00005820static vector int __ATTRS_o_ai vec_sll(vector int __a,
5821 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005822 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005823}
5824
Bill Seurer703e8482015-06-09 14:39:47 +00005825static vector int __ATTRS_o_ai vec_sll(vector int __a,
5826 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005827 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005828}
5829
Bill Seurer703e8482015-06-09 14:39:47 +00005830static vector int __ATTRS_o_ai vec_sll(vector int __a,
5831 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005832 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005833}
5834
Bill Seurer703e8482015-06-09 14:39:47 +00005835static vector unsigned int __ATTRS_o_ai vec_sll(vector unsigned int __a,
5836 vector unsigned char __b) {
5837 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
5838 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005839}
5840
Bill Seurer703e8482015-06-09 14:39:47 +00005841static vector unsigned int __ATTRS_o_ai vec_sll(vector unsigned int __a,
5842 vector unsigned short __b) {
5843 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
5844 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005845}
5846
Bill Seurer703e8482015-06-09 14:39:47 +00005847static vector unsigned int __ATTRS_o_ai vec_sll(vector unsigned int __a,
5848 vector unsigned int __b) {
5849 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
5850 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005851}
5852
Bill Seurer703e8482015-06-09 14:39:47 +00005853static vector bool int __ATTRS_o_ai vec_sll(vector bool int __a,
5854 vector unsigned char __b) {
5855 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
5856 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005857}
5858
Bill Seurer703e8482015-06-09 14:39:47 +00005859static vector bool int __ATTRS_o_ai vec_sll(vector bool int __a,
5860 vector unsigned short __b) {
5861 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
5862 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005863}
5864
Bill Seurer703e8482015-06-09 14:39:47 +00005865static vector bool int __ATTRS_o_ai vec_sll(vector bool int __a,
5866 vector unsigned int __b) {
5867 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
5868 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005869}
5870
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005871/* vec_vsl */
5872
Bill Seurer703e8482015-06-09 14:39:47 +00005873static vector signed char __ATTRS_o_ai vec_vsl(vector signed char __a,
5874 vector unsigned char __b) {
5875 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
5876 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005877}
5878
Bill Seurer703e8482015-06-09 14:39:47 +00005879static vector signed char __ATTRS_o_ai vec_vsl(vector signed char __a,
5880 vector unsigned short __b) {
5881 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
5882 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005883}
5884
Bill Seurer703e8482015-06-09 14:39:47 +00005885static vector signed char __ATTRS_o_ai vec_vsl(vector signed char __a,
5886 vector unsigned int __b) {
5887 return (vector signed char)__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 char __ATTRS_o_ai vec_vsl(vector unsigned char __a,
5892 vector unsigned char __b) {
5893 return (vector unsigned char)__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 char __ATTRS_o_ai vec_vsl(vector unsigned char __a,
5898 vector unsigned short __b) {
5899 return (vector unsigned char)__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 unsigned char __ATTRS_o_ai vec_vsl(vector unsigned char __a,
5904 vector unsigned int __b) {
5905 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
5906 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005907}
5908
Bill Seurer703e8482015-06-09 14:39:47 +00005909static vector bool char __ATTRS_o_ai vec_vsl(vector bool char __a,
5910 vector unsigned char __b) {
5911 return (vector bool char)__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 char __ATTRS_o_ai vec_vsl(vector bool char __a,
5916 vector unsigned short __b) {
5917 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
5918 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005919}
5920
Bill Seurer703e8482015-06-09 14:39:47 +00005921static vector bool char __ATTRS_o_ai vec_vsl(vector bool char __a,
5922 vector unsigned int __b) {
5923 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
5924 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005925}
5926
Bill Seurer703e8482015-06-09 14:39:47 +00005927static vector short __ATTRS_o_ai vec_vsl(vector short __a,
5928 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005929 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005930}
5931
Bill Seurer703e8482015-06-09 14:39:47 +00005932static vector short __ATTRS_o_ai vec_vsl(vector short __a,
5933 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005934 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005935}
5936
Bill Seurer703e8482015-06-09 14:39:47 +00005937static vector short __ATTRS_o_ai vec_vsl(vector short __a,
5938 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005939 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005940}
5941
Bill Seurer703e8482015-06-09 14:39:47 +00005942static vector unsigned short __ATTRS_o_ai vec_vsl(vector unsigned short __a,
5943 vector unsigned char __b) {
5944 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
5945 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005946}
5947
Bill Seurer703e8482015-06-09 14:39:47 +00005948static vector unsigned short __ATTRS_o_ai vec_vsl(vector unsigned short __a,
5949 vector unsigned short __b) {
5950 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
5951 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005952}
5953
Bill Seurer703e8482015-06-09 14:39:47 +00005954static vector unsigned short __ATTRS_o_ai vec_vsl(vector unsigned short __a,
5955 vector unsigned int __b) {
5956 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
5957 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005958}
5959
Bill Seurer703e8482015-06-09 14:39:47 +00005960static vector bool short __ATTRS_o_ai vec_vsl(vector bool short __a,
5961 vector unsigned char __b) {
5962 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
5963 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005964}
5965
Bill Seurer703e8482015-06-09 14:39:47 +00005966static vector bool short __ATTRS_o_ai vec_vsl(vector bool short __a,
5967 vector unsigned short __b) {
5968 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
5969 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005970}
5971
Bill Seurer703e8482015-06-09 14:39:47 +00005972static vector bool short __ATTRS_o_ai vec_vsl(vector bool short __a,
5973 vector unsigned int __b) {
5974 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
5975 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005976}
5977
Bill Seurer703e8482015-06-09 14:39:47 +00005978static vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
5979 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005980 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005981}
5982
Bill Seurer703e8482015-06-09 14:39:47 +00005983static vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
5984 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005985 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005986}
5987
Bill Seurer703e8482015-06-09 14:39:47 +00005988static vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
5989 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005990 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005991}
5992
Bill Seurer703e8482015-06-09 14:39:47 +00005993static vector int __ATTRS_o_ai vec_vsl(vector int __a,
5994 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005995 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005996}
5997
Bill Seurer703e8482015-06-09 14:39:47 +00005998static vector int __ATTRS_o_ai vec_vsl(vector int __a,
5999 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006000 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006001}
6002
Bill Seurer703e8482015-06-09 14:39:47 +00006003static vector int __ATTRS_o_ai vec_vsl(vector int __a,
6004 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006005 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006006}
6007
Bill Seurer703e8482015-06-09 14:39:47 +00006008static vector unsigned int __ATTRS_o_ai vec_vsl(vector unsigned int __a,
6009 vector unsigned char __b) {
6010 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
6011 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006012}
6013
Bill Seurer703e8482015-06-09 14:39:47 +00006014static vector unsigned int __ATTRS_o_ai vec_vsl(vector unsigned int __a,
6015 vector unsigned short __b) {
6016 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
6017 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006018}
6019
Bill Seurer703e8482015-06-09 14:39:47 +00006020static vector unsigned int __ATTRS_o_ai vec_vsl(vector unsigned int __a,
6021 vector unsigned int __b) {
6022 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
6023 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006024}
6025
Bill Seurer703e8482015-06-09 14:39:47 +00006026static vector bool int __ATTRS_o_ai vec_vsl(vector bool int __a,
6027 vector unsigned char __b) {
6028 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
6029 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006030}
6031
Bill Seurer703e8482015-06-09 14:39:47 +00006032static vector bool int __ATTRS_o_ai vec_vsl(vector bool int __a,
6033 vector unsigned short __b) {
6034 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
6035 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006036}
6037
Bill Seurer703e8482015-06-09 14:39:47 +00006038static vector bool int __ATTRS_o_ai vec_vsl(vector bool int __a,
6039 vector unsigned int __b) {
6040 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
6041 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006042}
6043
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006044/* vec_slo */
6045
Bill Seurer703e8482015-06-09 14:39:47 +00006046static vector signed char __ATTRS_o_ai vec_slo(vector signed char __a,
6047 vector signed char __b) {
6048 return (vector signed char)__builtin_altivec_vslo((vector int)__a,
6049 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006050}
6051
Bill Seurer703e8482015-06-09 14:39:47 +00006052static vector signed char __ATTRS_o_ai vec_slo(vector signed char __a,
6053 vector unsigned char __b) {
6054 return (vector signed char)__builtin_altivec_vslo((vector int)__a,
6055 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006056}
6057
Bill Seurer703e8482015-06-09 14:39:47 +00006058static vector unsigned char __ATTRS_o_ai vec_slo(vector unsigned char __a,
6059 vector signed char __b) {
6060 return (vector unsigned char)__builtin_altivec_vslo((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 char __ATTRS_o_ai vec_slo(vector unsigned char __a,
6065 vector unsigned char __b) {
6066 return (vector unsigned char)__builtin_altivec_vslo((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 short __ATTRS_o_ai vec_slo(vector short __a,
6071 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006072 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006073}
6074
Bill Seurer703e8482015-06-09 14:39:47 +00006075static vector short __ATTRS_o_ai vec_slo(vector short __a,
6076 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006077 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006078}
6079
Bill Seurer703e8482015-06-09 14:39:47 +00006080static vector unsigned short __ATTRS_o_ai vec_slo(vector unsigned short __a,
6081 vector signed char __b) {
6082 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
6083 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006084}
6085
Bill Seurer703e8482015-06-09 14:39:47 +00006086static vector unsigned short __ATTRS_o_ai vec_slo(vector unsigned short __a,
6087 vector unsigned char __b) {
6088 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
6089 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006090}
6091
Bill Seurer703e8482015-06-09 14:39:47 +00006092static vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
6093 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006094 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006095}
6096
Bill Seurer703e8482015-06-09 14:39:47 +00006097static vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
6098 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006099 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006100}
6101
Bill Seurer703e8482015-06-09 14:39:47 +00006102static vector int __ATTRS_o_ai vec_slo(vector int __a, vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006103 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006104}
6105
Bill Seurer703e8482015-06-09 14:39:47 +00006106static vector int __ATTRS_o_ai vec_slo(vector int __a,
6107 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006108 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006109}
6110
Bill Seurer703e8482015-06-09 14:39:47 +00006111static vector unsigned int __ATTRS_o_ai vec_slo(vector unsigned int __a,
6112 vector signed char __b) {
6113 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
6114 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006115}
6116
Bill Seurer703e8482015-06-09 14:39:47 +00006117static vector unsigned int __ATTRS_o_ai vec_slo(vector unsigned int __a,
6118 vector unsigned char __b) {
6119 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
6120 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006121}
6122
Bill Seurer703e8482015-06-09 14:39:47 +00006123static vector float __ATTRS_o_ai vec_slo(vector float __a,
6124 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006125 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006126}
6127
Bill Seurer703e8482015-06-09 14:39:47 +00006128static vector float __ATTRS_o_ai vec_slo(vector float __a,
6129 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006130 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006131}
6132
6133/* vec_vslo */
6134
Bill Seurer703e8482015-06-09 14:39:47 +00006135static vector signed char __ATTRS_o_ai vec_vslo(vector signed char __a,
6136 vector signed char __b) {
6137 return (vector signed char)__builtin_altivec_vslo((vector int)__a,
6138 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006139}
6140
Bill Seurer703e8482015-06-09 14:39:47 +00006141static vector signed char __ATTRS_o_ai vec_vslo(vector signed char __a,
6142 vector unsigned char __b) {
6143 return (vector signed char)__builtin_altivec_vslo((vector int)__a,
6144 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006145}
6146
Bill Seurer703e8482015-06-09 14:39:47 +00006147static vector unsigned char __ATTRS_o_ai vec_vslo(vector unsigned char __a,
6148 vector signed char __b) {
6149 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
6150 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006151}
6152
Bill Seurer703e8482015-06-09 14:39:47 +00006153static vector unsigned char __ATTRS_o_ai vec_vslo(vector unsigned char __a,
6154 vector unsigned char __b) {
6155 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
6156 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006157}
6158
Bill Seurer703e8482015-06-09 14:39:47 +00006159static vector short __ATTRS_o_ai vec_vslo(vector short __a,
6160 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006161 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006162}
6163
Bill Seurer703e8482015-06-09 14:39:47 +00006164static vector short __ATTRS_o_ai vec_vslo(vector short __a,
6165 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006166 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006167}
6168
Bill Seurer703e8482015-06-09 14:39:47 +00006169static vector unsigned short __ATTRS_o_ai vec_vslo(vector unsigned short __a,
6170 vector signed char __b) {
6171 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
6172 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006173}
6174
Bill Seurer703e8482015-06-09 14:39:47 +00006175static vector unsigned short __ATTRS_o_ai vec_vslo(vector unsigned short __a,
6176 vector unsigned char __b) {
6177 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
6178 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006179}
6180
Bill Seurer703e8482015-06-09 14:39:47 +00006181static vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
6182 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006183 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006184}
6185
Bill Seurer703e8482015-06-09 14:39:47 +00006186static vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
6187 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006188 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006189}
6190
Bill Seurer703e8482015-06-09 14:39:47 +00006191static vector int __ATTRS_o_ai vec_vslo(vector int __a,
6192 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006193 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006194}
6195
Bill Seurer703e8482015-06-09 14:39:47 +00006196static vector int __ATTRS_o_ai vec_vslo(vector int __a,
6197 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006198 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006199}
6200
Bill Seurer703e8482015-06-09 14:39:47 +00006201static vector unsigned int __ATTRS_o_ai vec_vslo(vector unsigned int __a,
6202 vector signed char __b) {
6203 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
6204 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006205}
6206
Bill Seurer703e8482015-06-09 14:39:47 +00006207static vector unsigned int __ATTRS_o_ai vec_vslo(vector unsigned int __a,
6208 vector unsigned char __b) {
6209 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
6210 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006211}
6212
Bill Seurer703e8482015-06-09 14:39:47 +00006213static vector float __ATTRS_o_ai vec_vslo(vector float __a,
6214 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006215 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006216}
6217
Bill Seurer703e8482015-06-09 14:39:47 +00006218static vector float __ATTRS_o_ai vec_vslo(vector float __a,
6219 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006220 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006221}
6222
6223/* vec_splat */
6224
Bill Seurer703e8482015-06-09 14:39:47 +00006225static vector signed char __ATTRS_o_ai vec_splat(vector signed char __a,
6226 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006227 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006228}
6229
Bill Seurer703e8482015-06-09 14:39:47 +00006230static vector unsigned char __ATTRS_o_ai vec_splat(vector unsigned char __a,
6231 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006232 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Yartsev9e968982010-08-19 03:00:09 +00006233}
6234
Bill Seurer703e8482015-06-09 14:39:47 +00006235static vector bool char __ATTRS_o_ai vec_splat(vector bool char __a,
6236 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006237 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006238}
6239
Bill Seurer703e8482015-06-09 14:39:47 +00006240static vector short __ATTRS_o_ai vec_splat(vector short __a,
6241 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006242 __b *= 2;
Bill Seurer703e8482015-06-09 14:39:47 +00006243 unsigned char b1 = __b + 1;
6244 return vec_perm(__a, __a,
6245 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
6246 __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006247}
6248
Bill Seurer703e8482015-06-09 14:39:47 +00006249static vector unsigned short __ATTRS_o_ai vec_splat(vector unsigned short __a,
6250 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006251 __b *= 2;
Bill Seurer703e8482015-06-09 14:39:47 +00006252 unsigned char b1 = __b + 1;
6253 return vec_perm(__a, __a,
6254 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
6255 __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00006256}
6257
Bill Seurer703e8482015-06-09 14:39:47 +00006258static vector bool short __ATTRS_o_ai vec_splat(vector bool short __a,
6259 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006260 __b *= 2;
Bill Seurer703e8482015-06-09 14:39:47 +00006261 unsigned char b1 = __b + 1;
6262 return vec_perm(__a, __a,
6263 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
6264 __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00006265}
6266
Bill Seurer703e8482015-06-09 14:39:47 +00006267static vector pixel __ATTRS_o_ai vec_splat(vector pixel __a,
6268 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006269 __b *= 2;
Bill Seurer703e8482015-06-09 14:39:47 +00006270 unsigned char b1 = __b + 1;
6271 return vec_perm(__a, __a,
6272 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
6273 __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006274}
6275
Bill Seurer703e8482015-06-09 14:39:47 +00006276static vector int __ATTRS_o_ai vec_splat(vector int __a, unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006277 __b *= 4;
Bill Seurer703e8482015-06-09 14:39:47 +00006278 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
6279 return vec_perm(__a, __a,
6280 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
6281 b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006282}
6283
Bill Seurer703e8482015-06-09 14:39:47 +00006284static vector unsigned int __ATTRS_o_ai vec_splat(vector unsigned int __a,
6285 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006286 __b *= 4;
Bill Seurer703e8482015-06-09 14:39:47 +00006287 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
6288 return vec_perm(__a, __a,
6289 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
6290 b1, b2, b3, __b, b1, b2, b3));
Anton Yartsev9e968982010-08-19 03:00:09 +00006291}
6292
Bill Seurer703e8482015-06-09 14:39:47 +00006293static vector bool int __ATTRS_o_ai vec_splat(vector bool int __a,
6294 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006295 __b *= 4;
Bill Seurer703e8482015-06-09 14:39:47 +00006296 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
6297 return vec_perm(__a, __a,
6298 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
6299 b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006300}
6301
Bill Seurer703e8482015-06-09 14:39:47 +00006302static vector float __ATTRS_o_ai vec_splat(vector float __a,
6303 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006304 __b *= 4;
Bill Seurer703e8482015-06-09 14:39:47 +00006305 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
6306 return vec_perm(__a, __a,
6307 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
6308 b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006309}
6310
6311/* vec_vspltb */
6312
6313#define __builtin_altivec_vspltb vec_vspltb
6314
Bill Seurer703e8482015-06-09 14:39:47 +00006315static vector signed char __ATTRS_o_ai vec_vspltb(vector signed char __a,
6316 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006317 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006318}
6319
Bill Seurer703e8482015-06-09 14:39:47 +00006320static vector unsigned char __ATTRS_o_ai vec_vspltb(vector unsigned char __a,
6321 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006322 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Yartsev9e968982010-08-19 03:00:09 +00006323}
6324
Bill Seurer703e8482015-06-09 14:39:47 +00006325static vector bool char __ATTRS_o_ai vec_vspltb(vector bool char __a,
6326 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006327 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006328}
6329
6330/* vec_vsplth */
6331
6332#define __builtin_altivec_vsplth vec_vsplth
6333
Bill Seurer703e8482015-06-09 14:39:47 +00006334static vector short __ATTRS_o_ai vec_vsplth(vector short __a,
6335 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006336 __b *= 2;
Bill Seurer703e8482015-06-09 14:39:47 +00006337 unsigned char b1 = __b + 1;
6338 return vec_perm(__a, __a,
6339 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
6340 __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006341}
6342
Bill Seurer703e8482015-06-09 14:39:47 +00006343static vector unsigned short __ATTRS_o_ai vec_vsplth(vector unsigned short __a,
6344 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006345 __b *= 2;
Bill Seurer703e8482015-06-09 14:39:47 +00006346 unsigned char b1 = __b + 1;
6347 return vec_perm(__a, __a,
6348 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
6349 __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00006350}
6351
Bill Seurer703e8482015-06-09 14:39:47 +00006352static vector bool short __ATTRS_o_ai vec_vsplth(vector bool short __a,
6353 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006354 __b *= 2;
Bill Seurer703e8482015-06-09 14:39:47 +00006355 unsigned char b1 = __b + 1;
6356 return vec_perm(__a, __a,
6357 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
6358 __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00006359}
6360
Bill Seurer703e8482015-06-09 14:39:47 +00006361static vector pixel __ATTRS_o_ai vec_vsplth(vector pixel __a,
6362 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006363 __b *= 2;
Bill Seurer703e8482015-06-09 14:39:47 +00006364 unsigned char b1 = __b + 1;
6365 return vec_perm(__a, __a,
6366 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
6367 __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006368}
6369
6370/* vec_vspltw */
6371
6372#define __builtin_altivec_vspltw vec_vspltw
6373
Bill Seurer703e8482015-06-09 14:39:47 +00006374static vector int __ATTRS_o_ai vec_vspltw(vector int __a, unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006375 __b *= 4;
Bill Seurer703e8482015-06-09 14:39:47 +00006376 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
6377 return vec_perm(__a, __a,
6378 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
6379 b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006380}
6381
Bill Seurer703e8482015-06-09 14:39:47 +00006382static vector unsigned int __ATTRS_o_ai vec_vspltw(vector unsigned int __a,
6383 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006384 __b *= 4;
Bill Seurer703e8482015-06-09 14:39:47 +00006385 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
6386 return vec_perm(__a, __a,
6387 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
6388 b1, b2, b3, __b, b1, b2, b3));
Anton Yartsev9e968982010-08-19 03:00:09 +00006389}
6390
Bill Seurer703e8482015-06-09 14:39:47 +00006391static vector bool int __ATTRS_o_ai vec_vspltw(vector bool int __a,
6392 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006393 __b *= 4;
Bill Seurer703e8482015-06-09 14:39:47 +00006394 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
6395 return vec_perm(__a, __a,
6396 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
6397 b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006398}
6399
Bill Seurer703e8482015-06-09 14:39:47 +00006400static vector float __ATTRS_o_ai vec_vspltw(vector float __a,
6401 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006402 __b *= 4;
Bill Seurer703e8482015-06-09 14:39:47 +00006403 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
6404 return vec_perm(__a, __a,
6405 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
6406 b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006407}
6408
6409/* vec_splat_s8 */
6410
6411#define __builtin_altivec_vspltisb vec_splat_s8
6412
6413// FIXME: parameter should be treated as 5-bit signed literal
Bill Seurer703e8482015-06-09 14:39:47 +00006414static vector signed char __ATTRS_o_ai vec_splat_s8(signed char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006415 return (vector signed char)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006416}
6417
6418/* vec_vspltisb */
6419
6420// FIXME: parameter should be treated as 5-bit signed literal
Bill Seurer703e8482015-06-09 14:39:47 +00006421static vector signed char __ATTRS_o_ai vec_vspltisb(signed char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006422 return (vector signed char)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006423}
6424
6425/* vec_splat_s16 */
6426
6427#define __builtin_altivec_vspltish vec_splat_s16
6428
6429// FIXME: parameter should be treated as 5-bit signed literal
Bill Seurer703e8482015-06-09 14:39:47 +00006430static vector short __ATTRS_o_ai vec_splat_s16(signed char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006431 return (vector short)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006432}
6433
6434/* vec_vspltish */
6435
6436// FIXME: parameter should be treated as 5-bit signed literal
Bill Seurer703e8482015-06-09 14:39:47 +00006437static vector short __ATTRS_o_ai vec_vspltish(signed char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006438 return (vector short)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006439}
6440
6441/* vec_splat_s32 */
6442
6443#define __builtin_altivec_vspltisw vec_splat_s32
6444
6445// FIXME: parameter should be treated as 5-bit signed literal
Bill Seurer703e8482015-06-09 14:39:47 +00006446static vector int __ATTRS_o_ai vec_splat_s32(signed char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006447 return (vector int)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006448}
6449
6450/* vec_vspltisw */
6451
6452// FIXME: parameter should be treated as 5-bit signed literal
Bill Seurer703e8482015-06-09 14:39:47 +00006453static vector int __ATTRS_o_ai vec_vspltisw(signed char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006454 return (vector int)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006455}
6456
6457/* vec_splat_u8 */
6458
6459// FIXME: parameter should be treated as 5-bit signed literal
Bill Seurer703e8482015-06-09 14:39:47 +00006460static vector unsigned char __ATTRS_o_ai vec_splat_u8(unsigned char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006461 return (vector unsigned char)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006462}
6463
6464/* vec_splat_u16 */
6465
6466// FIXME: parameter should be treated as 5-bit signed literal
Bill Seurer703e8482015-06-09 14:39:47 +00006467static vector unsigned short __ATTRS_o_ai vec_splat_u16(signed char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006468 return (vector unsigned short)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006469}
6470
6471/* vec_splat_u32 */
6472
6473// FIXME: parameter should be treated as 5-bit signed literal
Bill Seurer703e8482015-06-09 14:39:47 +00006474static vector unsigned int __ATTRS_o_ai vec_splat_u32(signed char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006475 return (vector unsigned int)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006476}
6477
6478/* vec_sr */
6479
Bill Seurer703e8482015-06-09 14:39:47 +00006480static vector signed char __ATTRS_o_ai vec_sr(vector signed char __a,
6481 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006482 return __a >> (vector signed char)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006483}
6484
Bill Seurer703e8482015-06-09 14:39:47 +00006485static vector unsigned char __ATTRS_o_ai vec_sr(vector unsigned char __a,
6486 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006487 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006488}
6489
Bill Seurer703e8482015-06-09 14:39:47 +00006490static vector short __ATTRS_o_ai vec_sr(vector short __a,
6491 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006492 return __a >> (vector short)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006493}
6494
Bill Seurer703e8482015-06-09 14:39:47 +00006495static vector unsigned short __ATTRS_o_ai vec_sr(vector unsigned short __a,
6496 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006497 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006498}
6499
Bill Seurer703e8482015-06-09 14:39:47 +00006500static vector int __ATTRS_o_ai vec_sr(vector int __a, vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006501 return __a >> (vector int)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006502}
6503
Bill Seurer703e8482015-06-09 14:39:47 +00006504static vector unsigned int __ATTRS_o_ai vec_sr(vector unsigned int __a,
6505 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006506 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006507}
6508
Kit Barton8553bec2015-03-11 15:57:19 +00006509#ifdef __POWER8_VECTOR__
6510static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00006511vec_sr(vector signed long long __a, vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00006512 return __a >> (vector long long)__b;
6513}
6514
6515static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00006516vec_sr(vector unsigned long long __a, vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00006517 return __a >> __b;
6518}
6519#endif
6520
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006521/* vec_vsrb */
6522
6523#define __builtin_altivec_vsrb vec_vsrb
6524
Bill Seurer703e8482015-06-09 14:39:47 +00006525static vector signed char __ATTRS_o_ai vec_vsrb(vector signed char __a,
6526 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006527 return __a >> (vector signed char)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006528}
6529
Bill Seurer703e8482015-06-09 14:39:47 +00006530static vector unsigned char __ATTRS_o_ai vec_vsrb(vector unsigned char __a,
6531 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006532 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006533}
6534
6535/* vec_vsrh */
6536
6537#define __builtin_altivec_vsrh vec_vsrh
6538
Bill Seurer703e8482015-06-09 14:39:47 +00006539static vector short __ATTRS_o_ai vec_vsrh(vector short __a,
6540 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006541 return __a >> (vector short)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006542}
6543
Bill Seurer703e8482015-06-09 14:39:47 +00006544static vector unsigned short __ATTRS_o_ai vec_vsrh(vector unsigned short __a,
6545 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006546 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006547}
6548
6549/* vec_vsrw */
6550
6551#define __builtin_altivec_vsrw vec_vsrw
6552
Bill Seurer703e8482015-06-09 14:39:47 +00006553static vector int __ATTRS_o_ai vec_vsrw(vector int __a,
6554 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006555 return __a >> (vector int)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006556}
6557
Bill Seurer703e8482015-06-09 14:39:47 +00006558static vector unsigned int __ATTRS_o_ai vec_vsrw(vector unsigned int __a,
6559 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006560 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006561}
6562
6563/* vec_sra */
6564
Bill Seurer703e8482015-06-09 14:39:47 +00006565static vector signed char __ATTRS_o_ai vec_sra(vector signed char __a,
6566 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006567 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006568}
6569
Bill Seurer703e8482015-06-09 14:39:47 +00006570static vector unsigned char __ATTRS_o_ai vec_sra(vector unsigned char __a,
6571 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006572 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006573}
6574
Bill Seurer703e8482015-06-09 14:39:47 +00006575static vector short __ATTRS_o_ai vec_sra(vector short __a,
6576 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006577 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006578}
6579
Bill Seurer703e8482015-06-09 14:39:47 +00006580static vector unsigned short __ATTRS_o_ai vec_sra(vector unsigned short __a,
6581 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006582 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006583}
6584
Bill Seurer703e8482015-06-09 14:39:47 +00006585static vector int __ATTRS_o_ai vec_sra(vector int __a,
6586 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006587 return __builtin_altivec_vsraw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006588}
6589
Bill Seurer703e8482015-06-09 14:39:47 +00006590static vector unsigned int __ATTRS_o_ai vec_sra(vector unsigned int __a,
6591 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006592 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006593}
6594
Kit Barton8553bec2015-03-11 15:57:19 +00006595#ifdef __POWER8_VECTOR__
6596static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00006597vec_sra(vector signed long long __a, vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00006598 return __a >> __b;
6599}
6600
6601static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00006602vec_sra(vector unsigned long long __a, vector unsigned long long __b) {
6603 return (vector unsigned long long)((vector signed long long)__a >> __b);
Kit Barton8553bec2015-03-11 15:57:19 +00006604}
6605#endif
6606
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006607/* vec_vsrab */
6608
Bill Seurer703e8482015-06-09 14:39:47 +00006609static vector signed char __ATTRS_o_ai vec_vsrab(vector signed char __a,
6610 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006611 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006612}
6613
Bill Seurer703e8482015-06-09 14:39:47 +00006614static vector unsigned char __ATTRS_o_ai vec_vsrab(vector unsigned char __a,
6615 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006616 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006617}
6618
6619/* vec_vsrah */
6620
Bill Seurer703e8482015-06-09 14:39:47 +00006621static vector short __ATTRS_o_ai vec_vsrah(vector short __a,
6622 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006623 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006624}
6625
Bill Seurer703e8482015-06-09 14:39:47 +00006626static vector unsigned short __ATTRS_o_ai vec_vsrah(vector unsigned short __a,
6627 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006628 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006629}
6630
6631/* vec_vsraw */
6632
Bill Seurer703e8482015-06-09 14:39:47 +00006633static vector int __ATTRS_o_ai vec_vsraw(vector int __a,
6634 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006635 return __builtin_altivec_vsraw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006636}
6637
Bill Seurer703e8482015-06-09 14:39:47 +00006638static vector unsigned int __ATTRS_o_ai vec_vsraw(vector unsigned int __a,
6639 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006640 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006641}
6642
6643/* vec_srl */
6644
Bill Seurer703e8482015-06-09 14:39:47 +00006645static vector signed char __ATTRS_o_ai vec_srl(vector signed char __a,
6646 vector unsigned char __b) {
6647 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
6648 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006649}
6650
Bill Seurer703e8482015-06-09 14:39:47 +00006651static vector signed char __ATTRS_o_ai vec_srl(vector signed char __a,
6652 vector unsigned short __b) {
6653 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
6654 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006655}
6656
Bill Seurer703e8482015-06-09 14:39:47 +00006657static vector signed char __ATTRS_o_ai vec_srl(vector signed char __a,
6658 vector unsigned int __b) {
6659 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
6660 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006661}
6662
Bill Seurer703e8482015-06-09 14:39:47 +00006663static vector unsigned char __ATTRS_o_ai vec_srl(vector unsigned char __a,
6664 vector unsigned char __b) {
6665 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
6666 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006667}
6668
Bill Seurer703e8482015-06-09 14:39:47 +00006669static vector unsigned char __ATTRS_o_ai vec_srl(vector unsigned char __a,
6670 vector unsigned short __b) {
6671 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
6672 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006673}
6674
Bill Seurer703e8482015-06-09 14:39:47 +00006675static vector unsigned char __ATTRS_o_ai vec_srl(vector unsigned char __a,
6676 vector unsigned int __b) {
6677 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
6678 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006679}
6680
Bill Seurer703e8482015-06-09 14:39:47 +00006681static vector bool char __ATTRS_o_ai vec_srl(vector bool char __a,
6682 vector unsigned char __b) {
6683 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
6684 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006685}
6686
Bill Seurer703e8482015-06-09 14:39:47 +00006687static vector bool char __ATTRS_o_ai vec_srl(vector bool char __a,
6688 vector unsigned short __b) {
6689 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
6690 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006691}
6692
Bill Seurer703e8482015-06-09 14:39:47 +00006693static vector bool char __ATTRS_o_ai vec_srl(vector bool char __a,
6694 vector unsigned int __b) {
6695 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
6696 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006697}
6698
Bill Seurer703e8482015-06-09 14:39:47 +00006699static vector short __ATTRS_o_ai vec_srl(vector short __a,
6700 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006701 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006702}
6703
Bill Seurer703e8482015-06-09 14:39:47 +00006704static vector short __ATTRS_o_ai vec_srl(vector short __a,
6705 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006706 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006707}
6708
Bill Seurer703e8482015-06-09 14:39:47 +00006709static vector short __ATTRS_o_ai vec_srl(vector short __a,
6710 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006711 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006712}
6713
Bill Seurer703e8482015-06-09 14:39:47 +00006714static vector unsigned short __ATTRS_o_ai vec_srl(vector unsigned short __a,
6715 vector unsigned char __b) {
6716 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
6717 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006718}
6719
Bill Seurer703e8482015-06-09 14:39:47 +00006720static vector unsigned short __ATTRS_o_ai vec_srl(vector unsigned short __a,
6721 vector unsigned short __b) {
6722 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
6723 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006724}
6725
Bill Seurer703e8482015-06-09 14:39:47 +00006726static vector unsigned short __ATTRS_o_ai vec_srl(vector unsigned short __a,
6727 vector unsigned int __b) {
6728 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
6729 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006730}
6731
Bill Seurer703e8482015-06-09 14:39:47 +00006732static vector bool short __ATTRS_o_ai vec_srl(vector bool short __a,
6733 vector unsigned char __b) {
6734 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
6735 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006736}
6737
Bill Seurer703e8482015-06-09 14:39:47 +00006738static vector bool short __ATTRS_o_ai vec_srl(vector bool short __a,
6739 vector unsigned short __b) {
6740 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
6741 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006742}
6743
Bill Seurer703e8482015-06-09 14:39:47 +00006744static vector bool short __ATTRS_o_ai vec_srl(vector bool short __a,
6745 vector unsigned int __b) {
6746 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
6747 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006748}
6749
Bill Seurer703e8482015-06-09 14:39:47 +00006750static vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
6751 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006752 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006753}
6754
Bill Seurer703e8482015-06-09 14:39:47 +00006755static vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
6756 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006757 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006758}
6759
Bill Seurer703e8482015-06-09 14:39:47 +00006760static vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
6761 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006762 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006763}
6764
Bill Seurer703e8482015-06-09 14:39:47 +00006765static vector int __ATTRS_o_ai vec_srl(vector int __a,
6766 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006767 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006768}
6769
Bill Seurer703e8482015-06-09 14:39:47 +00006770static vector int __ATTRS_o_ai vec_srl(vector int __a,
6771 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006772 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006773}
6774
Bill Seurer703e8482015-06-09 14:39:47 +00006775static vector int __ATTRS_o_ai vec_srl(vector int __a,
6776 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006777 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006778}
6779
Bill Seurer703e8482015-06-09 14:39:47 +00006780static vector unsigned int __ATTRS_o_ai vec_srl(vector unsigned int __a,
6781 vector unsigned char __b) {
6782 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
6783 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006784}
6785
Bill Seurer703e8482015-06-09 14:39:47 +00006786static vector unsigned int __ATTRS_o_ai vec_srl(vector unsigned int __a,
6787 vector unsigned short __b) {
6788 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
6789 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006790}
6791
Bill Seurer703e8482015-06-09 14:39:47 +00006792static vector unsigned int __ATTRS_o_ai vec_srl(vector unsigned int __a,
6793 vector unsigned int __b) {
6794 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
6795 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006796}
6797
Bill Seurer703e8482015-06-09 14:39:47 +00006798static vector bool int __ATTRS_o_ai vec_srl(vector bool int __a,
6799 vector unsigned char __b) {
6800 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
6801 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006802}
6803
Bill Seurer703e8482015-06-09 14:39:47 +00006804static vector bool int __ATTRS_o_ai vec_srl(vector bool int __a,
6805 vector unsigned short __b) {
6806 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
6807 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006808}
6809
Bill Seurer703e8482015-06-09 14:39:47 +00006810static vector bool int __ATTRS_o_ai vec_srl(vector bool int __a,
6811 vector unsigned int __b) {
6812 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
6813 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006814}
6815
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006816/* vec_vsr */
6817
Bill Seurer703e8482015-06-09 14:39:47 +00006818static vector signed char __ATTRS_o_ai vec_vsr(vector signed char __a,
6819 vector unsigned char __b) {
6820 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
6821 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006822}
6823
Bill Seurer703e8482015-06-09 14:39:47 +00006824static vector signed char __ATTRS_o_ai vec_vsr(vector signed char __a,
6825 vector unsigned short __b) {
6826 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
6827 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006828}
6829
Bill Seurer703e8482015-06-09 14:39:47 +00006830static vector signed char __ATTRS_o_ai vec_vsr(vector signed char __a,
6831 vector unsigned int __b) {
6832 return (vector signed char)__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 char __ATTRS_o_ai vec_vsr(vector unsigned char __a,
6837 vector unsigned char __b) {
6838 return (vector unsigned char)__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 char __ATTRS_o_ai vec_vsr(vector unsigned char __a,
6843 vector unsigned short __b) {
6844 return (vector unsigned char)__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 unsigned char __ATTRS_o_ai vec_vsr(vector unsigned char __a,
6849 vector unsigned int __b) {
6850 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
6851 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006852}
6853
Bill Seurer703e8482015-06-09 14:39:47 +00006854static vector bool char __ATTRS_o_ai vec_vsr(vector bool char __a,
6855 vector unsigned char __b) {
6856 return (vector bool char)__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 char __ATTRS_o_ai vec_vsr(vector bool char __a,
6861 vector unsigned short __b) {
6862 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
6863 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006864}
6865
Bill Seurer703e8482015-06-09 14:39:47 +00006866static vector bool char __ATTRS_o_ai vec_vsr(vector bool char __a,
6867 vector unsigned int __b) {
6868 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
6869 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006870}
6871
Bill Seurer703e8482015-06-09 14:39:47 +00006872static vector short __ATTRS_o_ai vec_vsr(vector short __a,
6873 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006874 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006875}
6876
Bill Seurer703e8482015-06-09 14:39:47 +00006877static vector short __ATTRS_o_ai vec_vsr(vector short __a,
6878 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006879 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006880}
6881
Bill Seurer703e8482015-06-09 14:39:47 +00006882static vector short __ATTRS_o_ai vec_vsr(vector short __a,
6883 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006884 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006885}
6886
Bill Seurer703e8482015-06-09 14:39:47 +00006887static vector unsigned short __ATTRS_o_ai vec_vsr(vector unsigned short __a,
6888 vector unsigned char __b) {
6889 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
6890 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006891}
6892
Bill Seurer703e8482015-06-09 14:39:47 +00006893static vector unsigned short __ATTRS_o_ai vec_vsr(vector unsigned short __a,
6894 vector unsigned short __b) {
6895 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
6896 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006897}
6898
Bill Seurer703e8482015-06-09 14:39:47 +00006899static vector unsigned short __ATTRS_o_ai vec_vsr(vector unsigned short __a,
6900 vector unsigned int __b) {
6901 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
6902 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006903}
6904
Bill Seurer703e8482015-06-09 14:39:47 +00006905static vector bool short __ATTRS_o_ai vec_vsr(vector bool short __a,
6906 vector unsigned char __b) {
6907 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
6908 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006909}
6910
Bill Seurer703e8482015-06-09 14:39:47 +00006911static vector bool short __ATTRS_o_ai vec_vsr(vector bool short __a,
6912 vector unsigned short __b) {
6913 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
6914 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006915}
6916
Bill Seurer703e8482015-06-09 14:39:47 +00006917static vector bool short __ATTRS_o_ai vec_vsr(vector bool short __a,
6918 vector unsigned int __b) {
6919 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
6920 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006921}
6922
Bill Seurer703e8482015-06-09 14:39:47 +00006923static vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
6924 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006925 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006926}
6927
Bill Seurer703e8482015-06-09 14:39:47 +00006928static vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
6929 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006930 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006931}
6932
Bill Seurer703e8482015-06-09 14:39:47 +00006933static vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
6934 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006935 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006936}
6937
Bill Seurer703e8482015-06-09 14:39:47 +00006938static vector int __ATTRS_o_ai vec_vsr(vector int __a,
6939 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006940 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006941}
6942
Bill Seurer703e8482015-06-09 14:39:47 +00006943static vector int __ATTRS_o_ai vec_vsr(vector int __a,
6944 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006945 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006946}
6947
Bill Seurer703e8482015-06-09 14:39:47 +00006948static vector int __ATTRS_o_ai vec_vsr(vector int __a,
6949 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006950 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006951}
6952
Bill Seurer703e8482015-06-09 14:39:47 +00006953static vector unsigned int __ATTRS_o_ai vec_vsr(vector unsigned int __a,
6954 vector unsigned char __b) {
6955 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
6956 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006957}
6958
Bill Seurer703e8482015-06-09 14:39:47 +00006959static vector unsigned int __ATTRS_o_ai vec_vsr(vector unsigned int __a,
6960 vector unsigned short __b) {
6961 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
6962 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006963}
6964
Bill Seurer703e8482015-06-09 14:39:47 +00006965static vector unsigned int __ATTRS_o_ai vec_vsr(vector unsigned int __a,
6966 vector unsigned int __b) {
6967 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
6968 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006969}
6970
Bill Seurer703e8482015-06-09 14:39:47 +00006971static vector bool int __ATTRS_o_ai vec_vsr(vector bool int __a,
6972 vector unsigned char __b) {
6973 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
6974 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006975}
6976
Bill Seurer703e8482015-06-09 14:39:47 +00006977static vector bool int __ATTRS_o_ai vec_vsr(vector bool int __a,
6978 vector unsigned short __b) {
6979 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
6980 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006981}
6982
Bill Seurer703e8482015-06-09 14:39:47 +00006983static vector bool int __ATTRS_o_ai vec_vsr(vector bool int __a,
6984 vector unsigned int __b) {
6985 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
6986 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006987}
6988
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006989/* vec_sro */
6990
Bill Seurer703e8482015-06-09 14:39:47 +00006991static vector signed char __ATTRS_o_ai vec_sro(vector signed char __a,
6992 vector signed char __b) {
6993 return (vector signed char)__builtin_altivec_vsro((vector int)__a,
6994 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006995}
6996
Bill Seurer703e8482015-06-09 14:39:47 +00006997static vector signed char __ATTRS_o_ai vec_sro(vector signed char __a,
6998 vector unsigned char __b) {
6999 return (vector signed char)__builtin_altivec_vsro((vector int)__a,
7000 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007001}
7002
Bill Seurer703e8482015-06-09 14:39:47 +00007003static vector unsigned char __ATTRS_o_ai vec_sro(vector unsigned char __a,
7004 vector signed char __b) {
7005 return (vector unsigned char)__builtin_altivec_vsro((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 char __ATTRS_o_ai vec_sro(vector unsigned char __a,
7010 vector unsigned char __b) {
7011 return (vector unsigned char)__builtin_altivec_vsro((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 short __ATTRS_o_ai vec_sro(vector short __a,
7016 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007017 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007018}
7019
Bill Seurer703e8482015-06-09 14:39:47 +00007020static vector short __ATTRS_o_ai vec_sro(vector short __a,
7021 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007022 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007023}
7024
Bill Seurer703e8482015-06-09 14:39:47 +00007025static vector unsigned short __ATTRS_o_ai vec_sro(vector unsigned short __a,
7026 vector signed char __b) {
7027 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
7028 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007029}
7030
Bill Seurer703e8482015-06-09 14:39:47 +00007031static vector unsigned short __ATTRS_o_ai vec_sro(vector unsigned short __a,
7032 vector unsigned char __b) {
7033 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
7034 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007035}
7036
Bill Seurer703e8482015-06-09 14:39:47 +00007037static vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
7038 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007039 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007040}
7041
Bill Seurer703e8482015-06-09 14:39:47 +00007042static vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
7043 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007044 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007045}
7046
Bill Seurer703e8482015-06-09 14:39:47 +00007047static vector int __ATTRS_o_ai vec_sro(vector int __a, vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007048 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007049}
7050
Bill Seurer703e8482015-06-09 14:39:47 +00007051static vector int __ATTRS_o_ai vec_sro(vector int __a,
7052 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007053 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007054}
7055
Bill Seurer703e8482015-06-09 14:39:47 +00007056static vector unsigned int __ATTRS_o_ai vec_sro(vector unsigned int __a,
7057 vector signed char __b) {
7058 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
7059 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007060}
7061
Bill Seurer703e8482015-06-09 14:39:47 +00007062static vector unsigned int __ATTRS_o_ai vec_sro(vector unsigned int __a,
7063 vector unsigned char __b) {
7064 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
7065 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007066}
7067
Bill Seurer703e8482015-06-09 14:39:47 +00007068static vector float __ATTRS_o_ai vec_sro(vector float __a,
7069 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007070 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007071}
7072
Bill Seurer703e8482015-06-09 14:39:47 +00007073static vector float __ATTRS_o_ai vec_sro(vector float __a,
7074 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007075 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007076}
7077
7078/* vec_vsro */
7079
Bill Seurer703e8482015-06-09 14:39:47 +00007080static vector signed char __ATTRS_o_ai vec_vsro(vector signed char __a,
7081 vector signed char __b) {
7082 return (vector signed char)__builtin_altivec_vsro((vector int)__a,
7083 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007084}
7085
Bill Seurer703e8482015-06-09 14:39:47 +00007086static vector signed char __ATTRS_o_ai vec_vsro(vector signed char __a,
7087 vector unsigned char __b) {
7088 return (vector signed char)__builtin_altivec_vsro((vector int)__a,
7089 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007090}
7091
Bill Seurer703e8482015-06-09 14:39:47 +00007092static vector unsigned char __ATTRS_o_ai vec_vsro(vector unsigned char __a,
7093 vector signed char __b) {
7094 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
7095 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007096}
7097
Bill Seurer703e8482015-06-09 14:39:47 +00007098static vector unsigned char __ATTRS_o_ai vec_vsro(vector unsigned char __a,
7099 vector unsigned char __b) {
7100 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
7101 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007102}
7103
Bill Seurer703e8482015-06-09 14:39:47 +00007104static vector short __ATTRS_o_ai vec_vsro(vector short __a,
7105 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007106 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007107}
7108
Bill Seurer703e8482015-06-09 14:39:47 +00007109static vector short __ATTRS_o_ai vec_vsro(vector short __a,
7110 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007111 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007112}
7113
Bill Seurer703e8482015-06-09 14:39:47 +00007114static vector unsigned short __ATTRS_o_ai vec_vsro(vector unsigned short __a,
7115 vector signed char __b) {
7116 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
7117 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007118}
7119
Bill Seurer703e8482015-06-09 14:39:47 +00007120static vector unsigned short __ATTRS_o_ai vec_vsro(vector unsigned short __a,
7121 vector unsigned char __b) {
7122 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
7123 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007124}
7125
Bill Seurer703e8482015-06-09 14:39:47 +00007126static vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
7127 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007128 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007129}
7130
Bill Seurer703e8482015-06-09 14:39:47 +00007131static vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
7132 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007133 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007134}
7135
Bill Seurer703e8482015-06-09 14:39:47 +00007136static vector int __ATTRS_o_ai vec_vsro(vector int __a,
7137 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007138 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007139}
7140
Bill Seurer703e8482015-06-09 14:39:47 +00007141static vector int __ATTRS_o_ai vec_vsro(vector int __a,
7142 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007143 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007144}
7145
Bill Seurer703e8482015-06-09 14:39:47 +00007146static vector unsigned int __ATTRS_o_ai vec_vsro(vector unsigned int __a,
7147 vector signed char __b) {
7148 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
7149 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007150}
7151
Bill Seurer703e8482015-06-09 14:39:47 +00007152static vector unsigned int __ATTRS_o_ai vec_vsro(vector unsigned int __a,
7153 vector unsigned char __b) {
7154 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
7155 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007156}
7157
Bill Seurer703e8482015-06-09 14:39:47 +00007158static vector float __ATTRS_o_ai vec_vsro(vector float __a,
7159 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007160 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007161}
7162
Bill Seurer703e8482015-06-09 14:39:47 +00007163static vector float __ATTRS_o_ai vec_vsro(vector float __a,
7164 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007165 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007166}
7167
7168/* vec_st */
7169
Bill Seurer703e8482015-06-09 14:39:47 +00007170static void __ATTRS_o_ai vec_st(vector signed char __a, int __b,
7171 vector signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007172 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007173}
7174
Bill Seurer703e8482015-06-09 14:39:47 +00007175static void __ATTRS_o_ai vec_st(vector signed char __a, int __b,
7176 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007177 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007178}
7179
Bill Seurer703e8482015-06-09 14:39:47 +00007180static void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b,
7181 vector unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007182 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007183}
7184
Bill Seurer703e8482015-06-09 14:39:47 +00007185static void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b,
7186 unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007187 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007188}
7189
Bill Seurer703e8482015-06-09 14:39:47 +00007190static void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
7191 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007192 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007193}
7194
Bill Seurer703e8482015-06-09 14:39:47 +00007195static void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
7196 unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007197 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007198}
7199
Bill Seurer703e8482015-06-09 14:39:47 +00007200static void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
7201 vector bool char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007202 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007203}
7204
Bill Seurer703e8482015-06-09 14:39:47 +00007205static void __ATTRS_o_ai vec_st(vector short __a, int __b, vector short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007206 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007207}
7208
Bill Seurer703e8482015-06-09 14:39:47 +00007209static void __ATTRS_o_ai vec_st(vector short __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007210 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007211}
7212
Bill Seurer703e8482015-06-09 14:39:47 +00007213static void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b,
7214 vector unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007215 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007216}
7217
Bill Seurer703e8482015-06-09 14:39:47 +00007218static void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b,
7219 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007220 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007221}
7222
Bill Seurer703e8482015-06-09 14:39:47 +00007223static void __ATTRS_o_ai vec_st(vector bool short __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007224 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007225}
7226
Bill Seurer703e8482015-06-09 14:39:47 +00007227static void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
7228 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007229 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007230}
7231
Bill Seurer703e8482015-06-09 14:39:47 +00007232static void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
7233 vector bool short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007234 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007235}
7236
Bill Seurer703e8482015-06-09 14:39:47 +00007237static void __ATTRS_o_ai vec_st(vector pixel __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007238 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007239}
7240
Bill Seurer703e8482015-06-09 14:39:47 +00007241static void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
7242 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007243 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007244}
7245
Bill Seurer703e8482015-06-09 14:39:47 +00007246static void __ATTRS_o_ai vec_st(vector pixel __a, int __b, vector pixel *__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 int __a, int __b, vector int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007251 __builtin_altivec_stvx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007252}
7253
Bill Seurer703e8482015-06-09 14:39:47 +00007254static void __ATTRS_o_ai vec_st(vector int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007255 __builtin_altivec_stvx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007256}
7257
Bill Seurer703e8482015-06-09 14:39:47 +00007258static void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b,
7259 vector unsigned int *__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 int __a, int __b,
7264 unsigned int *__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 bool int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007269 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007270}
7271
Bill Seurer703e8482015-06-09 14:39:47 +00007272static void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
7273 unsigned int *__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 int __a, int __b,
7278 vector bool int *__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 float __a, int __b, vector float *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007283 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007284}
7285
Bill Seurer703e8482015-06-09 14:39:47 +00007286static void __ATTRS_o_ai vec_st(vector float __a, int __b, float *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007287 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007288}
7289
7290/* vec_stvx */
7291
Bill Seurer703e8482015-06-09 14:39:47 +00007292static void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b,
7293 vector signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007294 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007295}
7296
Bill Seurer703e8482015-06-09 14:39:47 +00007297static void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b,
7298 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007299 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007300}
7301
Bill Seurer703e8482015-06-09 14:39:47 +00007302static void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b,
7303 vector unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007304 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007305}
7306
Bill Seurer703e8482015-06-09 14:39:47 +00007307static void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b,
7308 unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007309 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007310}
7311
Bill Seurer703e8482015-06-09 14:39:47 +00007312static void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
7313 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007314 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007315}
7316
Bill Seurer703e8482015-06-09 14:39:47 +00007317static void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
7318 unsigned char *__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_stvx(vector bool char __a, int __b,
7323 vector bool char *__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_stvx(vector short __a, int __b,
7328 vector short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007329 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007330}
7331
Bill Seurer703e8482015-06-09 14:39:47 +00007332static void __ATTRS_o_ai vec_stvx(vector short __a, int __b, short *__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_stvx(vector unsigned short __a, int __b,
7337 vector unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007338 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007339}
7340
Bill Seurer703e8482015-06-09 14:39:47 +00007341static void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b,
7342 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007343 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007344}
7345
Bill Seurer703e8482015-06-09 14:39:47 +00007346static void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007347 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007348}
7349
Bill Seurer703e8482015-06-09 14:39:47 +00007350static void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
7351 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007352 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007353}
7354
Bill Seurer703e8482015-06-09 14:39:47 +00007355static void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
7356 vector bool short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007357 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007358}
7359
Bill Seurer703e8482015-06-09 14:39:47 +00007360static void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007361 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007362}
7363
Bill Seurer703e8482015-06-09 14:39:47 +00007364static void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
7365 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007366 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007367}
7368
Bill Seurer703e8482015-06-09 14:39:47 +00007369static void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
7370 vector pixel *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007371 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007372}
7373
Bill Seurer703e8482015-06-09 14:39:47 +00007374static void __ATTRS_o_ai vec_stvx(vector int __a, int __b, vector int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007375 __builtin_altivec_stvx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007376}
7377
Bill Seurer703e8482015-06-09 14:39:47 +00007378static void __ATTRS_o_ai vec_stvx(vector int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007379 __builtin_altivec_stvx(__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 unsigned int __a, int __b,
7383 vector unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007384 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007385}
7386
Bill Seurer703e8482015-06-09 14:39:47 +00007387static void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b,
7388 unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007389 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007390}
7391
Bill Seurer703e8482015-06-09 14:39:47 +00007392static void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007393 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007394}
7395
Bill Seurer703e8482015-06-09 14:39:47 +00007396static void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
7397 unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007398 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007399}
7400
Bill Seurer703e8482015-06-09 14:39:47 +00007401static void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
7402 vector bool int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007403 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007404}
7405
Bill Seurer703e8482015-06-09 14:39:47 +00007406static void __ATTRS_o_ai vec_stvx(vector float __a, int __b,
7407 vector float *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007408 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007409}
7410
Bill Seurer703e8482015-06-09 14:39:47 +00007411static void __ATTRS_o_ai vec_stvx(vector float __a, int __b, float *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007412 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007413}
7414
7415/* vec_ste */
7416
Bill Seurer703e8482015-06-09 14:39:47 +00007417static void __ATTRS_o_ai vec_ste(vector signed char __a, int __b,
7418 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007419 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007420}
7421
Bill Seurer703e8482015-06-09 14:39:47 +00007422static void __ATTRS_o_ai vec_ste(vector unsigned char __a, int __b,
7423 unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007424 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007425}
7426
Bill Seurer703e8482015-06-09 14:39:47 +00007427static void __ATTRS_o_ai vec_ste(vector bool char __a, int __b,
7428 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007429 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007430}
7431
Bill Seurer703e8482015-06-09 14:39:47 +00007432static void __ATTRS_o_ai vec_ste(vector bool char __a, int __b,
7433 unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007434 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007435}
7436
Bill Seurer703e8482015-06-09 14:39:47 +00007437static void __ATTRS_o_ai vec_ste(vector short __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007438 __builtin_altivec_stvehx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007439}
7440
Bill Seurer703e8482015-06-09 14:39:47 +00007441static void __ATTRS_o_ai vec_ste(vector unsigned short __a, int __b,
7442 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007443 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007444}
7445
Bill Seurer703e8482015-06-09 14:39:47 +00007446static void __ATTRS_o_ai vec_ste(vector bool short __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007447 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007448}
7449
Bill Seurer703e8482015-06-09 14:39:47 +00007450static void __ATTRS_o_ai vec_ste(vector bool short __a, int __b,
7451 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007452 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007453}
7454
Bill Seurer703e8482015-06-09 14:39:47 +00007455static void __ATTRS_o_ai vec_ste(vector pixel __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007456 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007457}
7458
Bill Seurer703e8482015-06-09 14:39:47 +00007459static void __ATTRS_o_ai vec_ste(vector pixel __a, int __b,
7460 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007461 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007462}
7463
Bill Seurer703e8482015-06-09 14:39:47 +00007464static void __ATTRS_o_ai vec_ste(vector int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007465 __builtin_altivec_stvewx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007466}
7467
Bill Seurer703e8482015-06-09 14:39:47 +00007468static void __ATTRS_o_ai vec_ste(vector unsigned int __a, int __b,
7469 unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007470 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007471}
7472
Bill Seurer703e8482015-06-09 14:39:47 +00007473static void __ATTRS_o_ai vec_ste(vector bool int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007474 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007475}
7476
Bill Seurer703e8482015-06-09 14:39:47 +00007477static void __ATTRS_o_ai vec_ste(vector bool int __a, int __b,
7478 unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007479 __builtin_altivec_stvewx((vector int)__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 float __a, int __b, float *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007483 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007484}
7485
7486/* vec_stvebx */
7487
Bill Seurer703e8482015-06-09 14:39:47 +00007488static void __ATTRS_o_ai vec_stvebx(vector signed char __a, int __b,
7489 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007490 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007491}
7492
Bill Seurer703e8482015-06-09 14:39:47 +00007493static void __ATTRS_o_ai vec_stvebx(vector unsigned char __a, int __b,
7494 unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007495 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007496}
7497
Bill Seurer703e8482015-06-09 14:39:47 +00007498static void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b,
7499 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007500 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007501}
7502
Bill Seurer703e8482015-06-09 14:39:47 +00007503static void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b,
7504 unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007505 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007506}
7507
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007508/* vec_stvehx */
7509
Bill Seurer703e8482015-06-09 14:39:47 +00007510static void __ATTRS_o_ai vec_stvehx(vector short __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007511 __builtin_altivec_stvehx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007512}
7513
Bill Seurer703e8482015-06-09 14:39:47 +00007514static void __ATTRS_o_ai vec_stvehx(vector unsigned short __a, int __b,
7515 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007516 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007517}
7518
Bill Seurer703e8482015-06-09 14:39:47 +00007519static void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b,
7520 short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007521 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007522}
7523
Bill Seurer703e8482015-06-09 14:39:47 +00007524static void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b,
7525 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007526 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007527}
7528
Bill Seurer703e8482015-06-09 14:39:47 +00007529static void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007530 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007531}
7532
Bill Seurer703e8482015-06-09 14:39:47 +00007533static void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b,
7534 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007535 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007536}
7537
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007538/* vec_stvewx */
7539
Bill Seurer703e8482015-06-09 14:39:47 +00007540static void __ATTRS_o_ai vec_stvewx(vector int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007541 __builtin_altivec_stvewx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007542}
7543
Bill Seurer703e8482015-06-09 14:39:47 +00007544static void __ATTRS_o_ai vec_stvewx(vector unsigned int __a, int __b,
7545 unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007546 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007547}
7548
Bill Seurer703e8482015-06-09 14:39:47 +00007549static void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007550 __builtin_altivec_stvewx((vector int)__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_stvewx(vector bool int __a, int __b,
7554 unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007555 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007556}
7557
Bill Seurer703e8482015-06-09 14:39:47 +00007558static void __ATTRS_o_ai vec_stvewx(vector float __a, int __b, float *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007559 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007560}
7561
7562/* vec_stl */
7563
Bill Seurer703e8482015-06-09 14:39:47 +00007564static void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
7565 vector signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007566 __builtin_altivec_stvxl((vector int)__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_stl(vector signed char __a, int __b,
7570 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007571 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007572}
7573
Bill Seurer703e8482015-06-09 14:39:47 +00007574static void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
7575 vector unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007576 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007577}
7578
Bill Seurer703e8482015-06-09 14:39:47 +00007579static void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
7580 unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007581 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007582}
7583
Bill Seurer703e8482015-06-09 14:39:47 +00007584static void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
7585 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007586 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007587}
7588
Bill Seurer703e8482015-06-09 14:39:47 +00007589static void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
7590 unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007591 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007592}
7593
Bill Seurer703e8482015-06-09 14:39:47 +00007594static void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
7595 vector bool char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007596 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007597}
7598
Bill Seurer703e8482015-06-09 14:39:47 +00007599static void __ATTRS_o_ai vec_stl(vector short __a, int __b, vector short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007600 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007601}
7602
Bill Seurer703e8482015-06-09 14:39:47 +00007603static void __ATTRS_o_ai vec_stl(vector short __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007604 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007605}
7606
Bill Seurer703e8482015-06-09 14:39:47 +00007607static void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
7608 vector unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007609 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007610}
7611
Bill Seurer703e8482015-06-09 14:39:47 +00007612static void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
7613 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007614 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007615}
7616
Bill Seurer703e8482015-06-09 14:39:47 +00007617static void __ATTRS_o_ai vec_stl(vector bool short __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007618 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007619}
7620
Bill Seurer703e8482015-06-09 14:39:47 +00007621static void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
7622 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007623 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007624}
7625
Bill Seurer703e8482015-06-09 14:39:47 +00007626static void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
7627 vector bool short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007628 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007629}
7630
Bill Seurer703e8482015-06-09 14:39:47 +00007631static void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007632 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007633}
7634
Bill Seurer703e8482015-06-09 14:39:47 +00007635static void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
7636 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007637 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007638}
7639
Bill Seurer703e8482015-06-09 14:39:47 +00007640static void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, vector pixel *__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 int __a, int __b, vector int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007645 __builtin_altivec_stvxl(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007646}
7647
Bill Seurer703e8482015-06-09 14:39:47 +00007648static void __ATTRS_o_ai vec_stl(vector int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007649 __builtin_altivec_stvxl(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007650}
7651
Bill Seurer703e8482015-06-09 14:39:47 +00007652static void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
7653 vector unsigned int *__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 int __a, int __b,
7658 unsigned int *__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 bool int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007663 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007664}
7665
Bill Seurer703e8482015-06-09 14:39:47 +00007666static void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
7667 unsigned int *__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 int __a, int __b,
7672 vector bool int *__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 float __a, int __b, vector float *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007677 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007678}
7679
Bill Seurer703e8482015-06-09 14:39:47 +00007680static void __ATTRS_o_ai vec_stl(vector float __a, int __b, float *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007681 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007682}
7683
7684/* vec_stvxl */
7685
Bill Seurer703e8482015-06-09 14:39:47 +00007686static void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
7687 vector signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007688 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007689}
7690
Bill Seurer703e8482015-06-09 14:39:47 +00007691static void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
7692 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007693 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007694}
7695
Bill Seurer703e8482015-06-09 14:39:47 +00007696static void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
7697 vector unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007698 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007699}
7700
Bill Seurer703e8482015-06-09 14:39:47 +00007701static void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
7702 unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007703 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007704}
7705
Bill Seurer703e8482015-06-09 14:39:47 +00007706static void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
7707 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007708 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007709}
7710
Bill Seurer703e8482015-06-09 14:39:47 +00007711static void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
7712 unsigned char *__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_stvxl(vector bool char __a, int __b,
7717 vector bool char *__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_stvxl(vector short __a, int __b,
7722 vector short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007723 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007724}
7725
Bill Seurer703e8482015-06-09 14:39:47 +00007726static void __ATTRS_o_ai vec_stvxl(vector short __a, int __b, short *__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_stvxl(vector unsigned short __a, int __b,
7731 vector unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007732 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007733}
7734
Bill Seurer703e8482015-06-09 14:39:47 +00007735static void __ATTRS_o_ai vec_stvxl(vector unsigned short __a, int __b,
7736 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007737 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007738}
7739
Bill Seurer703e8482015-06-09 14:39:47 +00007740static void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007741 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007742}
7743
Bill Seurer703e8482015-06-09 14:39:47 +00007744static void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
7745 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007746 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007747}
7748
Bill Seurer703e8482015-06-09 14:39:47 +00007749static void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
7750 vector bool short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007751 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007752}
7753
Bill Seurer703e8482015-06-09 14:39:47 +00007754static void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007755 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007756}
7757
Bill Seurer703e8482015-06-09 14:39:47 +00007758static void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
7759 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007760 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007761}
7762
Bill Seurer703e8482015-06-09 14:39:47 +00007763static void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
7764 vector pixel *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007765 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007766}
7767
Bill Seurer703e8482015-06-09 14:39:47 +00007768static void __ATTRS_o_ai vec_stvxl(vector int __a, int __b, vector int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007769 __builtin_altivec_stvxl(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007770}
7771
Bill Seurer703e8482015-06-09 14:39:47 +00007772static void __ATTRS_o_ai vec_stvxl(vector int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007773 __builtin_altivec_stvxl(__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 unsigned int __a, int __b,
7777 vector unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007778 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007779}
7780
Bill Seurer703e8482015-06-09 14:39:47 +00007781static void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
7782 unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007783 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007784}
7785
Bill Seurer703e8482015-06-09 14:39:47 +00007786static void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007787 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007788}
7789
Bill Seurer703e8482015-06-09 14:39:47 +00007790static void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
7791 unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007792 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007793}
7794
Bill Seurer703e8482015-06-09 14:39:47 +00007795static void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
7796 vector bool int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007797 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007798}
7799
Bill Seurer703e8482015-06-09 14:39:47 +00007800static void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
7801 vector float *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007802 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007803}
7804
Bill Seurer703e8482015-06-09 14:39:47 +00007805static void __ATTRS_o_ai vec_stvxl(vector float __a, int __b, float *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007806 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007807}
7808
7809/* vec_sub */
7810
Bill Seurer703e8482015-06-09 14:39:47 +00007811static vector signed char __ATTRS_o_ai vec_sub(vector signed char __a,
7812 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007813 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007814}
7815
Bill Seurer703e8482015-06-09 14:39:47 +00007816static vector signed char __ATTRS_o_ai vec_sub(vector bool char __a,
7817 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007818 return (vector signed char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007819}
7820
Bill Seurer703e8482015-06-09 14:39:47 +00007821static vector signed char __ATTRS_o_ai vec_sub(vector signed char __a,
7822 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007823 return __a - (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007824}
7825
Bill Seurer703e8482015-06-09 14:39:47 +00007826static vector unsigned char __ATTRS_o_ai vec_sub(vector unsigned char __a,
7827 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007828 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007829}
7830
Bill Seurer703e8482015-06-09 14:39:47 +00007831static vector unsigned char __ATTRS_o_ai vec_sub(vector bool char __a,
7832 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007833 return (vector unsigned char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007834}
7835
Bill Seurer703e8482015-06-09 14:39:47 +00007836static vector unsigned char __ATTRS_o_ai vec_sub(vector unsigned char __a,
7837 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007838 return __a - (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007839}
7840
Bill Seurer703e8482015-06-09 14:39:47 +00007841static vector short __ATTRS_o_ai vec_sub(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007842 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007843}
7844
Bill Seurer703e8482015-06-09 14:39:47 +00007845static vector short __ATTRS_o_ai vec_sub(vector bool short __a,
7846 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007847 return (vector short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007848}
7849
Bill Seurer703e8482015-06-09 14:39:47 +00007850static vector short __ATTRS_o_ai vec_sub(vector short __a,
7851 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007852 return __a - (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007853}
7854
Bill Seurer703e8482015-06-09 14:39:47 +00007855static vector unsigned short __ATTRS_o_ai vec_sub(vector unsigned short __a,
7856 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007857 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007858}
7859
Bill Seurer703e8482015-06-09 14:39:47 +00007860static vector unsigned short __ATTRS_o_ai vec_sub(vector bool short __a,
7861 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007862 return (vector unsigned short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007863}
7864
Bill Seurer703e8482015-06-09 14:39:47 +00007865static vector unsigned short __ATTRS_o_ai vec_sub(vector unsigned short __a,
7866 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007867 return __a - (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007868}
7869
Bill Seurer703e8482015-06-09 14:39:47 +00007870static vector int __ATTRS_o_ai vec_sub(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007871 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007872}
7873
Bill Seurer703e8482015-06-09 14:39:47 +00007874static vector int __ATTRS_o_ai vec_sub(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007875 return (vector int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007876}
7877
Bill Seurer703e8482015-06-09 14:39:47 +00007878static vector int __ATTRS_o_ai vec_sub(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007879 return __a - (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007880}
7881
Bill Seurer703e8482015-06-09 14:39:47 +00007882static vector unsigned int __ATTRS_o_ai vec_sub(vector unsigned int __a,
7883 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007884 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007885}
7886
Bill Seurer703e8482015-06-09 14:39:47 +00007887static vector unsigned int __ATTRS_o_ai vec_sub(vector bool int __a,
7888 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007889 return (vector unsigned int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007890}
7891
Bill Seurer703e8482015-06-09 14:39:47 +00007892static vector unsigned int __ATTRS_o_ai vec_sub(vector unsigned int __a,
7893 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007894 return __a - (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007895}
7896
Kit Barton5944ee212015-05-25 15:52:45 +00007897#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
Bill Seurer703e8482015-06-09 14:39:47 +00007898static vector signed __int128 __ATTRS_o_ai vec_sub(vector signed __int128 __a,
7899 vector signed __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +00007900 return __a - __b;
7901}
7902
7903static vector unsigned __int128 __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00007904vec_sub(vector unsigned __int128 __a, vector unsigned __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +00007905 return __a - __b;
7906}
7907#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
7908
Bill Seurer703e8482015-06-09 14:39:47 +00007909static vector float __ATTRS_o_ai vec_sub(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007910 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007911}
7912
7913/* vec_vsububm */
7914
7915#define __builtin_altivec_vsububm vec_vsububm
7916
Bill Seurer703e8482015-06-09 14:39:47 +00007917static vector signed char __ATTRS_o_ai vec_vsububm(vector signed char __a,
7918 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007919 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007920}
7921
Bill Seurer703e8482015-06-09 14:39:47 +00007922static vector signed char __ATTRS_o_ai vec_vsububm(vector bool char __a,
7923 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007924 return (vector signed char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007925}
7926
Bill Seurer703e8482015-06-09 14:39:47 +00007927static vector signed char __ATTRS_o_ai vec_vsububm(vector signed char __a,
7928 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007929 return __a - (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007930}
7931
Bill Seurer703e8482015-06-09 14:39:47 +00007932static vector unsigned char __ATTRS_o_ai vec_vsububm(vector unsigned char __a,
7933 vector unsigned char __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 char __ATTRS_o_ai vec_vsububm(vector bool char __a,
7938 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007939 return (vector unsigned char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007940}
7941
Bill Seurer703e8482015-06-09 14:39:47 +00007942static vector unsigned char __ATTRS_o_ai vec_vsububm(vector unsigned char __a,
7943 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007944 return __a - (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007945}
7946
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007947/* vec_vsubuhm */
7948
7949#define __builtin_altivec_vsubuhm vec_vsubuhm
7950
Bill Seurer703e8482015-06-09 14:39:47 +00007951static vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
7952 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007953 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007954}
7955
Bill Seurer703e8482015-06-09 14:39:47 +00007956static vector short __ATTRS_o_ai vec_vsubuhm(vector bool short __a,
7957 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007958 return (vector short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007959}
7960
Bill Seurer703e8482015-06-09 14:39:47 +00007961static vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
7962 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007963 return __a - (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007964}
7965
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007966static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00007967vec_vsubuhm(vector unsigned short __a, vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007968 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007969}
7970
Anton Yartsevfc83c602010-08-19 03:21:36 +00007971static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00007972vec_vsubuhm(vector bool short __a, vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007973 return (vector unsigned short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007974}
7975
Bill Seurer703e8482015-06-09 14:39:47 +00007976static vector unsigned short __ATTRS_o_ai vec_vsubuhm(vector unsigned short __a,
7977 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007978 return __a - (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007979}
7980
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007981/* vec_vsubuwm */
7982
7983#define __builtin_altivec_vsubuwm vec_vsubuwm
7984
Bill Seurer703e8482015-06-09 14:39:47 +00007985static vector int __ATTRS_o_ai vec_vsubuwm(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007986 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007987}
7988
Bill Seurer703e8482015-06-09 14:39:47 +00007989static vector int __ATTRS_o_ai vec_vsubuwm(vector bool int __a,
7990 vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007991 return (vector int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007992}
7993
Bill Seurer703e8482015-06-09 14:39:47 +00007994static vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
7995 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007996 return __a - (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007997}
7998
Bill Seurer703e8482015-06-09 14:39:47 +00007999static vector unsigned int __ATTRS_o_ai vec_vsubuwm(vector unsigned int __a,
8000 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008001 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008002}
8003
Bill Seurer703e8482015-06-09 14:39:47 +00008004static vector unsigned int __ATTRS_o_ai vec_vsubuwm(vector bool int __a,
8005 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008006 return (vector unsigned int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008007}
8008
Bill Seurer703e8482015-06-09 14:39:47 +00008009static vector unsigned int __ATTRS_o_ai vec_vsubuwm(vector unsigned int __a,
8010 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008011 return __a - (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008012}
8013
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008014/* vec_vsubfp */
8015
8016#define __builtin_altivec_vsubfp vec_vsubfp
8017
8018static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00008019vec_vsubfp(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008020 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008021}
8022
8023/* vec_subc */
8024
Bill Seurer703e8482015-06-09 14:39:47 +00008025static vector unsigned int __ATTRS_o_ai vec_subc(vector unsigned int __a,
8026 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008027 return __builtin_altivec_vsubcuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008028}
8029
Kit Barton5944ee212015-05-25 15:52:45 +00008030#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
8031static vector unsigned __int128 __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008032vec_subc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +00008033 return __builtin_altivec_vsubcuq(__a, __b);
8034}
8035
8036static vector signed __int128 __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008037vec_subc(vector signed __int128 __a, vector signed __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +00008038 return __builtin_altivec_vsubcuq(__a, __b);
8039}
8040#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
8041
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008042/* vec_vsubcuw */
8043
8044static vector unsigned int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00008045vec_vsubcuw(vector unsigned int __a, vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008046 return __builtin_altivec_vsubcuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008047}
8048
8049/* vec_subs */
8050
Bill Seurer703e8482015-06-09 14:39:47 +00008051static vector signed char __ATTRS_o_ai vec_subs(vector signed char __a,
8052 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008053 return __builtin_altivec_vsubsbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008054}
8055
Bill Seurer703e8482015-06-09 14:39:47 +00008056static vector signed char __ATTRS_o_ai vec_subs(vector bool char __a,
8057 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008058 return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008059}
8060
Bill Seurer703e8482015-06-09 14:39:47 +00008061static vector signed char __ATTRS_o_ai vec_subs(vector signed char __a,
8062 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008063 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008064}
8065
Bill Seurer703e8482015-06-09 14:39:47 +00008066static vector unsigned char __ATTRS_o_ai vec_subs(vector unsigned char __a,
8067 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008068 return __builtin_altivec_vsububs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008069}
8070
Bill Seurer703e8482015-06-09 14:39:47 +00008071static vector unsigned char __ATTRS_o_ai vec_subs(vector bool char __a,
8072 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008073 return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008074}
8075
Bill Seurer703e8482015-06-09 14:39:47 +00008076static vector unsigned char __ATTRS_o_ai vec_subs(vector unsigned char __a,
8077 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008078 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008079}
8080
Bill Seurer703e8482015-06-09 14:39:47 +00008081static vector short __ATTRS_o_ai vec_subs(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008082 return __builtin_altivec_vsubshs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008083}
8084
Bill Seurer703e8482015-06-09 14:39:47 +00008085static vector short __ATTRS_o_ai vec_subs(vector bool short __a,
8086 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008087 return __builtin_altivec_vsubshs((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008088}
8089
Bill Seurer703e8482015-06-09 14:39:47 +00008090static vector short __ATTRS_o_ai vec_subs(vector short __a,
8091 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008092 return __builtin_altivec_vsubshs(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008093}
8094
Bill Seurer703e8482015-06-09 14:39:47 +00008095static vector unsigned short __ATTRS_o_ai vec_subs(vector unsigned short __a,
8096 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008097 return __builtin_altivec_vsubuhs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008098}
8099
Bill Seurer703e8482015-06-09 14:39:47 +00008100static vector unsigned short __ATTRS_o_ai vec_subs(vector bool short __a,
8101 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008102 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008103}
8104
Bill Seurer703e8482015-06-09 14:39:47 +00008105static vector unsigned short __ATTRS_o_ai vec_subs(vector unsigned short __a,
8106 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008107 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008108}
8109
Bill Seurer703e8482015-06-09 14:39:47 +00008110static vector int __ATTRS_o_ai vec_subs(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008111 return __builtin_altivec_vsubsws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008112}
8113
Bill Seurer703e8482015-06-09 14:39:47 +00008114static vector int __ATTRS_o_ai vec_subs(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008115 return __builtin_altivec_vsubsws((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008116}
8117
Bill Seurer703e8482015-06-09 14:39:47 +00008118static vector int __ATTRS_o_ai vec_subs(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008119 return __builtin_altivec_vsubsws(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008120}
8121
Bill Seurer703e8482015-06-09 14:39:47 +00008122static vector unsigned int __ATTRS_o_ai vec_subs(vector unsigned int __a,
8123 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008124 return __builtin_altivec_vsubuws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008125}
8126
Bill Seurer703e8482015-06-09 14:39:47 +00008127static vector unsigned int __ATTRS_o_ai vec_subs(vector bool int __a,
8128 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008129 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008130}
8131
Bill Seurer703e8482015-06-09 14:39:47 +00008132static vector unsigned int __ATTRS_o_ai vec_subs(vector unsigned int __a,
8133 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008134 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008135}
8136
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008137/* vec_vsubsbs */
8138
Bill Seurer703e8482015-06-09 14:39:47 +00008139static vector signed char __ATTRS_o_ai vec_vsubsbs(vector signed char __a,
8140 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008141 return __builtin_altivec_vsubsbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008142}
8143
Bill Seurer703e8482015-06-09 14:39:47 +00008144static vector signed char __ATTRS_o_ai vec_vsubsbs(vector bool char __a,
8145 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008146 return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008147}
8148
Bill Seurer703e8482015-06-09 14:39:47 +00008149static vector signed char __ATTRS_o_ai vec_vsubsbs(vector signed char __a,
8150 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008151 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008152}
8153
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008154/* vec_vsububs */
8155
Bill Seurer703e8482015-06-09 14:39:47 +00008156static vector unsigned char __ATTRS_o_ai vec_vsububs(vector unsigned char __a,
8157 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008158 return __builtin_altivec_vsububs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008159}
8160
Bill Seurer703e8482015-06-09 14:39:47 +00008161static vector unsigned char __ATTRS_o_ai vec_vsububs(vector bool char __a,
8162 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008163 return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008164}
8165
Bill Seurer703e8482015-06-09 14:39:47 +00008166static vector unsigned char __ATTRS_o_ai vec_vsububs(vector unsigned char __a,
8167 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008168 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008169}
8170
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008171/* vec_vsubshs */
8172
Bill Seurer703e8482015-06-09 14:39:47 +00008173static vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
8174 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008175 return __builtin_altivec_vsubshs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008176}
8177
Bill Seurer703e8482015-06-09 14:39:47 +00008178static vector short __ATTRS_o_ai vec_vsubshs(vector bool short __a,
8179 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008180 return __builtin_altivec_vsubshs((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008181}
8182
Bill Seurer703e8482015-06-09 14:39:47 +00008183static vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
8184 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008185 return __builtin_altivec_vsubshs(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008186}
8187
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008188/* vec_vsubuhs */
8189
Anton Yartsevfc83c602010-08-19 03:21:36 +00008190static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008191vec_vsubuhs(vector unsigned short __a, vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008192 return __builtin_altivec_vsubuhs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008193}
8194
Anton Yartsevfc83c602010-08-19 03:21:36 +00008195static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008196vec_vsubuhs(vector bool short __a, vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008197 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008198}
8199
Bill Seurer703e8482015-06-09 14:39:47 +00008200static vector unsigned short __ATTRS_o_ai vec_vsubuhs(vector unsigned short __a,
8201 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008202 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008203}
8204
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008205/* vec_vsubsws */
8206
Bill Seurer703e8482015-06-09 14:39:47 +00008207static vector int __ATTRS_o_ai vec_vsubsws(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008208 return __builtin_altivec_vsubsws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008209}
8210
Bill Seurer703e8482015-06-09 14:39:47 +00008211static vector int __ATTRS_o_ai vec_vsubsws(vector bool int __a,
8212 vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008213 return __builtin_altivec_vsubsws((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008214}
8215
Bill Seurer703e8482015-06-09 14:39:47 +00008216static vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
8217 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008218 return __builtin_altivec_vsubsws(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008219}
8220
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008221/* vec_vsubuws */
8222
Bill Seurer703e8482015-06-09 14:39:47 +00008223static vector unsigned int __ATTRS_o_ai vec_vsubuws(vector unsigned int __a,
8224 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008225 return __builtin_altivec_vsubuws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008226}
8227
Bill Seurer703e8482015-06-09 14:39:47 +00008228static vector unsigned int __ATTRS_o_ai vec_vsubuws(vector bool int __a,
8229 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008230 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008231}
8232
Bill Seurer703e8482015-06-09 14:39:47 +00008233static vector unsigned int __ATTRS_o_ai vec_vsubuws(vector unsigned int __a,
8234 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008235 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008236}
8237
Kit Barton5944ee212015-05-25 15:52:45 +00008238#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
8239/* vec_vsubuqm */
8240
8241static vector signed __int128 __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008242vec_vsubuqm(vector signed __int128 __a, vector signed __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +00008243 return __a - __b;
8244}
8245
8246static vector unsigned __int128 __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008247vec_vsubuqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +00008248 return __a - __b;
8249}
8250
8251/* vec_vsubeuqm */
8252
8253static vector signed __int128 __ATTRS_o_ai
8254vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b,
Bill Seurer703e8482015-06-09 14:39:47 +00008255 vector signed __int128 __c) {
Kit Barton5944ee212015-05-25 15:52:45 +00008256 return __builtin_altivec_vsubeuqm(__a, __b, __c);
8257}
8258
8259static vector unsigned __int128 __ATTRS_o_ai
8260vec_vsubeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
Bill Seurer703e8482015-06-09 14:39:47 +00008261 vector unsigned __int128 __c) {
Kit Barton5944ee212015-05-25 15:52:45 +00008262 return __builtin_altivec_vsubeuqm(__a, __b, __c);
8263}
8264
8265/* vec_vsubcuq */
8266
8267static vector signed __int128 __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008268vec_vsubcuq(vector signed __int128 __a, vector signed __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +00008269 return __builtin_altivec_vsubcuq(__a, __b);
8270}
8271
8272static vector unsigned __int128 __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008273vec_vsubcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +00008274 return __builtin_altivec_vsubcuq(__a, __b);
8275}
8276
8277/* vec_vsubecuq */
8278
8279static vector signed __int128 __ATTRS_o_ai
8280vec_vsubecuq(vector signed __int128 __a, vector signed __int128 __b,
Bill Seurer703e8482015-06-09 14:39:47 +00008281 vector signed __int128 __c) {
Kit Barton5944ee212015-05-25 15:52:45 +00008282 return __builtin_altivec_vsubecuq(__a, __b, __c);
8283}
8284
8285static vector unsigned __int128 __ATTRS_o_ai
8286vec_vsubecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
Bill Seurer703e8482015-06-09 14:39:47 +00008287 vector unsigned __int128 __c) {
Kit Barton5944ee212015-05-25 15:52:45 +00008288 return __builtin_altivec_vsubecuq(__a, __b, __c);
8289}
8290#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
8291
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008292/* vec_sum4s */
8293
Bill Seurer703e8482015-06-09 14:39:47 +00008294static vector int __ATTRS_o_ai vec_sum4s(vector signed char __a,
8295 vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008296 return __builtin_altivec_vsum4sbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008297}
8298
Bill Seurer703e8482015-06-09 14:39:47 +00008299static vector unsigned int __ATTRS_o_ai vec_sum4s(vector unsigned char __a,
8300 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008301 return __builtin_altivec_vsum4ubs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008302}
8303
Bill Seurer703e8482015-06-09 14:39:47 +00008304static vector int __ATTRS_o_ai vec_sum4s(vector signed short __a,
8305 vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008306 return __builtin_altivec_vsum4shs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008307}
8308
8309/* vec_vsum4sbs */
8310
8311static vector int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00008312vec_vsum4sbs(vector signed char __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008313 return __builtin_altivec_vsum4sbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008314}
8315
8316/* vec_vsum4ubs */
8317
8318static vector unsigned int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00008319vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008320 return __builtin_altivec_vsum4ubs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008321}
8322
8323/* vec_vsum4shs */
8324
8325static vector int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00008326vec_vsum4shs(vector signed short __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008327 return __builtin_altivec_vsum4shs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008328}
8329
8330/* vec_sum2s */
8331
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008332/* The vsum2sws instruction has a big-endian bias, so that the second
8333 input vector and the result always reference big-endian elements
8334 1 and 3 (little-endian element 0 and 2). For ease of porting the
8335 programmer wants elements 1 and 3 in both cases, so for little
8336 endian we must perform some permutes. */
8337
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008338static vector signed int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00008339vec_sum2s(vector int __a, vector int __b) {
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008340#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00008341 vector int __c = (vector signed int)vec_perm(
8342 __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
8343 8, 9, 10, 11));
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008344 __c = __builtin_altivec_vsum2sws(__a, __c);
Bill Seurer703e8482015-06-09 14:39:47 +00008345 return (vector signed int)vec_perm(
8346 __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
8347 8, 9, 10, 11));
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008348#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008349 return __builtin_altivec_vsum2sws(__a, __b);
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008350#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008351}
8352
8353/* vec_vsum2sws */
8354
8355static vector signed int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00008356vec_vsum2sws(vector int __a, vector int __b) {
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008357#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00008358 vector int __c = (vector signed int)vec_perm(
8359 __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
8360 8, 9, 10, 11));
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008361 __c = __builtin_altivec_vsum2sws(__a, __c);
Bill Seurer703e8482015-06-09 14:39:47 +00008362 return (vector signed int)vec_perm(
8363 __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
8364 8, 9, 10, 11));
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008365#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008366 return __builtin_altivec_vsum2sws(__a, __b);
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008367#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008368}
8369
8370/* vec_sums */
8371
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008372/* The vsumsws instruction has a big-endian bias, so that the second
8373 input vector and the result always reference big-endian element 3
8374 (little-endian element 0). For ease of porting the programmer
8375 wants element 3 in both cases, so for little endian we must perform
8376 some permutes. */
8377
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008378static vector signed int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00008379vec_sums(vector signed int __a, vector signed int __b) {
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008380#ifdef __LITTLE_ENDIAN__
Bill Schmidtccbe0a82014-08-04 23:21:26 +00008381 __b = (vector signed int)vec_splat(__b, 3);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008382 __b = __builtin_altivec_vsumsws(__a, __b);
Bill Schmidtccbe0a82014-08-04 23:21:26 +00008383 return (vector signed int)(0, 0, 0, __b[0]);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008384#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008385 return __builtin_altivec_vsumsws(__a, __b);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008386#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008387}
8388
8389/* vec_vsumsws */
8390
8391static vector signed int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00008392vec_vsumsws(vector signed int __a, vector signed int __b) {
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008393#ifdef __LITTLE_ENDIAN__
Bill Schmidtccbe0a82014-08-04 23:21:26 +00008394 __b = (vector signed int)vec_splat(__b, 3);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008395 __b = __builtin_altivec_vsumsws(__a, __b);
Bill Schmidtccbe0a82014-08-04 23:21:26 +00008396 return (vector signed int)(0, 0, 0, __b[0]);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008397#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008398 return __builtin_altivec_vsumsws(__a, __b);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008399#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008400}
8401
8402/* vec_trunc */
8403
8404static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00008405vec_trunc(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008406 return __builtin_altivec_vrfiz(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008407}
8408
8409/* vec_vrfiz */
8410
8411static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00008412vec_vrfiz(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008413 return __builtin_altivec_vrfiz(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008414}
8415
8416/* vec_unpackh */
8417
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008418/* The vector unpack instructions all have a big-endian bias, so for
8419 little endian we must reverse the meanings of "high" and "low." */
8420
Bill Seurer703e8482015-06-09 14:39:47 +00008421static vector short __ATTRS_o_ai vec_unpackh(vector signed char __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008422#ifdef __LITTLE_ENDIAN__
8423 return __builtin_altivec_vupklsb((vector char)__a);
8424#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008425 return __builtin_altivec_vupkhsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008426#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008427}
8428
Bill Seurer703e8482015-06-09 14:39:47 +00008429static vector bool short __ATTRS_o_ai vec_unpackh(vector bool char __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008430#ifdef __LITTLE_ENDIAN__
8431 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
8432#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008433 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008434#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008435}
8436
Bill Seurer703e8482015-06-09 14:39:47 +00008437static vector int __ATTRS_o_ai vec_unpackh(vector short __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008438#ifdef __LITTLE_ENDIAN__
8439 return __builtin_altivec_vupklsh(__a);
8440#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008441 return __builtin_altivec_vupkhsh(__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008442#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008443}
8444
Bill Seurer703e8482015-06-09 14:39:47 +00008445static vector bool int __ATTRS_o_ai vec_unpackh(vector bool short __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008446#ifdef __LITTLE_ENDIAN__
8447 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
8448#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008449 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008450#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008451}
8452
Bill Seurer703e8482015-06-09 14:39:47 +00008453static vector unsigned int __ATTRS_o_ai vec_unpackh(vector pixel __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008454#ifdef __LITTLE_ENDIAN__
8455 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
8456#else
8457 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
8458#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008459}
8460
Bill Schmidt41e14c42015-05-16 01:02:25 +00008461#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +00008462static vector long long __ATTRS_o_ai vec_unpackh(vector int __a) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00008463#ifdef __LITTLE_ENDIAN__
8464 return __builtin_altivec_vupklsw(__a);
8465#else
8466 return __builtin_altivec_vupkhsw(__a);
8467#endif
8468}
8469
Bill Seurer703e8482015-06-09 14:39:47 +00008470static vector bool long long __ATTRS_o_ai vec_unpackh(vector bool int __a) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00008471#ifdef __LITTLE_ENDIAN__
8472 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
8473#else
8474 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
8475#endif
8476}
8477#endif
8478
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008479/* vec_vupkhsb */
8480
Bill Seurer703e8482015-06-09 14:39:47 +00008481static vector short __ATTRS_o_ai vec_vupkhsb(vector signed char __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008482#ifdef __LITTLE_ENDIAN__
8483 return __builtin_altivec_vupklsb((vector char)__a);
8484#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008485 return __builtin_altivec_vupkhsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008486#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008487}
8488
Bill Seurer703e8482015-06-09 14:39:47 +00008489static vector bool short __ATTRS_o_ai vec_vupkhsb(vector bool char __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008490#ifdef __LITTLE_ENDIAN__
8491 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
8492#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008493 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008494#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008495}
8496
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008497/* vec_vupkhsh */
8498
Bill Seurer703e8482015-06-09 14:39:47 +00008499static vector int __ATTRS_o_ai vec_vupkhsh(vector short __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008500#ifdef __LITTLE_ENDIAN__
8501 return __builtin_altivec_vupklsh(__a);
8502#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008503 return __builtin_altivec_vupkhsh(__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008504#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008505}
8506
Bill Seurer703e8482015-06-09 14:39:47 +00008507static vector bool int __ATTRS_o_ai vec_vupkhsh(vector bool short __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008508#ifdef __LITTLE_ENDIAN__
8509 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
8510#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008511 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008512#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008513}
8514
Bill Seurer703e8482015-06-09 14:39:47 +00008515static vector unsigned int __ATTRS_o_ai vec_vupkhsh(vector pixel __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008516#ifdef __LITTLE_ENDIAN__
8517 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
8518#else
8519 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
8520#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008521}
8522
Bill Schmidt41e14c42015-05-16 01:02:25 +00008523/* vec_vupkhsw */
8524
8525#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +00008526static vector long long __ATTRS_o_ai vec_vupkhsw(vector int __a) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00008527#ifdef __LITTLE_ENDIAN__
8528 return __builtin_altivec_vupklsw(__a);
8529#else
8530 return __builtin_altivec_vupkhsw(__a);
8531#endif
8532}
8533
Bill Seurer703e8482015-06-09 14:39:47 +00008534static vector bool long long __ATTRS_o_ai vec_vupkhsw(vector bool int __a) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00008535#ifdef __LITTLE_ENDIAN__
8536 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
8537#else
8538 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
8539#endif
8540}
8541#endif
8542
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008543/* vec_unpackl */
8544
Bill Seurer703e8482015-06-09 14:39:47 +00008545static vector short __ATTRS_o_ai vec_unpackl(vector signed char __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008546#ifdef __LITTLE_ENDIAN__
8547 return __builtin_altivec_vupkhsb((vector char)__a);
8548#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008549 return __builtin_altivec_vupklsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008550#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008551}
8552
Bill Seurer703e8482015-06-09 14:39:47 +00008553static vector bool short __ATTRS_o_ai vec_unpackl(vector bool char __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008554#ifdef __LITTLE_ENDIAN__
8555 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
8556#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008557 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008558#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008559}
8560
Bill Seurer703e8482015-06-09 14:39:47 +00008561static vector int __ATTRS_o_ai vec_unpackl(vector short __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008562#ifdef __LITTLE_ENDIAN__
8563 return __builtin_altivec_vupkhsh(__a);
8564#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008565 return __builtin_altivec_vupklsh(__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008566#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008567}
8568
Bill Seurer703e8482015-06-09 14:39:47 +00008569static vector bool int __ATTRS_o_ai vec_unpackl(vector bool short __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008570#ifdef __LITTLE_ENDIAN__
8571 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
8572#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008573 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008574#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008575}
8576
Bill Seurer703e8482015-06-09 14:39:47 +00008577static vector unsigned int __ATTRS_o_ai vec_unpackl(vector pixel __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008578#ifdef __LITTLE_ENDIAN__
8579 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
8580#else
8581 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
8582#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008583}
8584
Bill Schmidt41e14c42015-05-16 01:02:25 +00008585#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +00008586static vector long long __ATTRS_o_ai vec_unpackl(vector int __a) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00008587#ifdef __LITTLE_ENDIAN__
8588 return __builtin_altivec_vupkhsw(__a);
8589#else
8590 return __builtin_altivec_vupklsw(__a);
8591#endif
8592}
8593
Bill Seurer703e8482015-06-09 14:39:47 +00008594static vector bool long long __ATTRS_o_ai vec_unpackl(vector bool int __a) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00008595#ifdef __LITTLE_ENDIAN__
8596 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
8597#else
8598 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
8599#endif
8600}
8601#endif
8602
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008603/* vec_vupklsb */
8604
Bill Seurer703e8482015-06-09 14:39:47 +00008605static vector short __ATTRS_o_ai vec_vupklsb(vector signed char __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008606#ifdef __LITTLE_ENDIAN__
8607 return __builtin_altivec_vupkhsb((vector char)__a);
8608#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008609 return __builtin_altivec_vupklsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008610#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008611}
8612
Bill Seurer703e8482015-06-09 14:39:47 +00008613static vector bool short __ATTRS_o_ai vec_vupklsb(vector bool char __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008614#ifdef __LITTLE_ENDIAN__
8615 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
8616#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008617 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008618#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008619}
8620
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008621/* vec_vupklsh */
8622
Bill Seurer703e8482015-06-09 14:39:47 +00008623static vector int __ATTRS_o_ai vec_vupklsh(vector short __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008624#ifdef __LITTLE_ENDIAN__
8625 return __builtin_altivec_vupkhsh(__a);
8626#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008627 return __builtin_altivec_vupklsh(__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008628#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008629}
8630
Bill Seurer703e8482015-06-09 14:39:47 +00008631static vector bool int __ATTRS_o_ai vec_vupklsh(vector bool short __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008632#ifdef __LITTLE_ENDIAN__
8633 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
8634#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008635 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008636#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008637}
8638
Bill Seurer703e8482015-06-09 14:39:47 +00008639static vector unsigned int __ATTRS_o_ai vec_vupklsh(vector pixel __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008640#ifdef __LITTLE_ENDIAN__
8641 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
8642#else
8643 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
8644#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008645}
8646
Bill Schmidt41e14c42015-05-16 01:02:25 +00008647/* vec_vupklsw */
8648
8649#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +00008650static vector long long __ATTRS_o_ai vec_vupklsw(vector int __a) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00008651#ifdef __LITTLE_ENDIAN__
8652 return __builtin_altivec_vupkhsw(__a);
8653#else
8654 return __builtin_altivec_vupklsw(__a);
8655#endif
8656}
8657
Bill Seurer703e8482015-06-09 14:39:47 +00008658static vector bool long long __ATTRS_o_ai vec_vupklsw(vector bool int __a) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00008659#ifdef __LITTLE_ENDIAN__
8660 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
8661#else
8662 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
8663#endif
8664}
8665#endif
8666
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008667/* vec_vsx_ld */
8668
8669#ifdef __VSX__
8670
Bill Seurer703e8482015-06-09 14:39:47 +00008671static vector signed int __ATTRS_o_ai vec_vsx_ld(int __a,
8672 const vector signed int *__b) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008673 return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
8674}
8675
8676static vector unsigned int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008677vec_vsx_ld(int __a, const vector unsigned int *__b) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008678 return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
8679}
8680
Bill Seurer703e8482015-06-09 14:39:47 +00008681static vector float __ATTRS_o_ai vec_vsx_ld(int __a, const vector float *__b) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008682 return (vector float)__builtin_vsx_lxvw4x(__a, __b);
8683}
8684
8685static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008686vec_vsx_ld(int __a, const vector signed long long *__b) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008687 return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b);
8688}
8689
8690static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008691vec_vsx_ld(int __a, const vector unsigned long long *__b) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008692 return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b);
8693}
8694
Bill Seurer703e8482015-06-09 14:39:47 +00008695static vector double __ATTRS_o_ai vec_vsx_ld(int __a,
8696 const vector double *__b) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008697 return (vector double)__builtin_vsx_lxvd2x(__a, __b);
8698}
8699
8700#endif
8701
8702/* vec_vsx_st */
8703
8704#ifdef __VSX__
8705
Bill Seurer703e8482015-06-09 14:39:47 +00008706static void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
8707 vector signed int *__c) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008708 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
8709}
8710
Bill Seurer703e8482015-06-09 14:39:47 +00008711static void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
8712 vector unsigned int *__c) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008713 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
8714}
8715
Bill Seurer703e8482015-06-09 14:39:47 +00008716static void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
8717 vector float *__c) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008718 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
8719}
8720
Bill Seurer703e8482015-06-09 14:39:47 +00008721static void __ATTRS_o_ai vec_vsx_st(vector signed long long __a, int __b,
8722 vector signed long long *__c) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008723 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
8724}
8725
Bill Seurer703e8482015-06-09 14:39:47 +00008726static void __ATTRS_o_ai vec_vsx_st(vector unsigned long long __a, int __b,
8727 vector unsigned long long *__c) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008728 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
8729}
8730
Bill Seurer703e8482015-06-09 14:39:47 +00008731static void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
8732 vector double *__c) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008733 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
8734}
8735
8736#endif
8737
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008738/* vec_xor */
8739
8740#define __builtin_altivec_vxor vec_xor
8741
Bill Seurer703e8482015-06-09 14:39:47 +00008742static vector signed char __ATTRS_o_ai vec_xor(vector signed char __a,
8743 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008744 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008745}
8746
Bill Seurer703e8482015-06-09 14:39:47 +00008747static vector signed char __ATTRS_o_ai vec_xor(vector bool char __a,
8748 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008749 return (vector signed char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008750}
8751
Bill Seurer703e8482015-06-09 14:39:47 +00008752static vector signed char __ATTRS_o_ai vec_xor(vector signed char __a,
8753 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008754 return __a ^ (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008755}
8756
Bill Seurer703e8482015-06-09 14:39:47 +00008757static vector unsigned char __ATTRS_o_ai vec_xor(vector unsigned char __a,
8758 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008759 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008760}
8761
Bill Seurer703e8482015-06-09 14:39:47 +00008762static vector unsigned char __ATTRS_o_ai vec_xor(vector bool char __a,
8763 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008764 return (vector unsigned char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008765}
8766
Bill Seurer703e8482015-06-09 14:39:47 +00008767static vector unsigned char __ATTRS_o_ai vec_xor(vector unsigned char __a,
8768 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008769 return __a ^ (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008770}
8771
Bill Seurer703e8482015-06-09 14:39:47 +00008772static vector bool char __ATTRS_o_ai vec_xor(vector bool char __a,
8773 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008774 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008775}
8776
Bill Seurer703e8482015-06-09 14:39:47 +00008777static vector short __ATTRS_o_ai vec_xor(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008778 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008779}
8780
Bill Seurer703e8482015-06-09 14:39:47 +00008781static vector short __ATTRS_o_ai vec_xor(vector bool short __a,
8782 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008783 return (vector short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008784}
8785
Bill Seurer703e8482015-06-09 14:39:47 +00008786static vector short __ATTRS_o_ai vec_xor(vector short __a,
8787 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008788 return __a ^ (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008789}
8790
Bill Seurer703e8482015-06-09 14:39:47 +00008791static vector unsigned short __ATTRS_o_ai vec_xor(vector unsigned short __a,
8792 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008793 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008794}
8795
Bill Seurer703e8482015-06-09 14:39:47 +00008796static vector unsigned short __ATTRS_o_ai vec_xor(vector bool short __a,
8797 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008798 return (vector unsigned short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008799}
8800
Bill Seurer703e8482015-06-09 14:39:47 +00008801static vector unsigned short __ATTRS_o_ai vec_xor(vector unsigned short __a,
8802 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008803 return __a ^ (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008804}
8805
Bill Seurer703e8482015-06-09 14:39:47 +00008806static vector bool short __ATTRS_o_ai vec_xor(vector bool short __a,
8807 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008808 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008809}
8810
Bill Seurer703e8482015-06-09 14:39:47 +00008811static vector int __ATTRS_o_ai vec_xor(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008812 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008813}
8814
Bill Seurer703e8482015-06-09 14:39:47 +00008815static vector int __ATTRS_o_ai vec_xor(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008816 return (vector int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008817}
8818
Bill Seurer703e8482015-06-09 14:39:47 +00008819static vector int __ATTRS_o_ai vec_xor(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008820 return __a ^ (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008821}
8822
Bill Seurer703e8482015-06-09 14:39:47 +00008823static vector unsigned int __ATTRS_o_ai vec_xor(vector unsigned int __a,
8824 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008825 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008826}
8827
Bill Seurer703e8482015-06-09 14:39:47 +00008828static vector unsigned int __ATTRS_o_ai vec_xor(vector bool int __a,
8829 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008830 return (vector unsigned int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008831}
8832
Bill Seurer703e8482015-06-09 14:39:47 +00008833static vector unsigned int __ATTRS_o_ai vec_xor(vector unsigned int __a,
8834 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008835 return __a ^ (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008836}
8837
Bill Seurer703e8482015-06-09 14:39:47 +00008838static vector bool int __ATTRS_o_ai vec_xor(vector bool int __a,
8839 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008840 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008841}
8842
Bill Seurer703e8482015-06-09 14:39:47 +00008843static vector float __ATTRS_o_ai vec_xor(vector float __a, vector float __b) {
8844 vector unsigned int __res =
8845 (vector unsigned int)__a ^ (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00008846 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008847}
8848
Bill Seurer703e8482015-06-09 14:39:47 +00008849static vector float __ATTRS_o_ai vec_xor(vector bool int __a,
8850 vector float __b) {
8851 vector unsigned int __res =
8852 (vector unsigned int)__a ^ (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00008853 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008854}
8855
Bill Seurer703e8482015-06-09 14:39:47 +00008856static vector float __ATTRS_o_ai vec_xor(vector float __a,
8857 vector bool int __b) {
8858 vector unsigned int __res =
8859 (vector unsigned int)__a ^ (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00008860 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008861}
8862
Bill Seurer8be14f12015-06-04 18:45:44 +00008863#ifdef __VSX__
8864static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008865vec_xor(vector signed long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00008866 return __a ^ __b;
8867}
8868
8869static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008870vec_xor(vector bool long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00008871 return (vector signed long long)__a ^ __b;
8872}
8873
Bill Seurer703e8482015-06-09 14:39:47 +00008874static vector signed long long __ATTRS_o_ai vec_xor(vector signed long long __a,
8875 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00008876 return __a ^ (vector signed long long)__b;
8877}
8878
8879static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008880vec_xor(vector unsigned long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00008881 return __a ^ __b;
8882}
8883
8884static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008885vec_xor(vector bool long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00008886 return (vector unsigned long long)__a ^ __b;
8887}
8888
8889static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008890vec_xor(vector unsigned long long __a, vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00008891 return __a ^ (vector unsigned long long)__b;
8892}
8893
Bill Seurer703e8482015-06-09 14:39:47 +00008894static vector bool long long __ATTRS_o_ai vec_xor(vector bool long long __a,
8895 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00008896 return __a ^ __b;
8897}
8898#endif
8899
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008900/* vec_vxor */
8901
Bill Seurer703e8482015-06-09 14:39:47 +00008902static vector signed char __ATTRS_o_ai vec_vxor(vector signed char __a,
8903 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008904 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008905}
8906
Bill Seurer703e8482015-06-09 14:39:47 +00008907static vector signed char __ATTRS_o_ai vec_vxor(vector bool char __a,
8908 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008909 return (vector signed char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008910}
8911
Bill Seurer703e8482015-06-09 14:39:47 +00008912static vector signed char __ATTRS_o_ai vec_vxor(vector signed char __a,
8913 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008914 return __a ^ (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008915}
8916
Bill Seurer703e8482015-06-09 14:39:47 +00008917static vector unsigned char __ATTRS_o_ai vec_vxor(vector unsigned char __a,
8918 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008919 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008920}
8921
Bill Seurer703e8482015-06-09 14:39:47 +00008922static vector unsigned char __ATTRS_o_ai vec_vxor(vector bool char __a,
8923 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008924 return (vector unsigned char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008925}
8926
Bill Seurer703e8482015-06-09 14:39:47 +00008927static vector unsigned char __ATTRS_o_ai vec_vxor(vector unsigned char __a,
8928 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008929 return __a ^ (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008930}
8931
Bill Seurer703e8482015-06-09 14:39:47 +00008932static vector bool char __ATTRS_o_ai vec_vxor(vector bool char __a,
8933 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008934 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008935}
8936
Bill Seurer703e8482015-06-09 14:39:47 +00008937static vector short __ATTRS_o_ai vec_vxor(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008938 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008939}
8940
Bill Seurer703e8482015-06-09 14:39:47 +00008941static vector short __ATTRS_o_ai vec_vxor(vector bool short __a,
8942 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008943 return (vector short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008944}
8945
Bill Seurer703e8482015-06-09 14:39:47 +00008946static vector short __ATTRS_o_ai vec_vxor(vector short __a,
8947 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008948 return __a ^ (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008949}
8950
Bill Seurer703e8482015-06-09 14:39:47 +00008951static vector unsigned short __ATTRS_o_ai vec_vxor(vector unsigned short __a,
8952 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008953 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008954}
8955
Bill Seurer703e8482015-06-09 14:39:47 +00008956static vector unsigned short __ATTRS_o_ai vec_vxor(vector bool short __a,
8957 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008958 return (vector unsigned short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008959}
8960
Bill Seurer703e8482015-06-09 14:39:47 +00008961static vector unsigned short __ATTRS_o_ai vec_vxor(vector unsigned short __a,
8962 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008963 return __a ^ (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008964}
8965
Bill Seurer703e8482015-06-09 14:39:47 +00008966static vector bool short __ATTRS_o_ai vec_vxor(vector bool short __a,
8967 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008968 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008969}
8970
Bill Seurer703e8482015-06-09 14:39:47 +00008971static vector int __ATTRS_o_ai vec_vxor(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008972 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008973}
8974
Bill Seurer703e8482015-06-09 14:39:47 +00008975static vector int __ATTRS_o_ai vec_vxor(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008976 return (vector int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008977}
8978
Bill Seurer703e8482015-06-09 14:39:47 +00008979static vector int __ATTRS_o_ai vec_vxor(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008980 return __a ^ (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008981}
8982
Bill Seurer703e8482015-06-09 14:39:47 +00008983static vector unsigned int __ATTRS_o_ai vec_vxor(vector unsigned int __a,
8984 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008985 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008986}
8987
Bill Seurer703e8482015-06-09 14:39:47 +00008988static vector unsigned int __ATTRS_o_ai vec_vxor(vector bool int __a,
8989 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008990 return (vector unsigned int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008991}
8992
Bill Seurer703e8482015-06-09 14:39:47 +00008993static vector unsigned int __ATTRS_o_ai vec_vxor(vector unsigned int __a,
8994 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008995 return __a ^ (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008996}
8997
Bill Seurer703e8482015-06-09 14:39:47 +00008998static vector bool int __ATTRS_o_ai vec_vxor(vector bool int __a,
8999 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009000 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009001}
9002
Bill Seurer703e8482015-06-09 14:39:47 +00009003static vector float __ATTRS_o_ai vec_vxor(vector float __a, vector float __b) {
9004 vector unsigned int __res =
9005 (vector unsigned int)__a ^ (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00009006 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009007}
Chris Lattnerdad40622010-04-14 03:54:58 +00009008
Bill Seurer703e8482015-06-09 14:39:47 +00009009static vector float __ATTRS_o_ai vec_vxor(vector bool int __a,
9010 vector float __b) {
9011 vector unsigned int __res =
9012 (vector unsigned int)__a ^ (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00009013 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009014}
9015
Bill Seurer703e8482015-06-09 14:39:47 +00009016static vector float __ATTRS_o_ai vec_vxor(vector float __a,
9017 vector bool int __b) {
9018 vector unsigned int __res =
9019 (vector unsigned int)__a ^ (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00009020 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009021}
9022
Bill Seurer8be14f12015-06-04 18:45:44 +00009023#ifdef __VSX__
9024static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009025vec_vxor(vector signed long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00009026 return __a ^ __b;
9027}
9028
9029static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009030vec_vxor(vector bool long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00009031 return (vector signed long long)__a ^ __b;
9032}
9033
9034static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009035vec_vxor(vector signed long long __a, vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00009036 return __a ^ (vector signed long long)__b;
9037}
9038
9039static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009040vec_vxor(vector unsigned long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00009041 return __a ^ __b;
9042}
9043
9044static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009045vec_vxor(vector bool long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00009046 return (vector unsigned long long)__a ^ __b;
9047}
9048
9049static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009050vec_vxor(vector unsigned long long __a, vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00009051 return __a ^ (vector unsigned long long)__b;
9052}
9053
Bill Seurer703e8482015-06-09 14:39:47 +00009054static vector bool long long __ATTRS_o_ai vec_vxor(vector bool long long __a,
9055 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00009056 return __a ^ __b;
9057}
9058#endif
9059
Anton Yartsev79d6af32010-09-18 00:39:16 +00009060/* ------------------------ extensions for CBEA ----------------------------- */
Anton Yartsev73d40232010-10-14 14:37:46 +00009061
9062/* vec_extract */
9063
Bill Seurer703e8482015-06-09 14:39:47 +00009064static signed char __ATTRS_o_ai vec_extract(vector signed char __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009065 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009066}
9067
Bill Seurer703e8482015-06-09 14:39:47 +00009068static unsigned char __ATTRS_o_ai vec_extract(vector unsigned char __a,
9069 int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009070 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009071}
9072
Bill Seurer703e8482015-06-09 14:39:47 +00009073static short __ATTRS_o_ai vec_extract(vector short __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009074 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009075}
9076
Bill Seurer703e8482015-06-09 14:39:47 +00009077static unsigned short __ATTRS_o_ai vec_extract(vector unsigned short __a,
9078 int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009079 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009080}
9081
Bill Seurer703e8482015-06-09 14:39:47 +00009082static int __ATTRS_o_ai vec_extract(vector int __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009083 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009084}
9085
Bill Seurer703e8482015-06-09 14:39:47 +00009086static unsigned int __ATTRS_o_ai vec_extract(vector unsigned int __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009087 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009088}
9089
Bill Seurer703e8482015-06-09 14:39:47 +00009090static float __ATTRS_o_ai vec_extract(vector float __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009091 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009092}
9093
9094/* vec_insert */
9095
Bill Seurer703e8482015-06-09 14:39:47 +00009096static vector signed char __ATTRS_o_ai vec_insert(signed char __a,
9097 vector signed char __b,
9098 int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009099 __b[__c] = __a;
9100 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009101}
9102
Bill Seurer703e8482015-06-09 14:39:47 +00009103static vector unsigned char __ATTRS_o_ai vec_insert(unsigned char __a,
9104 vector unsigned char __b,
9105 int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009106 __b[__c] = __a;
9107 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009108}
9109
Bill Seurer703e8482015-06-09 14:39:47 +00009110static vector short __ATTRS_o_ai vec_insert(short __a, vector short __b,
9111 int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009112 __b[__c] = __a;
9113 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009114}
9115
Bill Seurer703e8482015-06-09 14:39:47 +00009116static vector unsigned short __ATTRS_o_ai vec_insert(unsigned short __a,
9117 vector unsigned short __b,
9118 int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009119 __b[__c] = __a;
9120 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009121}
9122
Bill Seurer703e8482015-06-09 14:39:47 +00009123static vector int __ATTRS_o_ai vec_insert(int __a, vector int __b, int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009124 __b[__c] = __a;
9125 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009126}
9127
Bill Seurer703e8482015-06-09 14:39:47 +00009128static vector unsigned int __ATTRS_o_ai vec_insert(unsigned int __a,
9129 vector unsigned int __b,
9130 int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009131 __b[__c] = __a;
9132 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009133}
9134
Bill Seurer703e8482015-06-09 14:39:47 +00009135static vector float __ATTRS_o_ai vec_insert(float __a, vector float __b,
9136 int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009137 __b[__c] = __a;
9138 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009139}
9140
9141/* vec_lvlx */
9142
Bill Seurer703e8482015-06-09 14:39:47 +00009143static vector signed char __ATTRS_o_ai vec_lvlx(int __a,
9144 const signed char *__b) {
9145 return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009146 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009147}
9148
Bill Seurer703e8482015-06-09 14:39:47 +00009149static vector signed char __ATTRS_o_ai vec_lvlx(int __a,
9150 const vector signed char *__b) {
9151 return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009152 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009153}
9154
Bill Seurer703e8482015-06-09 14:39:47 +00009155static vector unsigned char __ATTRS_o_ai vec_lvlx(int __a,
9156 const unsigned char *__b) {
9157 return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009158 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009159}
9160
9161static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009162vec_lvlx(int __a, const vector unsigned char *__b) {
9163 return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009164 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009165}
9166
Bill Seurer703e8482015-06-09 14:39:47 +00009167static vector bool char __ATTRS_o_ai vec_lvlx(int __a,
9168 const vector bool char *__b) {
9169 return vec_perm(vec_ld(__a, __b), (vector bool char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009170 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009171}
9172
Bill Seurer703e8482015-06-09 14:39:47 +00009173static vector short __ATTRS_o_ai vec_lvlx(int __a, const short *__b) {
9174 return vec_perm(vec_ld(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009175}
9176
Bill Seurer703e8482015-06-09 14:39:47 +00009177static vector short __ATTRS_o_ai vec_lvlx(int __a, const vector short *__b) {
9178 return vec_perm(vec_ld(__a, __b), (vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009179 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009180}
9181
Bill Seurer703e8482015-06-09 14:39:47 +00009182static vector unsigned short __ATTRS_o_ai vec_lvlx(int __a,
9183 const unsigned short *__b) {
9184 return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009185 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009186}
9187
9188static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009189vec_lvlx(int __a, const vector unsigned short *__b) {
9190 return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009191 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009192}
9193
Bill Seurer703e8482015-06-09 14:39:47 +00009194static vector bool short __ATTRS_o_ai vec_lvlx(int __a,
9195 const vector bool short *__b) {
9196 return vec_perm(vec_ld(__a, __b), (vector bool short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009197 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009198}
9199
Bill Seurer703e8482015-06-09 14:39:47 +00009200static vector pixel __ATTRS_o_ai vec_lvlx(int __a, const vector pixel *__b) {
9201 return vec_perm(vec_ld(__a, __b), (vector pixel)(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 int __ATTRS_o_ai vec_lvlx(int __a, const int *__b) {
9206 return vec_perm(vec_ld(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009207}
9208
Bill Seurer703e8482015-06-09 14:39:47 +00009209static vector int __ATTRS_o_ai vec_lvlx(int __a, const vector int *__b) {
9210 return vec_perm(vec_ld(__a, __b), (vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009211 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009212}
9213
Bill Seurer703e8482015-06-09 14:39:47 +00009214static vector unsigned int __ATTRS_o_ai vec_lvlx(int __a,
9215 const unsigned int *__b) {
9216 return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009217 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009218}
9219
9220static vector unsigned int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009221vec_lvlx(int __a, const vector unsigned int *__b) {
9222 return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009223 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009224}
9225
Bill Seurer703e8482015-06-09 14:39:47 +00009226static vector bool int __ATTRS_o_ai vec_lvlx(int __a,
9227 const vector bool int *__b) {
9228 return vec_perm(vec_ld(__a, __b), (vector bool int)(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 float __ATTRS_o_ai vec_lvlx(int __a, const float *__b) {
9233 return vec_perm(vec_ld(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009234}
9235
Bill Seurer703e8482015-06-09 14:39:47 +00009236static vector float __ATTRS_o_ai vec_lvlx(int __a, const vector float *__b) {
9237 return vec_perm(vec_ld(__a, __b), (vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009238 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009239}
9240
9241/* vec_lvlxl */
9242
Bill Seurer703e8482015-06-09 14:39:47 +00009243static vector signed char __ATTRS_o_ai vec_lvlxl(int __a,
9244 const signed char *__b) {
9245 return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009246 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009247}
9248
9249static vector signed char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009250vec_lvlxl(int __a, const vector signed char *__b) {
9251 return vec_perm(vec_ldl(__a, __b), (vector signed char)(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 unsigned char __ATTRS_o_ai vec_lvlxl(int __a,
9256 const unsigned char *__b) {
9257 return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009258 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009259}
9260
9261static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009262vec_lvlxl(int __a, const vector unsigned char *__b) {
9263 return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009264 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009265}
9266
Bill Seurer703e8482015-06-09 14:39:47 +00009267static vector bool char __ATTRS_o_ai vec_lvlxl(int __a,
9268 const vector bool char *__b) {
9269 return vec_perm(vec_ldl(__a, __b), (vector bool char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009270 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009271}
9272
Bill Seurer703e8482015-06-09 14:39:47 +00009273static vector short __ATTRS_o_ai vec_lvlxl(int __a, const short *__b) {
9274 return vec_perm(vec_ldl(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009275}
9276
Bill Seurer703e8482015-06-09 14:39:47 +00009277static vector short __ATTRS_o_ai vec_lvlxl(int __a, const vector short *__b) {
9278 return vec_perm(vec_ldl(__a, __b), (vector short)(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 unsigned short __ATTRS_o_ai vec_lvlxl(int __a,
9283 const unsigned short *__b) {
9284 return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009285 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009286}
9287
9288static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009289vec_lvlxl(int __a, const vector unsigned short *__b) {
9290 return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009291 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009292}
9293
Bill Seurer703e8482015-06-09 14:39:47 +00009294static vector bool short __ATTRS_o_ai vec_lvlxl(int __a,
9295 const vector bool short *__b) {
9296 return vec_perm(vec_ldl(__a, __b), (vector bool short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009297 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009298}
9299
Bill Seurer703e8482015-06-09 14:39:47 +00009300static vector pixel __ATTRS_o_ai vec_lvlxl(int __a, const vector pixel *__b) {
9301 return vec_perm(vec_ldl(__a, __b), (vector pixel)(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 int __ATTRS_o_ai vec_lvlxl(int __a, const int *__b) {
9306 return vec_perm(vec_ldl(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009307}
9308
Bill Seurer703e8482015-06-09 14:39:47 +00009309static vector int __ATTRS_o_ai vec_lvlxl(int __a, const vector int *__b) {
9310 return vec_perm(vec_ldl(__a, __b), (vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009311 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009312}
9313
Bill Seurer703e8482015-06-09 14:39:47 +00009314static vector unsigned int __ATTRS_o_ai vec_lvlxl(int __a,
9315 const unsigned int *__b) {
9316 return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009317 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009318}
9319
9320static vector unsigned int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009321vec_lvlxl(int __a, const vector unsigned int *__b) {
9322 return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009323 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009324}
9325
Bill Seurer703e8482015-06-09 14:39:47 +00009326static vector bool int __ATTRS_o_ai vec_lvlxl(int __a,
9327 const vector bool int *__b) {
9328 return vec_perm(vec_ldl(__a, __b), (vector bool int)(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 float __ATTRS_o_ai vec_lvlxl(int __a, const float *__b) {
9333 return vec_perm(vec_ldl(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009334}
9335
Bill Seurer703e8482015-06-09 14:39:47 +00009336static vector float __ATTRS_o_ai vec_lvlxl(int __a, vector float *__b) {
9337 return vec_perm(vec_ldl(__a, __b), (vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009338 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009339}
9340
9341/* vec_lvrx */
9342
Bill Seurer703e8482015-06-09 14:39:47 +00009343static vector signed char __ATTRS_o_ai vec_lvrx(int __a,
9344 const signed char *__b) {
9345 return vec_perm((vector signed char)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009346 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009347}
9348
Bill Seurer703e8482015-06-09 14:39:47 +00009349static vector signed char __ATTRS_o_ai vec_lvrx(int __a,
9350 const vector signed char *__b) {
9351 return vec_perm((vector signed char)(0), vec_ld(__a, __b),
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 unsigned char __ATTRS_o_ai vec_lvrx(int __a,
9356 const unsigned char *__b) {
9357 return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009358 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009359}
9360
9361static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009362vec_lvrx(int __a, const vector unsigned char *__b) {
9363 return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009364 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009365}
9366
Bill Seurer703e8482015-06-09 14:39:47 +00009367static vector bool char __ATTRS_o_ai vec_lvrx(int __a,
9368 const vector bool char *__b) {
9369 return vec_perm((vector bool char)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009370 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009371}
9372
Bill Seurer703e8482015-06-09 14:39:47 +00009373static vector short __ATTRS_o_ai vec_lvrx(int __a, const short *__b) {
9374 return vec_perm((vector short)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009375}
9376
Bill Seurer703e8482015-06-09 14:39:47 +00009377static vector short __ATTRS_o_ai vec_lvrx(int __a, const vector short *__b) {
9378 return vec_perm((vector short)(0), vec_ld(__a, __b),
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 unsigned short __ATTRS_o_ai vec_lvrx(int __a,
9383 const unsigned short *__b) {
9384 return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009385 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009386}
9387
9388static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009389vec_lvrx(int __a, const vector unsigned short *__b) {
9390 return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009391 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009392}
9393
Bill Seurer703e8482015-06-09 14:39:47 +00009394static vector bool short __ATTRS_o_ai vec_lvrx(int __a,
9395 const vector bool short *__b) {
9396 return vec_perm((vector bool short)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009397 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009398}
9399
Bill Seurer703e8482015-06-09 14:39:47 +00009400static vector pixel __ATTRS_o_ai vec_lvrx(int __a, const vector pixel *__b) {
9401 return vec_perm((vector pixel)(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 int __ATTRS_o_ai vec_lvrx(int __a, const int *__b) {
9406 return vec_perm((vector int)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009407}
9408
Bill Seurer703e8482015-06-09 14:39:47 +00009409static vector int __ATTRS_o_ai vec_lvrx(int __a, const vector int *__b) {
9410 return vec_perm((vector int)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009411 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009412}
9413
Bill Seurer703e8482015-06-09 14:39:47 +00009414static vector unsigned int __ATTRS_o_ai vec_lvrx(int __a,
9415 const unsigned int *__b) {
9416 return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009417 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009418}
9419
9420static vector unsigned int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009421vec_lvrx(int __a, const vector unsigned int *__b) {
9422 return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009423 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009424}
9425
Bill Seurer703e8482015-06-09 14:39:47 +00009426static vector bool int __ATTRS_o_ai vec_lvrx(int __a,
9427 const vector bool int *__b) {
9428 return vec_perm((vector bool int)(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 float __ATTRS_o_ai vec_lvrx(int __a, const float *__b) {
9433 return vec_perm((vector float)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009434}
9435
Bill Seurer703e8482015-06-09 14:39:47 +00009436static vector float __ATTRS_o_ai vec_lvrx(int __a, const vector float *__b) {
9437 return vec_perm((vector float)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009438 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009439}
9440
9441/* vec_lvrxl */
9442
Bill Seurer703e8482015-06-09 14:39:47 +00009443static vector signed char __ATTRS_o_ai vec_lvrxl(int __a,
9444 const signed char *__b) {
9445 return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009446 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009447}
9448
9449static vector signed char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009450vec_lvrxl(int __a, const vector signed char *__b) {
9451 return vec_perm((vector signed char)(0), vec_ldl(__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 unsigned char __ATTRS_o_ai vec_lvrxl(int __a,
9456 const unsigned char *__b) {
9457 return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009458 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009459}
9460
9461static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009462vec_lvrxl(int __a, const vector unsigned char *__b) {
9463 return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009464 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009465}
9466
Bill Seurer703e8482015-06-09 14:39:47 +00009467static vector bool char __ATTRS_o_ai vec_lvrxl(int __a,
9468 const vector bool char *__b) {
9469 return vec_perm((vector bool char)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009470 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009471}
9472
Bill Seurer703e8482015-06-09 14:39:47 +00009473static vector short __ATTRS_o_ai vec_lvrxl(int __a, const short *__b) {
9474 return vec_perm((vector short)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009475}
9476
Bill Seurer703e8482015-06-09 14:39:47 +00009477static vector short __ATTRS_o_ai vec_lvrxl(int __a, const vector short *__b) {
9478 return vec_perm((vector short)(0), vec_ldl(__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 unsigned short __ATTRS_o_ai vec_lvrxl(int __a,
9483 const unsigned short *__b) {
9484 return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009485 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009486}
9487
9488static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009489vec_lvrxl(int __a, const vector unsigned short *__b) {
9490 return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009491 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009492}
9493
Bill Seurer703e8482015-06-09 14:39:47 +00009494static vector bool short __ATTRS_o_ai vec_lvrxl(int __a,
9495 const vector bool short *__b) {
9496 return vec_perm((vector bool short)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009497 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009498}
9499
Bill Seurer703e8482015-06-09 14:39:47 +00009500static vector pixel __ATTRS_o_ai vec_lvrxl(int __a, const vector pixel *__b) {
9501 return vec_perm((vector pixel)(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 int __ATTRS_o_ai vec_lvrxl(int __a, const int *__b) {
9506 return vec_perm((vector int)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009507}
9508
Bill Seurer703e8482015-06-09 14:39:47 +00009509static vector int __ATTRS_o_ai vec_lvrxl(int __a, const vector int *__b) {
9510 return vec_perm((vector int)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009511 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009512}
9513
Bill Seurer703e8482015-06-09 14:39:47 +00009514static vector unsigned int __ATTRS_o_ai vec_lvrxl(int __a,
9515 const unsigned int *__b) {
9516 return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009517 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009518}
9519
9520static vector unsigned int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009521vec_lvrxl(int __a, const vector unsigned int *__b) {
9522 return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009523 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009524}
9525
Bill Seurer703e8482015-06-09 14:39:47 +00009526static vector bool int __ATTRS_o_ai vec_lvrxl(int __a,
9527 const vector bool int *__b) {
9528 return vec_perm((vector bool int)(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 float __ATTRS_o_ai vec_lvrxl(int __a, const float *__b) {
9533 return vec_perm((vector float)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009534}
9535
Bill Seurer703e8482015-06-09 14:39:47 +00009536static vector float __ATTRS_o_ai vec_lvrxl(int __a, const vector float *__b) {
9537 return vec_perm((vector float)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009538 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009539}
9540
9541/* vec_stvlx */
9542
Bill Seurer703e8482015-06-09 14:39:47 +00009543static void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
9544 signed char *__c) {
9545 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9546 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009547}
9548
Bill Seurer703e8482015-06-09 14:39:47 +00009549static void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
9550 vector signed char *__c) {
9551 return vec_st(
9552 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9553 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009554}
9555
Bill Seurer703e8482015-06-09 14:39:47 +00009556static void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
9557 unsigned char *__c) {
9558 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9559 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009560}
9561
Bill Seurer703e8482015-06-09 14:39:47 +00009562static void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
9563 vector unsigned char *__c) {
9564 return vec_st(
9565 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9566 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009567}
9568
Bill Seurer703e8482015-06-09 14:39:47 +00009569static void __ATTRS_o_ai vec_stvlx(vector bool char __a, int __b,
9570 vector bool char *__c) {
9571 return vec_st(
9572 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9573 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009574}
9575
Bill Seurer703e8482015-06-09 14:39:47 +00009576static void __ATTRS_o_ai vec_stvlx(vector short __a, int __b, short *__c) {
9577 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9578 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009579}
9580
Bill Seurer703e8482015-06-09 14:39:47 +00009581static void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
9582 vector short *__c) {
9583 return vec_st(
9584 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9585 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009586}
9587
Bill Seurer703e8482015-06-09 14:39:47 +00009588static void __ATTRS_o_ai vec_stvlx(vector unsigned short __a, int __b,
9589 unsigned short *__c) {
9590 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9591 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009592}
9593
Bill Seurer703e8482015-06-09 14:39:47 +00009594static void __ATTRS_o_ai vec_stvlx(vector unsigned short __a, int __b,
9595 vector unsigned short *__c) {
9596 return vec_st(
9597 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9598 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009599}
9600
Bill Seurer703e8482015-06-09 14:39:47 +00009601static void __ATTRS_o_ai vec_stvlx(vector bool short __a, int __b,
9602 vector bool short *__c) {
9603 return vec_st(
9604 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9605 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009606}
9607
Bill Seurer703e8482015-06-09 14:39:47 +00009608static void __ATTRS_o_ai vec_stvlx(vector pixel __a, int __b,
9609 vector pixel *__c) {
9610 return vec_st(
9611 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9612 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009613}
9614
Bill Seurer703e8482015-06-09 14:39:47 +00009615static void __ATTRS_o_ai vec_stvlx(vector int __a, int __b, int *__c) {
9616 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9617 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009618}
9619
Bill Seurer703e8482015-06-09 14:39:47 +00009620static void __ATTRS_o_ai vec_stvlx(vector int __a, int __b, vector int *__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 unsigned int __a, int __b,
9627 unsigned int *__c) {
9628 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9629 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009630}
9631
Bill Seurer703e8482015-06-09 14:39:47 +00009632static void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
9633 vector unsigned int *__c) {
9634 return vec_st(
9635 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9636 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009637}
9638
Bill Seurer703e8482015-06-09 14:39:47 +00009639static void __ATTRS_o_ai vec_stvlx(vector bool int __a, int __b,
9640 vector bool int *__c) {
9641 return vec_st(
9642 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9643 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009644}
9645
Bill Seurer703e8482015-06-09 14:39:47 +00009646static void __ATTRS_o_ai vec_stvlx(vector float __a, int __b,
9647 vector float *__c) {
9648 return vec_st(
9649 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9650 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009651}
9652
9653/* vec_stvlxl */
9654
Bill Seurer703e8482015-06-09 14:39:47 +00009655static void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
9656 signed char *__c) {
9657 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9658 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009659}
9660
Bill Seurer703e8482015-06-09 14:39:47 +00009661static void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
9662 vector signed char *__c) {
9663 return vec_stl(
9664 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9665 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009666}
9667
Bill Seurer703e8482015-06-09 14:39:47 +00009668static void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a, int __b,
9669 unsigned char *__c) {
9670 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9671 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009672}
9673
Bill Seurer703e8482015-06-09 14:39:47 +00009674static void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a, int __b,
9675 vector unsigned char *__c) {
9676 return vec_stl(
9677 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9678 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009679}
9680
Bill Seurer703e8482015-06-09 14:39:47 +00009681static void __ATTRS_o_ai vec_stvlxl(vector bool char __a, int __b,
9682 vector bool char *__c) {
9683 return vec_stl(
9684 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9685 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009686}
9687
Bill Seurer703e8482015-06-09 14:39:47 +00009688static void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b, short *__c) {
9689 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9690 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009691}
9692
Bill Seurer703e8482015-06-09 14:39:47 +00009693static void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
9694 vector short *__c) {
9695 return vec_stl(
9696 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9697 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009698}
9699
Bill Seurer703e8482015-06-09 14:39:47 +00009700static void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a, int __b,
9701 unsigned short *__c) {
9702 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9703 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009704}
9705
Bill Seurer703e8482015-06-09 14:39:47 +00009706static void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a, int __b,
9707 vector unsigned short *__c) {
9708 return vec_stl(
9709 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9710 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009711}
9712
Bill Seurer703e8482015-06-09 14:39:47 +00009713static void __ATTRS_o_ai vec_stvlxl(vector bool short __a, int __b,
9714 vector bool short *__c) {
9715 return vec_stl(
9716 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9717 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009718}
9719
Bill Seurer703e8482015-06-09 14:39:47 +00009720static void __ATTRS_o_ai vec_stvlxl(vector pixel __a, int __b,
9721 vector pixel *__c) {
9722 return vec_stl(
9723 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9724 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009725}
9726
Bill Seurer703e8482015-06-09 14:39:47 +00009727static void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b, int *__c) {
9728 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9729 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009730}
9731
Bill Seurer703e8482015-06-09 14:39:47 +00009732static void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b, vector int *__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 unsigned int __a, int __b,
9739 unsigned int *__c) {
9740 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9741 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009742}
9743
Bill Seurer703e8482015-06-09 14:39:47 +00009744static void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
9745 vector unsigned int *__c) {
9746 return vec_stl(
9747 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9748 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009749}
9750
Bill Seurer703e8482015-06-09 14:39:47 +00009751static void __ATTRS_o_ai vec_stvlxl(vector bool int __a, int __b,
9752 vector bool int *__c) {
9753 return vec_stl(
9754 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9755 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009756}
9757
Bill Seurer703e8482015-06-09 14:39:47 +00009758static void __ATTRS_o_ai vec_stvlxl(vector float __a, int __b,
9759 vector float *__c) {
9760 return vec_stl(
9761 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9762 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009763}
9764
9765/* vec_stvrx */
9766
Bill Seurer703e8482015-06-09 14:39:47 +00009767static void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
9768 signed char *__c) {
9769 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
9770 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009771}
9772
Bill Seurer703e8482015-06-09 14:39:47 +00009773static void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
9774 vector signed char *__c) {
9775 return vec_st(
9776 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9777 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009778}
9779
Bill Seurer703e8482015-06-09 14:39:47 +00009780static void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
9781 unsigned char *__c) {
9782 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
9783 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009784}
9785
Bill Seurer703e8482015-06-09 14:39:47 +00009786static void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
9787 vector unsigned char *__c) {
9788 return vec_st(
9789 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9790 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009791}
9792
Bill Seurer703e8482015-06-09 14:39:47 +00009793static void __ATTRS_o_ai vec_stvrx(vector bool char __a, int __b,
9794 vector bool char *__c) {
9795 return vec_st(
9796 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9797 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009798}
9799
Bill Seurer703e8482015-06-09 14:39:47 +00009800static void __ATTRS_o_ai vec_stvrx(vector short __a, int __b, short *__c) {
9801 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
9802 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009803}
9804
Bill Seurer703e8482015-06-09 14:39:47 +00009805static void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
9806 vector short *__c) {
9807 return vec_st(
9808 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9809 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009810}
9811
Bill Seurer703e8482015-06-09 14:39:47 +00009812static void __ATTRS_o_ai vec_stvrx(vector unsigned short __a, int __b,
9813 unsigned short *__c) {
9814 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
9815 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009816}
9817
Bill Seurer703e8482015-06-09 14:39:47 +00009818static void __ATTRS_o_ai vec_stvrx(vector unsigned short __a, int __b,
9819 vector unsigned short *__c) {
9820 return vec_st(
9821 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9822 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009823}
9824
Bill Seurer703e8482015-06-09 14:39:47 +00009825static void __ATTRS_o_ai vec_stvrx(vector bool short __a, int __b,
9826 vector bool short *__c) {
9827 return vec_st(
9828 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9829 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009830}
9831
Bill Seurer703e8482015-06-09 14:39:47 +00009832static void __ATTRS_o_ai vec_stvrx(vector pixel __a, int __b,
9833 vector pixel *__c) {
9834 return vec_st(
9835 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9836 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009837}
9838
Bill Seurer703e8482015-06-09 14:39:47 +00009839static void __ATTRS_o_ai vec_stvrx(vector int __a, int __b, int *__c) {
9840 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
9841 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009842}
9843
Bill Seurer703e8482015-06-09 14:39:47 +00009844static void __ATTRS_o_ai vec_stvrx(vector int __a, int __b, vector int *__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 unsigned int __a, int __b,
9851 unsigned int *__c) {
9852 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
9853 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009854}
9855
Bill Seurer703e8482015-06-09 14:39:47 +00009856static void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
9857 vector unsigned int *__c) {
9858 return vec_st(
9859 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9860 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009861}
9862
Bill Seurer703e8482015-06-09 14:39:47 +00009863static void __ATTRS_o_ai vec_stvrx(vector bool int __a, int __b,
9864 vector bool int *__c) {
9865 return vec_st(
9866 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9867 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009868}
9869
Bill Seurer703e8482015-06-09 14:39:47 +00009870static void __ATTRS_o_ai vec_stvrx(vector float __a, int __b,
9871 vector float *__c) {
9872 return vec_st(
9873 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9874 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009875}
9876
9877/* vec_stvrxl */
9878
Bill Seurer703e8482015-06-09 14:39:47 +00009879static void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
9880 signed char *__c) {
9881 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
9882 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009883}
9884
Bill Seurer703e8482015-06-09 14:39:47 +00009885static void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
9886 vector signed char *__c) {
9887 return vec_stl(
9888 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9889 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009890}
9891
Bill Seurer703e8482015-06-09 14:39:47 +00009892static void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a, int __b,
9893 unsigned char *__c) {
9894 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
9895 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009896}
9897
Bill Seurer703e8482015-06-09 14:39:47 +00009898static void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a, int __b,
9899 vector unsigned char *__c) {
9900 return vec_stl(
9901 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9902 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009903}
9904
Bill Seurer703e8482015-06-09 14:39:47 +00009905static void __ATTRS_o_ai vec_stvrxl(vector bool char __a, int __b,
9906 vector bool char *__c) {
9907 return vec_stl(
9908 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9909 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009910}
9911
Bill Seurer703e8482015-06-09 14:39:47 +00009912static void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b, short *__c) {
9913 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
9914 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009915}
9916
Bill Seurer703e8482015-06-09 14:39:47 +00009917static void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
9918 vector short *__c) {
9919 return vec_stl(
9920 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9921 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009922}
9923
Bill Seurer703e8482015-06-09 14:39:47 +00009924static void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a, int __b,
9925 unsigned short *__c) {
9926 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
9927 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009928}
9929
Bill Seurer703e8482015-06-09 14:39:47 +00009930static void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a, int __b,
9931 vector unsigned short *__c) {
9932 return vec_stl(
9933 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9934 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009935}
9936
Bill Seurer703e8482015-06-09 14:39:47 +00009937static void __ATTRS_o_ai vec_stvrxl(vector bool short __a, int __b,
9938 vector bool short *__c) {
9939 return vec_stl(
9940 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9941 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009942}
9943
Bill Seurer703e8482015-06-09 14:39:47 +00009944static void __ATTRS_o_ai vec_stvrxl(vector pixel __a, int __b,
9945 vector pixel *__c) {
9946 return vec_stl(
9947 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9948 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009949}
9950
Bill Seurer703e8482015-06-09 14:39:47 +00009951static void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b, int *__c) {
9952 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
9953 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009954}
9955
Bill Seurer703e8482015-06-09 14:39:47 +00009956static void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b, vector int *__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 unsigned int __a, int __b,
9963 unsigned int *__c) {
9964 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
9965 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009966}
9967
Bill Seurer703e8482015-06-09 14:39:47 +00009968static void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
9969 vector unsigned int *__c) {
9970 return vec_stl(
9971 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9972 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009973}
9974
Bill Seurer703e8482015-06-09 14:39:47 +00009975static void __ATTRS_o_ai vec_stvrxl(vector bool int __a, int __b,
9976 vector bool int *__c) {
9977 return vec_stl(
9978 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9979 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009980}
9981
Bill Seurer703e8482015-06-09 14:39:47 +00009982static void __ATTRS_o_ai vec_stvrxl(vector float __a, int __b,
9983 vector float *__c) {
9984 return vec_stl(
9985 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9986 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009987}
9988
9989/* vec_promote */
9990
Bill Seurer703e8482015-06-09 14:39:47 +00009991static vector signed char __ATTRS_o_ai vec_promote(signed char __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009992 vector signed char __res = (vector signed char)(0);
9993 __res[__b] = __a;
9994 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +00009995}
9996
Bill Seurer703e8482015-06-09 14:39:47 +00009997static vector unsigned char __ATTRS_o_ai vec_promote(unsigned char __a,
9998 int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009999 vector unsigned char __res = (vector unsigned char)(0);
10000 __res[__b] = __a;
10001 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010002}
10003
Bill Seurer703e8482015-06-09 14:39:47 +000010004static vector short __ATTRS_o_ai vec_promote(short __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010005 vector short __res = (vector short)(0);
10006 __res[__b] = __a;
10007 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010008}
10009
Bill Seurer703e8482015-06-09 14:39:47 +000010010static vector unsigned short __ATTRS_o_ai vec_promote(unsigned short __a,
10011 int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010012 vector unsigned short __res = (vector unsigned short)(0);
10013 __res[__b] = __a;
10014 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010015}
10016
Bill Seurer703e8482015-06-09 14:39:47 +000010017static vector int __ATTRS_o_ai vec_promote(int __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010018 vector int __res = (vector int)(0);
10019 __res[__b] = __a;
10020 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010021}
10022
Bill Seurer703e8482015-06-09 14:39:47 +000010023static vector unsigned int __ATTRS_o_ai vec_promote(unsigned int __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010024 vector unsigned int __res = (vector unsigned int)(0);
10025 __res[__b] = __a;
10026 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010027}
10028
Bill Seurer703e8482015-06-09 14:39:47 +000010029static vector float __ATTRS_o_ai vec_promote(float __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010030 vector float __res = (vector float)(0);
10031 __res[__b] = __a;
10032 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010033}
10034
10035/* vec_splats */
10036
Bill Seurer703e8482015-06-09 14:39:47 +000010037static vector signed char __ATTRS_o_ai vec_splats(signed char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010038 return (vector signed char)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010039}
10040
Bill Seurer703e8482015-06-09 14:39:47 +000010041static vector unsigned char __ATTRS_o_ai vec_splats(unsigned char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010042 return (vector unsigned char)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010043}
10044
Bill Seurer703e8482015-06-09 14:39:47 +000010045static vector short __ATTRS_o_ai vec_splats(short __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010046 return (vector short)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010047}
10048
Bill Seurer703e8482015-06-09 14:39:47 +000010049static vector unsigned short __ATTRS_o_ai vec_splats(unsigned short __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010050 return (vector unsigned short)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010051}
10052
Bill Seurer703e8482015-06-09 14:39:47 +000010053static vector int __ATTRS_o_ai vec_splats(int __a) { return (vector int)(__a); }
Anton Yartsev73d40232010-10-14 14:37:46 +000010054
Bill Seurer703e8482015-06-09 14:39:47 +000010055static vector unsigned int __ATTRS_o_ai vec_splats(unsigned int __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010056 return (vector unsigned int)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010057}
10058
Bill Seurer703e8482015-06-09 14:39:47 +000010059static vector float __ATTRS_o_ai vec_splats(float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010060 return (vector float)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010061}
10062
Anton Yartsev79d6af32010-09-18 00:39:16 +000010063/* ----------------------------- predicates --------------------------------- */
Chris Lattnerdad40622010-04-14 03:54:58 +000010064
Chris Lattnerdad40622010-04-14 03:54:58 +000010065/* vec_all_eq */
10066
Bill Seurer703e8482015-06-09 14:39:47 +000010067static int __ATTRS_o_ai vec_all_eq(vector signed char __a,
10068 vector signed char __b) {
10069 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
10070 (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010071}
10072
Bill Seurer703e8482015-06-09 14:39:47 +000010073static int __ATTRS_o_ai vec_all_eq(vector signed char __a,
10074 vector bool char __b) {
10075 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
10076 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010077}
10078
Bill Seurer703e8482015-06-09 14:39:47 +000010079static int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
10080 vector unsigned char __b) {
10081 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
10082 (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010083}
10084
Bill Seurer703e8482015-06-09 14:39:47 +000010085static int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
10086 vector bool char __b) {
10087 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
10088 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010089}
10090
Bill Seurer703e8482015-06-09 14:39:47 +000010091static int __ATTRS_o_ai vec_all_eq(vector bool char __a,
10092 vector signed char __b) {
10093 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
10094 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010095}
10096
Bill Seurer703e8482015-06-09 14:39:47 +000010097static int __ATTRS_o_ai vec_all_eq(vector bool char __a,
10098 vector unsigned char __b) {
10099 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
10100 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010101}
10102
Bill Seurer703e8482015-06-09 14:39:47 +000010103static int __ATTRS_o_ai vec_all_eq(vector bool char __a, vector bool char __b) {
10104 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
10105 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010106}
10107
Bill Seurer703e8482015-06-09 14:39:47 +000010108static int __ATTRS_o_ai vec_all_eq(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010109 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010110}
10111
Bill Seurer703e8482015-06-09 14:39:47 +000010112static int __ATTRS_o_ai vec_all_eq(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010113 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010114}
10115
Bill Seurer703e8482015-06-09 14:39:47 +000010116static int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
10117 vector unsigned short __b) {
10118 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
10119 (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010120}
10121
Bill Seurer703e8482015-06-09 14:39:47 +000010122static int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
10123 vector bool short __b) {
10124 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
10125 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010126}
10127
Bill Seurer703e8482015-06-09 14:39:47 +000010128static int __ATTRS_o_ai vec_all_eq(vector bool short __a, vector short __b) {
10129 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
10130 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010131}
10132
Bill Seurer703e8482015-06-09 14:39:47 +000010133static int __ATTRS_o_ai vec_all_eq(vector bool short __a,
10134 vector unsigned short __b) {
10135 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
10136 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010137}
10138
Bill Seurer703e8482015-06-09 14:39:47 +000010139static int __ATTRS_o_ai vec_all_eq(vector bool short __a,
10140 vector bool short __b) {
10141 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
10142 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010143}
10144
Bill Seurer703e8482015-06-09 14:39:47 +000010145static int __ATTRS_o_ai vec_all_eq(vector pixel __a, vector pixel __b) {
10146 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
10147 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010148}
10149
Bill Seurer703e8482015-06-09 14:39:47 +000010150static int __ATTRS_o_ai vec_all_eq(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010151 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010152}
10153
Bill Seurer703e8482015-06-09 14:39:47 +000010154static int __ATTRS_o_ai vec_all_eq(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010155 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__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 unsigned int __a,
10159 vector unsigned int __b) {
10160 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
10161 (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010162}
10163
Bill Seurer703e8482015-06-09 14:39:47 +000010164static int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
10165 vector bool int __b) {
10166 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
10167 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010168}
10169
Bill Seurer703e8482015-06-09 14:39:47 +000010170static int __ATTRS_o_ai vec_all_eq(vector bool int __a, vector int __b) {
10171 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
10172 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010173}
10174
Bill Seurer703e8482015-06-09 14:39:47 +000010175static int __ATTRS_o_ai vec_all_eq(vector bool int __a,
10176 vector unsigned int __b) {
10177 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
10178 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010179}
10180
Bill Seurer703e8482015-06-09 14:39:47 +000010181static int __ATTRS_o_ai vec_all_eq(vector bool int __a, vector bool int __b) {
10182 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
10183 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010184}
10185
Kit Barton8553bec2015-03-11 15:57:19 +000010186#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000010187static int __ATTRS_o_ai vec_all_eq(vector signed long long __a,
10188 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010189 return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, __b);
10190}
10191
Bill Seurer703e8482015-06-09 14:39:47 +000010192static int __ATTRS_o_ai vec_all_eq(vector long long __a,
10193 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010194 return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, (vector long long)__b);
10195}
10196
Bill Seurer703e8482015-06-09 14:39:47 +000010197static int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
10198 vector unsigned long long __b) {
10199 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000010200 (vector long long)__b);
10201}
10202
Bill Seurer703e8482015-06-09 14:39:47 +000010203static int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
10204 vector bool long long __b) {
10205 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000010206 (vector long long)__b);
10207}
10208
Bill Seurer703e8482015-06-09 14:39:47 +000010209static int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
10210 vector long long __b) {
10211 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000010212 (vector long long)__b);
10213}
10214
Bill Seurer703e8482015-06-09 14:39:47 +000010215static int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
10216 vector unsigned long long __b) {
10217 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000010218 (vector long long)__b);
10219}
10220
Bill Seurer703e8482015-06-09 14:39:47 +000010221static int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
10222 vector bool long long __b) {
10223 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000010224 (vector long long)__b);
10225}
10226#endif
10227
Bill Seurer703e8482015-06-09 14:39:47 +000010228static int __ATTRS_o_ai vec_all_eq(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010229 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010230}
10231
10232/* vec_all_ge */
10233
Bill Seurer703e8482015-06-09 14:39:47 +000010234static int __ATTRS_o_ai vec_all_ge(vector signed char __a,
10235 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010236 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010237}
10238
Bill Seurer703e8482015-06-09 14:39:47 +000010239static int __ATTRS_o_ai vec_all_ge(vector signed char __a,
10240 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010241 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010242}
10243
Bill Seurer703e8482015-06-09 14:39:47 +000010244static int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
10245 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010246 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010247}
10248
Bill Seurer703e8482015-06-09 14:39:47 +000010249static int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
10250 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010251 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010252}
10253
Bill Seurer703e8482015-06-09 14:39:47 +000010254static int __ATTRS_o_ai vec_all_ge(vector bool char __a,
10255 vector signed char __b) {
10256 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010257 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010258}
10259
Bill Seurer703e8482015-06-09 14:39:47 +000010260static int __ATTRS_o_ai vec_all_ge(vector bool char __a,
10261 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010262 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010263}
10264
Bill Seurer703e8482015-06-09 14:39:47 +000010265static int __ATTRS_o_ai vec_all_ge(vector bool char __a, vector bool char __b) {
10266 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010267 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010268}
10269
Bill Seurer703e8482015-06-09 14:39:47 +000010270static int __ATTRS_o_ai vec_all_ge(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010271 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010272}
10273
Bill Seurer703e8482015-06-09 14:39:47 +000010274static int __ATTRS_o_ai vec_all_ge(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010275 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010276}
10277
Bill Seurer703e8482015-06-09 14:39:47 +000010278static int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
10279 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010280 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010281}
10282
Bill Seurer703e8482015-06-09 14:39:47 +000010283static int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
10284 vector bool short __b) {
10285 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
10286 __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010287}
10288
Bill Seurer703e8482015-06-09 14:39:47 +000010289static int __ATTRS_o_ai vec_all_ge(vector bool short __a, vector short __b) {
10290 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010291 (vector unsigned short)__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 bool short __a,
10295 vector unsigned short __b) {
10296 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010297 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010298}
10299
Bill Seurer703e8482015-06-09 14:39:47 +000010300static int __ATTRS_o_ai vec_all_ge(vector bool short __a,
10301 vector bool short __b) {
10302 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
10303 (vector unsigned short)__a);
10304}
10305
10306static int __ATTRS_o_ai vec_all_ge(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010307 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010308}
10309
Bill Seurer703e8482015-06-09 14:39:47 +000010310static int __ATTRS_o_ai vec_all_ge(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010311 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010312}
10313
Bill Seurer703e8482015-06-09 14:39:47 +000010314static int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
10315 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010316 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010317}
10318
Bill Seurer703e8482015-06-09 14:39:47 +000010319static int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
10320 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010321 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010322}
10323
Bill Seurer703e8482015-06-09 14:39:47 +000010324static int __ATTRS_o_ai vec_all_ge(vector bool int __a, vector int __b) {
10325 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010326 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010327}
10328
Bill Seurer703e8482015-06-09 14:39:47 +000010329static int __ATTRS_o_ai vec_all_ge(vector bool int __a,
10330 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010331 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010332}
10333
Bill Seurer703e8482015-06-09 14:39:47 +000010334static int __ATTRS_o_ai vec_all_ge(vector bool int __a, vector bool int __b) {
10335 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010336 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010337}
10338
Kit Barton8553bec2015-03-11 15:57:19 +000010339#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000010340static int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
10341 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010342 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, __a);
10343}
Bill Seurer703e8482015-06-09 14:39:47 +000010344static int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
10345 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010346 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__b,
10347 __a);
10348}
10349
Bill Seurer703e8482015-06-09 14:39:47 +000010350static int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
10351 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010352 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, __a);
10353}
10354
Bill Seurer703e8482015-06-09 14:39:47 +000010355static int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
10356 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010357 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
10358 __a);
10359}
10360
Bill Seurer703e8482015-06-09 14:39:47 +000010361static int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
10362 vector signed long long __b) {
10363 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
Kit Barton8553bec2015-03-11 15:57:19 +000010364 (vector unsigned long long)__a);
10365}
10366
Bill Seurer703e8482015-06-09 14:39:47 +000010367static int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
10368 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010369 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b,
10370 (vector unsigned long long)__a);
10371}
10372
Bill Seurer703e8482015-06-09 14:39:47 +000010373static int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
10374 vector bool long long __b) {
10375 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
Kit Barton8553bec2015-03-11 15:57:19 +000010376 (vector unsigned long long)__a);
10377}
10378#endif
10379
Bill Seurer703e8482015-06-09 14:39:47 +000010380static int __ATTRS_o_ai vec_all_ge(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010381 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010382}
10383
10384/* vec_all_gt */
10385
Bill Seurer703e8482015-06-09 14:39:47 +000010386static int __ATTRS_o_ai vec_all_gt(vector signed char __a,
10387 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010388 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010389}
10390
Bill Seurer703e8482015-06-09 14:39:47 +000010391static int __ATTRS_o_ai vec_all_gt(vector signed char __a,
10392 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010393 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010394}
10395
Bill Seurer703e8482015-06-09 14:39:47 +000010396static int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
10397 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010398 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010399}
10400
Bill Seurer703e8482015-06-09 14:39:47 +000010401static int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
10402 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010403 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010404}
10405
Bill Seurer703e8482015-06-09 14:39:47 +000010406static int __ATTRS_o_ai vec_all_gt(vector bool char __a,
10407 vector signed char __b) {
10408 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010409 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010410}
10411
Bill Seurer703e8482015-06-09 14:39:47 +000010412static int __ATTRS_o_ai vec_all_gt(vector bool char __a,
10413 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010414 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010415}
10416
Bill Seurer703e8482015-06-09 14:39:47 +000010417static int __ATTRS_o_ai vec_all_gt(vector bool char __a, vector bool char __b) {
10418 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010419 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010420}
10421
Bill Seurer703e8482015-06-09 14:39:47 +000010422static int __ATTRS_o_ai vec_all_gt(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010423 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010424}
10425
Bill Seurer703e8482015-06-09 14:39:47 +000010426static int __ATTRS_o_ai vec_all_gt(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010427 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010428}
10429
Bill Seurer703e8482015-06-09 14:39:47 +000010430static int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
10431 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010432 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010433}
10434
Bill Seurer703e8482015-06-09 14:39:47 +000010435static int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
10436 vector bool short __b) {
10437 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010438 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010439}
10440
Bill Seurer703e8482015-06-09 14:39:47 +000010441static int __ATTRS_o_ai vec_all_gt(vector bool short __a, vector short __b) {
10442 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010443 (vector unsigned short)__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 bool short __a,
10447 vector unsigned short __b) {
10448 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
10449 __b);
10450}
10451
10452static int __ATTRS_o_ai vec_all_gt(vector bool short __a,
10453 vector bool short __b) {
10454 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
10455 (vector unsigned short)__b);
10456}
10457
10458static int __ATTRS_o_ai vec_all_gt(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010459 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010460}
10461
Bill Seurer703e8482015-06-09 14:39:47 +000010462static int __ATTRS_o_ai vec_all_gt(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010463 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010464}
10465
Bill Seurer703e8482015-06-09 14:39:47 +000010466static int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
10467 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010468 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010469}
10470
Bill Seurer703e8482015-06-09 14:39:47 +000010471static int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
10472 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010473 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010474}
10475
Bill Seurer703e8482015-06-09 14:39:47 +000010476static int __ATTRS_o_ai vec_all_gt(vector bool int __a, vector int __b) {
10477 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010478 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010479}
10480
Bill Seurer703e8482015-06-09 14:39:47 +000010481static int __ATTRS_o_ai vec_all_gt(vector bool int __a,
10482 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010483 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010484}
10485
Bill Seurer703e8482015-06-09 14:39:47 +000010486static int __ATTRS_o_ai vec_all_gt(vector bool int __a, vector bool int __b) {
10487 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010488 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010489}
10490
Kit Barton8553bec2015-03-11 15:57:19 +000010491#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000010492static int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
10493 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010494 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, __b);
10495}
Bill Seurer703e8482015-06-09 14:39:47 +000010496static int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
10497 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010498 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a,
10499 (vector signed long long)__b);
10500}
10501
Bill Seurer703e8482015-06-09 14:39:47 +000010502static int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
10503 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010504 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, __b);
10505}
10506
Bill Seurer703e8482015-06-09 14:39:47 +000010507static int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
10508 vector bool long long __b) {
10509 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a,
Kit Barton8553bec2015-03-11 15:57:19 +000010510 (vector unsigned long long)__b);
10511}
10512
Bill Seurer703e8482015-06-09 14:39:47 +000010513static int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
10514 vector signed long long __b) {
10515 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000010516 (vector unsigned long long)__b);
10517}
10518
Bill Seurer703e8482015-06-09 14:39:47 +000010519static int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
10520 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010521 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
10522 __b);
10523}
10524
Bill Seurer703e8482015-06-09 14:39:47 +000010525static int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
10526 vector bool long long __b) {
10527 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000010528 (vector unsigned long long)__b);
10529}
10530#endif
10531
Bill Seurer703e8482015-06-09 14:39:47 +000010532static int __ATTRS_o_ai vec_all_gt(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010533 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010534}
10535
10536/* vec_all_in */
10537
10538static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000010539vec_all_in(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010540 return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010541}
10542
10543/* vec_all_le */
10544
Bill Seurer703e8482015-06-09 14:39:47 +000010545static int __ATTRS_o_ai vec_all_le(vector signed char __a,
10546 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010547 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010548}
10549
Bill Seurer703e8482015-06-09 14:39:47 +000010550static int __ATTRS_o_ai vec_all_le(vector signed char __a,
10551 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010552 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010553}
10554
Bill Seurer703e8482015-06-09 14:39:47 +000010555static int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
10556 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010557 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010558}
10559
Bill Seurer703e8482015-06-09 14:39:47 +000010560static int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
10561 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010562 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010563}
10564
Bill Seurer703e8482015-06-09 14:39:47 +000010565static int __ATTRS_o_ai vec_all_le(vector bool char __a,
10566 vector signed char __b) {
10567 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010568 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010569}
10570
Bill Seurer703e8482015-06-09 14:39:47 +000010571static int __ATTRS_o_ai vec_all_le(vector bool char __a,
10572 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010573 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010574}
10575
Bill Seurer703e8482015-06-09 14:39:47 +000010576static int __ATTRS_o_ai vec_all_le(vector bool char __a, vector bool char __b) {
10577 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010578 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010579}
10580
Bill Seurer703e8482015-06-09 14:39:47 +000010581static int __ATTRS_o_ai vec_all_le(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010582 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010583}
10584
Bill Seurer703e8482015-06-09 14:39:47 +000010585static int __ATTRS_o_ai vec_all_le(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010586 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010587}
10588
Bill Seurer703e8482015-06-09 14:39:47 +000010589static int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
10590 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010591 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010592}
10593
Bill Seurer703e8482015-06-09 14:39:47 +000010594static int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
10595 vector bool short __b) {
10596 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010597 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010598}
10599
Bill Seurer703e8482015-06-09 14:39:47 +000010600static int __ATTRS_o_ai vec_all_le(vector bool short __a, vector short __b) {
10601 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010602 (vector unsigned short)__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 bool short __a,
10606 vector unsigned short __b) {
10607 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
10608 __b);
10609}
10610
10611static int __ATTRS_o_ai vec_all_le(vector bool short __a,
10612 vector bool short __b) {
10613 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
10614 (vector unsigned short)__b);
10615}
10616
10617static int __ATTRS_o_ai vec_all_le(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010618 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010619}
10620
Bill Seurer703e8482015-06-09 14:39:47 +000010621static int __ATTRS_o_ai vec_all_le(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010622 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010623}
10624
Bill Seurer703e8482015-06-09 14:39:47 +000010625static int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
10626 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010627 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010628}
10629
Bill Seurer703e8482015-06-09 14:39:47 +000010630static int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
10631 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010632 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010633}
10634
Bill Seurer703e8482015-06-09 14:39:47 +000010635static int __ATTRS_o_ai vec_all_le(vector bool int __a, vector int __b) {
10636 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010637 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010638}
10639
Bill Seurer703e8482015-06-09 14:39:47 +000010640static int __ATTRS_o_ai vec_all_le(vector bool int __a,
10641 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010642 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010643}
10644
Bill Seurer703e8482015-06-09 14:39:47 +000010645static int __ATTRS_o_ai vec_all_le(vector bool int __a, vector bool int __b) {
10646 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010647 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010648}
10649
Kit Barton8553bec2015-03-11 15:57:19 +000010650#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000010651static int __ATTRS_o_ai vec_all_le(vector signed long long __a,
10652 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010653 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, __b);
10654}
10655
Bill Seurer703e8482015-06-09 14:39:47 +000010656static int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
10657 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010658 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, __b);
10659}
10660
Bill Seurer703e8482015-06-09 14:39:47 +000010661static int __ATTRS_o_ai vec_all_le(vector signed long long __a,
10662 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010663 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a,
10664 (vector signed long long)__b);
10665}
10666
Bill Seurer703e8482015-06-09 14:39:47 +000010667static int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
10668 vector bool long long __b) {
10669 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a,
Kit Barton8553bec2015-03-11 15:57:19 +000010670 (vector unsigned long long)__b);
10671}
10672
Bill Seurer703e8482015-06-09 14:39:47 +000010673static int __ATTRS_o_ai vec_all_le(vector bool long long __a,
10674 vector signed long long __b) {
10675 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000010676 (vector unsigned long long)__b);
10677}
10678
Bill Seurer703e8482015-06-09 14:39:47 +000010679static int __ATTRS_o_ai vec_all_le(vector bool long long __a,
10680 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010681 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
10682 __b);
10683}
10684
Bill Seurer703e8482015-06-09 14:39:47 +000010685static int __ATTRS_o_ai vec_all_le(vector bool long long __a,
10686 vector bool long long __b) {
10687 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000010688 (vector unsigned long long)__b);
10689}
10690#endif
10691
Bill Seurer703e8482015-06-09 14:39:47 +000010692static int __ATTRS_o_ai vec_all_le(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010693 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010694}
10695
10696/* vec_all_lt */
10697
Bill Seurer703e8482015-06-09 14:39:47 +000010698static int __ATTRS_o_ai vec_all_lt(vector signed char __a,
10699 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010700 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010701}
10702
Bill Seurer703e8482015-06-09 14:39:47 +000010703static int __ATTRS_o_ai vec_all_lt(vector signed char __a,
10704 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010705 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010706}
10707
Bill Seurer703e8482015-06-09 14:39:47 +000010708static int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
10709 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010710 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010711}
10712
Bill Seurer703e8482015-06-09 14:39:47 +000010713static int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
10714 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010715 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010716}
10717
Bill Seurer703e8482015-06-09 14:39:47 +000010718static int __ATTRS_o_ai vec_all_lt(vector bool char __a,
10719 vector signed char __b) {
10720 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010721 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010722}
10723
Bill Seurer703e8482015-06-09 14:39:47 +000010724static int __ATTRS_o_ai vec_all_lt(vector bool char __a,
10725 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010726 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010727}
10728
Bill Seurer703e8482015-06-09 14:39:47 +000010729static int __ATTRS_o_ai vec_all_lt(vector bool char __a, vector bool char __b) {
10730 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010731 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010732}
10733
Bill Seurer703e8482015-06-09 14:39:47 +000010734static int __ATTRS_o_ai vec_all_lt(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010735 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010736}
10737
Bill Seurer703e8482015-06-09 14:39:47 +000010738static int __ATTRS_o_ai vec_all_lt(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010739 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010740}
10741
Bill Seurer703e8482015-06-09 14:39:47 +000010742static int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
10743 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010744 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010745}
10746
Bill Seurer703e8482015-06-09 14:39:47 +000010747static int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
10748 vector bool short __b) {
10749 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
10750 __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010751}
10752
Bill Seurer703e8482015-06-09 14:39:47 +000010753static int __ATTRS_o_ai vec_all_lt(vector bool short __a, vector short __b) {
10754 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010755 (vector unsigned short)__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 bool short __a,
10759 vector unsigned short __b) {
10760 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010761 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010762}
10763
Bill Seurer703e8482015-06-09 14:39:47 +000010764static int __ATTRS_o_ai vec_all_lt(vector bool short __a,
10765 vector bool short __b) {
10766 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
10767 (vector unsigned short)__a);
10768}
10769
10770static int __ATTRS_o_ai vec_all_lt(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010771 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010772}
10773
Bill Seurer703e8482015-06-09 14:39:47 +000010774static int __ATTRS_o_ai vec_all_lt(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010775 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010776}
10777
Bill Seurer703e8482015-06-09 14:39:47 +000010778static int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
10779 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010780 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010781}
10782
Bill Seurer703e8482015-06-09 14:39:47 +000010783static int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
10784 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010785 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010786}
10787
Bill Seurer703e8482015-06-09 14:39:47 +000010788static int __ATTRS_o_ai vec_all_lt(vector bool int __a, vector int __b) {
10789 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010790 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010791}
10792
Bill Seurer703e8482015-06-09 14:39:47 +000010793static int __ATTRS_o_ai vec_all_lt(vector bool int __a,
10794 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010795 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010796}
10797
Bill Seurer703e8482015-06-09 14:39:47 +000010798static int __ATTRS_o_ai vec_all_lt(vector bool int __a, vector bool int __b) {
10799 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010800 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010801}
10802
Kit Barton8553bec2015-03-11 15:57:19 +000010803#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000010804static int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
10805 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010806 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, __a);
10807}
10808
Bill Seurer703e8482015-06-09 14:39:47 +000010809static int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
10810 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010811 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, __a);
10812}
10813
Bill Seurer703e8482015-06-09 14:39:47 +000010814static int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
10815 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010816 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__b,
10817 __a);
10818}
10819
Bill Seurer703e8482015-06-09 14:39:47 +000010820static int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
10821 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010822 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
10823 __a);
10824}
10825
Bill Seurer703e8482015-06-09 14:39:47 +000010826static int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
10827 vector signed long long __b) {
10828 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
Kit Barton8553bec2015-03-11 15:57:19 +000010829 (vector unsigned long long)__a);
10830}
10831
Bill Seurer703e8482015-06-09 14:39:47 +000010832static int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
10833 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010834 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b,
10835 (vector unsigned long long)__a);
10836}
10837
Bill Seurer703e8482015-06-09 14:39:47 +000010838static int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
10839 vector bool long long __b) {
10840 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
Kit Barton8553bec2015-03-11 15:57:19 +000010841 (vector unsigned long long)__a);
10842}
10843#endif
10844
Bill Seurer703e8482015-06-09 14:39:47 +000010845static int __ATTRS_o_ai vec_all_lt(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010846 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010847}
10848
10849/* vec_all_nan */
10850
Bill Seurer703e8482015-06-09 14:39:47 +000010851static int __attribute__((__always_inline__)) vec_all_nan(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010852 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010853}
10854
10855/* vec_all_ne */
10856
Bill Seurer703e8482015-06-09 14:39:47 +000010857static int __ATTRS_o_ai vec_all_ne(vector signed char __a,
10858 vector signed char __b) {
10859 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
10860 (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010861}
10862
Bill Seurer703e8482015-06-09 14:39:47 +000010863static int __ATTRS_o_ai vec_all_ne(vector signed char __a,
10864 vector bool char __b) {
10865 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
10866 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010867}
10868
Bill Seurer703e8482015-06-09 14:39:47 +000010869static int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
10870 vector unsigned char __b) {
10871 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
10872 (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010873}
10874
Bill Seurer703e8482015-06-09 14:39:47 +000010875static int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
10876 vector bool char __b) {
10877 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
10878 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010879}
10880
Bill Seurer703e8482015-06-09 14:39:47 +000010881static int __ATTRS_o_ai vec_all_ne(vector bool char __a,
10882 vector signed char __b) {
10883 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
10884 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010885}
10886
Bill Seurer703e8482015-06-09 14:39:47 +000010887static int __ATTRS_o_ai vec_all_ne(vector bool char __a,
10888 vector unsigned char __b) {
10889 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
10890 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010891}
10892
Bill Seurer703e8482015-06-09 14:39:47 +000010893static int __ATTRS_o_ai vec_all_ne(vector bool char __a, vector bool char __b) {
10894 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
10895 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010896}
10897
Bill Seurer703e8482015-06-09 14:39:47 +000010898static int __ATTRS_o_ai vec_all_ne(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010899 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010900}
10901
Bill Seurer703e8482015-06-09 14:39:47 +000010902static int __ATTRS_o_ai vec_all_ne(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010903 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010904}
10905
Bill Seurer703e8482015-06-09 14:39:47 +000010906static int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
10907 vector unsigned short __b) {
10908 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
10909 (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010910}
10911
Bill Seurer703e8482015-06-09 14:39:47 +000010912static int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
10913 vector bool short __b) {
10914 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
10915 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010916}
10917
Bill Seurer703e8482015-06-09 14:39:47 +000010918static int __ATTRS_o_ai vec_all_ne(vector bool short __a, vector short __b) {
10919 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
10920 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010921}
10922
Bill Seurer703e8482015-06-09 14:39:47 +000010923static int __ATTRS_o_ai vec_all_ne(vector bool short __a,
10924 vector unsigned short __b) {
10925 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
10926 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010927}
10928
Bill Seurer703e8482015-06-09 14:39:47 +000010929static int __ATTRS_o_ai vec_all_ne(vector bool short __a,
10930 vector bool short __b) {
10931 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
10932 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010933}
10934
Bill Seurer703e8482015-06-09 14:39:47 +000010935static int __ATTRS_o_ai vec_all_ne(vector pixel __a, vector pixel __b) {
10936 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
10937 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010938}
10939
Bill Seurer703e8482015-06-09 14:39:47 +000010940static int __ATTRS_o_ai vec_all_ne(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010941 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010942}
10943
Bill Seurer703e8482015-06-09 14:39:47 +000010944static int __ATTRS_o_ai vec_all_ne(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010945 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__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 unsigned int __a,
10949 vector unsigned int __b) {
10950 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
10951 (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010952}
10953
Bill Seurer703e8482015-06-09 14:39:47 +000010954static int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
10955 vector bool int __b) {
10956 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
10957 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010958}
10959
Bill Seurer703e8482015-06-09 14:39:47 +000010960static int __ATTRS_o_ai vec_all_ne(vector bool int __a, vector int __b) {
10961 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
10962 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010963}
10964
Bill Seurer703e8482015-06-09 14:39:47 +000010965static int __ATTRS_o_ai vec_all_ne(vector bool int __a,
10966 vector unsigned int __b) {
10967 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
10968 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010969}
10970
Bill Seurer703e8482015-06-09 14:39:47 +000010971static int __ATTRS_o_ai vec_all_ne(vector bool int __a, vector bool int __b) {
10972 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
10973 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010974}
10975
Kit Barton8553bec2015-03-11 15:57:19 +000010976#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000010977static int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
10978 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010979 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, __b);
10980}
10981
Bill Seurer703e8482015-06-09 14:39:47 +000010982static int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
10983 vector unsigned long long __b) {
10984 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000010985 (vector long long)__b);
10986}
10987
Bill Seurer703e8482015-06-09 14:39:47 +000010988static int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
10989 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010990 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a,
10991 (vector signed long long)__b);
10992}
10993
Bill Seurer703e8482015-06-09 14:39:47 +000010994static int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
10995 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010996 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
10997 (vector signed long long)__b);
10998}
10999
Bill Seurer703e8482015-06-09 14:39:47 +000011000static int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
11001 vector signed long long __b) {
11002 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000011003 (vector signed long long)__b);
11004}
11005
Bill Seurer703e8482015-06-09 14:39:47 +000011006static int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
11007 vector unsigned long long __b) {
11008 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
11009 (vector signed long long)__b);
11010}
11011
11012static int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
11013 vector bool long long __b) {
11014 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000011015 (vector signed long long)__b);
11016}
11017#endif
11018
Bill Seurer703e8482015-06-09 14:39:47 +000011019static int __ATTRS_o_ai vec_all_ne(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011020 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011021}
11022
11023/* vec_all_nge */
11024
11025static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000011026vec_all_nge(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011027 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011028}
11029
11030/* vec_all_ngt */
11031
11032static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000011033vec_all_ngt(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011034 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011035}
11036
11037/* vec_all_nle */
11038
11039static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000011040vec_all_nle(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011041 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011042}
11043
11044/* vec_all_nlt */
11045
11046static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000011047vec_all_nlt(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011048 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011049}
11050
11051/* vec_all_numeric */
11052
11053static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000011054vec_all_numeric(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011055 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011056}
11057
11058/* vec_any_eq */
11059
Bill Seurer703e8482015-06-09 14:39:47 +000011060static int __ATTRS_o_ai vec_any_eq(vector signed char __a,
11061 vector signed char __b) {
11062 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
11063 (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011064}
11065
Bill Seurer703e8482015-06-09 14:39:47 +000011066static int __ATTRS_o_ai vec_any_eq(vector signed char __a,
11067 vector bool char __b) {
11068 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
11069 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011070}
11071
Bill Seurer703e8482015-06-09 14:39:47 +000011072static int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
11073 vector unsigned char __b) {
11074 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
11075 (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011076}
11077
Bill Seurer703e8482015-06-09 14:39:47 +000011078static int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
11079 vector bool char __b) {
11080 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
11081 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011082}
11083
Bill Seurer703e8482015-06-09 14:39:47 +000011084static int __ATTRS_o_ai vec_any_eq(vector bool char __a,
11085 vector signed char __b) {
11086 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
11087 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011088}
11089
Bill Seurer703e8482015-06-09 14:39:47 +000011090static int __ATTRS_o_ai vec_any_eq(vector bool char __a,
11091 vector unsigned char __b) {
11092 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
11093 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011094}
11095
Bill Seurer703e8482015-06-09 14:39:47 +000011096static int __ATTRS_o_ai vec_any_eq(vector bool char __a, vector bool char __b) {
11097 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
11098 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011099}
11100
Bill Seurer703e8482015-06-09 14:39:47 +000011101static int __ATTRS_o_ai vec_any_eq(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011102 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011103}
11104
Bill Seurer703e8482015-06-09 14:39:47 +000011105static int __ATTRS_o_ai vec_any_eq(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011106 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011107}
11108
Bill Seurer703e8482015-06-09 14:39:47 +000011109static int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
11110 vector unsigned short __b) {
11111 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011112 (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011113}
11114
Bill Seurer703e8482015-06-09 14:39:47 +000011115static int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
11116 vector bool short __b) {
11117 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011118 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011119}
11120
Bill Seurer703e8482015-06-09 14:39:47 +000011121static int __ATTRS_o_ai vec_any_eq(vector bool short __a, vector short __b) {
11122 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011123 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011124}
11125
Bill Seurer703e8482015-06-09 14:39:47 +000011126static int __ATTRS_o_ai vec_any_eq(vector bool short __a,
11127 vector unsigned short __b) {
11128 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011129 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011130}
11131
Bill Seurer703e8482015-06-09 14:39:47 +000011132static int __ATTRS_o_ai vec_any_eq(vector bool short __a,
11133 vector bool short __b) {
11134 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011135 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011136}
11137
Bill Seurer703e8482015-06-09 14:39:47 +000011138static int __ATTRS_o_ai vec_any_eq(vector pixel __a, vector pixel __b) {
11139 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011140 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011141}
11142
Bill Seurer703e8482015-06-09 14:39:47 +000011143static int __ATTRS_o_ai vec_any_eq(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011144 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011145}
11146
Bill Seurer703e8482015-06-09 14:39:47 +000011147static int __ATTRS_o_ai vec_any_eq(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011148 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__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 unsigned int __a,
11152 vector unsigned int __b) {
11153 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
11154 (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011155}
11156
Bill Seurer703e8482015-06-09 14:39:47 +000011157static int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
11158 vector bool int __b) {
11159 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
11160 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011161}
11162
Bill Seurer703e8482015-06-09 14:39:47 +000011163static int __ATTRS_o_ai vec_any_eq(vector bool int __a, vector int __b) {
11164 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
11165 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011166}
11167
Bill Seurer703e8482015-06-09 14:39:47 +000011168static int __ATTRS_o_ai vec_any_eq(vector bool int __a,
11169 vector unsigned int __b) {
11170 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
11171 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011172}
11173
Bill Seurer703e8482015-06-09 14:39:47 +000011174static int __ATTRS_o_ai vec_any_eq(vector bool int __a, vector bool int __b) {
11175 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
11176 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011177}
11178
Kit Barton8553bec2015-03-11 15:57:19 +000011179#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000011180static int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
11181 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011182 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, __b);
11183}
11184
Bill Seurer703e8482015-06-09 14:39:47 +000011185static int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
11186 vector unsigned long long __b) {
11187 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector long long)__a,
11188 (vector long long)__b);
Kit Barton8553bec2015-03-11 15:57:19 +000011189}
11190
Bill Seurer703e8482015-06-09 14:39:47 +000011191static int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
11192 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011193 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a,
11194 (vector signed long long)__b);
11195}
11196
Bill Seurer703e8482015-06-09 14:39:47 +000011197static int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
11198 vector bool long long __b) {
11199 return __builtin_altivec_vcmpequd_p(
11200 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
Kit Barton8553bec2015-03-11 15:57:19 +000011201}
11202
Bill Seurer703e8482015-06-09 14:39:47 +000011203static int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
11204 vector signed long long __b) {
11205 return __builtin_altivec_vcmpequd_p(
11206 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
Kit Barton8553bec2015-03-11 15:57:19 +000011207}
11208
Bill Seurer703e8482015-06-09 14:39:47 +000011209static int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
11210 vector unsigned long long __b) {
11211 return __builtin_altivec_vcmpequd_p(
11212 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
Kit Barton8553bec2015-03-11 15:57:19 +000011213}
11214
Bill Seurer703e8482015-06-09 14:39:47 +000011215static int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
11216 vector bool long long __b) {
11217 return __builtin_altivec_vcmpequd_p(
11218 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
Kit Barton8553bec2015-03-11 15:57:19 +000011219}
11220#endif
11221
Bill Seurer703e8482015-06-09 14:39:47 +000011222static int __ATTRS_o_ai vec_any_eq(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011223 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011224}
11225
11226/* vec_any_ge */
11227
Bill Seurer703e8482015-06-09 14:39:47 +000011228static int __ATTRS_o_ai vec_any_ge(vector signed char __a,
11229 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011230 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011231}
11232
Bill Seurer703e8482015-06-09 14:39:47 +000011233static int __ATTRS_o_ai vec_any_ge(vector signed char __a,
11234 vector bool char __b) {
11235 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b,
11236 __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011237}
11238
Bill Seurer703e8482015-06-09 14:39:47 +000011239static int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
11240 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011241 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011242}
11243
Bill Seurer703e8482015-06-09 14:39:47 +000011244static int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
11245 vector bool char __b) {
11246 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
11247 __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011248}
11249
Bill Seurer703e8482015-06-09 14:39:47 +000011250static int __ATTRS_o_ai vec_any_ge(vector bool char __a,
11251 vector signed char __b) {
11252 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011253 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011254}
11255
Bill Seurer703e8482015-06-09 14:39:47 +000011256static int __ATTRS_o_ai vec_any_ge(vector bool char __a,
11257 vector unsigned char __b) {
11258 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011259 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011260}
11261
Bill Seurer703e8482015-06-09 14:39:47 +000011262static int __ATTRS_o_ai vec_any_ge(vector bool char __a, vector bool char __b) {
11263 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
11264 (vector unsigned char)__a);
11265}
11266
11267static int __ATTRS_o_ai vec_any_ge(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011268 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011269}
11270
Bill Seurer703e8482015-06-09 14:39:47 +000011271static int __ATTRS_o_ai vec_any_ge(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011272 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011273}
11274
Bill Seurer703e8482015-06-09 14:39:47 +000011275static int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
11276 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011277 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011278}
11279
Bill Seurer703e8482015-06-09 14:39:47 +000011280static int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
11281 vector bool short __b) {
11282 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
11283 __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011284}
11285
Bill Seurer703e8482015-06-09 14:39:47 +000011286static int __ATTRS_o_ai vec_any_ge(vector bool short __a, vector short __b) {
11287 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011288 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011289}
11290
Bill Seurer703e8482015-06-09 14:39:47 +000011291static int __ATTRS_o_ai vec_any_ge(vector bool short __a,
11292 vector unsigned short __b) {
11293 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011294 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011295}
11296
Bill Seurer703e8482015-06-09 14:39:47 +000011297static int __ATTRS_o_ai vec_any_ge(vector bool short __a,
11298 vector bool short __b) {
11299 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
11300 (vector unsigned short)__a);
11301}
11302
11303static int __ATTRS_o_ai vec_any_ge(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011304 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011305}
11306
Bill Seurer703e8482015-06-09 14:39:47 +000011307static int __ATTRS_o_ai vec_any_ge(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011308 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011309}
11310
Bill Seurer703e8482015-06-09 14:39:47 +000011311static int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
11312 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011313 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011314}
11315
Bill Seurer703e8482015-06-09 14:39:47 +000011316static int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
11317 vector bool int __b) {
11318 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
11319 __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011320}
11321
Bill Seurer703e8482015-06-09 14:39:47 +000011322static int __ATTRS_o_ai vec_any_ge(vector bool int __a, vector int __b) {
11323 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011324 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011325}
11326
Bill Seurer703e8482015-06-09 14:39:47 +000011327static int __ATTRS_o_ai vec_any_ge(vector bool int __a,
11328 vector unsigned int __b) {
11329 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b,
11330 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011331}
11332
Bill Seurer703e8482015-06-09 14:39:47 +000011333static int __ATTRS_o_ai vec_any_ge(vector bool int __a, vector bool int __b) {
11334 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011335 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011336}
11337
Kit Barton8553bec2015-03-11 15:57:19 +000011338#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000011339static int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
11340 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011341 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, __a);
11342}
11343
Bill Seurer703e8482015-06-09 14:39:47 +000011344static int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
11345 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011346 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, __a);
11347}
11348
Bill Seurer703e8482015-06-09 14:39:47 +000011349static int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
11350 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011351 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV,
11352 (vector signed long long)__b, __a);
11353}
11354
Bill Seurer703e8482015-06-09 14:39:47 +000011355static int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
11356 vector bool long long __b) {
11357 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
Kit Barton8553bec2015-03-11 15:57:19 +000011358 (vector unsigned long long)__b, __a);
11359}
11360
Bill Seurer703e8482015-06-09 14:39:47 +000011361static int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
11362 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011363 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
11364 (vector unsigned long long)__b,
11365 (vector unsigned long long)__a);
11366}
11367
Bill Seurer703e8482015-06-09 14:39:47 +000011368static int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
11369 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011370 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b,
11371 (vector unsigned long long)__a);
11372}
11373
Bill Seurer703e8482015-06-09 14:39:47 +000011374static int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
11375 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011376 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
11377 (vector unsigned long long)__b,
11378 (vector unsigned long long)__a);
11379}
11380#endif
11381
Bill Seurer703e8482015-06-09 14:39:47 +000011382static int __ATTRS_o_ai vec_any_ge(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011383 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011384}
11385
11386/* vec_any_gt */
11387
Bill Seurer703e8482015-06-09 14:39:47 +000011388static int __ATTRS_o_ai vec_any_gt(vector signed char __a,
11389 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011390 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011391}
11392
Bill Seurer703e8482015-06-09 14:39:47 +000011393static int __ATTRS_o_ai vec_any_gt(vector signed char __a,
11394 vector bool char __b) {
11395 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a,
11396 (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011397}
11398
Bill Seurer703e8482015-06-09 14:39:47 +000011399static int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
11400 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011401 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011402}
11403
Bill Seurer703e8482015-06-09 14:39:47 +000011404static int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
11405 vector bool char __b) {
11406 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011407 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011408}
11409
Bill Seurer703e8482015-06-09 14:39:47 +000011410static int __ATTRS_o_ai vec_any_gt(vector bool char __a,
11411 vector signed char __b) {
11412 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011413 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011414}
11415
Bill Seurer703e8482015-06-09 14:39:47 +000011416static int __ATTRS_o_ai vec_any_gt(vector bool char __a,
11417 vector unsigned char __b) {
11418 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
11419 __b);
11420}
11421
11422static int __ATTRS_o_ai vec_any_gt(vector bool char __a, vector bool char __b) {
11423 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
11424 (vector unsigned char)__b);
11425}
11426
11427static int __ATTRS_o_ai vec_any_gt(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011428 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011429}
11430
Bill Seurer703e8482015-06-09 14:39:47 +000011431static int __ATTRS_o_ai vec_any_gt(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011432 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011433}
11434
Bill Seurer703e8482015-06-09 14:39:47 +000011435static int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
11436 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011437 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011438}
11439
Bill Seurer703e8482015-06-09 14:39:47 +000011440static int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
11441 vector bool short __b) {
11442 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011443 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011444}
11445
Bill Seurer703e8482015-06-09 14:39:47 +000011446static int __ATTRS_o_ai vec_any_gt(vector bool short __a, vector short __b) {
11447 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011448 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011449}
11450
Bill Seurer703e8482015-06-09 14:39:47 +000011451static int __ATTRS_o_ai vec_any_gt(vector bool short __a,
11452 vector unsigned short __b) {
11453 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
11454 __b);
11455}
11456
11457static int __ATTRS_o_ai vec_any_gt(vector bool short __a,
11458 vector bool short __b) {
11459 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
11460 (vector unsigned short)__b);
11461}
11462
11463static int __ATTRS_o_ai vec_any_gt(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011464 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011465}
11466
Bill Seurer703e8482015-06-09 14:39:47 +000011467static int __ATTRS_o_ai vec_any_gt(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011468 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011469}
11470
Bill Seurer703e8482015-06-09 14:39:47 +000011471static int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
11472 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011473 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011474}
11475
Bill Seurer703e8482015-06-09 14:39:47 +000011476static int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
11477 vector bool int __b) {
11478 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011479 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011480}
11481
Bill Seurer703e8482015-06-09 14:39:47 +000011482static int __ATTRS_o_ai vec_any_gt(vector bool int __a, vector int __b) {
11483 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
11484 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011485}
11486
Bill Seurer703e8482015-06-09 14:39:47 +000011487static int __ATTRS_o_ai vec_any_gt(vector bool int __a,
11488 vector unsigned int __b) {
11489 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
11490 __b);
11491}
11492
11493static int __ATTRS_o_ai vec_any_gt(vector bool int __a, vector bool int __b) {
11494 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011495 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011496}
11497
Kit Barton8553bec2015-03-11 15:57:19 +000011498#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000011499static int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
11500 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011501 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, __b);
11502}
11503
Bill Seurer703e8482015-06-09 14:39:47 +000011504static int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
11505 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011506 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, __b);
11507}
11508
Bill Seurer703e8482015-06-09 14:39:47 +000011509static int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
11510 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011511 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a,
11512 (vector signed long long)__b);
11513}
11514
Bill Seurer703e8482015-06-09 14:39:47 +000011515static int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
11516 vector bool long long __b) {
11517 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a,
Kit Barton8553bec2015-03-11 15:57:19 +000011518 (vector unsigned long long)__b);
11519}
11520
Bill Seurer703e8482015-06-09 14:39:47 +000011521static int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
11522 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011523 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
11524 (vector unsigned long long)__a,
11525 (vector unsigned long long)__b);
11526}
11527
Bill Seurer703e8482015-06-09 14:39:47 +000011528static int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
11529 vector unsigned long long __b) {
11530 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
Kit Barton8553bec2015-03-11 15:57:19 +000011531 (vector unsigned long long)__a, __b);
11532}
11533
Bill Seurer703e8482015-06-09 14:39:47 +000011534static int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
11535 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011536 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
11537 (vector unsigned long long)__a,
11538 (vector unsigned long long)__b);
11539}
11540#endif
11541
Bill Seurer703e8482015-06-09 14:39:47 +000011542static int __ATTRS_o_ai vec_any_gt(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011543 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011544}
11545
11546/* vec_any_le */
11547
Bill Seurer703e8482015-06-09 14:39:47 +000011548static int __ATTRS_o_ai vec_any_le(vector signed char __a,
11549 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011550 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011551}
11552
Bill Seurer703e8482015-06-09 14:39:47 +000011553static int __ATTRS_o_ai vec_any_le(vector signed char __a,
11554 vector bool char __b) {
11555 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a,
11556 (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011557}
11558
Bill Seurer703e8482015-06-09 14:39:47 +000011559static int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
11560 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011561 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011562}
11563
Bill Seurer703e8482015-06-09 14:39:47 +000011564static int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
11565 vector bool char __b) {
11566 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011567 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011568}
11569
Bill Seurer703e8482015-06-09 14:39:47 +000011570static int __ATTRS_o_ai vec_any_le(vector bool char __a,
11571 vector signed char __b) {
11572 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011573 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011574}
11575
Bill Seurer703e8482015-06-09 14:39:47 +000011576static int __ATTRS_o_ai vec_any_le(vector bool char __a,
11577 vector unsigned char __b) {
11578 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
11579 __b);
11580}
11581
11582static int __ATTRS_o_ai vec_any_le(vector bool char __a, vector bool char __b) {
11583 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
11584 (vector unsigned char)__b);
11585}
11586
11587static int __ATTRS_o_ai vec_any_le(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011588 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011589}
11590
Bill Seurer703e8482015-06-09 14:39:47 +000011591static int __ATTRS_o_ai vec_any_le(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011592 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011593}
11594
Bill Seurer703e8482015-06-09 14:39:47 +000011595static int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
11596 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011597 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011598}
11599
Bill Seurer703e8482015-06-09 14:39:47 +000011600static int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
11601 vector bool short __b) {
11602 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011603 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011604}
11605
Bill Seurer703e8482015-06-09 14:39:47 +000011606static int __ATTRS_o_ai vec_any_le(vector bool short __a, vector short __b) {
11607 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011608 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011609}
11610
Bill Seurer703e8482015-06-09 14:39:47 +000011611static int __ATTRS_o_ai vec_any_le(vector bool short __a,
11612 vector unsigned short __b) {
11613 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
11614 __b);
11615}
11616
11617static int __ATTRS_o_ai vec_any_le(vector bool short __a,
11618 vector bool short __b) {
11619 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
11620 (vector unsigned short)__b);
11621}
11622
11623static int __ATTRS_o_ai vec_any_le(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011624 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011625}
11626
Bill Seurer703e8482015-06-09 14:39:47 +000011627static int __ATTRS_o_ai vec_any_le(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011628 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011629}
11630
Bill Seurer703e8482015-06-09 14:39:47 +000011631static int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
11632 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011633 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011634}
11635
Bill Seurer703e8482015-06-09 14:39:47 +000011636static int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
11637 vector bool int __b) {
11638 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011639 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011640}
11641
Bill Seurer703e8482015-06-09 14:39:47 +000011642static int __ATTRS_o_ai vec_any_le(vector bool int __a, vector int __b) {
11643 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
11644 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011645}
11646
Bill Seurer703e8482015-06-09 14:39:47 +000011647static int __ATTRS_o_ai vec_any_le(vector bool int __a,
11648 vector unsigned int __b) {
11649 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
11650 __b);
11651}
11652
11653static int __ATTRS_o_ai vec_any_le(vector bool int __a, vector bool int __b) {
11654 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011655 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011656}
11657
Kit Barton8553bec2015-03-11 15:57:19 +000011658#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000011659static int __ATTRS_o_ai vec_any_le(vector signed long long __a,
11660 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011661 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, __b);
11662}
11663
Bill Seurer703e8482015-06-09 14:39:47 +000011664static int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
11665 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011666 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, __b);
11667}
11668
Bill Seurer703e8482015-06-09 14:39:47 +000011669static int __ATTRS_o_ai vec_any_le(vector signed long long __a,
11670 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011671 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a,
11672 (vector signed long long)__b);
11673}
11674
Bill Seurer703e8482015-06-09 14:39:47 +000011675static int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
11676 vector bool long long __b) {
11677 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a,
Kit Barton8553bec2015-03-11 15:57:19 +000011678 (vector unsigned long long)__b);
11679}
11680
Bill Seurer703e8482015-06-09 14:39:47 +000011681static int __ATTRS_o_ai vec_any_le(vector bool long long __a,
11682 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011683 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
11684 (vector unsigned long long)__a,
11685 (vector unsigned long long)__b);
11686}
11687
Bill Seurer703e8482015-06-09 14:39:47 +000011688static int __ATTRS_o_ai vec_any_le(vector bool long long __a,
11689 vector unsigned long long __b) {
11690 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
Kit Barton8553bec2015-03-11 15:57:19 +000011691 (vector unsigned long long)__a, __b);
11692}
11693
Bill Seurer703e8482015-06-09 14:39:47 +000011694static int __ATTRS_o_ai vec_any_le(vector bool long long __a,
11695 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011696 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
11697 (vector unsigned long long)__a,
11698 (vector unsigned long long)__b);
11699}
11700#endif
11701
Bill Seurer703e8482015-06-09 14:39:47 +000011702static int __ATTRS_o_ai vec_any_le(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011703 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011704}
11705
11706/* vec_any_lt */
11707
Bill Seurer703e8482015-06-09 14:39:47 +000011708static int __ATTRS_o_ai vec_any_lt(vector signed char __a,
11709 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011710 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011711}
11712
Bill Seurer703e8482015-06-09 14:39:47 +000011713static int __ATTRS_o_ai vec_any_lt(vector signed char __a,
11714 vector bool char __b) {
11715 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b,
11716 __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011717}
11718
Bill Seurer703e8482015-06-09 14:39:47 +000011719static int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
11720 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011721 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011722}
11723
Bill Seurer703e8482015-06-09 14:39:47 +000011724static int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
11725 vector bool char __b) {
11726 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
11727 __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011728}
11729
Bill Seurer703e8482015-06-09 14:39:47 +000011730static int __ATTRS_o_ai vec_any_lt(vector bool char __a,
11731 vector signed char __b) {
11732 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011733 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011734}
11735
Bill Seurer703e8482015-06-09 14:39:47 +000011736static int __ATTRS_o_ai vec_any_lt(vector bool char __a,
11737 vector unsigned char __b) {
11738 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011739 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011740}
11741
Bill Seurer703e8482015-06-09 14:39:47 +000011742static int __ATTRS_o_ai vec_any_lt(vector bool char __a, vector bool char __b) {
11743 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
11744 (vector unsigned char)__a);
11745}
11746
11747static int __ATTRS_o_ai vec_any_lt(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011748 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011749}
11750
Bill Seurer703e8482015-06-09 14:39:47 +000011751static int __ATTRS_o_ai vec_any_lt(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011752 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011753}
11754
Bill Seurer703e8482015-06-09 14:39:47 +000011755static int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
11756 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011757 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011758}
11759
Bill Seurer703e8482015-06-09 14:39:47 +000011760static int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
11761 vector bool short __b) {
11762 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
11763 __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011764}
11765
Bill Seurer703e8482015-06-09 14:39:47 +000011766static int __ATTRS_o_ai vec_any_lt(vector bool short __a, vector short __b) {
11767 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011768 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011769}
11770
Bill Seurer703e8482015-06-09 14:39:47 +000011771static int __ATTRS_o_ai vec_any_lt(vector bool short __a,
11772 vector unsigned short __b) {
11773 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011774 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011775}
11776
Bill Seurer703e8482015-06-09 14:39:47 +000011777static int __ATTRS_o_ai vec_any_lt(vector bool short __a,
11778 vector bool short __b) {
11779 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
11780 (vector unsigned short)__a);
11781}
11782
11783static int __ATTRS_o_ai vec_any_lt(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011784 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011785}
11786
Bill Seurer703e8482015-06-09 14:39:47 +000011787static int __ATTRS_o_ai vec_any_lt(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011788 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011789}
11790
Bill Seurer703e8482015-06-09 14:39:47 +000011791static int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
11792 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011793 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011794}
11795
Bill Seurer703e8482015-06-09 14:39:47 +000011796static int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
11797 vector bool int __b) {
11798 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
11799 __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011800}
11801
Bill Seurer703e8482015-06-09 14:39:47 +000011802static int __ATTRS_o_ai vec_any_lt(vector bool int __a, vector int __b) {
11803 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011804 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011805}
11806
Bill Seurer703e8482015-06-09 14:39:47 +000011807static int __ATTRS_o_ai vec_any_lt(vector bool int __a,
11808 vector unsigned int __b) {
11809 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b,
11810 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011811}
11812
Bill Seurer703e8482015-06-09 14:39:47 +000011813static int __ATTRS_o_ai vec_any_lt(vector bool int __a, vector bool int __b) {
11814 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011815 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011816}
11817
Kit Barton8553bec2015-03-11 15:57:19 +000011818#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000011819static int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
11820 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011821 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, __a);
11822}
11823
Bill Seurer703e8482015-06-09 14:39:47 +000011824static int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
11825 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011826 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, __a);
11827}
11828
Bill Seurer703e8482015-06-09 14:39:47 +000011829static int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
11830 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011831 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV,
11832 (vector signed long long)__b, __a);
11833}
11834
Bill Seurer703e8482015-06-09 14:39:47 +000011835static int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
11836 vector bool long long __b) {
11837 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
Kit Barton8553bec2015-03-11 15:57:19 +000011838 (vector unsigned long long)__b, __a);
11839}
11840
Bill Seurer703e8482015-06-09 14:39:47 +000011841static int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
11842 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011843 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
11844 (vector unsigned long long)__b,
11845 (vector unsigned long long)__a);
11846}
11847
Bill Seurer703e8482015-06-09 14:39:47 +000011848static int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
11849 vector unsigned long long __b) {
11850 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b,
Kit Barton8553bec2015-03-11 15:57:19 +000011851 (vector unsigned long long)__a);
11852}
11853
Bill Seurer703e8482015-06-09 14:39:47 +000011854static int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
11855 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011856 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
11857 (vector unsigned long long)__b,
11858 (vector unsigned long long)__a);
11859}
11860#endif
11861
Bill Seurer703e8482015-06-09 14:39:47 +000011862static int __ATTRS_o_ai vec_any_lt(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011863 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011864}
11865
11866/* vec_any_nan */
11867
Bill Seurer703e8482015-06-09 14:39:47 +000011868static int __attribute__((__always_inline__)) vec_any_nan(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011869 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011870}
11871
11872/* vec_any_ne */
11873
Bill Seurer703e8482015-06-09 14:39:47 +000011874static int __ATTRS_o_ai vec_any_ne(vector signed char __a,
11875 vector signed char __b) {
11876 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
11877 (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011878}
11879
Bill Seurer703e8482015-06-09 14:39:47 +000011880static int __ATTRS_o_ai vec_any_ne(vector signed char __a,
11881 vector bool char __b) {
11882 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
11883 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011884}
11885
Bill Seurer703e8482015-06-09 14:39:47 +000011886static int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
11887 vector unsigned char __b) {
11888 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
11889 (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011890}
11891
Bill Seurer703e8482015-06-09 14:39:47 +000011892static int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
11893 vector bool char __b) {
11894 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
11895 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011896}
11897
Bill Seurer703e8482015-06-09 14:39:47 +000011898static int __ATTRS_o_ai vec_any_ne(vector bool char __a,
11899 vector signed char __b) {
11900 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
11901 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011902}
11903
Bill Seurer703e8482015-06-09 14:39:47 +000011904static int __ATTRS_o_ai vec_any_ne(vector bool char __a,
11905 vector unsigned char __b) {
11906 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
11907 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011908}
11909
Bill Seurer703e8482015-06-09 14:39:47 +000011910static int __ATTRS_o_ai vec_any_ne(vector bool char __a, vector bool char __b) {
11911 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
11912 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011913}
11914
Bill Seurer703e8482015-06-09 14:39:47 +000011915static int __ATTRS_o_ai vec_any_ne(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011916 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011917}
11918
Bill Seurer703e8482015-06-09 14:39:47 +000011919static int __ATTRS_o_ai vec_any_ne(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011920 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011921}
11922
Bill Seurer703e8482015-06-09 14:39:47 +000011923static int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
11924 vector unsigned short __b) {
11925 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011926 (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011927}
11928
Bill Seurer703e8482015-06-09 14:39:47 +000011929static int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
11930 vector bool short __b) {
11931 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011932 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011933}
11934
Bill Seurer703e8482015-06-09 14:39:47 +000011935static int __ATTRS_o_ai vec_any_ne(vector bool short __a, vector short __b) {
11936 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011937 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011938}
11939
Bill Seurer703e8482015-06-09 14:39:47 +000011940static int __ATTRS_o_ai vec_any_ne(vector bool short __a,
11941 vector unsigned short __b) {
11942 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011943 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011944}
11945
Bill Seurer703e8482015-06-09 14:39:47 +000011946static int __ATTRS_o_ai vec_any_ne(vector bool short __a,
11947 vector bool short __b) {
11948 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011949 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011950}
11951
Bill Seurer703e8482015-06-09 14:39:47 +000011952static int __ATTRS_o_ai vec_any_ne(vector pixel __a, vector pixel __b) {
11953 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011954 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011955}
11956
Bill Seurer703e8482015-06-09 14:39:47 +000011957static int __ATTRS_o_ai vec_any_ne(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011958 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011959}
11960
Bill Seurer703e8482015-06-09 14:39:47 +000011961static int __ATTRS_o_ai vec_any_ne(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011962 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__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 unsigned int __a,
11966 vector unsigned int __b) {
11967 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
11968 (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011969}
11970
Bill Seurer703e8482015-06-09 14:39:47 +000011971static int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
11972 vector bool int __b) {
11973 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
11974 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011975}
11976
Bill Seurer703e8482015-06-09 14:39:47 +000011977static int __ATTRS_o_ai vec_any_ne(vector bool int __a, vector int __b) {
11978 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
11979 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011980}
11981
Bill Seurer703e8482015-06-09 14:39:47 +000011982static int __ATTRS_o_ai vec_any_ne(vector bool int __a,
11983 vector unsigned int __b) {
11984 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
11985 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011986}
11987
Bill Seurer703e8482015-06-09 14:39:47 +000011988static int __ATTRS_o_ai vec_any_ne(vector bool int __a, vector bool int __b) {
11989 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
11990 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011991}
11992
Kit Barton8553bec2015-03-11 15:57:19 +000011993#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000011994static int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
11995 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011996 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, __b);
11997}
11998
Bill Seurer703e8482015-06-09 14:39:47 +000011999static int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
12000 vector unsigned long long __b) {
12001 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector long long)__a,
12002 (vector long long)__b);
Kit Barton8553bec2015-03-11 15:57:19 +000012003}
12004
Bill Seurer703e8482015-06-09 14:39:47 +000012005static int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
12006 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000012007 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a,
12008 (vector signed long long)__b);
12009}
12010
Bill Seurer703e8482015-06-09 14:39:47 +000012011static int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
12012 vector bool long long __b) {
12013 return __builtin_altivec_vcmpequd_p(
12014 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
Kit Barton8553bec2015-03-11 15:57:19 +000012015}
12016
Bill Seurer703e8482015-06-09 14:39:47 +000012017static int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
12018 vector signed long long __b) {
12019 return __builtin_altivec_vcmpequd_p(
12020 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
Kit Barton8553bec2015-03-11 15:57:19 +000012021}
12022
Bill Seurer703e8482015-06-09 14:39:47 +000012023static int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
12024 vector unsigned long long __b) {
12025 return __builtin_altivec_vcmpequd_p(
12026 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
Kit Barton8553bec2015-03-11 15:57:19 +000012027}
12028
Bill Seurer703e8482015-06-09 14:39:47 +000012029static int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
12030 vector bool long long __b) {
12031 return __builtin_altivec_vcmpequd_p(
12032 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
Kit Barton8553bec2015-03-11 15:57:19 +000012033}
12034#endif
12035
Bill Seurer703e8482015-06-09 14:39:47 +000012036static int __ATTRS_o_ai vec_any_ne(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000012037 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012038}
12039
12040/* vec_any_nge */
12041
12042static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000012043vec_any_nge(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000012044 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012045}
12046
12047/* vec_any_ngt */
12048
12049static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000012050vec_any_ngt(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000012051 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012052}
12053
12054/* vec_any_nle */
12055
12056static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000012057vec_any_nle(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000012058 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012059}
12060
12061/* vec_any_nlt */
12062
12063static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000012064vec_any_nlt(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000012065 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012066}
12067
12068/* vec_any_numeric */
12069
12070static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000012071vec_any_numeric(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +000012072 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012073}
12074
12075/* vec_any_out */
12076
12077static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000012078vec_any_out(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000012079 return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012080}
12081
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012082/* Power 8 Crypto functions
12083Note: We diverge from the current GCC implementation with regard
12084to cryptography and related functions as follows:
12085- Only the SHA and AES instructions and builtins are disabled by -mno-crypto
12086- The remaining ones are only available on Power8 and up so
12087 require -mpower8-vector
12088The justification for this is that export requirements require that
12089Category:Vector.Crypto is optional (i.e. compliant hardware may not provide
12090support). As a result, we need to be able to turn off support for those.
12091The remaining ones (currently controlled by -mcrypto for GCC) still
12092need to be provided on compliant hardware even if Vector.Crypto is not
12093provided.
12094FIXME: the naming convention for the builtins will be adjusted due
12095to the inconsistency (__builtin_crypto_ prefix on builtins that cannot be
12096removed with -mno-crypto). This is under development.
12097*/
12098#ifdef __CRYPTO__
12099static vector unsigned long long __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000012100__builtin_crypto_vsbox(vector unsigned long long __a) {
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012101 return __builtin_altivec_crypto_vsbox(__a);
12102}
12103
12104static vector unsigned long long __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000012105__builtin_crypto_vcipher(vector unsigned long long __a,
12106 vector unsigned long long __b) {
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012107 return __builtin_altivec_crypto_vcipher(__a, __b);
12108}
12109
12110static vector unsigned long long __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000012111__builtin_crypto_vcipherlast(vector unsigned long long __a,
12112 vector unsigned long long __b) {
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012113 return __builtin_altivec_crypto_vcipherlast(__a, __b);
12114}
12115
12116static vector unsigned long long __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000012117__builtin_crypto_vncipher(vector unsigned long long __a,
12118 vector unsigned long long __b) {
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012119 return __builtin_altivec_crypto_vncipher(__a, __b);
12120}
12121
12122static vector unsigned long long __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000012123__builtin_crypto_vncipherlast(vector unsigned long long __a,
12124 vector unsigned long long __b) {
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012125 return __builtin_altivec_crypto_vncipherlast(__a, __b);
12126}
12127
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012128#define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad
12129#define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw
12130#endif
12131
12132#ifdef __POWER8_VECTOR__
12133static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +000012134__builtin_crypto_vpermxor(vector unsigned char __a, vector unsigned char __b,
12135 vector unsigned char __c) {
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012136 return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
12137}
12138
12139static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +000012140__builtin_crypto_vpermxor(vector unsigned short __a, vector unsigned short __b,
12141 vector unsigned short __c) {
12142 return (vector unsigned short)__builtin_altivec_crypto_vpermxor(
12143 (vector unsigned char)__a, (vector unsigned char)__b,
12144 (vector unsigned char)__c);
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012145}
12146
Bill Seurer703e8482015-06-09 14:39:47 +000012147static vector unsigned int __ATTRS_o_ai __builtin_crypto_vpermxor(
12148 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
12149 return (vector unsigned int)__builtin_altivec_crypto_vpermxor(
12150 (vector unsigned char)__a, (vector unsigned char)__b,
12151 (vector unsigned char)__c);
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012152}
12153
Bill Seurer703e8482015-06-09 14:39:47 +000012154static vector unsigned long long __ATTRS_o_ai __builtin_crypto_vpermxor(
12155 vector unsigned long long __a, vector unsigned long long __b,
12156 vector unsigned long long __c) {
12157 return (vector unsigned long long)__builtin_altivec_crypto_vpermxor(
12158 (vector unsigned char)__a, (vector unsigned char)__b,
12159 (vector unsigned char)__c);
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012160}
12161
12162static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +000012163__builtin_crypto_vpmsumb(vector unsigned char __a, vector unsigned char __b) {
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012164 return __builtin_altivec_crypto_vpmsumb(__a, __b);
12165}
12166
12167static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +000012168__builtin_crypto_vpmsumb(vector unsigned short __a, vector unsigned short __b) {
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012169 return __builtin_altivec_crypto_vpmsumh(__a, __b);
12170}
12171
12172static vector unsigned int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +000012173__builtin_crypto_vpmsumb(vector unsigned int __a, vector unsigned int __b) {
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012174 return __builtin_altivec_crypto_vpmsumw(__a, __b);
12175}
12176
Bill Seurer703e8482015-06-09 14:39:47 +000012177static vector unsigned long long __ATTRS_o_ai __builtin_crypto_vpmsumb(
12178 vector unsigned long long __a, vector unsigned long long __b) {
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012179 return __builtin_altivec_crypto_vpmsumd(__a, __b);
12180}
Nemanja Ivanovicb17f1122015-06-11 06:25:36 +000012181
12182static vector signed char __ATTRS_o_ai vec_vgbbd (vector signed char __a)
12183{
12184 return __builtin_altivec_vgbbd((vector unsigned char) __a);
12185}
12186
12187static vector unsigned char __ATTRS_o_ai vec_vgbbd (vector unsigned char __a)
12188{
12189 return __builtin_altivec_vgbbd(__a);
12190}
12191
12192static vector long long __ATTRS_o_ai
12193vec_vbpermq (vector signed char __a, vector signed char __b)
12194{
12195 return __builtin_altivec_vbpermq((vector unsigned char) __a,
12196 (vector unsigned char) __b);
12197}
12198
12199static vector long long __ATTRS_o_ai
12200vec_vbpermq (vector unsigned char __a, vector unsigned char __b)
12201{
12202 return __builtin_altivec_vbpermq(__a, __b);
12203}
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012204#endif
12205
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012206#undef __ATTRS_o_ai
Chris Lattnerdad40622010-04-14 03:54:58 +000012207
12208#endif /* __ALTIVEC_H */