blob: 7427ed53fcba5479e3ccd41598477a79d000222a [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
Bill Seurer703e8482015-06-09 14:39:47 +0000113static vector float __ATTRS_o_ai vec_abs(vector float __a) {
114 vector unsigned int __res =
115 (vector unsigned int)__a & (vector unsigned int)(0x7FFFFFFF);
David Blaikie3302f2b2013-01-16 23:08:36 +0000116 return (vector float)__res;
Chris Lattnerdad40622010-04-14 03:54:58 +0000117}
118
119/* vec_abss */
120
Chris Lattnerdad40622010-04-14 03:54:58 +0000121#define __builtin_altivec_abss_v16qi vec_abss
Bill Seurer703e8482015-06-09 14:39:47 +0000122#define __builtin_altivec_abss_v8hi vec_abss
123#define __builtin_altivec_abss_v4si vec_abss
Chris Lattnerdad40622010-04-14 03:54:58 +0000124
Bill Seurer703e8482015-06-09 14:39:47 +0000125static vector signed char __ATTRS_o_ai vec_abss(vector signed char __a) {
126 return __builtin_altivec_vmaxsb(
127 __a, __builtin_altivec_vsubsbs((vector signed char)(0), __a));
Chris Lattnerdad40622010-04-14 03:54:58 +0000128}
129
Bill Seurer703e8482015-06-09 14:39:47 +0000130static vector signed short __ATTRS_o_ai vec_abss(vector signed short __a) {
131 return __builtin_altivec_vmaxsh(
132 __a, __builtin_altivec_vsubshs((vector signed short)(0), __a));
Chris Lattnerdad40622010-04-14 03:54:58 +0000133}
134
Bill Seurer703e8482015-06-09 14:39:47 +0000135static vector signed int __ATTRS_o_ai vec_abss(vector signed int __a) {
136 return __builtin_altivec_vmaxsw(
137 __a, __builtin_altivec_vsubsws((vector signed int)(0), __a));
Chris Lattnerdad40622010-04-14 03:54:58 +0000138}
139
140/* vec_add */
141
Bill Seurer703e8482015-06-09 14:39:47 +0000142static vector signed char __ATTRS_o_ai vec_add(vector signed char __a,
143 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000144 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000145}
146
Bill Seurer703e8482015-06-09 14:39:47 +0000147static vector signed char __ATTRS_o_ai vec_add(vector bool char __a,
148 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000149 return (vector signed char)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000150}
151
Bill Seurer703e8482015-06-09 14:39:47 +0000152static vector signed char __ATTRS_o_ai vec_add(vector signed char __a,
153 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000154 return __a + (vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000155}
156
Bill Seurer703e8482015-06-09 14:39:47 +0000157static vector unsigned char __ATTRS_o_ai vec_add(vector unsigned char __a,
158 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000159 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000160}
161
Bill Seurer703e8482015-06-09 14:39:47 +0000162static vector unsigned char __ATTRS_o_ai vec_add(vector bool char __a,
163 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000164 return (vector unsigned char)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000165}
166
Bill Seurer703e8482015-06-09 14:39:47 +0000167static vector unsigned char __ATTRS_o_ai vec_add(vector unsigned char __a,
168 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000169 return __a + (vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000170}
171
Bill Seurer703e8482015-06-09 14:39:47 +0000172static vector short __ATTRS_o_ai vec_add(vector short __a, vector short __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 short __ATTRS_o_ai vec_add(vector bool short __a,
177 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000178 return (vector short)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000179}
180
Bill Seurer703e8482015-06-09 14:39:47 +0000181static vector short __ATTRS_o_ai vec_add(vector short __a,
182 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000183 return __a + (vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000184}
185
Bill Seurer703e8482015-06-09 14:39:47 +0000186static vector unsigned short __ATTRS_o_ai vec_add(vector unsigned short __a,
187 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000188 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000189}
190
Bill Seurer703e8482015-06-09 14:39:47 +0000191static vector unsigned short __ATTRS_o_ai vec_add(vector bool short __a,
192 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000193 return (vector unsigned short)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000194}
195
Bill Seurer703e8482015-06-09 14:39:47 +0000196static vector unsigned short __ATTRS_o_ai vec_add(vector unsigned short __a,
197 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000198 return __a + (vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000199}
200
Bill Seurer703e8482015-06-09 14:39:47 +0000201static vector int __ATTRS_o_ai vec_add(vector int __a, vector int __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 int __ATTRS_o_ai vec_add(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000206 return (vector int)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000207}
208
Bill Seurer703e8482015-06-09 14:39:47 +0000209static vector int __ATTRS_o_ai vec_add(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000210 return __a + (vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000211}
212
Bill Seurer703e8482015-06-09 14:39:47 +0000213static vector unsigned int __ATTRS_o_ai vec_add(vector unsigned int __a,
214 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000215 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000216}
217
Bill Seurer703e8482015-06-09 14:39:47 +0000218static vector unsigned int __ATTRS_o_ai vec_add(vector bool int __a,
219 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000220 return (vector unsigned int)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000221}
222
Bill Seurer703e8482015-06-09 14:39:47 +0000223static vector unsigned int __ATTRS_o_ai vec_add(vector unsigned int __a,
224 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000225 return __a + (vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000226}
227
Kit Barton5944ee212015-05-25 15:52:45 +0000228#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
Bill Seurer703e8482015-06-09 14:39:47 +0000229static vector signed __int128 __ATTRS_o_ai vec_add(vector signed __int128 __a,
230 vector signed __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +0000231 return __a + __b;
232}
233
234static vector unsigned __int128 __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000235vec_add(vector unsigned __int128 __a, vector unsigned __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +0000236 return __a + __b;
237}
238#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
239
Bill Seurer703e8482015-06-09 14:39:47 +0000240static vector float __ATTRS_o_ai vec_add(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000241 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000242}
243
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000244/* vec_vaddubm */
245
246#define __builtin_altivec_vaddubm vec_vaddubm
247
Bill Seurer703e8482015-06-09 14:39:47 +0000248static vector signed char __ATTRS_o_ai vec_vaddubm(vector signed char __a,
249 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000250 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000251}
252
Bill Seurer703e8482015-06-09 14:39:47 +0000253static vector signed char __ATTRS_o_ai vec_vaddubm(vector bool char __a,
254 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000255 return (vector signed char)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000256}
257
Bill Seurer703e8482015-06-09 14:39:47 +0000258static vector signed char __ATTRS_o_ai vec_vaddubm(vector signed char __a,
259 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000260 return __a + (vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000261}
262
Bill Seurer703e8482015-06-09 14:39:47 +0000263static vector unsigned char __ATTRS_o_ai vec_vaddubm(vector unsigned char __a,
264 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000265 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000266}
267
Bill Seurer703e8482015-06-09 14:39:47 +0000268static vector unsigned char __ATTRS_o_ai vec_vaddubm(vector bool char __a,
269 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000270 return (vector unsigned char)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000271}
272
Bill Seurer703e8482015-06-09 14:39:47 +0000273static vector unsigned char __ATTRS_o_ai vec_vaddubm(vector unsigned char __a,
274 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000275 return __a + (vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000276}
277
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000278/* vec_vadduhm */
279
280#define __builtin_altivec_vadduhm vec_vadduhm
281
Bill Seurer703e8482015-06-09 14:39:47 +0000282static vector short __ATTRS_o_ai vec_vadduhm(vector short __a,
283 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000284 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000285}
286
Bill Seurer703e8482015-06-09 14:39:47 +0000287static vector short __ATTRS_o_ai vec_vadduhm(vector bool short __a,
288 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000289 return (vector short)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000290}
291
Bill Seurer703e8482015-06-09 14:39:47 +0000292static vector short __ATTRS_o_ai vec_vadduhm(vector short __a,
293 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000294 return __a + (vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000295}
296
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000297static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000298vec_vadduhm(vector unsigned short __a, vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000299 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000300}
301
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000302static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000303vec_vadduhm(vector bool short __a, vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000304 return (vector unsigned short)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000305}
306
Bill Seurer703e8482015-06-09 14:39:47 +0000307static vector unsigned short __ATTRS_o_ai vec_vadduhm(vector unsigned short __a,
308 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000309 return __a + (vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000310}
311
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000312/* vec_vadduwm */
313
314#define __builtin_altivec_vadduwm vec_vadduwm
315
Bill Seurer703e8482015-06-09 14:39:47 +0000316static vector int __ATTRS_o_ai vec_vadduwm(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000317 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000318}
319
Bill Seurer703e8482015-06-09 14:39:47 +0000320static vector int __ATTRS_o_ai vec_vadduwm(vector bool int __a,
321 vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000322 return (vector int)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000323}
324
Bill Seurer703e8482015-06-09 14:39:47 +0000325static vector int __ATTRS_o_ai vec_vadduwm(vector int __a,
326 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000327 return __a + (vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000328}
329
Bill Seurer703e8482015-06-09 14:39:47 +0000330static vector unsigned int __ATTRS_o_ai vec_vadduwm(vector unsigned int __a,
331 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000332 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000333}
334
Bill Seurer703e8482015-06-09 14:39:47 +0000335static vector unsigned int __ATTRS_o_ai vec_vadduwm(vector bool int __a,
336 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000337 return (vector unsigned int)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000338}
339
Bill Seurer703e8482015-06-09 14:39:47 +0000340static vector unsigned int __ATTRS_o_ai vec_vadduwm(vector unsigned int __a,
341 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000342 return __a + (vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000343}
344
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000345/* vec_vaddfp */
346
Bill Seurer703e8482015-06-09 14:39:47 +0000347#define __builtin_altivec_vaddfp vec_vaddfp
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000348
349static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +0000350vec_vaddfp(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000351 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000352}
353
Chris Lattnerdad40622010-04-14 03:54:58 +0000354/* vec_addc */
355
Bill Seurer703e8482015-06-09 14:39:47 +0000356static vector unsigned int __ATTRS_o_ai vec_addc(vector unsigned int __a,
357 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000358 return __builtin_altivec_vaddcuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000359}
360
Kit Barton5944ee212015-05-25 15:52:45 +0000361#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
362static vector signed __int128 __ATTRS_o_ai
363vec_addc(vector signed __int128 __a, vector signed __int128 __b) {
364 return __builtin_altivec_vaddcuq(__a, __b);
365}
366
367static vector unsigned __int128 __ATTRS_o_ai
368vec_addc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
369 return __builtin_altivec_vaddcuq(__a, __b);
370}
371#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
372
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000373/* vec_vaddcuw */
374
375static vector unsigned int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +0000376vec_vaddcuw(vector unsigned int __a, vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000377 return __builtin_altivec_vaddcuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000378}
Chris Lattnerdad40622010-04-14 03:54:58 +0000379
380/* vec_adds */
381
Bill Seurer703e8482015-06-09 14:39:47 +0000382static vector signed char __ATTRS_o_ai vec_adds(vector signed char __a,
383 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000384 return __builtin_altivec_vaddsbs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000385}
386
Bill Seurer703e8482015-06-09 14:39:47 +0000387static vector signed char __ATTRS_o_ai vec_adds(vector bool char __a,
388 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000389 return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000390}
391
Bill Seurer703e8482015-06-09 14:39:47 +0000392static vector signed char __ATTRS_o_ai vec_adds(vector signed char __a,
393 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000394 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000395}
396
Bill Seurer703e8482015-06-09 14:39:47 +0000397static vector unsigned char __ATTRS_o_ai vec_adds(vector unsigned char __a,
398 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000399 return __builtin_altivec_vaddubs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000400}
401
Bill Seurer703e8482015-06-09 14:39:47 +0000402static vector unsigned char __ATTRS_o_ai vec_adds(vector bool char __a,
403 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000404 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000405}
406
Bill Seurer703e8482015-06-09 14:39:47 +0000407static vector unsigned char __ATTRS_o_ai vec_adds(vector unsigned char __a,
408 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000409 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000410}
411
Bill Seurer703e8482015-06-09 14:39:47 +0000412static vector short __ATTRS_o_ai vec_adds(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000413 return __builtin_altivec_vaddshs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000414}
415
Bill Seurer703e8482015-06-09 14:39:47 +0000416static vector short __ATTRS_o_ai vec_adds(vector bool short __a,
417 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000418 return __builtin_altivec_vaddshs((vector short)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000419}
420
Bill Seurer703e8482015-06-09 14:39:47 +0000421static vector short __ATTRS_o_ai vec_adds(vector short __a,
422 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000423 return __builtin_altivec_vaddshs(__a, (vector short)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000424}
425
Bill Seurer703e8482015-06-09 14:39:47 +0000426static vector unsigned short __ATTRS_o_ai vec_adds(vector unsigned short __a,
427 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000428 return __builtin_altivec_vadduhs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000429}
430
Bill Seurer703e8482015-06-09 14:39:47 +0000431static vector unsigned short __ATTRS_o_ai vec_adds(vector bool short __a,
432 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000433 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000434}
435
Bill Seurer703e8482015-06-09 14:39:47 +0000436static vector unsigned short __ATTRS_o_ai vec_adds(vector unsigned short __a,
437 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000438 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000439}
440
Bill Seurer703e8482015-06-09 14:39:47 +0000441static vector int __ATTRS_o_ai vec_adds(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000442 return __builtin_altivec_vaddsws(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000443}
444
Bill Seurer703e8482015-06-09 14:39:47 +0000445static vector int __ATTRS_o_ai vec_adds(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000446 return __builtin_altivec_vaddsws((vector int)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000447}
448
Bill Seurer703e8482015-06-09 14:39:47 +0000449static vector int __ATTRS_o_ai vec_adds(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000450 return __builtin_altivec_vaddsws(__a, (vector int)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000451}
452
Bill Seurer703e8482015-06-09 14:39:47 +0000453static vector unsigned int __ATTRS_o_ai vec_adds(vector unsigned int __a,
454 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000455 return __builtin_altivec_vadduws(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000456}
457
Bill Seurer703e8482015-06-09 14:39:47 +0000458static vector unsigned int __ATTRS_o_ai vec_adds(vector bool int __a,
459 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000460 return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000461}
462
Bill Seurer703e8482015-06-09 14:39:47 +0000463static vector unsigned int __ATTRS_o_ai vec_adds(vector unsigned int __a,
464 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000465 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000466}
467
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000468/* vec_vaddsbs */
Chris Lattnerdad40622010-04-14 03:54:58 +0000469
Bill Seurer703e8482015-06-09 14:39:47 +0000470static vector signed char __ATTRS_o_ai vec_vaddsbs(vector signed char __a,
471 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000472 return __builtin_altivec_vaddsbs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000473}
474
Bill Seurer703e8482015-06-09 14:39:47 +0000475static vector signed char __ATTRS_o_ai vec_vaddsbs(vector bool char __a,
476 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000477 return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000478}
479
Bill Seurer703e8482015-06-09 14:39:47 +0000480static vector signed char __ATTRS_o_ai vec_vaddsbs(vector signed char __a,
481 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000482 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000483}
484
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000485/* vec_vaddubs */
486
Bill Seurer703e8482015-06-09 14:39:47 +0000487static vector unsigned char __ATTRS_o_ai vec_vaddubs(vector unsigned char __a,
488 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000489 return __builtin_altivec_vaddubs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000490}
491
Bill Seurer703e8482015-06-09 14:39:47 +0000492static vector unsigned char __ATTRS_o_ai vec_vaddubs(vector bool char __a,
493 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000494 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000495}
496
Bill Seurer703e8482015-06-09 14:39:47 +0000497static vector unsigned char __ATTRS_o_ai vec_vaddubs(vector unsigned char __a,
498 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000499 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000500}
501
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000502/* vec_vaddshs */
503
Bill Seurer703e8482015-06-09 14:39:47 +0000504static vector short __ATTRS_o_ai vec_vaddshs(vector short __a,
505 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000506 return __builtin_altivec_vaddshs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000507}
508
Bill Seurer703e8482015-06-09 14:39:47 +0000509static vector short __ATTRS_o_ai vec_vaddshs(vector bool short __a,
510 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000511 return __builtin_altivec_vaddshs((vector short)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000512}
513
Bill Seurer703e8482015-06-09 14:39:47 +0000514static vector short __ATTRS_o_ai vec_vaddshs(vector short __a,
515 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000516 return __builtin_altivec_vaddshs(__a, (vector short)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000517}
518
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000519/* vec_vadduhs */
520
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000521static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000522vec_vadduhs(vector unsigned short __a, vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000523 return __builtin_altivec_vadduhs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000524}
525
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000526static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000527vec_vadduhs(vector bool short __a, vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000528 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000529}
530
Bill Seurer703e8482015-06-09 14:39:47 +0000531static vector unsigned short __ATTRS_o_ai vec_vadduhs(vector unsigned short __a,
532 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000533 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000534}
535
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000536/* vec_vaddsws */
537
Bill Seurer703e8482015-06-09 14:39:47 +0000538static vector int __ATTRS_o_ai vec_vaddsws(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000539 return __builtin_altivec_vaddsws(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000540}
541
Bill Seurer703e8482015-06-09 14:39:47 +0000542static vector int __ATTRS_o_ai vec_vaddsws(vector bool int __a,
543 vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000544 return __builtin_altivec_vaddsws((vector int)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000545}
546
Bill Seurer703e8482015-06-09 14:39:47 +0000547static vector int __ATTRS_o_ai vec_vaddsws(vector int __a,
548 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000549 return __builtin_altivec_vaddsws(__a, (vector int)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000550}
551
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000552/* vec_vadduws */
553
Bill Seurer703e8482015-06-09 14:39:47 +0000554static vector unsigned int __ATTRS_o_ai vec_vadduws(vector unsigned int __a,
555 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000556 return __builtin_altivec_vadduws(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000557}
558
Bill Seurer703e8482015-06-09 14:39:47 +0000559static vector unsigned int __ATTRS_o_ai vec_vadduws(vector bool int __a,
560 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000561 return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000562}
563
Bill Seurer703e8482015-06-09 14:39:47 +0000564static vector unsigned int __ATTRS_o_ai vec_vadduws(vector unsigned int __a,
565 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000566 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000567}
568
Kit Barton5944ee212015-05-25 15:52:45 +0000569#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
570/* vec_vadduqm */
571
572static vector signed __int128 __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000573vec_vadduqm(vector signed __int128 __a, vector signed __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +0000574 return __a + __b;
575}
576
577static vector unsigned __int128 __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000578vec_vadduqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +0000579 return __a + __b;
580}
581
582/* vec_vaddeuqm */
583
584static vector signed __int128 __ATTRS_o_ai
585vec_vaddeuqm(vector signed __int128 __a, vector signed __int128 __b,
586 vector signed __int128 __c) {
587 return __builtin_altivec_vaddeuqm(__a, __b, __c);
588}
589
590static vector unsigned __int128 __ATTRS_o_ai
591vec_vaddeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
592 vector unsigned __int128 __c) {
593 return __builtin_altivec_vaddeuqm(__a, __b, __c);
594}
595
596/* vec_vaddcuq */
597
598static vector signed __int128 __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000599vec_vaddcuq(vector signed __int128 __a, vector signed __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +0000600 return __builtin_altivec_vaddcuq(__a, __b);
601}
602
603static vector unsigned __int128 __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000604vec_vaddcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +0000605 return __builtin_altivec_vaddcuq(__a, __b);
606}
607
608/* vec_vaddecuq */
609
610static vector signed __int128 __ATTRS_o_ai
611vec_vaddecuq(vector signed __int128 __a, vector signed __int128 __b,
612 vector signed __int128 __c) {
613 return __builtin_altivec_vaddecuq(__a, __b, __c);
614}
615
616static vector unsigned __int128 __ATTRS_o_ai
617vec_vaddecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
618 vector unsigned __int128 __c) {
619 return __builtin_altivec_vaddecuq(__a, __b, __c);
620}
621#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
622
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000623/* vec_and */
624
625#define __builtin_altivec_vand vec_and
626
Bill Seurer703e8482015-06-09 14:39:47 +0000627static vector signed char __ATTRS_o_ai vec_and(vector signed char __a,
628 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000629 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000630}
631
Bill Seurer703e8482015-06-09 14:39:47 +0000632static vector signed char __ATTRS_o_ai vec_and(vector bool char __a,
633 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000634 return (vector signed char)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000635}
636
Bill Seurer703e8482015-06-09 14:39:47 +0000637static vector signed char __ATTRS_o_ai vec_and(vector signed char __a,
638 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000639 return __a & (vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000640}
641
Bill Seurer703e8482015-06-09 14:39:47 +0000642static vector unsigned char __ATTRS_o_ai vec_and(vector unsigned char __a,
643 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000644 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000645}
646
Bill Seurer703e8482015-06-09 14:39:47 +0000647static vector unsigned char __ATTRS_o_ai vec_and(vector bool char __a,
648 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000649 return (vector unsigned char)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000650}
651
Bill Seurer703e8482015-06-09 14:39:47 +0000652static vector unsigned char __ATTRS_o_ai vec_and(vector unsigned char __a,
653 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000654 return __a & (vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000655}
656
Bill Seurer703e8482015-06-09 14:39:47 +0000657static vector bool char __ATTRS_o_ai vec_and(vector bool char __a,
658 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000659 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000660}
661
Bill Seurer703e8482015-06-09 14:39:47 +0000662static vector short __ATTRS_o_ai vec_and(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000663 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000664}
665
Bill Seurer703e8482015-06-09 14:39:47 +0000666static vector short __ATTRS_o_ai vec_and(vector bool short __a,
667 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000668 return (vector short)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000669}
670
Bill Seurer703e8482015-06-09 14:39:47 +0000671static vector short __ATTRS_o_ai vec_and(vector short __a,
672 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000673 return __a & (vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000674}
675
Bill Seurer703e8482015-06-09 14:39:47 +0000676static vector unsigned short __ATTRS_o_ai vec_and(vector unsigned short __a,
677 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000678 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000679}
680
Bill Seurer703e8482015-06-09 14:39:47 +0000681static vector unsigned short __ATTRS_o_ai vec_and(vector bool short __a,
682 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000683 return (vector unsigned short)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000684}
685
Bill Seurer703e8482015-06-09 14:39:47 +0000686static vector unsigned short __ATTRS_o_ai vec_and(vector unsigned short __a,
687 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000688 return __a & (vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000689}
690
Bill Seurer703e8482015-06-09 14:39:47 +0000691static vector bool short __ATTRS_o_ai vec_and(vector bool short __a,
692 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000693 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000694}
695
Bill Seurer703e8482015-06-09 14:39:47 +0000696static vector int __ATTRS_o_ai vec_and(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000697 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000698}
699
Bill Seurer703e8482015-06-09 14:39:47 +0000700static vector int __ATTRS_o_ai vec_and(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000701 return (vector int)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000702}
703
Bill Seurer703e8482015-06-09 14:39:47 +0000704static vector int __ATTRS_o_ai vec_and(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000705 return __a & (vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000706}
707
Bill Seurer703e8482015-06-09 14:39:47 +0000708static vector unsigned int __ATTRS_o_ai vec_and(vector unsigned int __a,
709 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000710 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000711}
712
Bill Seurer703e8482015-06-09 14:39:47 +0000713static vector unsigned int __ATTRS_o_ai vec_and(vector bool int __a,
714 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000715 return (vector unsigned int)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000716}
717
Bill Seurer703e8482015-06-09 14:39:47 +0000718static vector unsigned int __ATTRS_o_ai vec_and(vector unsigned int __a,
719 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000720 return __a & (vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000721}
722
Bill Seurer703e8482015-06-09 14:39:47 +0000723static vector bool int __ATTRS_o_ai vec_and(vector bool int __a,
724 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000725 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000726}
727
Bill Seurer703e8482015-06-09 14:39:47 +0000728static vector float __ATTRS_o_ai vec_and(vector float __a, vector float __b) {
729 vector unsigned int __res =
730 (vector unsigned int)__a & (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +0000731 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000732}
733
Bill Seurer703e8482015-06-09 14:39:47 +0000734static vector float __ATTRS_o_ai vec_and(vector bool int __a,
735 vector float __b) {
736 vector unsigned int __res =
737 (vector unsigned int)__a & (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +0000738 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000739}
740
Bill Seurer703e8482015-06-09 14:39:47 +0000741static vector float __ATTRS_o_ai vec_and(vector float __a,
742 vector bool int __b) {
743 vector unsigned int __res =
744 (vector unsigned int)__a & (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +0000745 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000746}
747
Bill Seurer8be14f12015-06-04 18:45:44 +0000748#ifdef __VSX__
749static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000750vec_and(vector signed long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +0000751 return __a & __b;
752}
753
754static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000755vec_and(vector bool long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +0000756 return (vector signed long long)__a & __b;
757}
758
Bill Seurer703e8482015-06-09 14:39:47 +0000759static vector signed long long __ATTRS_o_ai vec_and(vector signed long long __a,
760 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +0000761 return __a & (vector signed long long)__b;
762}
763
764static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000765vec_and(vector unsigned long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +0000766 return __a & __b;
767}
768
769static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000770vec_and(vector bool long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +0000771 return (vector unsigned long long)__a & __b;
772}
773
774static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000775vec_and(vector unsigned long long __a, vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +0000776 return __a & (vector unsigned long long)__b;
777}
778
Bill Seurer703e8482015-06-09 14:39:47 +0000779static vector bool long long __ATTRS_o_ai vec_and(vector bool long long __a,
780 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +0000781 return __a & __b;
782}
783#endif
784
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000785/* vec_vand */
786
Bill Seurer703e8482015-06-09 14:39:47 +0000787static vector signed char __ATTRS_o_ai vec_vand(vector signed char __a,
788 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000789 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000790}
791
Bill Seurer703e8482015-06-09 14:39:47 +0000792static vector signed char __ATTRS_o_ai vec_vand(vector bool char __a,
793 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000794 return (vector signed char)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000795}
796
Bill Seurer703e8482015-06-09 14:39:47 +0000797static vector signed char __ATTRS_o_ai vec_vand(vector signed char __a,
798 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000799 return __a & (vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000800}
801
Bill Seurer703e8482015-06-09 14:39:47 +0000802static vector unsigned char __ATTRS_o_ai vec_vand(vector unsigned char __a,
803 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000804 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000805}
806
Bill Seurer703e8482015-06-09 14:39:47 +0000807static vector unsigned char __ATTRS_o_ai vec_vand(vector bool char __a,
808 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000809 return (vector unsigned char)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000810}
811
Bill Seurer703e8482015-06-09 14:39:47 +0000812static vector unsigned char __ATTRS_o_ai vec_vand(vector unsigned char __a,
813 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000814 return __a & (vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000815}
816
Bill Seurer703e8482015-06-09 14:39:47 +0000817static vector bool char __ATTRS_o_ai vec_vand(vector bool char __a,
818 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000819 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000820}
821
Bill Seurer703e8482015-06-09 14:39:47 +0000822static vector short __ATTRS_o_ai vec_vand(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000823 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000824}
825
Bill Seurer703e8482015-06-09 14:39:47 +0000826static vector short __ATTRS_o_ai vec_vand(vector bool short __a,
827 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000828 return (vector short)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000829}
830
Bill Seurer703e8482015-06-09 14:39:47 +0000831static vector short __ATTRS_o_ai vec_vand(vector short __a,
832 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000833 return __a & (vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000834}
835
Bill Seurer703e8482015-06-09 14:39:47 +0000836static vector unsigned short __ATTRS_o_ai vec_vand(vector unsigned short __a,
837 vector unsigned short __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 unsigned short __ATTRS_o_ai vec_vand(vector bool short __a,
842 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000843 return (vector unsigned short)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000844}
845
Bill Seurer703e8482015-06-09 14:39:47 +0000846static vector unsigned short __ATTRS_o_ai vec_vand(vector unsigned short __a,
847 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000848 return __a & (vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000849}
850
Bill Seurer703e8482015-06-09 14:39:47 +0000851static vector bool short __ATTRS_o_ai vec_vand(vector bool short __a,
852 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000853 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000854}
855
Bill Seurer703e8482015-06-09 14:39:47 +0000856static vector int __ATTRS_o_ai vec_vand(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000857 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000858}
859
Bill Seurer703e8482015-06-09 14:39:47 +0000860static vector int __ATTRS_o_ai vec_vand(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000861 return (vector int)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000862}
863
Bill Seurer703e8482015-06-09 14:39:47 +0000864static vector int __ATTRS_o_ai vec_vand(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000865 return __a & (vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000866}
867
Bill Seurer703e8482015-06-09 14:39:47 +0000868static vector unsigned int __ATTRS_o_ai vec_vand(vector unsigned int __a,
869 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000870 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000871}
872
Bill Seurer703e8482015-06-09 14:39:47 +0000873static vector unsigned int __ATTRS_o_ai vec_vand(vector bool int __a,
874 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000875 return (vector unsigned int)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000876}
877
Bill Seurer703e8482015-06-09 14:39:47 +0000878static vector unsigned int __ATTRS_o_ai vec_vand(vector unsigned int __a,
879 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000880 return __a & (vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000881}
882
Bill Seurer703e8482015-06-09 14:39:47 +0000883static vector bool int __ATTRS_o_ai vec_vand(vector bool int __a,
884 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000885 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000886}
887
Bill Seurer703e8482015-06-09 14:39:47 +0000888static vector float __ATTRS_o_ai vec_vand(vector float __a, vector float __b) {
889 vector unsigned int __res =
890 (vector unsigned int)__a & (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +0000891 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000892}
893
Bill Seurer703e8482015-06-09 14:39:47 +0000894static vector float __ATTRS_o_ai vec_vand(vector bool int __a,
895 vector float __b) {
896 vector unsigned int __res =
897 (vector unsigned int)__a & (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +0000898 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000899}
900
Bill Seurer703e8482015-06-09 14:39:47 +0000901static vector float __ATTRS_o_ai vec_vand(vector float __a,
902 vector bool int __b) {
903 vector unsigned int __res =
904 (vector unsigned int)__a & (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +0000905 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000906}
907
Bill Seurer8be14f12015-06-04 18:45:44 +0000908#ifdef __VSX__
909static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000910vec_vand(vector signed long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +0000911 return __a & __b;
912}
913
914static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000915vec_vand(vector bool long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +0000916 return (vector signed long long)__a & __b;
917}
918
919static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000920vec_vand(vector signed long long __a, vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +0000921 return __a & (vector signed long long)__b;
922}
923
924static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000925vec_vand(vector unsigned long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +0000926 return __a & __b;
927}
928
929static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000930vec_vand(vector bool long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +0000931 return (vector unsigned long long)__a & __b;
932}
933
934static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +0000935vec_vand(vector unsigned long long __a, vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +0000936 return __a & (vector unsigned long long)__b;
937}
938
Bill Seurer703e8482015-06-09 14:39:47 +0000939static vector bool long long __ATTRS_o_ai vec_vand(vector bool long long __a,
940 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +0000941 return __a & __b;
942}
943#endif
944
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000945/* vec_andc */
946
947#define __builtin_altivec_vandc vec_andc
948
Bill Seurer703e8482015-06-09 14:39:47 +0000949static vector signed char __ATTRS_o_ai vec_andc(vector signed char __a,
950 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000951 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000952}
953
Bill Seurer703e8482015-06-09 14:39:47 +0000954static vector signed char __ATTRS_o_ai vec_andc(vector bool char __a,
955 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000956 return (vector signed char)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000957}
958
Bill Seurer703e8482015-06-09 14:39:47 +0000959static vector signed char __ATTRS_o_ai vec_andc(vector signed char __a,
960 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000961 return __a & ~(vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000962}
963
Bill Seurer703e8482015-06-09 14:39:47 +0000964static vector unsigned char __ATTRS_o_ai vec_andc(vector unsigned char __a,
965 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000966 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000967}
968
Bill Seurer703e8482015-06-09 14:39:47 +0000969static vector unsigned char __ATTRS_o_ai vec_andc(vector bool char __a,
970 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000971 return (vector unsigned char)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000972}
973
Bill Seurer703e8482015-06-09 14:39:47 +0000974static vector unsigned char __ATTRS_o_ai vec_andc(vector unsigned char __a,
975 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000976 return __a & ~(vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000977}
978
Bill Seurer703e8482015-06-09 14:39:47 +0000979static vector bool char __ATTRS_o_ai vec_andc(vector bool char __a,
980 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000981 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000982}
983
Bill Seurer703e8482015-06-09 14:39:47 +0000984static vector short __ATTRS_o_ai vec_andc(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000985 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000986}
987
Bill Seurer703e8482015-06-09 14:39:47 +0000988static vector short __ATTRS_o_ai vec_andc(vector bool short __a,
989 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000990 return (vector short)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000991}
992
Bill Seurer703e8482015-06-09 14:39:47 +0000993static vector short __ATTRS_o_ai vec_andc(vector short __a,
994 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +0000995 return __a & ~(vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000996}
997
Bill Seurer703e8482015-06-09 14:39:47 +0000998static vector unsigned short __ATTRS_o_ai vec_andc(vector unsigned short __a,
999 vector unsigned short __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 unsigned short __ATTRS_o_ai vec_andc(vector bool short __a,
1004 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001005 return (vector unsigned short)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001006}
1007
Bill Seurer703e8482015-06-09 14:39:47 +00001008static vector unsigned short __ATTRS_o_ai vec_andc(vector unsigned short __a,
1009 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001010 return __a & ~(vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001011}
1012
Bill Seurer703e8482015-06-09 14:39:47 +00001013static vector bool short __ATTRS_o_ai vec_andc(vector bool short __a,
1014 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001015 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001016}
1017
Bill Seurer703e8482015-06-09 14:39:47 +00001018static vector int __ATTRS_o_ai vec_andc(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001019 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001020}
1021
Bill Seurer703e8482015-06-09 14:39:47 +00001022static vector int __ATTRS_o_ai vec_andc(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001023 return (vector int)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001024}
1025
Bill Seurer703e8482015-06-09 14:39:47 +00001026static vector int __ATTRS_o_ai vec_andc(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001027 return __a & ~(vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001028}
1029
Bill Seurer703e8482015-06-09 14:39:47 +00001030static vector unsigned int __ATTRS_o_ai vec_andc(vector unsigned int __a,
1031 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001032 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001033}
1034
Bill Seurer703e8482015-06-09 14:39:47 +00001035static vector unsigned int __ATTRS_o_ai vec_andc(vector bool int __a,
1036 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001037 return (vector unsigned int)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001038}
1039
Bill Seurer703e8482015-06-09 14:39:47 +00001040static vector unsigned int __ATTRS_o_ai vec_andc(vector unsigned int __a,
1041 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001042 return __a & ~(vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001043}
1044
Bill Seurer703e8482015-06-09 14:39:47 +00001045static vector bool int __ATTRS_o_ai vec_andc(vector bool int __a,
1046 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001047 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001048}
1049
Bill Seurer703e8482015-06-09 14:39:47 +00001050static vector float __ATTRS_o_ai vec_andc(vector float __a, vector float __b) {
1051 vector unsigned int __res =
1052 (vector unsigned int)__a & ~(vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00001053 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001054}
1055
Bill Seurer703e8482015-06-09 14:39:47 +00001056static vector float __ATTRS_o_ai vec_andc(vector bool int __a,
1057 vector float __b) {
1058 vector unsigned int __res =
1059 (vector unsigned int)__a & ~(vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00001060 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001061}
1062
Bill Seurer703e8482015-06-09 14:39:47 +00001063static vector float __ATTRS_o_ai vec_andc(vector float __a,
1064 vector bool int __b) {
1065 vector unsigned int __res =
1066 (vector unsigned int)__a & ~(vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00001067 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001068}
1069
Bill Seurer8be14f12015-06-04 18:45:44 +00001070#ifdef __VSX__
1071static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001072vec_andc(vector signed long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00001073 return __a & ~__b;
1074}
1075
1076static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001077vec_andc(vector bool long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00001078 return (vector signed long long)__a & ~__b;
1079}
1080
1081static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001082vec_andc(vector signed long long __a, vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00001083 return __a & ~(vector signed long long)__b;
1084}
1085
1086static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001087vec_andc(vector unsigned long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00001088 return __a & ~__b;
1089}
1090
1091static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001092vec_andc(vector bool long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00001093 return (vector unsigned long long)__a & ~__b;
1094}
1095
1096static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001097vec_andc(vector unsigned long long __a, vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00001098 return __a & ~(vector unsigned long long)__b;
1099}
1100
Bill Seurer703e8482015-06-09 14:39:47 +00001101static vector bool long long __ATTRS_o_ai vec_andc(vector bool long long __a,
1102 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00001103 return __a & ~__b;
1104}
1105#endif
1106
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001107/* vec_vandc */
1108
Bill Seurer703e8482015-06-09 14:39:47 +00001109static vector signed char __ATTRS_o_ai vec_vandc(vector signed char __a,
1110 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001111 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001112}
1113
Bill Seurer703e8482015-06-09 14:39:47 +00001114static vector signed char __ATTRS_o_ai vec_vandc(vector bool char __a,
1115 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001116 return (vector signed char)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001117}
1118
Bill Seurer703e8482015-06-09 14:39:47 +00001119static vector signed char __ATTRS_o_ai vec_vandc(vector signed char __a,
1120 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001121 return __a & ~(vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001122}
1123
Bill Seurer703e8482015-06-09 14:39:47 +00001124static vector unsigned char __ATTRS_o_ai vec_vandc(vector unsigned char __a,
1125 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001126 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001127}
1128
Bill Seurer703e8482015-06-09 14:39:47 +00001129static vector unsigned char __ATTRS_o_ai vec_vandc(vector bool char __a,
1130 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001131 return (vector unsigned char)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001132}
1133
Bill Seurer703e8482015-06-09 14:39:47 +00001134static vector unsigned char __ATTRS_o_ai vec_vandc(vector unsigned char __a,
1135 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001136 return __a & ~(vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001137}
1138
Bill Seurer703e8482015-06-09 14:39:47 +00001139static vector bool char __ATTRS_o_ai vec_vandc(vector bool char __a,
1140 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001141 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001142}
1143
Bill Seurer703e8482015-06-09 14:39:47 +00001144static vector short __ATTRS_o_ai vec_vandc(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001145 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001146}
1147
Bill Seurer703e8482015-06-09 14:39:47 +00001148static vector short __ATTRS_o_ai vec_vandc(vector bool short __a,
1149 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001150 return (vector short)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001151}
1152
Bill Seurer703e8482015-06-09 14:39:47 +00001153static vector short __ATTRS_o_ai vec_vandc(vector short __a,
1154 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001155 return __a & ~(vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001156}
1157
Bill Seurer703e8482015-06-09 14:39:47 +00001158static vector unsigned short __ATTRS_o_ai vec_vandc(vector unsigned short __a,
1159 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001160 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001161}
1162
Bill Seurer703e8482015-06-09 14:39:47 +00001163static vector unsigned short __ATTRS_o_ai vec_vandc(vector bool short __a,
1164 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001165 return (vector unsigned short)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001166}
1167
Bill Seurer703e8482015-06-09 14:39:47 +00001168static vector unsigned short __ATTRS_o_ai vec_vandc(vector unsigned short __a,
1169 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001170 return __a & ~(vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001171}
1172
Bill Seurer703e8482015-06-09 14:39:47 +00001173static vector bool short __ATTRS_o_ai vec_vandc(vector bool short __a,
1174 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001175 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001176}
1177
Bill Seurer703e8482015-06-09 14:39:47 +00001178static vector int __ATTRS_o_ai vec_vandc(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001179 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001180}
1181
Bill Seurer703e8482015-06-09 14:39:47 +00001182static vector int __ATTRS_o_ai vec_vandc(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001183 return (vector int)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001184}
1185
Bill Seurer703e8482015-06-09 14:39:47 +00001186static vector int __ATTRS_o_ai vec_vandc(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001187 return __a & ~(vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001188}
1189
Bill Seurer703e8482015-06-09 14:39:47 +00001190static vector unsigned int __ATTRS_o_ai vec_vandc(vector unsigned int __a,
1191 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001192 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001193}
1194
Bill Seurer703e8482015-06-09 14:39:47 +00001195static vector unsigned int __ATTRS_o_ai vec_vandc(vector bool int __a,
1196 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001197 return (vector unsigned int)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001198}
1199
Bill Seurer703e8482015-06-09 14:39:47 +00001200static vector unsigned int __ATTRS_o_ai vec_vandc(vector unsigned int __a,
1201 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001202 return __a & ~(vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001203}
1204
Bill Seurer703e8482015-06-09 14:39:47 +00001205static vector bool int __ATTRS_o_ai vec_vandc(vector bool int __a,
1206 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001207 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001208}
1209
Bill Seurer703e8482015-06-09 14:39:47 +00001210static vector float __ATTRS_o_ai vec_vandc(vector float __a, vector float __b) {
1211 vector unsigned int __res =
1212 (vector unsigned int)__a & ~(vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00001213 return (vector float)__res;
Chris Lattnerdad40622010-04-14 03:54:58 +00001214}
1215
Bill Seurer703e8482015-06-09 14:39:47 +00001216static vector float __ATTRS_o_ai vec_vandc(vector bool int __a,
1217 vector float __b) {
1218 vector unsigned int __res =
1219 (vector unsigned int)__a & ~(vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00001220 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001221}
1222
Bill Seurer703e8482015-06-09 14:39:47 +00001223static vector float __ATTRS_o_ai vec_vandc(vector float __a,
1224 vector bool int __b) {
1225 vector unsigned int __res =
1226 (vector unsigned int)__a & ~(vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00001227 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001228}
1229
Bill Seurer8be14f12015-06-04 18:45:44 +00001230#ifdef __VSX__
1231static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001232vec_vandc(vector signed long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00001233 return __a & ~__b;
1234}
1235
1236static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001237vec_vandc(vector bool long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00001238 return (vector signed long long)__a & ~__b;
1239}
1240
1241static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001242vec_vandc(vector signed long long __a, vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00001243 return __a & ~(vector signed long long)__b;
1244}
1245
1246static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001247vec_vandc(vector unsigned long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00001248 return __a & ~__b;
1249}
1250
1251static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001252vec_vandc(vector bool long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00001253 return (vector unsigned long long)__a & ~__b;
1254}
1255
1256static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001257vec_vandc(vector unsigned long long __a, vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00001258 return __a & ~(vector unsigned long long)__b;
1259}
1260
Bill Seurer703e8482015-06-09 14:39:47 +00001261static vector bool long long __ATTRS_o_ai vec_vandc(vector bool long long __a,
1262 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00001263 return __a & ~__b;
1264}
1265#endif
1266
Chris Lattnerdad40622010-04-14 03:54:58 +00001267/* vec_avg */
1268
Bill Seurer703e8482015-06-09 14:39:47 +00001269static vector signed char __ATTRS_o_ai vec_avg(vector signed char __a,
1270 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001271 return __builtin_altivec_vavgsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001272}
1273
Bill Seurer703e8482015-06-09 14:39:47 +00001274static vector unsigned char __ATTRS_o_ai vec_avg(vector unsigned char __a,
1275 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001276 return __builtin_altivec_vavgub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001277}
1278
Bill Seurer703e8482015-06-09 14:39:47 +00001279static vector short __ATTRS_o_ai vec_avg(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001280 return __builtin_altivec_vavgsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001281}
1282
Bill Seurer703e8482015-06-09 14:39:47 +00001283static vector unsigned short __ATTRS_o_ai vec_avg(vector unsigned short __a,
1284 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001285 return __builtin_altivec_vavguh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001286}
1287
Bill Seurer703e8482015-06-09 14:39:47 +00001288static vector int __ATTRS_o_ai vec_avg(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001289 return __builtin_altivec_vavgsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001290}
1291
Bill Seurer703e8482015-06-09 14:39:47 +00001292static vector unsigned int __ATTRS_o_ai vec_avg(vector unsigned int __a,
1293 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001294 return __builtin_altivec_vavguw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001295}
1296
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001297/* vec_vavgsb */
Chris Lattnerdad40622010-04-14 03:54:58 +00001298
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001299static vector signed char __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001300vec_vavgsb(vector signed char __a, vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001301 return __builtin_altivec_vavgsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001302}
1303
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001304/* vec_vavgub */
1305
1306static vector unsigned char __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001307vec_vavgub(vector unsigned char __a, vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001308 return __builtin_altivec_vavgub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001309}
1310
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001311/* vec_vavgsh */
1312
1313static vector short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001314vec_vavgsh(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001315 return __builtin_altivec_vavgsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001316}
1317
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001318/* vec_vavguh */
1319
1320static vector unsigned short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001321vec_vavguh(vector unsigned short __a, vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001322 return __builtin_altivec_vavguh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001323}
1324
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001325/* vec_vavgsw */
1326
1327static vector int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001328vec_vavgsw(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001329 return __builtin_altivec_vavgsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001330}
1331
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001332/* vec_vavguw */
1333
1334static vector unsigned int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001335vec_vavguw(vector unsigned int __a, vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001336 return __builtin_altivec_vavguw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001337}
1338
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001339/* vec_ceil */
1340
1341static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001342vec_ceil(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001343 return __builtin_altivec_vrfip(__a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001344}
1345
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001346/* vec_vrfip */
Chris Lattnerdad40622010-04-14 03:54:58 +00001347
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001348static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001349vec_vrfip(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001350 return __builtin_altivec_vrfip(__a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001351}
1352
1353/* vec_cmpb */
1354
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001355static vector int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001356vec_cmpb(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001357 return __builtin_altivec_vcmpbfp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001358}
1359
1360/* vec_vcmpbfp */
1361
1362static vector int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001363vec_vcmpbfp(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001364 return __builtin_altivec_vcmpbfp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001365}
Chris Lattnerdad40622010-04-14 03:54:58 +00001366
1367/* vec_cmpeq */
1368
Bill Seurer703e8482015-06-09 14:39:47 +00001369static vector bool char __ATTRS_o_ai vec_cmpeq(vector signed char __a,
1370 vector signed char __b) {
1371 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
1372 (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001373}
1374
Bill Seurer703e8482015-06-09 14:39:47 +00001375static vector bool char __ATTRS_o_ai vec_cmpeq(vector unsigned char __a,
1376 vector unsigned char __b) {
1377 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
1378 (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001379}
1380
Bill Seurer703e8482015-06-09 14:39:47 +00001381static vector bool short __ATTRS_o_ai vec_cmpeq(vector short __a,
1382 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001383 return (vector bool short)__builtin_altivec_vcmpequh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001384}
1385
Bill Seurer703e8482015-06-09 14:39:47 +00001386static vector bool short __ATTRS_o_ai vec_cmpeq(vector unsigned short __a,
1387 vector unsigned short __b) {
1388 return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a,
1389 (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001390}
1391
Bill Seurer703e8482015-06-09 14:39:47 +00001392static vector bool int __ATTRS_o_ai vec_cmpeq(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001393 return (vector bool int)__builtin_altivec_vcmpequw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001394}
1395
Bill Seurer703e8482015-06-09 14:39:47 +00001396static vector bool int __ATTRS_o_ai vec_cmpeq(vector unsigned int __a,
1397 vector unsigned int __b) {
1398 return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a,
1399 (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001400}
1401
Kit Barton8553bec2015-03-11 15:57:19 +00001402#ifdef __POWER8_VECTOR__
1403static vector bool long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001404vec_cmpeq(vector signed long long __a, vector signed long long __b) {
1405 return (vector bool long long)__builtin_altivec_vcmpequd(__a, __b);
Kit Barton8553bec2015-03-11 15:57:19 +00001406}
1407
1408static vector bool long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001409vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b) {
1410 return (vector bool long long)__builtin_altivec_vcmpequd(
1411 (vector long long)__a, (vector long long)__b);
Kit Barton8553bec2015-03-11 15:57:19 +00001412}
1413#endif
1414
Bill Seurer703e8482015-06-09 14:39:47 +00001415static vector bool int __ATTRS_o_ai vec_cmpeq(vector float __a,
1416 vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001417 return (vector bool int)__builtin_altivec_vcmpeqfp(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001418}
1419
1420/* vec_cmpge */
1421
Anton Yartsevfc83c602010-08-19 03:21:36 +00001422static vector bool int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001423vec_cmpge(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001424 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001425}
1426
1427/* vec_vcmpgefp */
1428
Anton Yartsevfc83c602010-08-19 03:21:36 +00001429static vector bool int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001430vec_vcmpgefp(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001431 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001432}
Chris Lattnerdad40622010-04-14 03:54:58 +00001433
1434/* vec_cmpgt */
1435
Bill Seurer703e8482015-06-09 14:39:47 +00001436static vector bool char __ATTRS_o_ai vec_cmpgt(vector signed char __a,
1437 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001438 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001439}
1440
Bill Seurer703e8482015-06-09 14:39:47 +00001441static vector bool char __ATTRS_o_ai vec_cmpgt(vector unsigned char __a,
1442 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001443 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001444}
1445
Bill Seurer703e8482015-06-09 14:39:47 +00001446static vector bool short __ATTRS_o_ai vec_cmpgt(vector short __a,
1447 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001448 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001449}
1450
Bill Seurer703e8482015-06-09 14:39:47 +00001451static vector bool short __ATTRS_o_ai vec_cmpgt(vector unsigned short __a,
1452 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001453 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001454}
1455
Bill Seurer703e8482015-06-09 14:39:47 +00001456static vector bool int __ATTRS_o_ai vec_cmpgt(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001457 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001458}
1459
Bill Seurer703e8482015-06-09 14:39:47 +00001460static vector bool int __ATTRS_o_ai vec_cmpgt(vector unsigned int __a,
1461 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001462 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001463}
1464
Kit Barton8553bec2015-03-11 15:57:19 +00001465#ifdef __POWER8_VECTOR__
1466static vector bool long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001467vec_cmpgt(vector signed long long __a, vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00001468 return (vector bool long long)__builtin_altivec_vcmpgtsd(__a, __b);
1469}
1470
1471static vector bool long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001472vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00001473 return (vector bool long long)__builtin_altivec_vcmpgtud(__a, __b);
1474}
1475#endif
1476
Bill Seurer703e8482015-06-09 14:39:47 +00001477static vector bool int __ATTRS_o_ai vec_cmpgt(vector float __a,
1478 vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001479 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001480}
1481
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001482/* vec_vcmpgtsb */
Chris Lattnerdad40622010-04-14 03:54:58 +00001483
Anton Yartsevfc83c602010-08-19 03:21:36 +00001484static vector bool char __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001485vec_vcmpgtsb(vector signed char __a, vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001486 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001487}
1488
1489/* vec_vcmpgtub */
1490
Anton Yartsevfc83c602010-08-19 03:21:36 +00001491static vector bool char __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001492vec_vcmpgtub(vector unsigned char __a, vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001493 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001494}
1495
1496/* vec_vcmpgtsh */
1497
Anton Yartsevfc83c602010-08-19 03:21:36 +00001498static vector bool short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001499vec_vcmpgtsh(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001500 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001501}
1502
1503/* vec_vcmpgtuh */
1504
Anton Yartsevfc83c602010-08-19 03:21:36 +00001505static vector bool short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001506vec_vcmpgtuh(vector unsigned short __a, vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001507 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001508}
1509
1510/* vec_vcmpgtsw */
1511
Anton Yartsevfc83c602010-08-19 03:21:36 +00001512static vector bool int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001513vec_vcmpgtsw(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001514 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001515}
1516
1517/* vec_vcmpgtuw */
1518
Anton Yartsevfc83c602010-08-19 03:21:36 +00001519static vector bool int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001520vec_vcmpgtuw(vector unsigned int __a, vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001521 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001522}
1523
1524/* vec_vcmpgtfp */
1525
Anton Yartsevfc83c602010-08-19 03:21:36 +00001526static vector bool int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001527vec_vcmpgtfp(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001528 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001529}
1530
1531/* vec_cmple */
Chris Lattnerdad40622010-04-14 03:54:58 +00001532
Anton Yartsevfc83c602010-08-19 03:21:36 +00001533static vector bool int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001534vec_cmple(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001535 return (vector bool int)__builtin_altivec_vcmpgefp(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001536}
1537
1538/* vec_cmplt */
1539
Bill Seurer703e8482015-06-09 14:39:47 +00001540static vector bool char __ATTRS_o_ai vec_cmplt(vector signed char __a,
1541 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001542 return (vector bool char)__builtin_altivec_vcmpgtsb(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001543}
1544
Bill Seurer703e8482015-06-09 14:39:47 +00001545static vector bool char __ATTRS_o_ai vec_cmplt(vector unsigned char __a,
1546 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001547 return (vector bool char)__builtin_altivec_vcmpgtub(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001548}
1549
Bill Seurer703e8482015-06-09 14:39:47 +00001550static vector bool short __ATTRS_o_ai vec_cmplt(vector short __a,
1551 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001552 return (vector bool short)__builtin_altivec_vcmpgtsh(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001553}
1554
Bill Seurer703e8482015-06-09 14:39:47 +00001555static vector bool short __ATTRS_o_ai vec_cmplt(vector unsigned short __a,
1556 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001557 return (vector bool short)__builtin_altivec_vcmpgtuh(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001558}
1559
Bill Seurer703e8482015-06-09 14:39:47 +00001560static vector bool int __ATTRS_o_ai vec_cmplt(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001561 return (vector bool int)__builtin_altivec_vcmpgtsw(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001562}
1563
Bill Seurer703e8482015-06-09 14:39:47 +00001564static vector bool int __ATTRS_o_ai vec_cmplt(vector unsigned int __a,
1565 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001566 return (vector bool int)__builtin_altivec_vcmpgtuw(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001567}
1568
Bill Seurer703e8482015-06-09 14:39:47 +00001569static vector bool int __ATTRS_o_ai vec_cmplt(vector float __a,
1570 vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001571 return (vector bool int)__builtin_altivec_vcmpgtfp(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001572}
1573
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001574/* vec_ctf */
1575
Bill Seurer703e8482015-06-09 14:39:47 +00001576static vector float __ATTRS_o_ai vec_ctf(vector int __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001577 return __builtin_altivec_vcfsx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001578}
1579
Bill Seurer703e8482015-06-09 14:39:47 +00001580static vector float __ATTRS_o_ai vec_ctf(vector unsigned int __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001581 return __builtin_altivec_vcfux((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001582}
1583
1584/* vec_vcfsx */
1585
1586static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001587vec_vcfsx(vector int __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001588 return __builtin_altivec_vcfsx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001589}
1590
1591/* vec_vcfux */
1592
1593static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001594vec_vcfux(vector unsigned int __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001595 return __builtin_altivec_vcfux((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001596}
1597
1598/* vec_cts */
1599
1600static vector int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001601vec_cts(vector float __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001602 return __builtin_altivec_vctsxs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001603}
1604
1605/* vec_vctsxs */
1606
1607static vector int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001608vec_vctsxs(vector float __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001609 return __builtin_altivec_vctsxs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001610}
1611
1612/* vec_ctu */
1613
1614static vector unsigned int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001615vec_ctu(vector float __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001616 return __builtin_altivec_vctuxs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001617}
1618
1619/* vec_vctuxs */
1620
1621static vector unsigned int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001622vec_vctuxs(vector float __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001623 return __builtin_altivec_vctuxs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001624}
1625
Bill Schmidtcee13a22014-11-14 12:10:51 +00001626/* vec_div */
1627#ifdef __VSX__
Bill Seurer703e8482015-06-09 14:39:47 +00001628static vector float __ATTRS_o_ai vec_div(vector float __a, vector float __b) {
Bill Schmidtcee13a22014-11-14 12:10:51 +00001629 return __builtin_vsx_xvdivsp(__a, __b);
1630}
1631
Bill Seurer703e8482015-06-09 14:39:47 +00001632static vector double __ATTRS_o_ai vec_div(vector double __a,
1633 vector double __b) {
Bill Schmidtcee13a22014-11-14 12:10:51 +00001634 return __builtin_vsx_xvdivdp(__a, __b);
1635}
1636#endif
1637
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001638/* vec_dss */
1639
Bill Seurer703e8482015-06-09 14:39:47 +00001640static void __attribute__((__always_inline__)) vec_dss(int __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001641 __builtin_altivec_dss(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001642}
1643
1644/* vec_dssall */
1645
Bill Seurer703e8482015-06-09 14:39:47 +00001646static void __attribute__((__always_inline__)) vec_dssall(void) {
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001647 __builtin_altivec_dssall();
1648}
1649
1650/* vec_dst */
1651
1652static void __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001653vec_dst(const void *__a, int __b, int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001654 __builtin_altivec_dst(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001655}
1656
1657/* vec_dstst */
1658
1659static void __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001660vec_dstst(const void *__a, int __b, int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001661 __builtin_altivec_dstst(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001662}
1663
1664/* vec_dststt */
1665
1666static void __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001667vec_dststt(const void *__a, int __b, int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001668 __builtin_altivec_dststt(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001669}
1670
1671/* vec_dstt */
1672
1673static void __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001674vec_dstt(const void *__a, int __b, int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001675 __builtin_altivec_dstt(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001676}
1677
1678/* vec_expte */
1679
1680static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001681vec_expte(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001682 return __builtin_altivec_vexptefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001683}
1684
1685/* vec_vexptefp */
1686
1687static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001688vec_vexptefp(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001689 return __builtin_altivec_vexptefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001690}
1691
1692/* vec_floor */
1693
1694static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001695vec_floor(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001696 return __builtin_altivec_vrfim(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001697}
1698
1699/* vec_vrfim */
1700
1701static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00001702vec_vrfim(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001703 return __builtin_altivec_vrfim(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001704}
1705
1706/* vec_ld */
1707
Bill Seurer703e8482015-06-09 14:39:47 +00001708static vector signed char __ATTRS_o_ai vec_ld(int __a,
1709 const vector signed char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001710 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001711}
1712
Bill Seurer703e8482015-06-09 14:39:47 +00001713static vector signed char __ATTRS_o_ai vec_ld(int __a, const signed char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001714 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001715}
1716
1717static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001718vec_ld(int __a, const vector unsigned char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001719 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001720}
1721
Bill Seurer703e8482015-06-09 14:39:47 +00001722static vector unsigned char __ATTRS_o_ai vec_ld(int __a,
1723 const unsigned char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001724 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001725}
1726
Bill Seurer703e8482015-06-09 14:39:47 +00001727static vector bool char __ATTRS_o_ai vec_ld(int __a,
1728 const vector bool char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001729 return (vector bool char)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001730}
1731
Bill Seurer703e8482015-06-09 14:39:47 +00001732static vector short __ATTRS_o_ai vec_ld(int __a, const vector short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001733 return (vector short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001734}
1735
Bill Seurer703e8482015-06-09 14:39:47 +00001736static vector short __ATTRS_o_ai vec_ld(int __a, const short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001737 return (vector short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001738}
1739
1740static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001741vec_ld(int __a, const vector unsigned short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001742 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001743}
1744
Bill Seurer703e8482015-06-09 14:39:47 +00001745static vector unsigned short __ATTRS_o_ai vec_ld(int __a,
1746 const unsigned short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001747 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001748}
1749
Bill Seurer703e8482015-06-09 14:39:47 +00001750static vector bool short __ATTRS_o_ai vec_ld(int __a,
1751 const vector bool short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001752 return (vector bool short)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001753}
1754
Bill Seurer703e8482015-06-09 14:39:47 +00001755static vector pixel __ATTRS_o_ai vec_ld(int __a, const vector pixel *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001756 return (vector pixel)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001757}
1758
Bill Seurer703e8482015-06-09 14:39:47 +00001759static vector int __ATTRS_o_ai vec_ld(int __a, const vector int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001760 return (vector int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001761}
1762
Bill Seurer703e8482015-06-09 14:39:47 +00001763static vector int __ATTRS_o_ai vec_ld(int __a, const int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001764 return (vector int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001765}
1766
Bill Seurer703e8482015-06-09 14:39:47 +00001767static vector unsigned int __ATTRS_o_ai vec_ld(int __a,
1768 const vector unsigned int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001769 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001770}
1771
Bill Seurer703e8482015-06-09 14:39:47 +00001772static vector unsigned int __ATTRS_o_ai vec_ld(int __a,
1773 const unsigned int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001774 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001775}
1776
Bill Seurer703e8482015-06-09 14:39:47 +00001777static vector bool int __ATTRS_o_ai vec_ld(int __a,
1778 const vector bool int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001779 return (vector bool int)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001780}
1781
Bill Seurer703e8482015-06-09 14:39:47 +00001782static vector float __ATTRS_o_ai vec_ld(int __a, const vector float *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001783 return (vector float)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001784}
1785
Bill Seurer703e8482015-06-09 14:39:47 +00001786static vector float __ATTRS_o_ai vec_ld(int __a, const float *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001787 return (vector float)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001788}
1789
1790/* vec_lvx */
1791
Bill Seurer703e8482015-06-09 14:39:47 +00001792static vector signed char __ATTRS_o_ai vec_lvx(int __a,
1793 const vector signed char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001794 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001795}
1796
Bill Seurer703e8482015-06-09 14:39:47 +00001797static vector signed char __ATTRS_o_ai vec_lvx(int __a,
1798 const signed char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001799 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001800}
1801
1802static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001803vec_lvx(int __a, const vector unsigned char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001804 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001805}
1806
Bill Seurer703e8482015-06-09 14:39:47 +00001807static vector unsigned char __ATTRS_o_ai vec_lvx(int __a,
1808 const unsigned char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001809 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001810}
1811
Bill Seurer703e8482015-06-09 14:39:47 +00001812static vector bool char __ATTRS_o_ai vec_lvx(int __a,
1813 const vector bool char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001814 return (vector bool char)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001815}
1816
Bill Seurer703e8482015-06-09 14:39:47 +00001817static vector short __ATTRS_o_ai vec_lvx(int __a, const vector short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001818 return (vector short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001819}
1820
Bill Seurer703e8482015-06-09 14:39:47 +00001821static vector short __ATTRS_o_ai vec_lvx(int __a, const short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001822 return (vector short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001823}
1824
1825static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001826vec_lvx(int __a, const vector unsigned short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001827 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001828}
1829
Bill Seurer703e8482015-06-09 14:39:47 +00001830static vector unsigned short __ATTRS_o_ai vec_lvx(int __a,
1831 const unsigned short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001832 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001833}
1834
Bill Seurer703e8482015-06-09 14:39:47 +00001835static vector bool short __ATTRS_o_ai vec_lvx(int __a,
1836 const vector bool short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001837 return (vector bool short)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001838}
1839
Bill Seurer703e8482015-06-09 14:39:47 +00001840static vector pixel __ATTRS_o_ai vec_lvx(int __a, const vector pixel *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001841 return (vector pixel)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001842}
1843
Bill Seurer703e8482015-06-09 14:39:47 +00001844static vector int __ATTRS_o_ai vec_lvx(int __a, const vector int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001845 return (vector int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001846}
1847
Bill Seurer703e8482015-06-09 14:39:47 +00001848static vector int __ATTRS_o_ai vec_lvx(int __a, const int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001849 return (vector int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001850}
1851
1852static vector unsigned int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001853vec_lvx(int __a, const vector unsigned int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001854 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001855}
1856
Bill Seurer703e8482015-06-09 14:39:47 +00001857static vector unsigned int __ATTRS_o_ai vec_lvx(int __a,
1858 const unsigned int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001859 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001860}
1861
Bill Seurer703e8482015-06-09 14:39:47 +00001862static vector bool int __ATTRS_o_ai vec_lvx(int __a,
1863 const vector bool int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001864 return (vector bool int)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001865}
1866
Bill Seurer703e8482015-06-09 14:39:47 +00001867static vector float __ATTRS_o_ai vec_lvx(int __a, const vector float *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001868 return (vector float)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001869}
1870
Bill Seurer703e8482015-06-09 14:39:47 +00001871static vector float __ATTRS_o_ai vec_lvx(int __a, const float *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001872 return (vector float)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001873}
1874
1875/* vec_lde */
1876
Bill Seurer703e8482015-06-09 14:39:47 +00001877static vector signed char __ATTRS_o_ai vec_lde(int __a,
1878 const signed char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001879 return (vector signed char)__builtin_altivec_lvebx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001880}
1881
Bill Seurer703e8482015-06-09 14:39:47 +00001882static vector unsigned char __ATTRS_o_ai vec_lde(int __a,
1883 const unsigned char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001884 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001885}
1886
Bill Seurer703e8482015-06-09 14:39:47 +00001887static vector short __ATTRS_o_ai vec_lde(int __a, const short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001888 return (vector short)__builtin_altivec_lvehx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001889}
1890
Bill Seurer703e8482015-06-09 14:39:47 +00001891static vector unsigned short __ATTRS_o_ai vec_lde(int __a,
1892 const unsigned short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001893 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001894}
1895
Bill Seurer703e8482015-06-09 14:39:47 +00001896static vector int __ATTRS_o_ai vec_lde(int __a, const int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001897 return (vector int)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001898}
1899
Bill Seurer703e8482015-06-09 14:39:47 +00001900static vector unsigned int __ATTRS_o_ai vec_lde(int __a,
1901 const unsigned int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001902 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001903}
1904
Bill Seurer703e8482015-06-09 14:39:47 +00001905static vector float __ATTRS_o_ai vec_lde(int __a, const float *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001906 return (vector float)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001907}
1908
1909/* vec_lvebx */
1910
Bill Seurer703e8482015-06-09 14:39:47 +00001911static vector signed char __ATTRS_o_ai vec_lvebx(int __a,
1912 const signed char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001913 return (vector signed char)__builtin_altivec_lvebx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001914}
1915
Bill Seurer703e8482015-06-09 14:39:47 +00001916static vector unsigned char __ATTRS_o_ai vec_lvebx(int __a,
1917 const unsigned char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001918 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001919}
1920
1921/* vec_lvehx */
1922
Bill Seurer703e8482015-06-09 14:39:47 +00001923static vector short __ATTRS_o_ai vec_lvehx(int __a, const short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001924 return (vector short)__builtin_altivec_lvehx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001925}
1926
Bill Seurer703e8482015-06-09 14:39:47 +00001927static vector unsigned short __ATTRS_o_ai vec_lvehx(int __a,
1928 const unsigned short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001929 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001930}
1931
1932/* vec_lvewx */
1933
Bill Seurer703e8482015-06-09 14:39:47 +00001934static vector int __ATTRS_o_ai vec_lvewx(int __a, const int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001935 return (vector int)__builtin_altivec_lvewx(__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_lvewx(int __a,
1939 const unsigned int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001940 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001941}
1942
Bill Seurer703e8482015-06-09 14:39:47 +00001943static vector float __ATTRS_o_ai vec_lvewx(int __a, const float *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001944 return (vector float)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001945}
1946
1947/* vec_ldl */
1948
Bill Seurer703e8482015-06-09 14:39:47 +00001949static vector signed char __ATTRS_o_ai vec_ldl(int __a,
1950 const vector signed char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001951 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001952}
1953
Bill Seurer703e8482015-06-09 14:39:47 +00001954static vector signed char __ATTRS_o_ai vec_ldl(int __a,
1955 const signed char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001956 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001957}
1958
1959static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001960vec_ldl(int __a, const vector unsigned char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001961 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001962}
1963
Bill Seurer703e8482015-06-09 14:39:47 +00001964static vector unsigned char __ATTRS_o_ai vec_ldl(int __a,
1965 const unsigned char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001966 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001967}
1968
Bill Seurer703e8482015-06-09 14:39:47 +00001969static vector bool char __ATTRS_o_ai vec_ldl(int __a,
1970 const vector bool char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001971 return (vector bool char)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001972}
1973
Bill Seurer703e8482015-06-09 14:39:47 +00001974static vector short __ATTRS_o_ai vec_ldl(int __a, const vector short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001975 return (vector short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001976}
1977
Bill Seurer703e8482015-06-09 14:39:47 +00001978static vector short __ATTRS_o_ai vec_ldl(int __a, const short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001979 return (vector short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001980}
1981
1982static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00001983vec_ldl(int __a, const vector unsigned short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001984 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001985}
1986
Bill Seurer703e8482015-06-09 14:39:47 +00001987static vector unsigned short __ATTRS_o_ai vec_ldl(int __a,
1988 const unsigned short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001989 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001990}
1991
Bill Seurer703e8482015-06-09 14:39:47 +00001992static vector bool short __ATTRS_o_ai vec_ldl(int __a,
1993 const vector bool short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001994 return (vector bool short)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001995}
1996
Bill Seurer703e8482015-06-09 14:39:47 +00001997static vector pixel __ATTRS_o_ai vec_ldl(int __a, const vector pixel *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00001998 return (vector pixel short)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001999}
2000
Bill Seurer703e8482015-06-09 14:39:47 +00002001static vector int __ATTRS_o_ai vec_ldl(int __a, const vector int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002002 return (vector int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002003}
2004
Bill Seurer703e8482015-06-09 14:39:47 +00002005static vector int __ATTRS_o_ai vec_ldl(int __a, const int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002006 return (vector int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002007}
2008
2009static vector unsigned int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002010vec_ldl(int __a, const vector unsigned int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002011 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002012}
2013
Bill Seurer703e8482015-06-09 14:39:47 +00002014static vector unsigned int __ATTRS_o_ai vec_ldl(int __a,
2015 const unsigned int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002016 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002017}
2018
Bill Seurer703e8482015-06-09 14:39:47 +00002019static vector bool int __ATTRS_o_ai vec_ldl(int __a,
2020 const vector bool int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002021 return (vector bool int)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002022}
2023
Bill Seurer703e8482015-06-09 14:39:47 +00002024static vector float __ATTRS_o_ai vec_ldl(int __a, const vector float *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002025 return (vector float)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002026}
2027
Bill Seurer703e8482015-06-09 14:39:47 +00002028static vector float __ATTRS_o_ai vec_ldl(int __a, const float *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002029 return (vector float)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002030}
2031
2032/* vec_lvxl */
2033
Bill Seurer703e8482015-06-09 14:39:47 +00002034static vector signed char __ATTRS_o_ai vec_lvxl(int __a,
2035 const vector signed char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002036 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002037}
2038
Bill Seurer703e8482015-06-09 14:39:47 +00002039static vector signed char __ATTRS_o_ai vec_lvxl(int __a,
2040 const signed char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002041 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002042}
2043
2044static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002045vec_lvxl(int __a, const vector unsigned char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002046 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002047}
2048
Bill Seurer703e8482015-06-09 14:39:47 +00002049static vector unsigned char __ATTRS_o_ai vec_lvxl(int __a,
2050 const unsigned char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002051 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002052}
2053
Bill Seurer703e8482015-06-09 14:39:47 +00002054static vector bool char __ATTRS_o_ai vec_lvxl(int __a,
2055 const vector bool char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002056 return (vector bool char)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002057}
2058
Bill Seurer703e8482015-06-09 14:39:47 +00002059static vector short __ATTRS_o_ai vec_lvxl(int __a, const vector short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002060 return (vector short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002061}
2062
Bill Seurer703e8482015-06-09 14:39:47 +00002063static vector short __ATTRS_o_ai vec_lvxl(int __a, const short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002064 return (vector short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002065}
2066
2067static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002068vec_lvxl(int __a, const vector unsigned short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002069 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002070}
2071
Bill Seurer703e8482015-06-09 14:39:47 +00002072static vector unsigned short __ATTRS_o_ai vec_lvxl(int __a,
2073 const unsigned short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002074 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002075}
2076
Bill Seurer703e8482015-06-09 14:39:47 +00002077static vector bool short __ATTRS_o_ai vec_lvxl(int __a,
2078 const vector bool short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002079 return (vector bool short)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002080}
2081
Bill Seurer703e8482015-06-09 14:39:47 +00002082static vector pixel __ATTRS_o_ai vec_lvxl(int __a, const vector pixel *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002083 return (vector pixel)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002084}
2085
Bill Seurer703e8482015-06-09 14:39:47 +00002086static vector int __ATTRS_o_ai vec_lvxl(int __a, const vector int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002087 return (vector int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002088}
2089
Bill Seurer703e8482015-06-09 14:39:47 +00002090static vector int __ATTRS_o_ai vec_lvxl(int __a, const int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002091 return (vector int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002092}
2093
2094static vector unsigned int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002095vec_lvxl(int __a, const vector unsigned int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002096 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002097}
2098
Bill Seurer703e8482015-06-09 14:39:47 +00002099static vector unsigned int __ATTRS_o_ai vec_lvxl(int __a,
2100 const unsigned int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002101 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002102}
2103
Bill Seurer703e8482015-06-09 14:39:47 +00002104static vector bool int __ATTRS_o_ai vec_lvxl(int __a,
2105 const vector bool int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002106 return (vector bool int)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002107}
2108
Bill Seurer703e8482015-06-09 14:39:47 +00002109static vector float __ATTRS_o_ai vec_lvxl(int __a, const vector float *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002110 return (vector float)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002111}
2112
Bill Seurer703e8482015-06-09 14:39:47 +00002113static vector float __ATTRS_o_ai vec_lvxl(int __a, const float *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002114 return (vector float)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002115}
2116
2117/* vec_loge */
2118
2119static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00002120vec_loge(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002121 return __builtin_altivec_vlogefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002122}
2123
2124/* vec_vlogefp */
2125
2126static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00002127vec_vlogefp(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002128 return __builtin_altivec_vlogefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002129}
2130
2131/* vec_lvsl */
2132
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002133#ifdef __LITTLE_ENDIAN__
2134static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002135 __attribute__((__deprecated__("use assignment for unaligned little endian \
2136loads/stores"))) vec_lvsl(int __a, const signed char *__b) {
2137 vector unsigned char mask =
2138 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2139 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2140 7, 6, 5, 4, 3, 2, 1, 0};
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002141 return vec_perm(mask, mask, reverse);
2142}
2143#else
Bill Seurer703e8482015-06-09 14:39:47 +00002144static vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
2145 const signed char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002146 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002147}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002148#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002149
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002150#ifdef __LITTLE_ENDIAN__
2151static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002152 __attribute__((__deprecated__("use assignment for unaligned little endian \
2153loads/stores"))) vec_lvsl(int __a, const unsigned char *__b) {
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002154 vector unsigned char mask =
Bill Seurer703e8482015-06-09 14:39:47 +00002155 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2156 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2157 7, 6, 5, 4, 3, 2, 1, 0};
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002158 return vec_perm(mask, mask, reverse);
2159}
2160#else
Bill Seurer703e8482015-06-09 14:39:47 +00002161static vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
2162 const unsigned char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002163 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002164}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002165#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002166
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002167#ifdef __LITTLE_ENDIAN__
2168static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002169 __attribute__((__deprecated__("use assignment for unaligned little endian \
2170loads/stores"))) vec_lvsl(int __a, const short *__b) {
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002171 vector unsigned char mask =
Bill Seurer703e8482015-06-09 14:39:47 +00002172 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2173 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2174 7, 6, 5, 4, 3, 2, 1, 0};
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002175 return vec_perm(mask, mask, reverse);
2176}
2177#else
Bill Seurer703e8482015-06-09 14:39:47 +00002178static vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, const short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002179 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002180}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002181#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002182
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002183#ifdef __LITTLE_ENDIAN__
2184static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002185 __attribute__((__deprecated__("use assignment for unaligned little endian \
2186loads/stores"))) vec_lvsl(int __a, const unsigned short *__b) {
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002187 vector unsigned char mask =
Bill Seurer703e8482015-06-09 14:39:47 +00002188 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2189 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2190 7, 6, 5, 4, 3, 2, 1, 0};
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002191 return vec_perm(mask, mask, reverse);
2192}
2193#else
Bill Seurer703e8482015-06-09 14:39:47 +00002194static vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
2195 const unsigned short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002196 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002197}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002198#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002199
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002200#ifdef __LITTLE_ENDIAN__
2201static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002202 __attribute__((__deprecated__("use assignment for unaligned little endian \
2203loads/stores"))) vec_lvsl(int __a, const int *__b) {
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002204 vector unsigned char mask =
Bill Seurer703e8482015-06-09 14:39:47 +00002205 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2206 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2207 7, 6, 5, 4, 3, 2, 1, 0};
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002208 return vec_perm(mask, mask, reverse);
2209}
2210#else
Bill Seurer703e8482015-06-09 14:39:47 +00002211static vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, const int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002212 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002213}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002214#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002215
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002216#ifdef __LITTLE_ENDIAN__
2217static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002218 __attribute__((__deprecated__("use assignment for unaligned little endian \
2219loads/stores"))) vec_lvsl(int __a, const unsigned int *__b) {
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002220 vector unsigned char mask =
Bill Seurer703e8482015-06-09 14:39:47 +00002221 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2222 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2223 7, 6, 5, 4, 3, 2, 1, 0};
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002224 return vec_perm(mask, mask, reverse);
2225}
2226#else
Bill Seurer703e8482015-06-09 14:39:47 +00002227static vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
2228 const unsigned int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002229 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002230}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002231#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002232
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002233#ifdef __LITTLE_ENDIAN__
2234static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002235 __attribute__((__deprecated__("use assignment for unaligned little endian \
2236loads/stores"))) vec_lvsl(int __a, const float *__b) {
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002237 vector unsigned char mask =
Bill Seurer703e8482015-06-09 14:39:47 +00002238 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2239 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2240 7, 6, 5, 4, 3, 2, 1, 0};
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002241 return vec_perm(mask, mask, reverse);
2242}
2243#else
Bill Seurer703e8482015-06-09 14:39:47 +00002244static vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, const float *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002245 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002246}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002247#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002248
2249/* vec_lvsr */
2250
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002251#ifdef __LITTLE_ENDIAN__
2252static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002253 __attribute__((__deprecated__("use assignment for unaligned little endian \
2254loads/stores"))) vec_lvsr(int __a, const signed char *__b) {
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002255 vector unsigned char mask =
Bill Seurer703e8482015-06-09 14:39:47 +00002256 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2257 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2258 7, 6, 5, 4, 3, 2, 1, 0};
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002259 return vec_perm(mask, mask, reverse);
2260}
2261#else
Bill Seurer703e8482015-06-09 14:39:47 +00002262static vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
2263 const signed char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002264 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002265}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002266#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002267
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002268#ifdef __LITTLE_ENDIAN__
2269static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002270 __attribute__((__deprecated__("use assignment for unaligned little endian \
2271loads/stores"))) vec_lvsr(int __a, const unsigned char *__b) {
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002272 vector unsigned char mask =
Bill Seurer703e8482015-06-09 14:39:47 +00002273 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2274 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2275 7, 6, 5, 4, 3, 2, 1, 0};
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002276 return vec_perm(mask, mask, reverse);
2277}
2278#else
Bill Seurer703e8482015-06-09 14:39:47 +00002279static vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
2280 const unsigned char *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002281 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002282}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002283#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002284
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002285#ifdef __LITTLE_ENDIAN__
2286static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002287 __attribute__((__deprecated__("use assignment for unaligned little endian \
2288loads/stores"))) vec_lvsr(int __a, const short *__b) {
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002289 vector unsigned char mask =
Bill Seurer703e8482015-06-09 14:39:47 +00002290 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2291 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2292 7, 6, 5, 4, 3, 2, 1, 0};
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002293 return vec_perm(mask, mask, reverse);
2294}
2295#else
Bill Seurer703e8482015-06-09 14:39:47 +00002296static vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, const short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002297 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002298}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002299#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002300
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002301#ifdef __LITTLE_ENDIAN__
2302static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002303 __attribute__((__deprecated__("use assignment for unaligned little endian \
2304loads/stores"))) vec_lvsr(int __a, const unsigned short *__b) {
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002305 vector unsigned char mask =
Bill Seurer703e8482015-06-09 14:39:47 +00002306 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2307 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2308 7, 6, 5, 4, 3, 2, 1, 0};
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002309 return vec_perm(mask, mask, reverse);
2310}
2311#else
Bill Seurer703e8482015-06-09 14:39:47 +00002312static vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
2313 const unsigned short *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002314 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002315}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002316#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002317
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002318#ifdef __LITTLE_ENDIAN__
2319static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002320 __attribute__((__deprecated__("use assignment for unaligned little endian \
2321loads/stores"))) vec_lvsr(int __a, const int *__b) {
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002322 vector unsigned char mask =
Bill Seurer703e8482015-06-09 14:39:47 +00002323 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2324 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2325 7, 6, 5, 4, 3, 2, 1, 0};
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002326 return vec_perm(mask, mask, reverse);
2327}
2328#else
Bill Seurer703e8482015-06-09 14:39:47 +00002329static vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, const int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002330 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002331}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002332#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002333
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002334#ifdef __LITTLE_ENDIAN__
2335static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002336 __attribute__((__deprecated__("use assignment for unaligned little endian \
2337loads/stores"))) vec_lvsr(int __a, const unsigned int *__b) {
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002338 vector unsigned char mask =
Bill Seurer703e8482015-06-09 14:39:47 +00002339 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2340 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2341 7, 6, 5, 4, 3, 2, 1, 0};
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002342 return vec_perm(mask, mask, reverse);
2343}
2344#else
Bill Seurer703e8482015-06-09 14:39:47 +00002345static vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
2346 const unsigned int *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002347 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002348}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002349#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002350
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002351#ifdef __LITTLE_ENDIAN__
2352static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002353 __attribute__((__deprecated__("use assignment for unaligned little endian \
2354loads/stores"))) vec_lvsr(int __a, const float *__b) {
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002355 vector unsigned char mask =
Bill Seurer703e8482015-06-09 14:39:47 +00002356 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2357 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2358 7, 6, 5, 4, 3, 2, 1, 0};
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002359 return vec_perm(mask, mask, reverse);
2360}
2361#else
Bill Seurer703e8482015-06-09 14:39:47 +00002362static vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, const float *__b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002363 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002364}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002365#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002366
2367/* vec_madd */
2368
2369static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00002370vec_madd(vector float __a, vector float __b, vector float __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002371 return __builtin_altivec_vmaddfp(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002372}
2373
2374/* vec_vmaddfp */
2375
2376static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00002377vec_vmaddfp(vector float __a, vector float __b, vector float __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002378 return __builtin_altivec_vmaddfp(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002379}
2380
2381/* vec_madds */
2382
2383static vector signed short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00002384vec_madds(vector signed short __a, vector signed short __b,
2385 vector signed short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002386 return __builtin_altivec_vmhaddshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002387}
2388
2389/* vec_vmhaddshs */
2390static vector signed short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00002391vec_vmhaddshs(vector signed short __a, vector signed short __b,
2392 vector signed short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002393 return __builtin_altivec_vmhaddshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002394}
2395
Chris Lattnerdad40622010-04-14 03:54:58 +00002396/* vec_max */
2397
Bill Seurer703e8482015-06-09 14:39:47 +00002398static vector signed char __ATTRS_o_ai vec_max(vector signed char __a,
2399 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002400 return __builtin_altivec_vmaxsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002401}
2402
Bill Seurer703e8482015-06-09 14:39:47 +00002403static vector signed char __ATTRS_o_ai vec_max(vector bool char __a,
2404 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002405 return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002406}
2407
Bill Seurer703e8482015-06-09 14:39:47 +00002408static vector signed char __ATTRS_o_ai vec_max(vector signed char __a,
2409 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002410 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002411}
2412
Bill Seurer703e8482015-06-09 14:39:47 +00002413static vector unsigned char __ATTRS_o_ai vec_max(vector unsigned char __a,
2414 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002415 return __builtin_altivec_vmaxub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002416}
2417
Bill Seurer703e8482015-06-09 14:39:47 +00002418static vector unsigned char __ATTRS_o_ai vec_max(vector bool char __a,
2419 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002420 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002421}
2422
Bill Seurer703e8482015-06-09 14:39:47 +00002423static vector unsigned char __ATTRS_o_ai vec_max(vector unsigned char __a,
2424 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002425 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002426}
2427
Bill Seurer703e8482015-06-09 14:39:47 +00002428static vector short __ATTRS_o_ai vec_max(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002429 return __builtin_altivec_vmaxsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002430}
2431
Bill Seurer703e8482015-06-09 14:39:47 +00002432static vector short __ATTRS_o_ai vec_max(vector bool short __a,
2433 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002434 return __builtin_altivec_vmaxsh((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002435}
2436
Bill Seurer703e8482015-06-09 14:39:47 +00002437static vector short __ATTRS_o_ai vec_max(vector short __a,
2438 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002439 return __builtin_altivec_vmaxsh(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002440}
2441
Bill Seurer703e8482015-06-09 14:39:47 +00002442static vector unsigned short __ATTRS_o_ai vec_max(vector unsigned short __a,
2443 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002444 return __builtin_altivec_vmaxuh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002445}
2446
Bill Seurer703e8482015-06-09 14:39:47 +00002447static vector unsigned short __ATTRS_o_ai vec_max(vector bool short __a,
2448 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002449 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002450}
2451
Bill Seurer703e8482015-06-09 14:39:47 +00002452static vector unsigned short __ATTRS_o_ai vec_max(vector unsigned short __a,
2453 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002454 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002455}
2456
Bill Seurer703e8482015-06-09 14:39:47 +00002457static vector int __ATTRS_o_ai vec_max(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002458 return __builtin_altivec_vmaxsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002459}
2460
Bill Seurer703e8482015-06-09 14:39:47 +00002461static vector int __ATTRS_o_ai vec_max(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002462 return __builtin_altivec_vmaxsw((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002463}
2464
Bill Seurer703e8482015-06-09 14:39:47 +00002465static vector int __ATTRS_o_ai vec_max(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002466 return __builtin_altivec_vmaxsw(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002467}
2468
Bill Seurer703e8482015-06-09 14:39:47 +00002469static vector unsigned int __ATTRS_o_ai vec_max(vector unsigned int __a,
2470 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002471 return __builtin_altivec_vmaxuw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002472}
2473
Bill Seurer703e8482015-06-09 14:39:47 +00002474static vector unsigned int __ATTRS_o_ai vec_max(vector bool int __a,
2475 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002476 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002477}
2478
Bill Seurer703e8482015-06-09 14:39:47 +00002479static vector unsigned int __ATTRS_o_ai vec_max(vector unsigned int __a,
2480 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002481 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002482}
2483
Kit Barton8553bec2015-03-11 15:57:19 +00002484#ifdef __POWER8_VECTOR__
2485static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002486vec_max(vector signed long long __a, vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00002487 return __builtin_altivec_vmaxsd(__a, __b);
2488}
2489
Bill Seurer8be14f12015-06-04 18:45:44 +00002490static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002491vec_max(vector bool long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00002492 return __builtin_altivec_vmaxsd((vector signed long long)__a, __b);
2493}
2494
Bill Seurer703e8482015-06-09 14:39:47 +00002495static vector signed long long __ATTRS_o_ai vec_max(vector signed long long __a,
2496 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00002497 return __builtin_altivec_vmaxsd(__a, (vector signed long long)__b);
2498}
2499
Kit Barton8553bec2015-03-11 15:57:19 +00002500static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002501vec_max(vector unsigned long long __a, vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00002502 return __builtin_altivec_vmaxud(__a, __b);
2503}
Bill Seurer8be14f12015-06-04 18:45:44 +00002504
2505static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002506vec_max(vector bool long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00002507 return __builtin_altivec_vmaxud((vector unsigned long long)__a, __b);
2508}
2509
2510static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002511vec_max(vector unsigned long long __a, vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00002512 return __builtin_altivec_vmaxud(__a, (vector unsigned long long)__b);
2513}
Kit Barton8553bec2015-03-11 15:57:19 +00002514#endif
2515
Bill Seurer703e8482015-06-09 14:39:47 +00002516static vector float __ATTRS_o_ai vec_max(vector float __a, vector float __b) {
Bill Schmidt691e01d2014-10-31 19:19:24 +00002517#ifdef __VSX__
2518 return __builtin_vsx_xvmaxsp(__a, __b);
2519#else
David Blaikie3302f2b2013-01-16 23:08:36 +00002520 return __builtin_altivec_vmaxfp(__a, __b);
Bill Schmidt691e01d2014-10-31 19:19:24 +00002521#endif
Chris Lattnerdad40622010-04-14 03:54:58 +00002522}
2523
Bill Schmidt691e01d2014-10-31 19:19:24 +00002524#ifdef __VSX__
Bill Seurer703e8482015-06-09 14:39:47 +00002525static vector double __ATTRS_o_ai vec_max(vector double __a,
2526 vector double __b) {
Bill Schmidt691e01d2014-10-31 19:19:24 +00002527 return __builtin_vsx_xvmaxdp(__a, __b);
2528}
2529#endif
2530
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002531/* vec_vmaxsb */
2532
Bill Seurer703e8482015-06-09 14:39:47 +00002533static vector signed char __ATTRS_o_ai vec_vmaxsb(vector signed char __a,
2534 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002535 return __builtin_altivec_vmaxsb(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002536}
2537
Bill Seurer703e8482015-06-09 14:39:47 +00002538static vector signed char __ATTRS_o_ai vec_vmaxsb(vector bool char __a,
2539 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002540 return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002541}
2542
Bill Seurer703e8482015-06-09 14:39:47 +00002543static vector signed char __ATTRS_o_ai vec_vmaxsb(vector signed char __a,
2544 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002545 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002546}
2547
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002548/* vec_vmaxub */
2549
Bill Seurer703e8482015-06-09 14:39:47 +00002550static vector unsigned char __ATTRS_o_ai vec_vmaxub(vector unsigned char __a,
2551 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002552 return __builtin_altivec_vmaxub(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002553}
2554
Bill Seurer703e8482015-06-09 14:39:47 +00002555static vector unsigned char __ATTRS_o_ai vec_vmaxub(vector bool char __a,
2556 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002557 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002558}
2559
Bill Seurer703e8482015-06-09 14:39:47 +00002560static vector unsigned char __ATTRS_o_ai vec_vmaxub(vector unsigned char __a,
2561 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002562 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002563}
2564
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002565/* vec_vmaxsh */
2566
Bill Seurer703e8482015-06-09 14:39:47 +00002567static vector short __ATTRS_o_ai vec_vmaxsh(vector short __a,
2568 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002569 return __builtin_altivec_vmaxsh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002570}
2571
Bill Seurer703e8482015-06-09 14:39:47 +00002572static vector short __ATTRS_o_ai vec_vmaxsh(vector bool short __a,
2573 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002574 return __builtin_altivec_vmaxsh((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002575}
2576
Bill Seurer703e8482015-06-09 14:39:47 +00002577static vector short __ATTRS_o_ai vec_vmaxsh(vector short __a,
2578 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002579 return __builtin_altivec_vmaxsh(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002580}
2581
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002582/* vec_vmaxuh */
2583
Anton Yartsevfc83c602010-08-19 03:21:36 +00002584static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002585vec_vmaxuh(vector unsigned short __a, vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002586 return __builtin_altivec_vmaxuh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002587}
2588
Anton Yartsevfc83c602010-08-19 03:21:36 +00002589static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002590vec_vmaxuh(vector bool short __a, vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002591 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002592}
2593
Bill Seurer703e8482015-06-09 14:39:47 +00002594static vector unsigned short __ATTRS_o_ai vec_vmaxuh(vector unsigned short __a,
2595 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002596 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002597}
2598
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002599/* vec_vmaxsw */
2600
Bill Seurer703e8482015-06-09 14:39:47 +00002601static vector int __ATTRS_o_ai vec_vmaxsw(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002602 return __builtin_altivec_vmaxsw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002603}
2604
Bill Seurer703e8482015-06-09 14:39:47 +00002605static vector int __ATTRS_o_ai vec_vmaxsw(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002606 return __builtin_altivec_vmaxsw((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002607}
2608
Bill Seurer703e8482015-06-09 14:39:47 +00002609static vector int __ATTRS_o_ai vec_vmaxsw(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002610 return __builtin_altivec_vmaxsw(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002611}
2612
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002613/* vec_vmaxuw */
2614
Bill Seurer703e8482015-06-09 14:39:47 +00002615static vector unsigned int __ATTRS_o_ai vec_vmaxuw(vector unsigned int __a,
2616 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002617 return __builtin_altivec_vmaxuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002618}
2619
Bill Seurer703e8482015-06-09 14:39:47 +00002620static vector unsigned int __ATTRS_o_ai vec_vmaxuw(vector bool int __a,
2621 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002622 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002623}
2624
Bill Seurer703e8482015-06-09 14:39:47 +00002625static vector unsigned int __ATTRS_o_ai vec_vmaxuw(vector unsigned int __a,
2626 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00002627 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002628}
2629
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002630/* vec_vmaxfp */
2631
2632static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00002633vec_vmaxfp(vector float __a, vector float __b) {
Bill Schmidt691e01d2014-10-31 19:19:24 +00002634#ifdef __VSX__
2635 return __builtin_vsx_xvmaxsp(__a, __b);
2636#else
David Blaikie3302f2b2013-01-16 23:08:36 +00002637 return __builtin_altivec_vmaxfp(__a, __b);
Bill Schmidt691e01d2014-10-31 19:19:24 +00002638#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002639}
2640
2641/* vec_mergeh */
2642
Bill Seurer703e8482015-06-09 14:39:47 +00002643static vector signed char __ATTRS_o_ai vec_mergeh(vector signed char __a,
2644 vector signed char __b) {
2645 return vec_perm(__a, __b,
2646 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
2647 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
2648 0x06, 0x16, 0x07, 0x17));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002649}
2650
Bill Seurer703e8482015-06-09 14:39:47 +00002651static vector unsigned char __ATTRS_o_ai vec_mergeh(vector unsigned char __a,
2652 vector unsigned char __b) {
2653 return vec_perm(__a, __b,
2654 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
2655 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
2656 0x06, 0x16, 0x07, 0x17));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002657}
2658
Bill Seurer703e8482015-06-09 14:39:47 +00002659static vector bool char __ATTRS_o_ai vec_mergeh(vector bool char __a,
2660 vector bool char __b) {
2661 return vec_perm(__a, __b,
2662 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
2663 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
2664 0x06, 0x16, 0x07, 0x17));
Anton Yartsev9e968982010-08-19 03:00:09 +00002665}
2666
Bill Seurer703e8482015-06-09 14:39:47 +00002667static vector short __ATTRS_o_ai vec_mergeh(vector short __a,
2668 vector short __b) {
2669 return vec_perm(__a, __b,
2670 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
2671 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
2672 0x06, 0x07, 0x16, 0x17));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002673}
2674
2675static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002676vec_mergeh(vector unsigned short __a, vector unsigned short __b) {
2677 return vec_perm(__a, __b,
2678 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
2679 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
2680 0x06, 0x07, 0x16, 0x17));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002681}
2682
Bill Seurer703e8482015-06-09 14:39:47 +00002683static vector bool short __ATTRS_o_ai vec_mergeh(vector bool short __a,
2684 vector bool short __b) {
2685 return vec_perm(__a, __b,
2686 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
2687 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
2688 0x06, 0x07, 0x16, 0x17));
Anton Yartsev9e968982010-08-19 03:00:09 +00002689}
2690
Bill Seurer703e8482015-06-09 14:39:47 +00002691static vector pixel __ATTRS_o_ai vec_mergeh(vector pixel __a,
2692 vector pixel __b) {
2693 return vec_perm(__a, __b,
2694 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
2695 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
2696 0x06, 0x07, 0x16, 0x17));
Anton Yartsev9e968982010-08-19 03:00:09 +00002697}
2698
Bill Seurer703e8482015-06-09 14:39:47 +00002699static vector int __ATTRS_o_ai vec_mergeh(vector int __a, vector int __b) {
2700 return vec_perm(__a, __b,
2701 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
2702 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
2703 0x14, 0x15, 0x16, 0x17));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002704}
2705
Bill Seurer703e8482015-06-09 14:39:47 +00002706static vector unsigned int __ATTRS_o_ai vec_mergeh(vector unsigned int __a,
2707 vector unsigned int __b) {
2708 return vec_perm(__a, __b,
2709 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
2710 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
2711 0x14, 0x15, 0x16, 0x17));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002712}
2713
Bill Seurer703e8482015-06-09 14:39:47 +00002714static vector bool int __ATTRS_o_ai vec_mergeh(vector bool int __a,
2715 vector bool int __b) {
2716 return vec_perm(__a, __b,
2717 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
2718 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
2719 0x14, 0x15, 0x16, 0x17));
Anton Yartsev9e968982010-08-19 03:00:09 +00002720}
2721
Bill Seurer703e8482015-06-09 14:39:47 +00002722static vector float __ATTRS_o_ai vec_mergeh(vector float __a,
2723 vector float __b) {
2724 return vec_perm(__a, __b,
2725 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
2726 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
2727 0x14, 0x15, 0x16, 0x17));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002728}
2729
2730/* vec_vmrghb */
2731
2732#define __builtin_altivec_vmrghb vec_vmrghb
2733
Bill Seurer703e8482015-06-09 14:39:47 +00002734static vector signed char __ATTRS_o_ai vec_vmrghb(vector signed char __a,
2735 vector signed char __b) {
2736 return vec_perm(__a, __b,
2737 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
2738 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
2739 0x06, 0x16, 0x07, 0x17));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002740}
2741
Bill Seurer703e8482015-06-09 14:39:47 +00002742static vector unsigned char __ATTRS_o_ai vec_vmrghb(vector unsigned char __a,
2743 vector unsigned char __b) {
2744 return vec_perm(__a, __b,
2745 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
2746 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
2747 0x06, 0x16, 0x07, 0x17));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002748}
2749
Bill Seurer703e8482015-06-09 14:39:47 +00002750static vector bool char __ATTRS_o_ai vec_vmrghb(vector bool char __a,
2751 vector bool char __b) {
2752 return vec_perm(__a, __b,
2753 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
2754 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
2755 0x06, 0x16, 0x07, 0x17));
Anton Yartsev9e968982010-08-19 03:00:09 +00002756}
2757
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002758/* vec_vmrghh */
2759
2760#define __builtin_altivec_vmrghh vec_vmrghh
2761
Bill Seurer703e8482015-06-09 14:39:47 +00002762static vector short __ATTRS_o_ai vec_vmrghh(vector short __a,
2763 vector short __b) {
2764 return vec_perm(__a, __b,
2765 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
2766 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
2767 0x06, 0x07, 0x16, 0x17));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002768}
2769
2770static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002771vec_vmrghh(vector unsigned short __a, vector unsigned short __b) {
2772 return vec_perm(__a, __b,
2773 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
2774 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
2775 0x06, 0x07, 0x16, 0x17));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002776}
2777
Bill Seurer703e8482015-06-09 14:39:47 +00002778static vector bool short __ATTRS_o_ai vec_vmrghh(vector bool short __a,
2779 vector bool short __b) {
2780 return vec_perm(__a, __b,
2781 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
2782 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
2783 0x06, 0x07, 0x16, 0x17));
Anton Yartsev9e968982010-08-19 03:00:09 +00002784}
2785
Bill Seurer703e8482015-06-09 14:39:47 +00002786static vector pixel __ATTRS_o_ai vec_vmrghh(vector pixel __a,
2787 vector pixel __b) {
2788 return vec_perm(__a, __b,
2789 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
2790 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
2791 0x06, 0x07, 0x16, 0x17));
Anton Yartsev9e968982010-08-19 03:00:09 +00002792}
2793
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002794/* vec_vmrghw */
2795
2796#define __builtin_altivec_vmrghw vec_vmrghw
2797
Bill Seurer703e8482015-06-09 14:39:47 +00002798static vector int __ATTRS_o_ai vec_vmrghw(vector int __a, vector int __b) {
2799 return vec_perm(__a, __b,
2800 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
2801 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
2802 0x14, 0x15, 0x16, 0x17));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002803}
2804
Bill Seurer703e8482015-06-09 14:39:47 +00002805static vector unsigned int __ATTRS_o_ai vec_vmrghw(vector unsigned int __a,
2806 vector unsigned int __b) {
2807 return vec_perm(__a, __b,
2808 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
2809 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
2810 0x14, 0x15, 0x16, 0x17));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002811}
2812
Bill Seurer703e8482015-06-09 14:39:47 +00002813static vector bool int __ATTRS_o_ai vec_vmrghw(vector bool int __a,
2814 vector bool int __b) {
2815 return vec_perm(__a, __b,
2816 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
2817 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
2818 0x14, 0x15, 0x16, 0x17));
Anton Yartsev9e968982010-08-19 03:00:09 +00002819}
2820
Bill Seurer703e8482015-06-09 14:39:47 +00002821static vector float __ATTRS_o_ai vec_vmrghw(vector float __a,
2822 vector float __b) {
2823 return vec_perm(__a, __b,
2824 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
2825 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
2826 0x14, 0x15, 0x16, 0x17));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002827}
2828
2829/* vec_mergel */
2830
Bill Seurer703e8482015-06-09 14:39:47 +00002831static vector signed char __ATTRS_o_ai vec_mergel(vector signed char __a,
2832 vector signed char __b) {
2833 return vec_perm(__a, __b,
2834 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
2835 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
2836 0x0E, 0x1E, 0x0F, 0x1F));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002837}
2838
Bill Seurer703e8482015-06-09 14:39:47 +00002839static vector unsigned char __ATTRS_o_ai vec_mergel(vector unsigned char __a,
2840 vector unsigned char __b) {
2841 return vec_perm(__a, __b,
2842 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
2843 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
2844 0x0E, 0x1E, 0x0F, 0x1F));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002845}
2846
Bill Seurer703e8482015-06-09 14:39:47 +00002847static vector bool char __ATTRS_o_ai vec_mergel(vector bool char __a,
2848 vector bool char __b) {
2849 return vec_perm(__a, __b,
2850 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
2851 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
2852 0x0E, 0x1E, 0x0F, 0x1F));
Anton Yartsev9e968982010-08-19 03:00:09 +00002853}
2854
Bill Seurer703e8482015-06-09 14:39:47 +00002855static vector short __ATTRS_o_ai vec_mergel(vector short __a,
2856 vector short __b) {
2857 return vec_perm(__a, __b,
2858 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
2859 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
2860 0x0E, 0x0F, 0x1E, 0x1F));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002861}
2862
2863static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002864vec_mergel(vector unsigned short __a, vector unsigned short __b) {
2865 return vec_perm(__a, __b,
2866 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
2867 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
2868 0x0E, 0x0F, 0x1E, 0x1F));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002869}
2870
Bill Seurer703e8482015-06-09 14:39:47 +00002871static vector bool short __ATTRS_o_ai vec_mergel(vector bool short __a,
2872 vector bool short __b) {
2873 return vec_perm(__a, __b,
2874 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
2875 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
2876 0x0E, 0x0F, 0x1E, 0x1F));
Anton Yartsev9e968982010-08-19 03:00:09 +00002877}
2878
Bill Seurer703e8482015-06-09 14:39:47 +00002879static vector pixel __ATTRS_o_ai vec_mergel(vector pixel __a,
2880 vector pixel __b) {
2881 return vec_perm(__a, __b,
2882 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
2883 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
2884 0x0E, 0x0F, 0x1E, 0x1F));
Anton Yartsev9e968982010-08-19 03:00:09 +00002885}
2886
Bill Seurer703e8482015-06-09 14:39:47 +00002887static vector int __ATTRS_o_ai vec_mergel(vector int __a, vector int __b) {
2888 return vec_perm(__a, __b,
2889 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
2890 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
2891 0x1C, 0x1D, 0x1E, 0x1F));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002892}
2893
Bill Seurer703e8482015-06-09 14:39:47 +00002894static vector unsigned int __ATTRS_o_ai vec_mergel(vector unsigned int __a,
2895 vector unsigned int __b) {
2896 return vec_perm(__a, __b,
2897 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
2898 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
2899 0x1C, 0x1D, 0x1E, 0x1F));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002900}
2901
Bill Seurer703e8482015-06-09 14:39:47 +00002902static vector bool int __ATTRS_o_ai vec_mergel(vector bool int __a,
2903 vector bool int __b) {
2904 return vec_perm(__a, __b,
2905 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
2906 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
2907 0x1C, 0x1D, 0x1E, 0x1F));
Anton Yartsev9e968982010-08-19 03:00:09 +00002908}
2909
Bill Seurer703e8482015-06-09 14:39:47 +00002910static vector float __ATTRS_o_ai vec_mergel(vector float __a,
2911 vector float __b) {
2912 return vec_perm(__a, __b,
2913 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
2914 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
2915 0x1C, 0x1D, 0x1E, 0x1F));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002916}
2917
2918/* vec_vmrglb */
2919
2920#define __builtin_altivec_vmrglb vec_vmrglb
2921
Bill Seurer703e8482015-06-09 14:39:47 +00002922static vector signed char __ATTRS_o_ai vec_vmrglb(vector signed char __a,
2923 vector signed char __b) {
2924 return vec_perm(__a, __b,
2925 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
2926 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
2927 0x0E, 0x1E, 0x0F, 0x1F));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002928}
2929
Bill Seurer703e8482015-06-09 14:39:47 +00002930static vector unsigned char __ATTRS_o_ai vec_vmrglb(vector unsigned char __a,
2931 vector unsigned char __b) {
2932 return vec_perm(__a, __b,
2933 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
2934 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
2935 0x0E, 0x1E, 0x0F, 0x1F));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002936}
2937
Bill Seurer703e8482015-06-09 14:39:47 +00002938static vector bool char __ATTRS_o_ai vec_vmrglb(vector bool char __a,
2939 vector bool char __b) {
2940 return vec_perm(__a, __b,
2941 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
2942 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
2943 0x0E, 0x1E, 0x0F, 0x1F));
Anton Yartsev9e968982010-08-19 03:00:09 +00002944}
2945
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002946/* vec_vmrglh */
2947
2948#define __builtin_altivec_vmrglh vec_vmrglh
2949
Bill Seurer703e8482015-06-09 14:39:47 +00002950static vector short __ATTRS_o_ai vec_vmrglh(vector short __a,
2951 vector short __b) {
2952 return vec_perm(__a, __b,
2953 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
2954 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
2955 0x0E, 0x0F, 0x1E, 0x1F));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002956}
2957
2958static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00002959vec_vmrglh(vector unsigned short __a, vector unsigned short __b) {
2960 return vec_perm(__a, __b,
2961 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
2962 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
2963 0x0E, 0x0F, 0x1E, 0x1F));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002964}
2965
Bill Seurer703e8482015-06-09 14:39:47 +00002966static vector bool short __ATTRS_o_ai vec_vmrglh(vector bool short __a,
2967 vector bool short __b) {
2968 return vec_perm(__a, __b,
2969 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
2970 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
2971 0x0E, 0x0F, 0x1E, 0x1F));
Anton Yartsev9e968982010-08-19 03:00:09 +00002972}
2973
Bill Seurer703e8482015-06-09 14:39:47 +00002974static vector pixel __ATTRS_o_ai vec_vmrglh(vector pixel __a,
2975 vector pixel __b) {
2976 return vec_perm(__a, __b,
2977 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
2978 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
2979 0x0E, 0x0F, 0x1E, 0x1F));
Anton Yartsev9e968982010-08-19 03:00:09 +00002980}
2981
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002982/* vec_vmrglw */
2983
2984#define __builtin_altivec_vmrglw vec_vmrglw
2985
Bill Seurer703e8482015-06-09 14:39:47 +00002986static vector int __ATTRS_o_ai vec_vmrglw(vector int __a, vector int __b) {
2987 return vec_perm(__a, __b,
2988 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
2989 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
2990 0x1C, 0x1D, 0x1E, 0x1F));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002991}
2992
Bill Seurer703e8482015-06-09 14:39:47 +00002993static vector unsigned int __ATTRS_o_ai vec_vmrglw(vector unsigned int __a,
2994 vector unsigned int __b) {
2995 return vec_perm(__a, __b,
2996 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
2997 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
2998 0x1C, 0x1D, 0x1E, 0x1F));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002999}
3000
Bill Seurer703e8482015-06-09 14:39:47 +00003001static vector bool int __ATTRS_o_ai vec_vmrglw(vector bool int __a,
3002 vector bool int __b) {
3003 return vec_perm(__a, __b,
3004 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3005 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3006 0x1C, 0x1D, 0x1E, 0x1F));
Anton Yartsev9e968982010-08-19 03:00:09 +00003007}
3008
Bill Seurer703e8482015-06-09 14:39:47 +00003009static vector float __ATTRS_o_ai vec_vmrglw(vector float __a,
3010 vector float __b) {
3011 return vec_perm(__a, __b,
3012 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3013 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3014 0x1C, 0x1D, 0x1E, 0x1F));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003015}
3016
Chris Lattnerdad40622010-04-14 03:54:58 +00003017/* vec_mfvscr */
3018
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003019static vector unsigned short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003020vec_mfvscr(void) {
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003021 return __builtin_altivec_mfvscr();
3022}
Chris Lattnerdad40622010-04-14 03:54:58 +00003023
3024/* vec_min */
3025
Bill Seurer703e8482015-06-09 14:39:47 +00003026static vector signed char __ATTRS_o_ai vec_min(vector signed char __a,
3027 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003028 return __builtin_altivec_vminsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003029}
3030
Bill Seurer703e8482015-06-09 14:39:47 +00003031static vector signed char __ATTRS_o_ai vec_min(vector bool char __a,
3032 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003033 return __builtin_altivec_vminsb((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003034}
3035
Bill Seurer703e8482015-06-09 14:39:47 +00003036static vector signed char __ATTRS_o_ai vec_min(vector signed char __a,
3037 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003038 return __builtin_altivec_vminsb(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003039}
3040
Bill Seurer703e8482015-06-09 14:39:47 +00003041static vector unsigned char __ATTRS_o_ai vec_min(vector unsigned char __a,
3042 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003043 return __builtin_altivec_vminub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003044}
3045
Bill Seurer703e8482015-06-09 14:39:47 +00003046static vector unsigned char __ATTRS_o_ai vec_min(vector bool char __a,
3047 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003048 return __builtin_altivec_vminub((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003049}
3050
Bill Seurer703e8482015-06-09 14:39:47 +00003051static vector unsigned char __ATTRS_o_ai vec_min(vector unsigned char __a,
3052 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003053 return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003054}
3055
Bill Seurer703e8482015-06-09 14:39:47 +00003056static vector short __ATTRS_o_ai vec_min(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003057 return __builtin_altivec_vminsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003058}
3059
Bill Seurer703e8482015-06-09 14:39:47 +00003060static vector short __ATTRS_o_ai vec_min(vector bool short __a,
3061 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003062 return __builtin_altivec_vminsh((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003063}
3064
Bill Seurer703e8482015-06-09 14:39:47 +00003065static vector short __ATTRS_o_ai vec_min(vector short __a,
3066 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003067 return __builtin_altivec_vminsh(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003068}
3069
Bill Seurer703e8482015-06-09 14:39:47 +00003070static vector unsigned short __ATTRS_o_ai vec_min(vector unsigned short __a,
3071 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003072 return __builtin_altivec_vminuh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003073}
3074
Bill Seurer703e8482015-06-09 14:39:47 +00003075static vector unsigned short __ATTRS_o_ai vec_min(vector bool short __a,
3076 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003077 return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003078}
3079
Bill Seurer703e8482015-06-09 14:39:47 +00003080static vector unsigned short __ATTRS_o_ai vec_min(vector unsigned short __a,
3081 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003082 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003083}
3084
Bill Seurer703e8482015-06-09 14:39:47 +00003085static vector int __ATTRS_o_ai vec_min(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003086 return __builtin_altivec_vminsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003087}
3088
Bill Seurer703e8482015-06-09 14:39:47 +00003089static vector int __ATTRS_o_ai vec_min(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003090 return __builtin_altivec_vminsw((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003091}
3092
Bill Seurer703e8482015-06-09 14:39:47 +00003093static vector int __ATTRS_o_ai vec_min(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003094 return __builtin_altivec_vminsw(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003095}
3096
Bill Seurer703e8482015-06-09 14:39:47 +00003097static vector unsigned int __ATTRS_o_ai vec_min(vector unsigned int __a,
3098 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003099 return __builtin_altivec_vminuw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003100}
3101
Bill Seurer703e8482015-06-09 14:39:47 +00003102static vector unsigned int __ATTRS_o_ai vec_min(vector bool int __a,
3103 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003104 return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003105}
3106
Bill Seurer703e8482015-06-09 14:39:47 +00003107static vector unsigned int __ATTRS_o_ai vec_min(vector unsigned int __a,
3108 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003109 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003110}
3111
Kit Barton8553bec2015-03-11 15:57:19 +00003112#ifdef __POWER8_VECTOR__
3113static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003114vec_min(vector signed long long __a, vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00003115 return __builtin_altivec_vminsd(__a, __b);
3116}
3117
Bill Seurer8be14f12015-06-04 18:45:44 +00003118static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003119vec_min(vector bool long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00003120 return __builtin_altivec_vminsd((vector signed long long)__a, __b);
3121}
3122
Bill Seurer703e8482015-06-09 14:39:47 +00003123static vector signed long long __ATTRS_o_ai vec_min(vector signed long long __a,
3124 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00003125 return __builtin_altivec_vminsd(__a, (vector signed long long)__b);
3126}
3127
Kit Barton8553bec2015-03-11 15:57:19 +00003128static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003129vec_min(vector unsigned long long __a, vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00003130 return __builtin_altivec_vminud(__a, __b);
3131}
Bill Seurer8be14f12015-06-04 18:45:44 +00003132
3133static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003134vec_min(vector bool long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00003135 return __builtin_altivec_vminud((vector unsigned long long)__a, __b);
3136}
3137
3138static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003139vec_min(vector unsigned long long __a, vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00003140 return __builtin_altivec_vminud(__a, (vector unsigned long long)__b);
3141}
Kit Barton8553bec2015-03-11 15:57:19 +00003142#endif
3143
Bill Seurer703e8482015-06-09 14:39:47 +00003144static vector float __ATTRS_o_ai vec_min(vector float __a, vector float __b) {
Bill Schmidt691e01d2014-10-31 19:19:24 +00003145#ifdef __VSX__
3146 return __builtin_vsx_xvminsp(__a, __b);
3147#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003148 return __builtin_altivec_vminfp(__a, __b);
Bill Schmidt691e01d2014-10-31 19:19:24 +00003149#endif
Chris Lattnerdad40622010-04-14 03:54:58 +00003150}
3151
Bill Schmidt691e01d2014-10-31 19:19:24 +00003152#ifdef __VSX__
Bill Seurer703e8482015-06-09 14:39:47 +00003153static vector double __ATTRS_o_ai vec_min(vector double __a,
3154 vector double __b) {
Bill Schmidt691e01d2014-10-31 19:19:24 +00003155 return __builtin_vsx_xvmindp(__a, __b);
3156}
3157#endif
3158
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003159/* vec_vminsb */
3160
Bill Seurer703e8482015-06-09 14:39:47 +00003161static vector signed char __ATTRS_o_ai vec_vminsb(vector signed char __a,
3162 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003163 return __builtin_altivec_vminsb(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003164}
3165
Bill Seurer703e8482015-06-09 14:39:47 +00003166static vector signed char __ATTRS_o_ai vec_vminsb(vector bool char __a,
3167 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003168 return __builtin_altivec_vminsb((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003169}
3170
Bill Seurer703e8482015-06-09 14:39:47 +00003171static vector signed char __ATTRS_o_ai vec_vminsb(vector signed char __a,
3172 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003173 return __builtin_altivec_vminsb(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003174}
3175
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003176/* vec_vminub */
3177
Bill Seurer703e8482015-06-09 14:39:47 +00003178static vector unsigned char __ATTRS_o_ai vec_vminub(vector unsigned char __a,
3179 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003180 return __builtin_altivec_vminub(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003181}
3182
Bill Seurer703e8482015-06-09 14:39:47 +00003183static vector unsigned char __ATTRS_o_ai vec_vminub(vector bool char __a,
3184 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003185 return __builtin_altivec_vminub((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003186}
3187
Bill Seurer703e8482015-06-09 14:39:47 +00003188static vector unsigned char __ATTRS_o_ai vec_vminub(vector unsigned char __a,
3189 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003190 return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003191}
3192
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003193/* vec_vminsh */
3194
Bill Seurer703e8482015-06-09 14:39:47 +00003195static vector short __ATTRS_o_ai vec_vminsh(vector short __a,
3196 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003197 return __builtin_altivec_vminsh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003198}
3199
Bill Seurer703e8482015-06-09 14:39:47 +00003200static vector short __ATTRS_o_ai vec_vminsh(vector bool short __a,
3201 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003202 return __builtin_altivec_vminsh((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003203}
3204
Bill Seurer703e8482015-06-09 14:39:47 +00003205static vector short __ATTRS_o_ai vec_vminsh(vector short __a,
3206 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003207 return __builtin_altivec_vminsh(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003208}
3209
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003210/* vec_vminuh */
3211
Anton Yartsevfc83c602010-08-19 03:21:36 +00003212static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003213vec_vminuh(vector unsigned short __a, vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003214 return __builtin_altivec_vminuh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003215}
3216
Anton Yartsevfc83c602010-08-19 03:21:36 +00003217static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003218vec_vminuh(vector bool short __a, vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003219 return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003220}
3221
Bill Seurer703e8482015-06-09 14:39:47 +00003222static vector unsigned short __ATTRS_o_ai vec_vminuh(vector unsigned short __a,
3223 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003224 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003225}
3226
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003227/* vec_vminsw */
3228
Bill Seurer703e8482015-06-09 14:39:47 +00003229static vector int __ATTRS_o_ai vec_vminsw(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003230 return __builtin_altivec_vminsw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003231}
3232
Bill Seurer703e8482015-06-09 14:39:47 +00003233static vector int __ATTRS_o_ai vec_vminsw(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003234 return __builtin_altivec_vminsw((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003235}
3236
Bill Seurer703e8482015-06-09 14:39:47 +00003237static vector int __ATTRS_o_ai vec_vminsw(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003238 return __builtin_altivec_vminsw(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003239}
3240
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003241/* vec_vminuw */
3242
Bill Seurer703e8482015-06-09 14:39:47 +00003243static vector unsigned int __ATTRS_o_ai vec_vminuw(vector unsigned int __a,
3244 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003245 return __builtin_altivec_vminuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003246}
3247
Bill Seurer703e8482015-06-09 14:39:47 +00003248static vector unsigned int __ATTRS_o_ai vec_vminuw(vector bool int __a,
3249 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003250 return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003251}
3252
Bill Seurer703e8482015-06-09 14:39:47 +00003253static vector unsigned int __ATTRS_o_ai vec_vminuw(vector unsigned int __a,
3254 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003255 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003256}
3257
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003258/* vec_vminfp */
3259
3260static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003261vec_vminfp(vector float __a, vector float __b) {
Bill Schmidt691e01d2014-10-31 19:19:24 +00003262#ifdef __VSX__
3263 return __builtin_vsx_xvminsp(__a, __b);
3264#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003265 return __builtin_altivec_vminfp(__a, __b);
Bill Schmidt691e01d2014-10-31 19:19:24 +00003266#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003267}
3268
3269/* vec_mladd */
3270
3271#define __builtin_altivec_vmladduhm vec_mladd
3272
Bill Seurer703e8482015-06-09 14:39:47 +00003273static vector short __ATTRS_o_ai vec_mladd(vector short __a, vector short __b,
3274 vector short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003275 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003276}
3277
Bill Seurer703e8482015-06-09 14:39:47 +00003278static vector short __ATTRS_o_ai vec_mladd(vector short __a,
3279 vector unsigned short __b,
3280 vector unsigned short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003281 return __a * (vector short)__b + (vector short)__c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003282}
3283
Bill Seurer703e8482015-06-09 14:39:47 +00003284static vector short __ATTRS_o_ai vec_mladd(vector unsigned short __a,
3285 vector short __b, vector short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003286 return (vector short)__a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003287}
3288
Bill Seurer703e8482015-06-09 14:39:47 +00003289static vector unsigned short __ATTRS_o_ai vec_mladd(vector unsigned short __a,
3290 vector unsigned short __b,
3291 vector unsigned short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003292 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003293}
3294
3295/* vec_vmladduhm */
3296
Bill Seurer703e8482015-06-09 14:39:47 +00003297static vector short __ATTRS_o_ai vec_vmladduhm(vector short __a,
3298 vector short __b,
3299 vector short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003300 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003301}
3302
Bill Seurer703e8482015-06-09 14:39:47 +00003303static vector short __ATTRS_o_ai vec_vmladduhm(vector short __a,
3304 vector unsigned short __b,
3305 vector unsigned short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003306 return __a * (vector short)__b + (vector short)__c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003307}
3308
Bill Seurer703e8482015-06-09 14:39:47 +00003309static vector short __ATTRS_o_ai vec_vmladduhm(vector unsigned short __a,
3310 vector short __b,
3311 vector short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003312 return (vector short)__a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003313}
3314
3315static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003316vec_vmladduhm(vector unsigned short __a, vector unsigned short __b,
3317 vector unsigned short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003318 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003319}
3320
3321/* vec_mradds */
3322
3323static vector short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003324vec_mradds(vector short __a, vector short __b, vector short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003325 return __builtin_altivec_vmhraddshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003326}
3327
3328/* vec_vmhraddshs */
3329
3330static vector short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003331vec_vmhraddshs(vector short __a, vector short __b, vector short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003332 return __builtin_altivec_vmhraddshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003333}
3334
3335/* vec_msum */
3336
Bill Seurer703e8482015-06-09 14:39:47 +00003337static vector int __ATTRS_o_ai vec_msum(vector signed char __a,
3338 vector unsigned char __b,
3339 vector int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003340 return __builtin_altivec_vmsummbm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003341}
3342
Bill Seurer703e8482015-06-09 14:39:47 +00003343static vector unsigned int __ATTRS_o_ai vec_msum(vector unsigned char __a,
3344 vector unsigned char __b,
3345 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003346 return __builtin_altivec_vmsumubm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003347}
3348
Bill Seurer703e8482015-06-09 14:39:47 +00003349static vector int __ATTRS_o_ai vec_msum(vector short __a, vector short __b,
3350 vector int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003351 return __builtin_altivec_vmsumshm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003352}
3353
Bill Seurer703e8482015-06-09 14:39:47 +00003354static vector unsigned int __ATTRS_o_ai vec_msum(vector unsigned short __a,
3355 vector unsigned short __b,
3356 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003357 return __builtin_altivec_vmsumuhm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003358}
3359
3360/* vec_vmsummbm */
3361
3362static vector int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003363vec_vmsummbm(vector signed char __a, vector unsigned char __b, vector int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003364 return __builtin_altivec_vmsummbm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003365}
3366
3367/* vec_vmsumubm */
3368
3369static vector unsigned int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003370vec_vmsumubm(vector unsigned char __a, vector unsigned char __b,
3371 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003372 return __builtin_altivec_vmsumubm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003373}
3374
3375/* vec_vmsumshm */
3376
3377static vector int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003378vec_vmsumshm(vector short __a, vector short __b, vector int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003379 return __builtin_altivec_vmsumshm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003380}
3381
3382/* vec_vmsumuhm */
3383
3384static vector unsigned int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003385vec_vmsumuhm(vector unsigned short __a, vector unsigned short __b,
3386 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003387 return __builtin_altivec_vmsumuhm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003388}
3389
3390/* vec_msums */
3391
Bill Seurer703e8482015-06-09 14:39:47 +00003392static vector int __ATTRS_o_ai vec_msums(vector short __a, vector short __b,
3393 vector int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003394 return __builtin_altivec_vmsumshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003395}
3396
Bill Seurer703e8482015-06-09 14:39:47 +00003397static vector unsigned int __ATTRS_o_ai vec_msums(vector unsigned short __a,
3398 vector unsigned short __b,
3399 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003400 return __builtin_altivec_vmsumuhs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003401}
3402
3403/* vec_vmsumshs */
3404
3405static vector int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003406vec_vmsumshs(vector short __a, vector short __b, vector int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003407 return __builtin_altivec_vmsumshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003408}
3409
3410/* vec_vmsumuhs */
3411
3412static vector unsigned int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003413vec_vmsumuhs(vector unsigned short __a, vector unsigned short __b,
3414 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003415 return __builtin_altivec_vmsumuhs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003416}
3417
Chris Lattnerdad40622010-04-14 03:54:58 +00003418/* vec_mtvscr */
3419
Bill Seurer703e8482015-06-09 14:39:47 +00003420static void __ATTRS_o_ai vec_mtvscr(vector signed char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003421 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003422}
3423
Bill Seurer703e8482015-06-09 14:39:47 +00003424static void __ATTRS_o_ai vec_mtvscr(vector unsigned char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003425 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003426}
3427
Bill Seurer703e8482015-06-09 14:39:47 +00003428static void __ATTRS_o_ai vec_mtvscr(vector bool char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003429 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003430}
3431
Bill Seurer703e8482015-06-09 14:39:47 +00003432static void __ATTRS_o_ai vec_mtvscr(vector short __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003433 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003434}
3435
Bill Seurer703e8482015-06-09 14:39:47 +00003436static void __ATTRS_o_ai vec_mtvscr(vector unsigned short __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003437 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003438}
3439
Bill Seurer703e8482015-06-09 14:39:47 +00003440static void __ATTRS_o_ai vec_mtvscr(vector bool short __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003441 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003442}
3443
Bill Seurer703e8482015-06-09 14:39:47 +00003444static void __ATTRS_o_ai vec_mtvscr(vector pixel __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003445 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003446}
3447
Bill Seurer703e8482015-06-09 14:39:47 +00003448static void __ATTRS_o_ai vec_mtvscr(vector int __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003449 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003450}
3451
Bill Seurer703e8482015-06-09 14:39:47 +00003452static void __ATTRS_o_ai vec_mtvscr(vector unsigned int __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003453 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003454}
3455
Bill Seurer703e8482015-06-09 14:39:47 +00003456static void __ATTRS_o_ai vec_mtvscr(vector bool int __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003457 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003458}
3459
Bill Seurer703e8482015-06-09 14:39:47 +00003460static void __ATTRS_o_ai vec_mtvscr(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003461 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003462}
3463
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003464/* The vmulos* and vmules* instructions have a big endian bias, so
3465 we must reverse the meaning of "even" and "odd" for little endian. */
3466
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003467/* vec_mule */
3468
Bill Seurer703e8482015-06-09 14:39:47 +00003469static vector short __ATTRS_o_ai vec_mule(vector signed char __a,
3470 vector signed char __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003471#ifdef __LITTLE_ENDIAN__
3472 return __builtin_altivec_vmulosb(__a, __b);
3473#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003474 return __builtin_altivec_vmulesb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003475#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003476}
3477
Bill Seurer703e8482015-06-09 14:39:47 +00003478static vector unsigned short __ATTRS_o_ai vec_mule(vector unsigned char __a,
3479 vector unsigned char __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003480#ifdef __LITTLE_ENDIAN__
3481 return __builtin_altivec_vmuloub(__a, __b);
3482#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003483 return __builtin_altivec_vmuleub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003484#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003485}
3486
Bill Seurer703e8482015-06-09 14:39:47 +00003487static vector int __ATTRS_o_ai vec_mule(vector short __a, vector short __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003488#ifdef __LITTLE_ENDIAN__
3489 return __builtin_altivec_vmulosh(__a, __b);
3490#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003491 return __builtin_altivec_vmulesh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003492#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003493}
3494
Bill Seurer703e8482015-06-09 14:39:47 +00003495static vector unsigned int __ATTRS_o_ai vec_mule(vector unsigned short __a,
3496 vector unsigned short __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003497#ifdef __LITTLE_ENDIAN__
3498 return __builtin_altivec_vmulouh(__a, __b);
3499#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003500 return __builtin_altivec_vmuleuh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003501#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003502}
3503
Kit Barton8553bec2015-03-11 15:57:19 +00003504#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +00003505static vector signed long long __ATTRS_o_ai vec_mule(vector signed int __a,
3506 vector signed int __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00003507#ifdef __LITTLE_ENDIAN__
3508 return __builtin_altivec_vmulosw(__a, __b);
3509#else
3510 return __builtin_altivec_vmulesw(__a, __b);
3511#endif
3512}
3513
3514static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003515vec_mule(vector unsigned int __a, vector unsigned int __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00003516#ifdef __LITTLE_ENDIAN__
3517 return __builtin_altivec_vmulouw(__a, __b);
3518#else
3519 return __builtin_altivec_vmuleuw(__a, __b);
3520#endif
3521}
3522#endif
3523
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003524/* vec_vmulesb */
3525
3526static vector short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003527vec_vmulesb(vector signed char __a, vector signed char __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003528#ifdef __LITTLE_ENDIAN__
3529 return __builtin_altivec_vmulosb(__a, __b);
3530#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003531 return __builtin_altivec_vmulesb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003532#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003533}
3534
3535/* vec_vmuleub */
3536
3537static vector unsigned short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003538vec_vmuleub(vector unsigned char __a, vector unsigned char __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003539#ifdef __LITTLE_ENDIAN__
3540 return __builtin_altivec_vmuloub(__a, __b);
3541#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003542 return __builtin_altivec_vmuleub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003543#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003544}
3545
3546/* vec_vmulesh */
3547
3548static vector int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003549vec_vmulesh(vector short __a, vector short __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003550#ifdef __LITTLE_ENDIAN__
3551 return __builtin_altivec_vmulosh(__a, __b);
3552#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003553 return __builtin_altivec_vmulesh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003554#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003555}
3556
3557/* vec_vmuleuh */
3558
3559static vector unsigned int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003560vec_vmuleuh(vector unsigned short __a, vector unsigned short __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003561#ifdef __LITTLE_ENDIAN__
3562 return __builtin_altivec_vmulouh(__a, __b);
3563#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003564 return __builtin_altivec_vmuleuh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003565#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003566}
3567
3568/* vec_mulo */
3569
Bill Seurer703e8482015-06-09 14:39:47 +00003570static vector short __ATTRS_o_ai vec_mulo(vector signed char __a,
3571 vector signed char __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003572#ifdef __LITTLE_ENDIAN__
3573 return __builtin_altivec_vmulesb(__a, __b);
3574#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003575 return __builtin_altivec_vmulosb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003576#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003577}
3578
Bill Seurer703e8482015-06-09 14:39:47 +00003579static vector unsigned short __ATTRS_o_ai vec_mulo(vector unsigned char __a,
3580 vector unsigned char __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003581#ifdef __LITTLE_ENDIAN__
3582 return __builtin_altivec_vmuleub(__a, __b);
3583#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003584 return __builtin_altivec_vmuloub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003585#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003586}
3587
Bill Seurer703e8482015-06-09 14:39:47 +00003588static vector int __ATTRS_o_ai vec_mulo(vector short __a, vector short __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003589#ifdef __LITTLE_ENDIAN__
3590 return __builtin_altivec_vmulesh(__a, __b);
3591#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003592 return __builtin_altivec_vmulosh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003593#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003594}
3595
Bill Seurer703e8482015-06-09 14:39:47 +00003596static vector unsigned int __ATTRS_o_ai vec_mulo(vector unsigned short __a,
3597 vector unsigned short __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003598#ifdef __LITTLE_ENDIAN__
3599 return __builtin_altivec_vmuleuh(__a, __b);
3600#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003601 return __builtin_altivec_vmulouh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003602#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003603}
3604
Kit Barton8553bec2015-03-11 15:57:19 +00003605#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +00003606static vector signed long long __ATTRS_o_ai vec_mulo(vector signed int __a,
3607 vector signed int __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00003608#ifdef __LITTLE_ENDIAN__
3609 return __builtin_altivec_vmulesw(__a, __b);
3610#else
3611 return __builtin_altivec_vmulosw(__a, __b);
3612#endif
3613}
3614
3615static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003616vec_mulo(vector unsigned int __a, vector unsigned int __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00003617#ifdef __LITTLE_ENDIAN__
3618 return __builtin_altivec_vmuleuw(__a, __b);
3619#else
3620 return __builtin_altivec_vmulouw(__a, __b);
3621#endif
3622}
3623#endif
3624
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003625/* vec_vmulosb */
3626
3627static vector short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003628vec_vmulosb(vector signed char __a, vector signed char __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003629#ifdef __LITTLE_ENDIAN__
3630 return __builtin_altivec_vmulesb(__a, __b);
3631#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003632 return __builtin_altivec_vmulosb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003633#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003634}
3635
3636/* vec_vmuloub */
3637
3638static vector unsigned short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003639vec_vmuloub(vector unsigned char __a, vector unsigned char __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003640#ifdef __LITTLE_ENDIAN__
3641 return __builtin_altivec_vmuleub(__a, __b);
3642#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003643 return __builtin_altivec_vmuloub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003644#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003645}
3646
3647/* vec_vmulosh */
3648
3649static vector int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003650vec_vmulosh(vector short __a, vector short __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003651#ifdef __LITTLE_ENDIAN__
3652 return __builtin_altivec_vmulesh(__a, __b);
3653#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003654 return __builtin_altivec_vmulosh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003655#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003656}
3657
3658/* vec_vmulouh */
3659
3660static vector unsigned int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003661vec_vmulouh(vector unsigned short __a, vector unsigned short __b) {
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003662#ifdef __LITTLE_ENDIAN__
3663 return __builtin_altivec_vmuleuh(__a, __b);
3664#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003665 return __builtin_altivec_vmulouh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003666#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003667}
3668
3669/* vec_nmsub */
3670
3671static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003672vec_nmsub(vector float __a, vector float __b, vector float __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003673 return __builtin_altivec_vnmsubfp(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003674}
3675
3676/* vec_vnmsubfp */
3677
3678static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00003679vec_vnmsubfp(vector float __a, vector float __b, vector float __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003680 return __builtin_altivec_vnmsubfp(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003681}
3682
3683/* vec_nor */
3684
3685#define __builtin_altivec_vnor vec_nor
3686
Bill Seurer703e8482015-06-09 14:39:47 +00003687static vector signed char __ATTRS_o_ai vec_nor(vector signed char __a,
3688 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003689 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003690}
3691
Bill Seurer703e8482015-06-09 14:39:47 +00003692static vector unsigned char __ATTRS_o_ai vec_nor(vector unsigned char __a,
3693 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003694 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003695}
3696
Bill Seurer703e8482015-06-09 14:39:47 +00003697static vector bool char __ATTRS_o_ai vec_nor(vector bool char __a,
3698 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003699 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003700}
3701
Bill Seurer703e8482015-06-09 14:39:47 +00003702static vector short __ATTRS_o_ai vec_nor(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003703 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003704}
3705
Bill Seurer703e8482015-06-09 14:39:47 +00003706static vector unsigned short __ATTRS_o_ai vec_nor(vector unsigned short __a,
3707 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003708 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003709}
3710
Bill Seurer703e8482015-06-09 14:39:47 +00003711static vector bool short __ATTRS_o_ai vec_nor(vector bool short __a,
3712 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003713 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003714}
3715
Bill Seurer703e8482015-06-09 14:39:47 +00003716static vector int __ATTRS_o_ai vec_nor(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003717 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003718}
3719
Bill Seurer703e8482015-06-09 14:39:47 +00003720static vector unsigned int __ATTRS_o_ai vec_nor(vector unsigned int __a,
3721 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003722 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003723}
3724
Bill Seurer703e8482015-06-09 14:39:47 +00003725static vector bool int __ATTRS_o_ai vec_nor(vector bool int __a,
3726 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003727 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003728}
3729
Bill Seurer703e8482015-06-09 14:39:47 +00003730static vector float __ATTRS_o_ai vec_nor(vector float __a, vector float __b) {
3731 vector unsigned int __res =
3732 ~((vector unsigned int)__a | (vector unsigned int)__b);
David Blaikie3302f2b2013-01-16 23:08:36 +00003733 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003734}
3735
3736/* vec_vnor */
3737
Bill Seurer703e8482015-06-09 14:39:47 +00003738static vector signed char __ATTRS_o_ai vec_vnor(vector signed char __a,
3739 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003740 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003741}
3742
Bill Seurer703e8482015-06-09 14:39:47 +00003743static vector unsigned char __ATTRS_o_ai vec_vnor(vector unsigned char __a,
3744 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003745 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003746}
3747
Bill Seurer703e8482015-06-09 14:39:47 +00003748static vector bool char __ATTRS_o_ai vec_vnor(vector bool char __a,
3749 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003750 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003751}
3752
Bill Seurer703e8482015-06-09 14:39:47 +00003753static vector short __ATTRS_o_ai vec_vnor(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003754 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003755}
3756
Bill Seurer703e8482015-06-09 14:39:47 +00003757static vector unsigned short __ATTRS_o_ai vec_vnor(vector unsigned short __a,
3758 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003759 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003760}
3761
Bill Seurer703e8482015-06-09 14:39:47 +00003762static vector bool short __ATTRS_o_ai vec_vnor(vector bool short __a,
3763 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003764 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003765}
3766
Bill Seurer703e8482015-06-09 14:39:47 +00003767static vector int __ATTRS_o_ai vec_vnor(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003768 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003769}
3770
Bill Seurer703e8482015-06-09 14:39:47 +00003771static vector unsigned int __ATTRS_o_ai vec_vnor(vector unsigned int __a,
3772 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003773 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003774}
3775
Bill Seurer703e8482015-06-09 14:39:47 +00003776static vector bool int __ATTRS_o_ai vec_vnor(vector bool int __a,
3777 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003778 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003779}
3780
Bill Seurer703e8482015-06-09 14:39:47 +00003781static vector float __ATTRS_o_ai vec_vnor(vector float __a, vector float __b) {
3782 vector unsigned int __res =
3783 ~((vector unsigned int)__a | (vector unsigned int)__b);
David Blaikie3302f2b2013-01-16 23:08:36 +00003784 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003785}
3786
Bill Seurer8be14f12015-06-04 18:45:44 +00003787#ifdef __VSX__
3788static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003789vec_nor(vector signed long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00003790 return ~(__a | __b);
3791}
3792
3793static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003794vec_nor(vector unsigned long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00003795 return ~(__a | __b);
3796}
3797
Bill Seurer703e8482015-06-09 14:39:47 +00003798static vector bool long long __ATTRS_o_ai vec_nor(vector bool long long __a,
3799 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00003800 return ~(__a | __b);
3801}
3802#endif
3803
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003804/* vec_or */
3805
3806#define __builtin_altivec_vor vec_or
3807
Bill Seurer703e8482015-06-09 14:39:47 +00003808static vector signed char __ATTRS_o_ai vec_or(vector signed char __a,
3809 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003810 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003811}
3812
Bill Seurer703e8482015-06-09 14:39:47 +00003813static vector signed char __ATTRS_o_ai vec_or(vector bool char __a,
3814 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003815 return (vector signed char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003816}
3817
Bill Seurer703e8482015-06-09 14:39:47 +00003818static vector signed char __ATTRS_o_ai vec_or(vector signed char __a,
3819 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003820 return __a | (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003821}
3822
Bill Seurer703e8482015-06-09 14:39:47 +00003823static vector unsigned char __ATTRS_o_ai vec_or(vector unsigned char __a,
3824 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003825 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003826}
3827
Bill Seurer703e8482015-06-09 14:39:47 +00003828static vector unsigned char __ATTRS_o_ai vec_or(vector bool char __a,
3829 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003830 return (vector unsigned char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003831}
3832
Bill Seurer703e8482015-06-09 14:39:47 +00003833static vector unsigned char __ATTRS_o_ai vec_or(vector unsigned char __a,
3834 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003835 return __a | (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003836}
3837
Bill Seurer703e8482015-06-09 14:39:47 +00003838static vector bool char __ATTRS_o_ai vec_or(vector bool char __a,
3839 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003840 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003841}
3842
Bill Seurer703e8482015-06-09 14:39:47 +00003843static vector short __ATTRS_o_ai vec_or(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003844 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003845}
3846
Bill Seurer703e8482015-06-09 14:39:47 +00003847static vector short __ATTRS_o_ai vec_or(vector bool short __a,
3848 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003849 return (vector short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003850}
3851
Bill Seurer703e8482015-06-09 14:39:47 +00003852static vector short __ATTRS_o_ai vec_or(vector short __a,
3853 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003854 return __a | (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003855}
3856
Bill Seurer703e8482015-06-09 14:39:47 +00003857static vector unsigned short __ATTRS_o_ai vec_or(vector unsigned short __a,
3858 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003859 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003860}
3861
Bill Seurer703e8482015-06-09 14:39:47 +00003862static vector unsigned short __ATTRS_o_ai vec_or(vector bool short __a,
3863 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003864 return (vector unsigned short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003865}
3866
Bill Seurer703e8482015-06-09 14:39:47 +00003867static vector unsigned short __ATTRS_o_ai vec_or(vector unsigned short __a,
3868 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003869 return __a | (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003870}
3871
Bill Seurer703e8482015-06-09 14:39:47 +00003872static vector bool short __ATTRS_o_ai vec_or(vector bool short __a,
3873 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003874 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003875}
3876
Bill Seurer703e8482015-06-09 14:39:47 +00003877static vector int __ATTRS_o_ai vec_or(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003878 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003879}
3880
Bill Seurer703e8482015-06-09 14:39:47 +00003881static vector int __ATTRS_o_ai vec_or(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003882 return (vector int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003883}
3884
Bill Seurer703e8482015-06-09 14:39:47 +00003885static vector int __ATTRS_o_ai vec_or(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003886 return __a | (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003887}
3888
Bill Seurer703e8482015-06-09 14:39:47 +00003889static vector unsigned int __ATTRS_o_ai vec_or(vector unsigned int __a,
3890 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003891 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003892}
3893
Bill Seurer703e8482015-06-09 14:39:47 +00003894static vector unsigned int __ATTRS_o_ai vec_or(vector bool int __a,
3895 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003896 return (vector unsigned int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003897}
3898
Bill Seurer703e8482015-06-09 14:39:47 +00003899static vector unsigned int __ATTRS_o_ai vec_or(vector unsigned int __a,
3900 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003901 return __a | (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003902}
3903
Bill Seurer703e8482015-06-09 14:39:47 +00003904static vector bool int __ATTRS_o_ai vec_or(vector bool int __a,
3905 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003906 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003907}
3908
Bill Seurer703e8482015-06-09 14:39:47 +00003909static vector float __ATTRS_o_ai vec_or(vector float __a, vector float __b) {
3910 vector unsigned int __res =
3911 (vector unsigned int)__a | (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00003912 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003913}
3914
Bill Seurer703e8482015-06-09 14:39:47 +00003915static vector float __ATTRS_o_ai vec_or(vector bool int __a, vector float __b) {
3916 vector unsigned int __res =
3917 (vector unsigned int)__a | (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00003918 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003919}
3920
Bill Seurer703e8482015-06-09 14:39:47 +00003921static vector float __ATTRS_o_ai vec_or(vector float __a, vector bool int __b) {
3922 vector unsigned int __res =
3923 (vector unsigned int)__a | (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00003924 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003925}
3926
Bill Seurer8be14f12015-06-04 18:45:44 +00003927#ifdef __VSX__
3928static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003929vec_or(vector signed long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00003930 return __a | __b;
3931}
3932
3933static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003934vec_or(vector bool long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00003935 return (vector signed long long)__a | __b;
3936}
3937
Bill Seurer703e8482015-06-09 14:39:47 +00003938static vector signed long long __ATTRS_o_ai vec_or(vector signed long long __a,
3939 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00003940 return __a | (vector signed long long)__b;
3941}
3942
3943static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003944vec_or(vector unsigned long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00003945 return __a | __b;
3946}
3947
3948static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003949vec_or(vector bool long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00003950 return (vector unsigned long long)__a | __b;
3951}
3952
3953static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00003954vec_or(vector unsigned long long __a, vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00003955 return __a | (vector unsigned long long)__b;
3956}
3957
Bill Seurer703e8482015-06-09 14:39:47 +00003958static vector bool long long __ATTRS_o_ai vec_or(vector bool long long __a,
3959 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00003960 return __a | __b;
3961}
3962#endif
3963
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003964/* vec_vor */
3965
Bill Seurer703e8482015-06-09 14:39:47 +00003966static vector signed char __ATTRS_o_ai vec_vor(vector signed char __a,
3967 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003968 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003969}
3970
Bill Seurer703e8482015-06-09 14:39:47 +00003971static vector signed char __ATTRS_o_ai vec_vor(vector bool char __a,
3972 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003973 return (vector signed char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003974}
3975
Bill Seurer703e8482015-06-09 14:39:47 +00003976static vector signed char __ATTRS_o_ai vec_vor(vector signed char __a,
3977 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003978 return __a | (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003979}
3980
Bill Seurer703e8482015-06-09 14:39:47 +00003981static vector unsigned char __ATTRS_o_ai vec_vor(vector unsigned char __a,
3982 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003983 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003984}
3985
Bill Seurer703e8482015-06-09 14:39:47 +00003986static vector unsigned char __ATTRS_o_ai vec_vor(vector bool char __a,
3987 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003988 return (vector unsigned char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003989}
3990
Bill Seurer703e8482015-06-09 14:39:47 +00003991static vector unsigned char __ATTRS_o_ai vec_vor(vector unsigned char __a,
3992 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003993 return __a | (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003994}
3995
Bill Seurer703e8482015-06-09 14:39:47 +00003996static vector bool char __ATTRS_o_ai vec_vor(vector bool char __a,
3997 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00003998 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003999}
4000
Bill Seurer703e8482015-06-09 14:39:47 +00004001static vector short __ATTRS_o_ai vec_vor(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004002 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004003}
4004
Bill Seurer703e8482015-06-09 14:39:47 +00004005static vector short __ATTRS_o_ai vec_vor(vector bool short __a,
4006 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004007 return (vector short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004008}
4009
Bill Seurer703e8482015-06-09 14:39:47 +00004010static vector short __ATTRS_o_ai vec_vor(vector short __a,
4011 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004012 return __a | (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004013}
4014
Bill Seurer703e8482015-06-09 14:39:47 +00004015static vector unsigned short __ATTRS_o_ai vec_vor(vector unsigned short __a,
4016 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004017 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004018}
4019
Bill Seurer703e8482015-06-09 14:39:47 +00004020static vector unsigned short __ATTRS_o_ai vec_vor(vector bool short __a,
4021 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004022 return (vector unsigned short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004023}
4024
Bill Seurer703e8482015-06-09 14:39:47 +00004025static vector unsigned short __ATTRS_o_ai vec_vor(vector unsigned short __a,
4026 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004027 return __a | (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004028}
4029
Bill Seurer703e8482015-06-09 14:39:47 +00004030static vector bool short __ATTRS_o_ai vec_vor(vector bool short __a,
4031 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004032 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004033}
4034
Bill Seurer703e8482015-06-09 14:39:47 +00004035static vector int __ATTRS_o_ai vec_vor(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004036 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004037}
4038
Bill Seurer703e8482015-06-09 14:39:47 +00004039static vector int __ATTRS_o_ai vec_vor(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004040 return (vector int)__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_vor(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004044 return __a | (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004045}
4046
Bill Seurer703e8482015-06-09 14:39:47 +00004047static vector unsigned int __ATTRS_o_ai vec_vor(vector unsigned int __a,
4048 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004049 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004050}
4051
Bill Seurer703e8482015-06-09 14:39:47 +00004052static vector unsigned int __ATTRS_o_ai vec_vor(vector bool int __a,
4053 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004054 return (vector unsigned int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004055}
4056
Bill Seurer703e8482015-06-09 14:39:47 +00004057static vector unsigned int __ATTRS_o_ai vec_vor(vector unsigned int __a,
4058 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004059 return __a | (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004060}
4061
Bill Seurer703e8482015-06-09 14:39:47 +00004062static vector bool int __ATTRS_o_ai vec_vor(vector bool int __a,
4063 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004064 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004065}
4066
Bill Seurer703e8482015-06-09 14:39:47 +00004067static vector float __ATTRS_o_ai vec_vor(vector float __a, vector float __b) {
4068 vector unsigned int __res =
4069 (vector unsigned int)__a | (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00004070 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004071}
4072
Bill Seurer703e8482015-06-09 14:39:47 +00004073static vector float __ATTRS_o_ai vec_vor(vector bool int __a,
4074 vector float __b) {
4075 vector unsigned int __res =
4076 (vector unsigned int)__a | (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00004077 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004078}
4079
Bill Seurer703e8482015-06-09 14:39:47 +00004080static vector float __ATTRS_o_ai vec_vor(vector float __a,
4081 vector bool int __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 Seurer8be14f12015-06-04 18:45:44 +00004087#ifdef __VSX__
4088static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004089vec_vor(vector signed long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004090 return __a | __b;
4091}
4092
4093static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004094vec_vor(vector bool long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004095 return (vector signed long long)__a | __b;
4096}
4097
Bill Seurer703e8482015-06-09 14:39:47 +00004098static vector signed long long __ATTRS_o_ai vec_vor(vector signed long long __a,
4099 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004100 return __a | (vector signed long long)__b;
4101}
4102
4103static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004104vec_vor(vector unsigned long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004105 return __a | __b;
4106}
4107
4108static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004109vec_vor(vector bool long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004110 return (vector unsigned long long)__a | __b;
4111}
4112
4113static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004114vec_vor(vector unsigned long long __a, vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004115 return __a | (vector unsigned long long)__b;
4116}
4117
Bill Seurer703e8482015-06-09 14:39:47 +00004118static vector bool long long __ATTRS_o_ai vec_vor(vector bool long long __a,
4119 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00004120 return __a | __b;
4121}
4122#endif
4123
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004124/* vec_pack */
4125
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004126/* The various vector pack instructions have a big-endian bias, so for
4127 little endian we must handle reversed element numbering. */
4128
Bill Seurer703e8482015-06-09 14:39:47 +00004129static vector signed char __ATTRS_o_ai vec_pack(vector signed short __a,
4130 vector signed short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004131#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004132 return (vector signed char)vec_perm(
4133 __a, __b,
4134 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4135 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004136#else
Bill Seurer703e8482015-06-09 14:39:47 +00004137 return (vector signed char)vec_perm(
4138 __a, __b,
4139 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4140 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004141#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004142}
4143
Bill Seurer703e8482015-06-09 14:39:47 +00004144static vector unsigned char __ATTRS_o_ai vec_pack(vector unsigned short __a,
4145 vector unsigned short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004146#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004147 return (vector unsigned char)vec_perm(
4148 __a, __b,
4149 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4150 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004151#else
Bill Seurer703e8482015-06-09 14:39:47 +00004152 return (vector unsigned char)vec_perm(
4153 __a, __b,
4154 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4155 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004156#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004157}
4158
Bill Seurer703e8482015-06-09 14:39:47 +00004159static vector bool char __ATTRS_o_ai vec_pack(vector bool short __a,
4160 vector bool short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004161#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004162 return (vector bool char)vec_perm(
4163 __a, __b,
4164 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4165 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004166#else
Bill Seurer703e8482015-06-09 14:39:47 +00004167 return (vector bool char)vec_perm(
4168 __a, __b,
4169 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4170 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004171#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004172}
4173
Bill Seurer703e8482015-06-09 14:39:47 +00004174static vector short __ATTRS_o_ai vec_pack(vector int __a, vector int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004175#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004176 return (vector short)vec_perm(
4177 __a, __b,
4178 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4179 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004180#else
Bill Seurer703e8482015-06-09 14:39:47 +00004181 return (vector short)vec_perm(
4182 __a, __b,
4183 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4184 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004185#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004186}
4187
Bill Seurer703e8482015-06-09 14:39:47 +00004188static vector unsigned short __ATTRS_o_ai vec_pack(vector unsigned int __a,
4189 vector unsigned int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004190#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004191 return (vector unsigned short)vec_perm(
4192 __a, __b,
4193 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4194 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004195#else
Bill Seurer703e8482015-06-09 14:39:47 +00004196 return (vector unsigned short)vec_perm(
4197 __a, __b,
4198 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4199 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004200#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004201}
4202
Bill Seurer703e8482015-06-09 14:39:47 +00004203static vector bool short __ATTRS_o_ai vec_pack(vector bool int __a,
4204 vector bool int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004205#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004206 return (vector bool short)vec_perm(
4207 __a, __b,
4208 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4209 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004210#else
Bill Seurer703e8482015-06-09 14:39:47 +00004211 return (vector bool short)vec_perm(
4212 __a, __b,
4213 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4214 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004215#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004216}
4217
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004218/* vec_vpkuhum */
4219
4220#define __builtin_altivec_vpkuhum vec_vpkuhum
4221
Bill Seurer703e8482015-06-09 14:39:47 +00004222static vector signed char __ATTRS_o_ai vec_vpkuhum(vector signed short __a,
4223 vector signed short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004224#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004225 return (vector signed char)vec_perm(
4226 __a, __b,
4227 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4228 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004229#else
Bill Seurer703e8482015-06-09 14:39:47 +00004230 return (vector signed char)vec_perm(
4231 __a, __b,
4232 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4233 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004234#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004235}
4236
4237static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004238vec_vpkuhum(vector unsigned short __a, vector unsigned short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004239#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004240 return (vector unsigned char)vec_perm(
4241 __a, __b,
4242 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4243 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004244#else
Bill Seurer703e8482015-06-09 14:39:47 +00004245 return (vector unsigned char)vec_perm(
4246 __a, __b,
4247 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4248 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004249#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004250}
4251
Bill Seurer703e8482015-06-09 14:39:47 +00004252static vector bool char __ATTRS_o_ai vec_vpkuhum(vector bool short __a,
4253 vector bool short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004254#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004255 return (vector bool char)vec_perm(
4256 __a, __b,
4257 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4258 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004259#else
Bill Seurer703e8482015-06-09 14:39:47 +00004260 return (vector bool char)vec_perm(
4261 __a, __b,
4262 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4263 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004264#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004265}
4266
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004267/* vec_vpkuwum */
4268
4269#define __builtin_altivec_vpkuwum vec_vpkuwum
4270
Bill Seurer703e8482015-06-09 14:39:47 +00004271static vector short __ATTRS_o_ai vec_vpkuwum(vector int __a, vector int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004272#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004273 return (vector short)vec_perm(
4274 __a, __b,
4275 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4276 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004277#else
Bill Seurer703e8482015-06-09 14:39:47 +00004278 return (vector short)vec_perm(
4279 __a, __b,
4280 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4281 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004282#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004283}
4284
Bill Seurer703e8482015-06-09 14:39:47 +00004285static vector unsigned short __ATTRS_o_ai vec_vpkuwum(vector unsigned int __a,
4286 vector unsigned int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004287#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004288 return (vector unsigned short)vec_perm(
4289 __a, __b,
4290 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4291 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004292#else
Bill Seurer703e8482015-06-09 14:39:47 +00004293 return (vector unsigned short)vec_perm(
4294 __a, __b,
4295 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4296 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004297#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004298}
4299
Bill Seurer703e8482015-06-09 14:39:47 +00004300static vector bool short __ATTRS_o_ai vec_vpkuwum(vector bool int __a,
4301 vector bool int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004302#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004303 return (vector bool short)vec_perm(
4304 __a, __b,
4305 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4306 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004307#else
Bill Seurer703e8482015-06-09 14:39:47 +00004308 return (vector bool short)vec_perm(
4309 __a, __b,
4310 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4311 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004312#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004313}
4314
Bill Schmidt41e14c42015-05-16 01:02:25 +00004315/* vec_vpkudum */
4316
4317#ifdef __POWER8_VECTOR__
4318#define __builtin_altivec_vpkudum vec_vpkudum
4319
Bill Seurer703e8482015-06-09 14:39:47 +00004320static vector int __ATTRS_o_ai vec_vpkudum(vector long long __a,
4321 vector long long __b) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00004322#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004323 return (vector int)vec_perm(
4324 __a, __b,
4325 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
4326 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
Bill Schmidt41e14c42015-05-16 01:02:25 +00004327#else
Bill Seurer703e8482015-06-09 14:39:47 +00004328 return (vector int)vec_perm(
4329 __a, __b,
4330 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
4331 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
Bill Schmidt41e14c42015-05-16 01:02:25 +00004332#endif
4333}
4334
4335static vector unsigned int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004336vec_vpkudum(vector unsigned long long __a, vector unsigned long long __b) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00004337#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004338 return (vector unsigned int)vec_perm(
4339 __a, __b,
4340 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
4341 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
Bill Schmidt41e14c42015-05-16 01:02:25 +00004342#else
Bill Seurer703e8482015-06-09 14:39:47 +00004343 return (vector unsigned int)vec_perm(
4344 __a, __b,
4345 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
4346 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
Bill Schmidt41e14c42015-05-16 01:02:25 +00004347#endif
4348}
4349
Bill Seurer703e8482015-06-09 14:39:47 +00004350static vector bool int __ATTRS_o_ai vec_vpkudum(vector bool long long __a,
4351 vector bool long long __b) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00004352#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004353 return (vector bool int)vec_perm(
4354 (vector long long)__a, (vector long long)__b,
4355 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
4356 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
Bill Schmidt41e14c42015-05-16 01:02:25 +00004357#else
Bill Seurer703e8482015-06-09 14:39:47 +00004358 return (vector bool int)vec_perm(
4359 (vector long long)__a, (vector long long)__b,
4360 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
4361 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
Bill Schmidt41e14c42015-05-16 01:02:25 +00004362#endif
4363}
4364#endif
4365
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004366/* vec_packpx */
4367
4368static vector pixel __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00004369vec_packpx(vector unsigned int __a, vector unsigned int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004370#ifdef __LITTLE_ENDIAN__
4371 return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
4372#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004373 return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004374#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004375}
4376
4377/* vec_vpkpx */
4378
4379static vector pixel __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00004380vec_vpkpx(vector unsigned int __a, vector unsigned int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004381#ifdef __LITTLE_ENDIAN__
4382 return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
4383#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004384 return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004385#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004386}
4387
4388/* vec_packs */
4389
Bill Seurer703e8482015-06-09 14:39:47 +00004390static vector signed char __ATTRS_o_ai vec_packs(vector short __a,
4391 vector short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004392#ifdef __LITTLE_ENDIAN__
4393 return __builtin_altivec_vpkshss(__b, __a);
4394#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004395 return __builtin_altivec_vpkshss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004396#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004397}
4398
Bill Seurer703e8482015-06-09 14:39:47 +00004399static vector unsigned char __ATTRS_o_ai vec_packs(vector unsigned short __a,
4400 vector unsigned short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004401#ifdef __LITTLE_ENDIAN__
4402 return __builtin_altivec_vpkuhus(__b, __a);
4403#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004404 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004405#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004406}
4407
Bill Seurer703e8482015-06-09 14:39:47 +00004408static vector signed short __ATTRS_o_ai vec_packs(vector int __a,
4409 vector int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004410#ifdef __LITTLE_ENDIAN__
4411 return __builtin_altivec_vpkswss(__b, __a);
4412#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004413 return __builtin_altivec_vpkswss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004414#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004415}
4416
Bill Seurer703e8482015-06-09 14:39:47 +00004417static vector unsigned short __ATTRS_o_ai vec_packs(vector unsigned int __a,
4418 vector unsigned int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004419#ifdef __LITTLE_ENDIAN__
4420 return __builtin_altivec_vpkuwus(__b, __a);
4421#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004422 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004423#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004424}
4425
Bill Schmidt41e14c42015-05-16 01:02:25 +00004426#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +00004427static vector int __ATTRS_o_ai vec_packs(vector long long __a,
4428 vector long long __b) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00004429#ifdef __LITTLE_ENDIAN__
4430 return __builtin_altivec_vpksdss(__b, __a);
4431#else
4432 return __builtin_altivec_vpksdss(__a, __b);
4433#endif
4434}
4435
4436static vector unsigned int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004437vec_packs(vector unsigned long long __a, vector unsigned long long __b) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00004438#ifdef __LITTLE_ENDIAN__
4439 return __builtin_altivec_vpkudus(__b, __a);
4440#else
4441 return __builtin_altivec_vpkudus(__a, __b);
4442#endif
4443}
4444#endif
4445
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004446/* vec_vpkshss */
4447
4448static vector signed char __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00004449vec_vpkshss(vector short __a, vector short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004450#ifdef __LITTLE_ENDIAN__
4451 return __builtin_altivec_vpkshss(__b, __a);
4452#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004453 return __builtin_altivec_vpkshss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004454#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004455}
4456
Bill Schmidt41e14c42015-05-16 01:02:25 +00004457/* vec_vpksdss */
4458
4459#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +00004460static vector int __ATTRS_o_ai vec_vpksdss(vector long long __a,
4461 vector long long __b) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00004462#ifdef __LITTLE_ENDIAN__
4463 return __builtin_altivec_vpksdss(__b, __a);
4464#else
4465 return __builtin_altivec_vpksdss(__a, __b);
4466#endif
4467}
4468#endif
4469
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004470/* vec_vpkuhus */
4471
4472static vector unsigned char __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00004473vec_vpkuhus(vector unsigned short __a, vector unsigned short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004474#ifdef __LITTLE_ENDIAN__
4475 return __builtin_altivec_vpkuhus(__b, __a);
4476#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004477 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004478#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004479}
4480
Bill Schmidt41e14c42015-05-16 01:02:25 +00004481/* vec_vpkudus */
4482
4483#ifdef __POWER8_VECTOR__
4484static vector unsigned int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00004485vec_vpkudus(vector unsigned long long __a, vector unsigned long long __b) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00004486#ifdef __LITTLE_ENDIAN__
4487 return __builtin_altivec_vpkudus(__b, __a);
4488#else
4489 return __builtin_altivec_vpkudus(__a, __b);
4490#endif
4491}
4492#endif
4493
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004494/* vec_vpkswss */
4495
4496static vector signed short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00004497vec_vpkswss(vector int __a, vector int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004498#ifdef __LITTLE_ENDIAN__
4499 return __builtin_altivec_vpkswss(__b, __a);
4500#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004501 return __builtin_altivec_vpkswss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004502#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004503}
4504
4505/* vec_vpkuwus */
4506
4507static vector unsigned short __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00004508vec_vpkuwus(vector unsigned int __a, vector unsigned int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004509#ifdef __LITTLE_ENDIAN__
4510 return __builtin_altivec_vpkuwus(__b, __a);
4511#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004512 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004513#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004514}
4515
4516/* vec_packsu */
4517
Bill Seurer703e8482015-06-09 14:39:47 +00004518static vector unsigned char __ATTRS_o_ai vec_packsu(vector short __a,
4519 vector short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004520#ifdef __LITTLE_ENDIAN__
4521 return __builtin_altivec_vpkshus(__b, __a);
4522#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004523 return __builtin_altivec_vpkshus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004524#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004525}
4526
Bill Seurer703e8482015-06-09 14:39:47 +00004527static vector unsigned char __ATTRS_o_ai vec_packsu(vector unsigned short __a,
4528 vector unsigned short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004529#ifdef __LITTLE_ENDIAN__
4530 return __builtin_altivec_vpkuhus(__b, __a);
4531#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004532 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004533#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004534}
4535
Bill Seurer703e8482015-06-09 14:39:47 +00004536static vector unsigned short __ATTRS_o_ai vec_packsu(vector int __a,
4537 vector int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004538#ifdef __LITTLE_ENDIAN__
4539 return __builtin_altivec_vpkswus(__b, __a);
4540#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004541 return __builtin_altivec_vpkswus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004542#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004543}
4544
Bill Seurer703e8482015-06-09 14:39:47 +00004545static vector unsigned short __ATTRS_o_ai vec_packsu(vector unsigned int __a,
4546 vector unsigned int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004547#ifdef __LITTLE_ENDIAN__
4548 return __builtin_altivec_vpkuwus(__b, __a);
4549#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004550 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004551#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004552}
4553
Bill Schmidt41e14c42015-05-16 01:02:25 +00004554#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +00004555static vector unsigned int __ATTRS_o_ai vec_packsu(vector long long __a,
4556 vector long long __b) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00004557#ifdef __LITTLE_ENDIAN__
4558 return __builtin_altivec_vpksdus(__b, __a);
4559#else
4560 return __builtin_altivec_vpksdus(__a, __b);
4561#endif
4562}
4563
4564static vector unsigned int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004565vec_packsu(vector unsigned long long __a, vector unsigned long long __b) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00004566#ifdef __LITTLE_ENDIAN__
4567 return __builtin_altivec_vpkudus(__b, __a);
4568#else
4569 return __builtin_altivec_vpkudus(__a, __b);
4570#endif
4571}
4572#endif
4573
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004574/* vec_vpkshus */
4575
Bill Seurer703e8482015-06-09 14:39:47 +00004576static vector unsigned char __ATTRS_o_ai vec_vpkshus(vector short __a,
4577 vector short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004578#ifdef __LITTLE_ENDIAN__
4579 return __builtin_altivec_vpkshus(__b, __a);
4580#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004581 return __builtin_altivec_vpkshus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004582#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004583}
4584
4585static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004586vec_vpkshus(vector unsigned short __a, vector unsigned short __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004587#ifdef __LITTLE_ENDIAN__
4588 return __builtin_altivec_vpkuhus(__b, __a);
4589#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004590 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004591#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004592}
4593
4594/* vec_vpkswus */
4595
Bill Seurer703e8482015-06-09 14:39:47 +00004596static vector unsigned short __ATTRS_o_ai vec_vpkswus(vector int __a,
4597 vector int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004598#ifdef __LITTLE_ENDIAN__
4599 return __builtin_altivec_vpkswus(__b, __a);
4600#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004601 return __builtin_altivec_vpkswus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004602#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004603}
4604
Bill Seurer703e8482015-06-09 14:39:47 +00004605static vector unsigned short __ATTRS_o_ai vec_vpkswus(vector unsigned int __a,
4606 vector unsigned int __b) {
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004607#ifdef __LITTLE_ENDIAN__
4608 return __builtin_altivec_vpkuwus(__b, __a);
4609#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004610 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004611#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004612}
4613
Bill Schmidt41e14c42015-05-16 01:02:25 +00004614/* vec_vpksdus */
4615
4616#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +00004617static vector unsigned int __ATTRS_o_ai vec_vpksdus(vector long long __a,
4618 vector long long __b) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00004619#ifdef __LITTLE_ENDIAN__
4620 return __builtin_altivec_vpksdus(__b, __a);
4621#else
4622 return __builtin_altivec_vpksdus(__a, __b);
4623#endif
4624}
4625#endif
4626
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004627/* vec_perm */
4628
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004629// The vperm instruction is defined architecturally with a big-endian bias.
4630// For little endian, we swap the input operands and invert the permute
4631// control vector. Only the rightmost 5 bits matter, so we could use
4632// a vector of all 31s instead of all 255s to perform the inversion.
4633// However, when the PCV is not a constant, using 255 has an advantage
4634// in that the vec_xor can be recognized as a vec_nor (and for P8 and
4635// later, possibly a vec_nand).
4636
Bill Seurer703e8482015-06-09 14:39:47 +00004637static vector signed char __ATTRS_o_ai vec_perm(vector signed char __a,
4638 vector signed char __b,
4639 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004640#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004641 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4642 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004643 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00004644 return (vector signed char)__builtin_altivec_vperm_4si((vector int)__b,
4645 (vector int)__a, __d);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004646#else
Bill Seurer703e8482015-06-09 14:39:47 +00004647 return (vector signed char)__builtin_altivec_vperm_4si((vector int)__a,
4648 (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004649#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004650}
4651
Bill Seurer703e8482015-06-09 14:39:47 +00004652static vector unsigned char __ATTRS_o_ai vec_perm(vector unsigned char __a,
4653 vector unsigned char __b,
4654 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004655#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004656 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4657 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004658 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00004659 return (vector unsigned char)__builtin_altivec_vperm_4si(
4660 (vector int)__b, (vector int)__a, __d);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004661#else
Bill Seurer703e8482015-06-09 14:39:47 +00004662 return (vector unsigned char)__builtin_altivec_vperm_4si(
4663 (vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004664#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004665}
4666
Bill Seurer703e8482015-06-09 14:39:47 +00004667static vector bool char __ATTRS_o_ai vec_perm(vector bool char __a,
4668 vector bool char __b,
4669 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004670#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004671 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4672 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004673 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00004674 return (vector bool char)__builtin_altivec_vperm_4si((vector int)__b,
4675 (vector int)__a, __d);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004676#else
Bill Seurer703e8482015-06-09 14:39:47 +00004677 return (vector bool char)__builtin_altivec_vperm_4si((vector int)__a,
4678 (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004679#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004680}
4681
Bill Seurer703e8482015-06-09 14:39:47 +00004682static vector short __ATTRS_o_ai vec_perm(vector short __a, vector short __b,
4683 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004684#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004685 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4686 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004687 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00004688 return (vector short)__builtin_altivec_vperm_4si((vector int)__b,
4689 (vector int)__a, __d);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004690#else
Bill Seurer703e8482015-06-09 14:39:47 +00004691 return (vector short)__builtin_altivec_vperm_4si((vector int)__a,
4692 (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004693#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004694}
4695
Bill Seurer703e8482015-06-09 14:39:47 +00004696static vector unsigned short __ATTRS_o_ai vec_perm(vector unsigned short __a,
4697 vector unsigned short __b,
4698 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004699#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004700 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4701 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004702 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00004703 return (vector unsigned short)__builtin_altivec_vperm_4si(
4704 (vector int)__b, (vector int)__a, __d);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004705#else
Bill Seurer703e8482015-06-09 14:39:47 +00004706 return (vector unsigned short)__builtin_altivec_vperm_4si(
4707 (vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004708#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004709}
4710
Bill Seurer703e8482015-06-09 14:39:47 +00004711static vector bool short __ATTRS_o_ai vec_perm(vector bool short __a,
4712 vector bool short __b,
4713 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004714#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004715 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4716 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004717 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00004718 return (vector bool short)__builtin_altivec_vperm_4si((vector int)__b,
4719 (vector int)__a, __d);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004720#else
Bill Seurer703e8482015-06-09 14:39:47 +00004721 return (vector bool short)__builtin_altivec_vperm_4si((vector int)__a,
4722 (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004723#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004724}
4725
Bill Seurer703e8482015-06-09 14:39:47 +00004726static vector pixel __ATTRS_o_ai vec_perm(vector pixel __a, vector pixel __b,
4727 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004728#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004729 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4730 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004731 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00004732 return (vector pixel)__builtin_altivec_vperm_4si((vector int)__b,
4733 (vector int)__a, __d);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004734#else
Bill Seurer703e8482015-06-09 14:39:47 +00004735 return (vector pixel)__builtin_altivec_vperm_4si((vector int)__a,
4736 (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004737#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004738}
4739
Bill Seurer703e8482015-06-09 14:39:47 +00004740static vector int __ATTRS_o_ai vec_perm(vector int __a, vector int __b,
4741 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004742#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004743 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4744 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004745 __d = vec_xor(__c, __d);
4746 return (vector int)__builtin_altivec_vperm_4si(__b, __a, __d);
4747#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004748 return (vector int)__builtin_altivec_vperm_4si(__a, __b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004749#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004750}
4751
Bill Seurer703e8482015-06-09 14:39:47 +00004752static vector unsigned int __ATTRS_o_ai vec_perm(vector unsigned int __a,
4753 vector unsigned int __b,
4754 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004755#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004756 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4757 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004758 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00004759 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__b,
4760 (vector int)__a, __d);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004761#else
Bill Seurer703e8482015-06-09 14:39:47 +00004762 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__a,
4763 (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004764#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004765}
4766
Bill Seurer703e8482015-06-09 14:39:47 +00004767static vector bool int __ATTRS_o_ai vec_perm(vector bool int __a,
4768 vector bool int __b,
4769 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004770#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004771 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4772 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004773 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00004774 return (vector bool int)__builtin_altivec_vperm_4si((vector int)__b,
4775 (vector int)__a, __d);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004776#else
Bill Seurer703e8482015-06-09 14:39:47 +00004777 return (vector bool int)__builtin_altivec_vperm_4si((vector int)__a,
4778 (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004779#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004780}
4781
Bill Seurer703e8482015-06-09 14:39:47 +00004782static vector float __ATTRS_o_ai vec_perm(vector float __a, vector float __b,
4783 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004784#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004785 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4786 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004787 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00004788 return (vector float)__builtin_altivec_vperm_4si((vector int)__b,
4789 (vector int)__a, __d);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004790#else
Bill Seurer703e8482015-06-09 14:39:47 +00004791 return (vector float)__builtin_altivec_vperm_4si((vector int)__a,
4792 (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004793#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004794}
4795
Bill Schmidt8ff672d2014-11-14 13:10:13 +00004796#ifdef __VSX__
Bill Seurer703e8482015-06-09 14:39:47 +00004797static vector long long __ATTRS_o_ai vec_perm(vector long long __a,
4798 vector long long __b,
4799 vector unsigned char __c) {
Bill Schmidt8ff672d2014-11-14 13:10:13 +00004800#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004801 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4802 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidt8ff672d2014-11-14 13:10:13 +00004803 __d = vec_xor(__c, __d);
4804 return (vector long long)__builtin_altivec_vperm_4si(__b, __a, __d);
4805#else
4806 return (vector long long)__builtin_altivec_vperm_4si(__a, __b, __c);
4807#endif
4808}
4809
Eric Christopherc67e1b62014-12-10 00:57:43 +00004810static vector unsigned long long __ATTRS_o_ai
Bill Schmidt8ff672d2014-11-14 13:10:13 +00004811vec_perm(vector unsigned long long __a, vector unsigned long long __b,
Bill Seurer703e8482015-06-09 14:39:47 +00004812 vector unsigned char __c) {
Bill Schmidt8ff672d2014-11-14 13:10:13 +00004813#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004814 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4815 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidt8ff672d2014-11-14 13:10:13 +00004816 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00004817 return (vector unsigned long long)__builtin_altivec_vperm_4si(
4818 (vector int)__b, (vector int)__a, __d);
Bill Schmidt8ff672d2014-11-14 13:10:13 +00004819#else
Bill Seurer703e8482015-06-09 14:39:47 +00004820 return (vector unsigned long long)__builtin_altivec_vperm_4si(
4821 (vector int)__a, (vector int)__b, __c);
Bill Schmidt8ff672d2014-11-14 13:10:13 +00004822#endif
4823}
4824
Bill Seurer703e8482015-06-09 14:39:47 +00004825static vector double __ATTRS_o_ai vec_perm(vector double __a, vector double __b,
4826 vector unsigned char __c) {
Bill Schmidt8ff672d2014-11-14 13:10:13 +00004827#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00004828 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
4829 255, 255, 255, 255, 255, 255, 255, 255};
Bill Schmidt8ff672d2014-11-14 13:10:13 +00004830 __d = vec_xor(__c, __d);
Bill Seurer703e8482015-06-09 14:39:47 +00004831 return (vector double)__builtin_altivec_vperm_4si((vector int)__b,
4832 (vector int)__a, __d);
Bill Schmidt8ff672d2014-11-14 13:10:13 +00004833#else
Bill Seurer703e8482015-06-09 14:39:47 +00004834 return (vector double)__builtin_altivec_vperm_4si((vector int)__a,
4835 (vector int)__b, __c);
Bill Schmidt8ff672d2014-11-14 13:10:13 +00004836#endif
4837}
4838#endif
4839
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004840/* vec_vperm */
4841
Bill Seurer703e8482015-06-09 14:39:47 +00004842static vector signed char __ATTRS_o_ai vec_vperm(vector signed char __a,
4843 vector signed char __b,
4844 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004845 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004846}
4847
Bill Seurer703e8482015-06-09 14:39:47 +00004848static vector unsigned char __ATTRS_o_ai vec_vperm(vector unsigned char __a,
4849 vector unsigned char __b,
4850 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004851 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004852}
4853
Bill Seurer703e8482015-06-09 14:39:47 +00004854static vector bool char __ATTRS_o_ai vec_vperm(vector bool char __a,
4855 vector bool char __b,
4856 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004857 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00004858}
4859
Bill Seurer703e8482015-06-09 14:39:47 +00004860static vector short __ATTRS_o_ai vec_vperm(vector short __a, vector short __b,
4861 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004862 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004863}
4864
Bill Seurer703e8482015-06-09 14:39:47 +00004865static vector unsigned short __ATTRS_o_ai vec_vperm(vector unsigned short __a,
4866 vector unsigned short __b,
4867 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004868 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004869}
4870
Bill Seurer703e8482015-06-09 14:39:47 +00004871static vector bool short __ATTRS_o_ai vec_vperm(vector bool short __a,
4872 vector bool short __b,
4873 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004874 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00004875}
4876
Bill Seurer703e8482015-06-09 14:39:47 +00004877static vector pixel __ATTRS_o_ai vec_vperm(vector pixel __a, vector pixel __b,
4878 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004879 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00004880}
4881
Bill Seurer703e8482015-06-09 14:39:47 +00004882static vector int __ATTRS_o_ai vec_vperm(vector int __a, vector int __b,
4883 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004884 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004885}
4886
Bill Seurer703e8482015-06-09 14:39:47 +00004887static vector unsigned int __ATTRS_o_ai vec_vperm(vector unsigned int __a,
4888 vector unsigned int __b,
4889 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004890 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004891}
4892
Bill Seurer703e8482015-06-09 14:39:47 +00004893static vector bool int __ATTRS_o_ai vec_vperm(vector bool int __a,
4894 vector bool int __b,
4895 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004896 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00004897}
4898
Bill Seurer703e8482015-06-09 14:39:47 +00004899static vector float __ATTRS_o_ai vec_vperm(vector float __a, vector float __b,
4900 vector unsigned char __c) {
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004901 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004902}
4903
Bill Schmidt8ff672d2014-11-14 13:10:13 +00004904#ifdef __VSX__
Bill Seurer703e8482015-06-09 14:39:47 +00004905static vector long long __ATTRS_o_ai vec_vperm(vector long long __a,
4906 vector long long __b,
4907 vector unsigned char __c) {
Bill Schmidt8ff672d2014-11-14 13:10:13 +00004908 return vec_perm(__a, __b, __c);
4909}
4910
4911static vector unsigned long long __ATTRS_o_ai
4912vec_vperm(vector unsigned long long __a, vector unsigned long long __b,
Bill Seurer703e8482015-06-09 14:39:47 +00004913 vector unsigned char __c) {
Bill Schmidt8ff672d2014-11-14 13:10:13 +00004914 return vec_perm(__a, __b, __c);
4915}
4916
Bill Seurer703e8482015-06-09 14:39:47 +00004917static vector double __ATTRS_o_ai vec_vperm(vector double __a,
4918 vector double __b,
4919 vector unsigned char __c) {
Bill Schmidt8ff672d2014-11-14 13:10:13 +00004920 return vec_perm(__a, __b, __c);
4921}
4922#endif
4923
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004924/* vec_re */
4925
Ulrich Weigand9936f132012-10-31 18:17:07 +00004926static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00004927vec_re(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004928 return __builtin_altivec_vrefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004929}
4930
4931/* vec_vrefp */
4932
Ulrich Weigand9936f132012-10-31 18:17:07 +00004933static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00004934vec_vrefp(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004935 return __builtin_altivec_vrefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004936}
4937
4938/* vec_rl */
4939
Bill Seurer703e8482015-06-09 14:39:47 +00004940static vector signed char __ATTRS_o_ai vec_rl(vector signed char __a,
4941 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004942 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004943}
4944
Bill Seurer703e8482015-06-09 14:39:47 +00004945static vector unsigned char __ATTRS_o_ai vec_rl(vector unsigned char __a,
4946 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004947 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004948}
4949
Bill Seurer703e8482015-06-09 14:39:47 +00004950static vector short __ATTRS_o_ai vec_rl(vector short __a,
4951 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004952 return __builtin_altivec_vrlh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004953}
4954
Bill Seurer703e8482015-06-09 14:39:47 +00004955static vector unsigned short __ATTRS_o_ai vec_rl(vector unsigned short __a,
4956 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004957 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004958}
4959
Bill Seurer703e8482015-06-09 14:39:47 +00004960static vector int __ATTRS_o_ai vec_rl(vector int __a, vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004961 return __builtin_altivec_vrlw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004962}
4963
Bill Seurer703e8482015-06-09 14:39:47 +00004964static vector unsigned int __ATTRS_o_ai vec_rl(vector unsigned int __a,
4965 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004966 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004967}
4968
Kit Barton8553bec2015-03-11 15:57:19 +00004969#ifdef __POWER8_VECTOR__
4970static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004971vec_rl(vector signed long long __a, vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00004972 return __builtin_altivec_vrld(__a, __b);
4973}
4974
4975static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00004976vec_rl(vector unsigned long long __a, vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00004977 return __builtin_altivec_vrld(__a, __b);
4978}
4979#endif
4980
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004981/* vec_vrlb */
4982
Bill Seurer703e8482015-06-09 14:39:47 +00004983static vector signed char __ATTRS_o_ai vec_vrlb(vector signed char __a,
4984 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004985 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004986}
4987
Bill Seurer703e8482015-06-09 14:39:47 +00004988static vector unsigned char __ATTRS_o_ai vec_vrlb(vector unsigned char __a,
4989 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004990 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004991}
4992
4993/* vec_vrlh */
4994
Bill Seurer703e8482015-06-09 14:39:47 +00004995static vector short __ATTRS_o_ai vec_vrlh(vector short __a,
4996 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00004997 return __builtin_altivec_vrlh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004998}
4999
Bill Seurer703e8482015-06-09 14:39:47 +00005000static vector unsigned short __ATTRS_o_ai vec_vrlh(vector unsigned short __a,
5001 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005002 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005003}
5004
5005/* vec_vrlw */
5006
Bill Seurer703e8482015-06-09 14:39:47 +00005007static vector int __ATTRS_o_ai vec_vrlw(vector int __a,
5008 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005009 return __builtin_altivec_vrlw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005010}
5011
Bill Seurer703e8482015-06-09 14:39:47 +00005012static vector unsigned int __ATTRS_o_ai vec_vrlw(vector unsigned int __a,
5013 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005014 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005015}
5016
5017/* vec_round */
5018
5019static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00005020vec_round(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005021 return __builtin_altivec_vrfin(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005022}
5023
5024/* vec_vrfin */
5025
5026static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00005027vec_vrfin(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005028 return __builtin_altivec_vrfin(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005029}
5030
5031/* vec_rsqrte */
5032
5033static __vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00005034vec_rsqrte(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005035 return __builtin_altivec_vrsqrtefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005036}
5037
5038/* vec_vrsqrtefp */
5039
5040static __vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00005041vec_vrsqrtefp(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005042 return __builtin_altivec_vrsqrtefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005043}
5044
5045/* vec_sel */
5046
5047#define __builtin_altivec_vsel_4si vec_sel
5048
Bill Seurer703e8482015-06-09 14:39:47 +00005049static vector signed char __ATTRS_o_ai vec_sel(vector signed char __a,
5050 vector signed char __b,
5051 vector unsigned char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005052 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005053}
5054
Bill Seurer703e8482015-06-09 14:39:47 +00005055static vector signed char __ATTRS_o_ai vec_sel(vector signed char __a,
5056 vector signed char __b,
5057 vector bool char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005058 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005059}
5060
Bill Seurer703e8482015-06-09 14:39:47 +00005061static vector unsigned char __ATTRS_o_ai vec_sel(vector unsigned char __a,
5062 vector unsigned char __b,
5063 vector unsigned char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005064 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005065}
5066
Bill Seurer703e8482015-06-09 14:39:47 +00005067static vector unsigned char __ATTRS_o_ai vec_sel(vector unsigned char __a,
5068 vector unsigned char __b,
5069 vector bool char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005070 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005071}
5072
Bill Seurer703e8482015-06-09 14:39:47 +00005073static vector bool char __ATTRS_o_ai vec_sel(vector bool char __a,
5074 vector bool char __b,
5075 vector unsigned char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005076 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005077}
5078
Bill Seurer703e8482015-06-09 14:39:47 +00005079static vector bool char __ATTRS_o_ai vec_sel(vector bool char __a,
5080 vector bool char __b,
5081 vector bool char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005082 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005083}
5084
Bill Seurer703e8482015-06-09 14:39:47 +00005085static vector short __ATTRS_o_ai vec_sel(vector short __a, vector short __b,
5086 vector unsigned short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005087 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005088}
5089
Bill Seurer703e8482015-06-09 14:39:47 +00005090static vector short __ATTRS_o_ai vec_sel(vector short __a, vector short __b,
5091 vector bool short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005092 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005093}
5094
Bill Seurer703e8482015-06-09 14:39:47 +00005095static vector unsigned short __ATTRS_o_ai vec_sel(vector unsigned short __a,
5096 vector unsigned short __b,
5097 vector unsigned short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005098 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005099}
5100
Bill Seurer703e8482015-06-09 14:39:47 +00005101static vector unsigned short __ATTRS_o_ai vec_sel(vector unsigned short __a,
5102 vector unsigned short __b,
5103 vector bool short __c) {
5104 return (__a & ~(vector unsigned short)__c) |
5105 (__b & (vector unsigned short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005106}
5107
Bill Seurer703e8482015-06-09 14:39:47 +00005108static vector bool short __ATTRS_o_ai vec_sel(vector bool short __a,
5109 vector bool short __b,
5110 vector unsigned short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005111 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005112}
5113
Bill Seurer703e8482015-06-09 14:39:47 +00005114static vector bool short __ATTRS_o_ai vec_sel(vector bool short __a,
5115 vector bool short __b,
5116 vector bool short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005117 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005118}
5119
Bill Seurer703e8482015-06-09 14:39:47 +00005120static vector int __ATTRS_o_ai vec_sel(vector int __a, vector int __b,
5121 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005122 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005123}
5124
Bill Seurer703e8482015-06-09 14:39:47 +00005125static vector int __ATTRS_o_ai vec_sel(vector int __a, vector int __b,
5126 vector bool int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005127 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005128}
5129
Bill Seurer703e8482015-06-09 14:39:47 +00005130static vector unsigned int __ATTRS_o_ai vec_sel(vector unsigned int __a,
5131 vector unsigned int __b,
5132 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005133 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005134}
5135
Bill Seurer703e8482015-06-09 14:39:47 +00005136static vector unsigned int __ATTRS_o_ai vec_sel(vector unsigned int __a,
5137 vector unsigned int __b,
5138 vector bool int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005139 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005140}
5141
Bill Seurer703e8482015-06-09 14:39:47 +00005142static vector bool int __ATTRS_o_ai vec_sel(vector bool int __a,
5143 vector bool int __b,
5144 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005145 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005146}
5147
Bill Seurer703e8482015-06-09 14:39:47 +00005148static vector bool int __ATTRS_o_ai vec_sel(vector bool int __a,
5149 vector bool int __b,
5150 vector bool int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005151 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005152}
5153
Bill Seurer703e8482015-06-09 14:39:47 +00005154static vector float __ATTRS_o_ai vec_sel(vector float __a, vector float __b,
5155 vector unsigned int __c) {
5156 vector int __res = ((vector int)__a & ~(vector int)__c) |
5157 ((vector int)__b & (vector int)__c);
David Blaikie3302f2b2013-01-16 23:08:36 +00005158 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005159}
5160
Bill Seurer703e8482015-06-09 14:39:47 +00005161static vector float __ATTRS_o_ai vec_sel(vector float __a, vector float __b,
5162 vector bool int __c) {
5163 vector int __res = ((vector int)__a & ~(vector int)__c) |
5164 ((vector int)__b & (vector int)__c);
David Blaikie3302f2b2013-01-16 23:08:36 +00005165 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00005166}
5167
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005168/* vec_vsel */
5169
Bill Seurer703e8482015-06-09 14:39:47 +00005170static vector signed char __ATTRS_o_ai vec_vsel(vector signed char __a,
5171 vector signed char __b,
5172 vector unsigned char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005173 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005174}
5175
Bill Seurer703e8482015-06-09 14:39:47 +00005176static vector signed char __ATTRS_o_ai vec_vsel(vector signed char __a,
5177 vector signed char __b,
5178 vector bool char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005179 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005180}
5181
Bill Seurer703e8482015-06-09 14:39:47 +00005182static vector unsigned char __ATTRS_o_ai vec_vsel(vector unsigned char __a,
5183 vector unsigned char __b,
5184 vector unsigned char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005185 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005186}
5187
Bill Seurer703e8482015-06-09 14:39:47 +00005188static vector unsigned char __ATTRS_o_ai vec_vsel(vector unsigned char __a,
5189 vector unsigned char __b,
5190 vector bool char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005191 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005192}
5193
Bill Seurer703e8482015-06-09 14:39:47 +00005194static vector bool char __ATTRS_o_ai vec_vsel(vector bool char __a,
5195 vector bool char __b,
5196 vector unsigned char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005197 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005198}
5199
Bill Seurer703e8482015-06-09 14:39:47 +00005200static vector bool char __ATTRS_o_ai vec_vsel(vector bool char __a,
5201 vector bool char __b,
5202 vector bool char __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005203 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005204}
5205
Bill Seurer703e8482015-06-09 14:39:47 +00005206static vector short __ATTRS_o_ai vec_vsel(vector short __a, vector short __b,
5207 vector unsigned short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005208 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005209}
5210
Bill Seurer703e8482015-06-09 14:39:47 +00005211static vector short __ATTRS_o_ai vec_vsel(vector short __a, vector short __b,
5212 vector bool short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005213 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005214}
5215
Bill Seurer703e8482015-06-09 14:39:47 +00005216static vector unsigned short __ATTRS_o_ai vec_vsel(vector unsigned short __a,
5217 vector unsigned short __b,
5218 vector unsigned short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005219 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005220}
5221
Bill Seurer703e8482015-06-09 14:39:47 +00005222static vector unsigned short __ATTRS_o_ai vec_vsel(vector unsigned short __a,
5223 vector unsigned short __b,
5224 vector bool short __c) {
5225 return (__a & ~(vector unsigned short)__c) |
5226 (__b & (vector unsigned short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005227}
5228
Bill Seurer703e8482015-06-09 14:39:47 +00005229static vector bool short __ATTRS_o_ai vec_vsel(vector bool short __a,
5230 vector bool short __b,
5231 vector unsigned short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005232 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005233}
5234
Bill Seurer703e8482015-06-09 14:39:47 +00005235static vector bool short __ATTRS_o_ai vec_vsel(vector bool short __a,
5236 vector bool short __b,
5237 vector bool short __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005238 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005239}
5240
Bill Seurer703e8482015-06-09 14:39:47 +00005241static vector int __ATTRS_o_ai vec_vsel(vector int __a, vector int __b,
5242 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005243 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005244}
5245
Bill Seurer703e8482015-06-09 14:39:47 +00005246static vector int __ATTRS_o_ai vec_vsel(vector int __a, vector int __b,
5247 vector bool int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005248 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005249}
5250
Bill Seurer703e8482015-06-09 14:39:47 +00005251static vector unsigned int __ATTRS_o_ai vec_vsel(vector unsigned int __a,
5252 vector unsigned int __b,
5253 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005254 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005255}
5256
Bill Seurer703e8482015-06-09 14:39:47 +00005257static vector unsigned int __ATTRS_o_ai vec_vsel(vector unsigned int __a,
5258 vector unsigned int __b,
5259 vector bool int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005260 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005261}
5262
Bill Seurer703e8482015-06-09 14:39:47 +00005263static vector bool int __ATTRS_o_ai vec_vsel(vector bool int __a,
5264 vector bool int __b,
5265 vector unsigned int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005266 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005267}
5268
Bill Seurer703e8482015-06-09 14:39:47 +00005269static vector bool int __ATTRS_o_ai vec_vsel(vector bool int __a,
5270 vector bool int __b,
5271 vector bool int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005272 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005273}
5274
Bill Seurer703e8482015-06-09 14:39:47 +00005275static vector float __ATTRS_o_ai vec_vsel(vector float __a, vector float __b,
5276 vector unsigned int __c) {
5277 vector int __res = ((vector int)__a & ~(vector int)__c) |
5278 ((vector int)__b & (vector int)__c);
David Blaikie3302f2b2013-01-16 23:08:36 +00005279 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005280}
5281
Bill Seurer703e8482015-06-09 14:39:47 +00005282static vector float __ATTRS_o_ai vec_vsel(vector float __a, vector float __b,
5283 vector bool int __c) {
5284 vector int __res = ((vector int)__a & ~(vector int)__c) |
5285 ((vector int)__b & (vector int)__c);
David Blaikie3302f2b2013-01-16 23:08:36 +00005286 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00005287}
5288
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005289/* vec_sl */
5290
Bill Seurer703e8482015-06-09 14:39:47 +00005291static vector signed char __ATTRS_o_ai vec_sl(vector signed char __a,
5292 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005293 return __a << (vector signed char)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005294}
5295
Bill Seurer703e8482015-06-09 14:39:47 +00005296static vector unsigned char __ATTRS_o_ai vec_sl(vector unsigned char __a,
5297 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005298 return __a << __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005299}
5300
Bill Seurer703e8482015-06-09 14:39:47 +00005301static vector short __ATTRS_o_ai vec_sl(vector short __a,
5302 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005303 return __a << (vector short)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005304}
5305
Bill Seurer703e8482015-06-09 14:39:47 +00005306static vector unsigned short __ATTRS_o_ai vec_sl(vector unsigned short __a,
5307 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005308 return __a << __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005309}
5310
Bill Seurer703e8482015-06-09 14:39:47 +00005311static vector int __ATTRS_o_ai vec_sl(vector int __a, vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005312 return __a << (vector int)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005313}
5314
Bill Seurer703e8482015-06-09 14:39:47 +00005315static vector unsigned int __ATTRS_o_ai vec_sl(vector unsigned int __a,
5316 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005317 return __a << __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005318}
5319
Kit Barton8553bec2015-03-11 15:57:19 +00005320#ifdef __POWER8_VECTOR__
5321static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00005322vec_sl(vector signed long long __a, vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00005323 return __a << (vector long long)__b;
5324}
5325
5326static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00005327vec_sl(vector unsigned long long __a, vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00005328 return __a << __b;
5329}
5330#endif
5331
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005332/* vec_vslb */
5333
5334#define __builtin_altivec_vslb vec_vslb
5335
Bill Seurer703e8482015-06-09 14:39:47 +00005336static vector signed char __ATTRS_o_ai vec_vslb(vector signed char __a,
5337 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005338 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005339}
5340
Bill Seurer703e8482015-06-09 14:39:47 +00005341static vector unsigned char __ATTRS_o_ai vec_vslb(vector unsigned char __a,
5342 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005343 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005344}
5345
5346/* vec_vslh */
5347
5348#define __builtin_altivec_vslh vec_vslh
5349
Bill Seurer703e8482015-06-09 14:39:47 +00005350static vector short __ATTRS_o_ai vec_vslh(vector short __a,
5351 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005352 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005353}
5354
Bill Seurer703e8482015-06-09 14:39:47 +00005355static vector unsigned short __ATTRS_o_ai vec_vslh(vector unsigned short __a,
5356 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005357 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005358}
5359
5360/* vec_vslw */
5361
5362#define __builtin_altivec_vslw vec_vslw
5363
Bill Seurer703e8482015-06-09 14:39:47 +00005364static vector int __ATTRS_o_ai vec_vslw(vector int __a,
5365 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005366 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005367}
5368
Bill Seurer703e8482015-06-09 14:39:47 +00005369static vector unsigned int __ATTRS_o_ai vec_vslw(vector unsigned int __a,
5370 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005371 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005372}
5373
5374/* vec_sld */
5375
5376#define __builtin_altivec_vsldoi_4si vec_sld
5377
Bill Seurer703e8482015-06-09 14:39:47 +00005378static vector signed char __ATTRS_o_ai vec_sld(vector signed char __a,
5379 vector signed char __b,
5380 unsigned char __c) {
5381 return vec_perm(
5382 __a, __b,
5383 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5384 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5385 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005386}
5387
Bill Seurer703e8482015-06-09 14:39:47 +00005388static vector unsigned char __ATTRS_o_ai vec_sld(vector unsigned char __a,
5389 vector unsigned char __b,
5390 unsigned char __c) {
5391 return vec_perm(
5392 __a, __b,
5393 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5394 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5395 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005396}
5397
Bill Seurer703e8482015-06-09 14:39:47 +00005398static vector short __ATTRS_o_ai vec_sld(vector short __a, vector short __b,
5399 unsigned char __c) {
5400 return vec_perm(
5401 __a, __b,
5402 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5403 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5404 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005405}
5406
Bill Seurer703e8482015-06-09 14:39:47 +00005407static vector unsigned short __ATTRS_o_ai vec_sld(vector unsigned short __a,
5408 vector unsigned short __b,
5409 unsigned char __c) {
5410 return vec_perm(
5411 __a, __b,
5412 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5413 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5414 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Yartsev9e968982010-08-19 03:00:09 +00005415}
5416
Bill Seurer703e8482015-06-09 14:39:47 +00005417static vector pixel __ATTRS_o_ai vec_sld(vector pixel __a, vector pixel __b,
5418 unsigned char __c) {
5419 return vec_perm(
5420 __a, __b,
5421 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5422 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5423 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005424}
5425
Bill Seurer703e8482015-06-09 14:39:47 +00005426static vector int __ATTRS_o_ai vec_sld(vector int __a, vector int __b,
5427 unsigned char __c) {
5428 return vec_perm(
5429 __a, __b,
5430 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5431 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5432 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005433}
5434
Bill Seurer703e8482015-06-09 14:39:47 +00005435static vector unsigned int __ATTRS_o_ai vec_sld(vector unsigned int __a,
5436 vector unsigned int __b,
5437 unsigned char __c) {
5438 return vec_perm(
5439 __a, __b,
5440 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5441 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5442 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005443}
5444
Bill Seurer703e8482015-06-09 14:39:47 +00005445static vector float __ATTRS_o_ai vec_sld(vector float __a, vector float __b,
5446 unsigned char __c) {
5447 return vec_perm(
5448 __a, __b,
5449 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5450 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5451 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005452}
5453
5454/* vec_vsldoi */
5455
Bill Seurer703e8482015-06-09 14:39:47 +00005456static vector signed char __ATTRS_o_ai vec_vsldoi(vector signed char __a,
5457 vector signed char __b,
5458 unsigned char __c) {
5459 return vec_perm(
5460 __a, __b,
5461 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5462 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5463 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005464}
5465
Bill Seurer703e8482015-06-09 14:39:47 +00005466static vector unsigned char __ATTRS_o_ai vec_vsldoi(vector unsigned char __a,
5467 vector unsigned char __b,
5468 unsigned char __c) {
5469 return vec_perm(
5470 __a, __b,
5471 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5472 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5473 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005474}
5475
Bill Seurer703e8482015-06-09 14:39:47 +00005476static vector short __ATTRS_o_ai vec_vsldoi(vector short __a, vector short __b,
5477 unsigned char __c) {
5478 return vec_perm(
5479 __a, __b,
5480 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5481 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5482 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005483}
5484
Bill Seurer703e8482015-06-09 14:39:47 +00005485static vector unsigned short __ATTRS_o_ai vec_vsldoi(vector unsigned short __a,
5486 vector unsigned short __b,
5487 unsigned char __c) {
5488 return vec_perm(
5489 __a, __b,
5490 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5491 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5492 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Yartsev9e968982010-08-19 03:00:09 +00005493}
5494
Bill Seurer703e8482015-06-09 14:39:47 +00005495static vector pixel __ATTRS_o_ai vec_vsldoi(vector pixel __a, vector pixel __b,
5496 unsigned char __c) {
5497 return vec_perm(
5498 __a, __b,
5499 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5500 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5501 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005502}
5503
Bill Seurer703e8482015-06-09 14:39:47 +00005504static vector int __ATTRS_o_ai vec_vsldoi(vector int __a, vector int __b,
5505 unsigned char __c) {
5506 return vec_perm(
5507 __a, __b,
5508 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5509 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5510 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005511}
5512
Bill Seurer703e8482015-06-09 14:39:47 +00005513static vector unsigned int __ATTRS_o_ai vec_vsldoi(vector unsigned int __a,
5514 vector unsigned int __b,
5515 unsigned char __c) {
5516 return vec_perm(
5517 __a, __b,
5518 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5519 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5520 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005521}
5522
Bill Seurer703e8482015-06-09 14:39:47 +00005523static vector float __ATTRS_o_ai vec_vsldoi(vector float __a, vector float __b,
5524 unsigned char __c) {
5525 return vec_perm(
5526 __a, __b,
5527 (vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
5528 __c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
5529 __c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005530}
5531
5532/* vec_sll */
5533
Bill Seurer703e8482015-06-09 14:39:47 +00005534static vector signed char __ATTRS_o_ai vec_sll(vector signed char __a,
5535 vector unsigned char __b) {
5536 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
5537 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005538}
5539
Bill Seurer703e8482015-06-09 14:39:47 +00005540static vector signed char __ATTRS_o_ai vec_sll(vector signed char __a,
5541 vector unsigned short __b) {
5542 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
5543 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005544}
5545
Bill Seurer703e8482015-06-09 14:39:47 +00005546static vector signed char __ATTRS_o_ai vec_sll(vector signed char __a,
5547 vector unsigned int __b) {
5548 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
5549 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005550}
5551
Bill Seurer703e8482015-06-09 14:39:47 +00005552static vector unsigned char __ATTRS_o_ai vec_sll(vector unsigned char __a,
5553 vector unsigned char __b) {
5554 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
5555 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005556}
5557
Bill Seurer703e8482015-06-09 14:39:47 +00005558static vector unsigned char __ATTRS_o_ai vec_sll(vector unsigned char __a,
5559 vector unsigned short __b) {
5560 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
5561 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005562}
5563
Bill Seurer703e8482015-06-09 14:39:47 +00005564static vector unsigned char __ATTRS_o_ai vec_sll(vector unsigned char __a,
5565 vector unsigned int __b) {
5566 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
5567 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005568}
5569
Bill Seurer703e8482015-06-09 14:39:47 +00005570static vector bool char __ATTRS_o_ai vec_sll(vector bool char __a,
5571 vector unsigned char __b) {
5572 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
5573 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005574}
5575
Bill Seurer703e8482015-06-09 14:39:47 +00005576static vector bool char __ATTRS_o_ai vec_sll(vector bool char __a,
5577 vector unsigned short __b) {
5578 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
5579 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005580}
5581
Bill Seurer703e8482015-06-09 14:39:47 +00005582static vector bool char __ATTRS_o_ai vec_sll(vector bool char __a,
5583 vector unsigned int __b) {
5584 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
5585 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005586}
5587
Bill Seurer703e8482015-06-09 14:39:47 +00005588static vector short __ATTRS_o_ai vec_sll(vector short __a,
5589 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005590 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005591}
5592
Bill Seurer703e8482015-06-09 14:39:47 +00005593static vector short __ATTRS_o_ai vec_sll(vector short __a,
5594 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005595 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005596}
5597
Bill Seurer703e8482015-06-09 14:39:47 +00005598static vector short __ATTRS_o_ai vec_sll(vector short __a,
5599 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005600 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005601}
5602
Bill Seurer703e8482015-06-09 14:39:47 +00005603static vector unsigned short __ATTRS_o_ai vec_sll(vector unsigned short __a,
5604 vector unsigned char __b) {
5605 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
5606 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005607}
5608
Bill Seurer703e8482015-06-09 14:39:47 +00005609static vector unsigned short __ATTRS_o_ai vec_sll(vector unsigned short __a,
5610 vector unsigned short __b) {
5611 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
5612 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005613}
5614
Bill Seurer703e8482015-06-09 14:39:47 +00005615static vector unsigned short __ATTRS_o_ai vec_sll(vector unsigned short __a,
5616 vector unsigned int __b) {
5617 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
5618 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005619}
5620
Bill Seurer703e8482015-06-09 14:39:47 +00005621static vector bool short __ATTRS_o_ai vec_sll(vector bool short __a,
5622 vector unsigned char __b) {
5623 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
5624 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005625}
5626
Bill Seurer703e8482015-06-09 14:39:47 +00005627static vector bool short __ATTRS_o_ai vec_sll(vector bool short __a,
5628 vector unsigned short __b) {
5629 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
5630 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005631}
5632
Bill Seurer703e8482015-06-09 14:39:47 +00005633static vector bool short __ATTRS_o_ai vec_sll(vector bool short __a,
5634 vector unsigned int __b) {
5635 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
5636 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005637}
5638
Bill Seurer703e8482015-06-09 14:39:47 +00005639static vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
5640 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005641 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005642}
5643
Bill Seurer703e8482015-06-09 14:39:47 +00005644static vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
5645 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005646 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005647}
5648
Bill Seurer703e8482015-06-09 14:39:47 +00005649static vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
5650 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005651 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005652}
5653
Bill Seurer703e8482015-06-09 14:39:47 +00005654static vector int __ATTRS_o_ai vec_sll(vector int __a,
5655 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005656 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005657}
5658
Bill Seurer703e8482015-06-09 14:39:47 +00005659static vector int __ATTRS_o_ai vec_sll(vector int __a,
5660 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005661 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005662}
5663
Bill Seurer703e8482015-06-09 14:39:47 +00005664static vector int __ATTRS_o_ai vec_sll(vector int __a,
5665 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005666 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005667}
5668
Bill Seurer703e8482015-06-09 14:39:47 +00005669static vector unsigned int __ATTRS_o_ai vec_sll(vector unsigned int __a,
5670 vector unsigned char __b) {
5671 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
5672 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005673}
5674
Bill Seurer703e8482015-06-09 14:39:47 +00005675static vector unsigned int __ATTRS_o_ai vec_sll(vector unsigned int __a,
5676 vector unsigned short __b) {
5677 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
5678 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005679}
5680
Bill Seurer703e8482015-06-09 14:39:47 +00005681static vector unsigned int __ATTRS_o_ai vec_sll(vector unsigned int __a,
5682 vector unsigned int __b) {
5683 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
5684 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005685}
5686
Bill Seurer703e8482015-06-09 14:39:47 +00005687static vector bool int __ATTRS_o_ai vec_sll(vector bool int __a,
5688 vector unsigned char __b) {
5689 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
5690 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005691}
5692
Bill Seurer703e8482015-06-09 14:39:47 +00005693static vector bool int __ATTRS_o_ai vec_sll(vector bool int __a,
5694 vector unsigned short __b) {
5695 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
5696 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005697}
5698
Bill Seurer703e8482015-06-09 14:39:47 +00005699static vector bool int __ATTRS_o_ai vec_sll(vector bool int __a,
5700 vector unsigned int __b) {
5701 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
5702 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005703}
5704
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005705/* vec_vsl */
5706
Bill Seurer703e8482015-06-09 14:39:47 +00005707static vector signed char __ATTRS_o_ai vec_vsl(vector signed char __a,
5708 vector unsigned char __b) {
5709 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
5710 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005711}
5712
Bill Seurer703e8482015-06-09 14:39:47 +00005713static vector signed char __ATTRS_o_ai vec_vsl(vector signed char __a,
5714 vector unsigned short __b) {
5715 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
5716 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005717}
5718
Bill Seurer703e8482015-06-09 14:39:47 +00005719static vector signed char __ATTRS_o_ai vec_vsl(vector signed char __a,
5720 vector unsigned int __b) {
5721 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
5722 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005723}
5724
Bill Seurer703e8482015-06-09 14:39:47 +00005725static vector unsigned char __ATTRS_o_ai vec_vsl(vector unsigned char __a,
5726 vector unsigned char __b) {
5727 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
5728 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005729}
5730
Bill Seurer703e8482015-06-09 14:39:47 +00005731static vector unsigned char __ATTRS_o_ai vec_vsl(vector unsigned char __a,
5732 vector unsigned short __b) {
5733 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
5734 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005735}
5736
Bill Seurer703e8482015-06-09 14:39:47 +00005737static vector unsigned char __ATTRS_o_ai vec_vsl(vector unsigned char __a,
5738 vector unsigned int __b) {
5739 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
5740 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005741}
5742
Bill Seurer703e8482015-06-09 14:39:47 +00005743static vector bool char __ATTRS_o_ai vec_vsl(vector bool char __a,
5744 vector unsigned char __b) {
5745 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
5746 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005747}
5748
Bill Seurer703e8482015-06-09 14:39:47 +00005749static vector bool char __ATTRS_o_ai vec_vsl(vector bool char __a,
5750 vector unsigned short __b) {
5751 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
5752 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005753}
5754
Bill Seurer703e8482015-06-09 14:39:47 +00005755static vector bool char __ATTRS_o_ai vec_vsl(vector bool char __a,
5756 vector unsigned int __b) {
5757 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
5758 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005759}
5760
Bill Seurer703e8482015-06-09 14:39:47 +00005761static vector short __ATTRS_o_ai vec_vsl(vector short __a,
5762 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005763 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005764}
5765
Bill Seurer703e8482015-06-09 14:39:47 +00005766static vector short __ATTRS_o_ai vec_vsl(vector short __a,
5767 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005768 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005769}
5770
Bill Seurer703e8482015-06-09 14:39:47 +00005771static vector short __ATTRS_o_ai vec_vsl(vector short __a,
5772 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005773 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005774}
5775
Bill Seurer703e8482015-06-09 14:39:47 +00005776static vector unsigned short __ATTRS_o_ai vec_vsl(vector unsigned short __a,
5777 vector unsigned char __b) {
5778 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
5779 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005780}
5781
Bill Seurer703e8482015-06-09 14:39:47 +00005782static vector unsigned short __ATTRS_o_ai vec_vsl(vector unsigned short __a,
5783 vector unsigned short __b) {
5784 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
5785 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005786}
5787
Bill Seurer703e8482015-06-09 14:39:47 +00005788static vector unsigned short __ATTRS_o_ai vec_vsl(vector unsigned short __a,
5789 vector unsigned int __b) {
5790 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
5791 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005792}
5793
Bill Seurer703e8482015-06-09 14:39:47 +00005794static vector bool short __ATTRS_o_ai vec_vsl(vector bool short __a,
5795 vector unsigned char __b) {
5796 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
5797 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005798}
5799
Bill Seurer703e8482015-06-09 14:39:47 +00005800static vector bool short __ATTRS_o_ai vec_vsl(vector bool short __a,
5801 vector unsigned short __b) {
5802 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
5803 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005804}
5805
Bill Seurer703e8482015-06-09 14:39:47 +00005806static vector bool short __ATTRS_o_ai vec_vsl(vector bool short __a,
5807 vector unsigned int __b) {
5808 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
5809 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005810}
5811
Bill Seurer703e8482015-06-09 14:39:47 +00005812static vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
5813 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005814 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005815}
5816
Bill Seurer703e8482015-06-09 14:39:47 +00005817static vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
5818 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005819 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005820}
5821
Bill Seurer703e8482015-06-09 14:39:47 +00005822static vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
5823 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005824 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005825}
5826
Bill Seurer703e8482015-06-09 14:39:47 +00005827static vector int __ATTRS_o_ai vec_vsl(vector int __a,
5828 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005829 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005830}
5831
Bill Seurer703e8482015-06-09 14:39:47 +00005832static vector int __ATTRS_o_ai vec_vsl(vector int __a,
5833 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005834 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005835}
5836
Bill Seurer703e8482015-06-09 14:39:47 +00005837static vector int __ATTRS_o_ai vec_vsl(vector int __a,
5838 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005839 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005840}
5841
Bill Seurer703e8482015-06-09 14:39:47 +00005842static vector unsigned int __ATTRS_o_ai vec_vsl(vector unsigned int __a,
5843 vector unsigned char __b) {
5844 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
5845 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005846}
5847
Bill Seurer703e8482015-06-09 14:39:47 +00005848static vector unsigned int __ATTRS_o_ai vec_vsl(vector unsigned int __a,
5849 vector unsigned short __b) {
5850 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
5851 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005852}
5853
Bill Seurer703e8482015-06-09 14:39:47 +00005854static vector unsigned int __ATTRS_o_ai vec_vsl(vector unsigned int __a,
5855 vector unsigned int __b) {
5856 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
5857 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005858}
5859
Bill Seurer703e8482015-06-09 14:39:47 +00005860static vector bool int __ATTRS_o_ai vec_vsl(vector bool int __a,
5861 vector unsigned char __b) {
5862 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
5863 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005864}
5865
Bill Seurer703e8482015-06-09 14:39:47 +00005866static vector bool int __ATTRS_o_ai vec_vsl(vector bool int __a,
5867 vector unsigned short __b) {
5868 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
5869 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005870}
5871
Bill Seurer703e8482015-06-09 14:39:47 +00005872static vector bool int __ATTRS_o_ai vec_vsl(vector bool int __a,
5873 vector unsigned int __b) {
5874 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
5875 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005876}
5877
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005878/* vec_slo */
5879
Bill Seurer703e8482015-06-09 14:39:47 +00005880static vector signed char __ATTRS_o_ai vec_slo(vector signed char __a,
5881 vector signed char __b) {
5882 return (vector signed char)__builtin_altivec_vslo((vector int)__a,
5883 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005884}
5885
Bill Seurer703e8482015-06-09 14:39:47 +00005886static vector signed char __ATTRS_o_ai vec_slo(vector signed char __a,
5887 vector unsigned char __b) {
5888 return (vector signed char)__builtin_altivec_vslo((vector int)__a,
5889 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005890}
5891
Bill Seurer703e8482015-06-09 14:39:47 +00005892static vector unsigned char __ATTRS_o_ai vec_slo(vector unsigned char __a,
5893 vector signed char __b) {
5894 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
5895 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005896}
5897
Bill Seurer703e8482015-06-09 14:39:47 +00005898static vector unsigned char __ATTRS_o_ai vec_slo(vector unsigned char __a,
5899 vector unsigned char __b) {
5900 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
5901 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005902}
5903
Bill Seurer703e8482015-06-09 14:39:47 +00005904static vector short __ATTRS_o_ai vec_slo(vector short __a,
5905 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005906 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005907}
5908
Bill Seurer703e8482015-06-09 14:39:47 +00005909static vector short __ATTRS_o_ai vec_slo(vector short __a,
5910 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005911 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005912}
5913
Bill Seurer703e8482015-06-09 14:39:47 +00005914static vector unsigned short __ATTRS_o_ai vec_slo(vector unsigned short __a,
5915 vector signed char __b) {
5916 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
5917 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005918}
5919
Bill Seurer703e8482015-06-09 14:39:47 +00005920static vector unsigned short __ATTRS_o_ai vec_slo(vector unsigned short __a,
5921 vector unsigned char __b) {
5922 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
5923 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005924}
5925
Bill Seurer703e8482015-06-09 14:39:47 +00005926static vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
5927 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005928 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005929}
5930
Bill Seurer703e8482015-06-09 14:39:47 +00005931static vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
5932 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005933 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005934}
5935
Bill Seurer703e8482015-06-09 14:39:47 +00005936static vector int __ATTRS_o_ai vec_slo(vector int __a, vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005937 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005938}
5939
Bill Seurer703e8482015-06-09 14:39:47 +00005940static vector int __ATTRS_o_ai vec_slo(vector int __a,
5941 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005942 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005943}
5944
Bill Seurer703e8482015-06-09 14:39:47 +00005945static vector unsigned int __ATTRS_o_ai vec_slo(vector unsigned int __a,
5946 vector signed char __b) {
5947 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
5948 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005949}
5950
Bill Seurer703e8482015-06-09 14:39:47 +00005951static vector unsigned int __ATTRS_o_ai vec_slo(vector unsigned int __a,
5952 vector unsigned char __b) {
5953 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
5954 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005955}
5956
Bill Seurer703e8482015-06-09 14:39:47 +00005957static vector float __ATTRS_o_ai vec_slo(vector float __a,
5958 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005959 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005960}
5961
Bill Seurer703e8482015-06-09 14:39:47 +00005962static vector float __ATTRS_o_ai vec_slo(vector float __a,
5963 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005964 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005965}
5966
5967/* vec_vslo */
5968
Bill Seurer703e8482015-06-09 14:39:47 +00005969static vector signed char __ATTRS_o_ai vec_vslo(vector signed char __a,
5970 vector signed char __b) {
5971 return (vector signed char)__builtin_altivec_vslo((vector int)__a,
5972 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005973}
5974
Bill Seurer703e8482015-06-09 14:39:47 +00005975static vector signed char __ATTRS_o_ai vec_vslo(vector signed char __a,
5976 vector unsigned char __b) {
5977 return (vector signed char)__builtin_altivec_vslo((vector int)__a,
5978 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005979}
5980
Bill Seurer703e8482015-06-09 14:39:47 +00005981static vector unsigned char __ATTRS_o_ai vec_vslo(vector unsigned char __a,
5982 vector signed char __b) {
5983 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
5984 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005985}
5986
Bill Seurer703e8482015-06-09 14:39:47 +00005987static vector unsigned char __ATTRS_o_ai vec_vslo(vector unsigned char __a,
5988 vector unsigned char __b) {
5989 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
5990 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005991}
5992
Bill Seurer703e8482015-06-09 14:39:47 +00005993static vector short __ATTRS_o_ai vec_vslo(vector short __a,
5994 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00005995 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005996}
5997
Bill Seurer703e8482015-06-09 14:39:47 +00005998static vector short __ATTRS_o_ai vec_vslo(vector short __a,
5999 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006000 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006001}
6002
Bill Seurer703e8482015-06-09 14:39:47 +00006003static vector unsigned short __ATTRS_o_ai vec_vslo(vector unsigned short __a,
6004 vector signed char __b) {
6005 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
6006 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006007}
6008
Bill Seurer703e8482015-06-09 14:39:47 +00006009static vector unsigned short __ATTRS_o_ai vec_vslo(vector unsigned short __a,
6010 vector unsigned char __b) {
6011 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
6012 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006013}
6014
Bill Seurer703e8482015-06-09 14:39:47 +00006015static vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
6016 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006017 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006018}
6019
Bill Seurer703e8482015-06-09 14:39:47 +00006020static vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
6021 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006022 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006023}
6024
Bill Seurer703e8482015-06-09 14:39:47 +00006025static vector int __ATTRS_o_ai vec_vslo(vector int __a,
6026 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006027 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006028}
6029
Bill Seurer703e8482015-06-09 14:39:47 +00006030static vector int __ATTRS_o_ai vec_vslo(vector int __a,
6031 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006032 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006033}
6034
Bill Seurer703e8482015-06-09 14:39:47 +00006035static vector unsigned int __ATTRS_o_ai vec_vslo(vector unsigned int __a,
6036 vector signed char __b) {
6037 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
6038 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006039}
6040
Bill Seurer703e8482015-06-09 14:39:47 +00006041static vector unsigned int __ATTRS_o_ai vec_vslo(vector unsigned int __a,
6042 vector unsigned char __b) {
6043 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
6044 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006045}
6046
Bill Seurer703e8482015-06-09 14:39:47 +00006047static vector float __ATTRS_o_ai vec_vslo(vector float __a,
6048 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006049 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006050}
6051
Bill Seurer703e8482015-06-09 14:39:47 +00006052static vector float __ATTRS_o_ai vec_vslo(vector float __a,
6053 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006054 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006055}
6056
6057/* vec_splat */
6058
Bill Seurer703e8482015-06-09 14:39:47 +00006059static vector signed char __ATTRS_o_ai vec_splat(vector signed char __a,
6060 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006061 return vec_perm(__a, __a, (vector unsigned char)(__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_splat(vector unsigned char __a,
6065 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006066 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Yartsev9e968982010-08-19 03:00:09 +00006067}
6068
Bill Seurer703e8482015-06-09 14:39:47 +00006069static vector bool char __ATTRS_o_ai vec_splat(vector bool char __a,
6070 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006071 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006072}
6073
Bill Seurer703e8482015-06-09 14:39:47 +00006074static vector short __ATTRS_o_ai vec_splat(vector short __a,
6075 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006076 __b *= 2;
Bill Seurer703e8482015-06-09 14:39:47 +00006077 unsigned char b1 = __b + 1;
6078 return vec_perm(__a, __a,
6079 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
6080 __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006081}
6082
Bill Seurer703e8482015-06-09 14:39:47 +00006083static vector unsigned short __ATTRS_o_ai vec_splat(vector unsigned short __a,
6084 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006085 __b *= 2;
Bill Seurer703e8482015-06-09 14:39:47 +00006086 unsigned char b1 = __b + 1;
6087 return vec_perm(__a, __a,
6088 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
6089 __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00006090}
6091
Bill Seurer703e8482015-06-09 14:39:47 +00006092static vector bool short __ATTRS_o_ai vec_splat(vector bool short __a,
6093 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006094 __b *= 2;
Bill Seurer703e8482015-06-09 14:39:47 +00006095 unsigned char b1 = __b + 1;
6096 return vec_perm(__a, __a,
6097 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
6098 __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00006099}
6100
Bill Seurer703e8482015-06-09 14:39:47 +00006101static vector pixel __ATTRS_o_ai vec_splat(vector pixel __a,
6102 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006103 __b *= 2;
Bill Seurer703e8482015-06-09 14:39:47 +00006104 unsigned char b1 = __b + 1;
6105 return vec_perm(__a, __a,
6106 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
6107 __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006108}
6109
Bill Seurer703e8482015-06-09 14:39:47 +00006110static vector int __ATTRS_o_ai vec_splat(vector int __a, unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006111 __b *= 4;
Bill Seurer703e8482015-06-09 14:39:47 +00006112 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
6113 return vec_perm(__a, __a,
6114 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
6115 b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006116}
6117
Bill Seurer703e8482015-06-09 14:39:47 +00006118static vector unsigned int __ATTRS_o_ai vec_splat(vector unsigned int __a,
6119 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006120 __b *= 4;
Bill Seurer703e8482015-06-09 14:39:47 +00006121 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
6122 return vec_perm(__a, __a,
6123 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
6124 b1, b2, b3, __b, b1, b2, b3));
Anton Yartsev9e968982010-08-19 03:00:09 +00006125}
6126
Bill Seurer703e8482015-06-09 14:39:47 +00006127static vector bool int __ATTRS_o_ai vec_splat(vector bool int __a,
6128 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006129 __b *= 4;
Bill Seurer703e8482015-06-09 14:39:47 +00006130 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
6131 return vec_perm(__a, __a,
6132 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
6133 b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006134}
6135
Bill Seurer703e8482015-06-09 14:39:47 +00006136static vector float __ATTRS_o_ai vec_splat(vector float __a,
6137 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006138 __b *= 4;
Bill Seurer703e8482015-06-09 14:39:47 +00006139 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
6140 return vec_perm(__a, __a,
6141 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
6142 b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006143}
6144
6145/* vec_vspltb */
6146
6147#define __builtin_altivec_vspltb vec_vspltb
6148
Bill Seurer703e8482015-06-09 14:39:47 +00006149static vector signed char __ATTRS_o_ai vec_vspltb(vector signed char __a,
6150 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006151 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006152}
6153
Bill Seurer703e8482015-06-09 14:39:47 +00006154static vector unsigned char __ATTRS_o_ai vec_vspltb(vector unsigned char __a,
6155 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006156 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Yartsev9e968982010-08-19 03:00:09 +00006157}
6158
Bill Seurer703e8482015-06-09 14:39:47 +00006159static vector bool char __ATTRS_o_ai vec_vspltb(vector bool char __a,
6160 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006161 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006162}
6163
6164/* vec_vsplth */
6165
6166#define __builtin_altivec_vsplth vec_vsplth
6167
Bill Seurer703e8482015-06-09 14:39:47 +00006168static vector short __ATTRS_o_ai vec_vsplth(vector short __a,
6169 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006170 __b *= 2;
Bill Seurer703e8482015-06-09 14:39:47 +00006171 unsigned char b1 = __b + 1;
6172 return vec_perm(__a, __a,
6173 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
6174 __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006175}
6176
Bill Seurer703e8482015-06-09 14:39:47 +00006177static vector unsigned short __ATTRS_o_ai vec_vsplth(vector unsigned short __a,
6178 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006179 __b *= 2;
Bill Seurer703e8482015-06-09 14:39:47 +00006180 unsigned char b1 = __b + 1;
6181 return vec_perm(__a, __a,
6182 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
6183 __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00006184}
6185
Bill Seurer703e8482015-06-09 14:39:47 +00006186static vector bool short __ATTRS_o_ai vec_vsplth(vector bool short __a,
6187 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006188 __b *= 2;
Bill Seurer703e8482015-06-09 14:39:47 +00006189 unsigned char b1 = __b + 1;
6190 return vec_perm(__a, __a,
6191 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
6192 __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00006193}
6194
Bill Seurer703e8482015-06-09 14:39:47 +00006195static vector pixel __ATTRS_o_ai vec_vsplth(vector pixel __a,
6196 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006197 __b *= 2;
Bill Seurer703e8482015-06-09 14:39:47 +00006198 unsigned char b1 = __b + 1;
6199 return vec_perm(__a, __a,
6200 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
6201 __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006202}
6203
6204/* vec_vspltw */
6205
6206#define __builtin_altivec_vspltw vec_vspltw
6207
Bill Seurer703e8482015-06-09 14:39:47 +00006208static vector int __ATTRS_o_ai vec_vspltw(vector int __a, unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006209 __b *= 4;
Bill Seurer703e8482015-06-09 14:39:47 +00006210 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
6211 return vec_perm(__a, __a,
6212 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
6213 b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006214}
6215
Bill Seurer703e8482015-06-09 14:39:47 +00006216static vector unsigned int __ATTRS_o_ai vec_vspltw(vector unsigned int __a,
6217 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006218 __b *= 4;
Bill Seurer703e8482015-06-09 14:39:47 +00006219 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
6220 return vec_perm(__a, __a,
6221 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
6222 b1, b2, b3, __b, b1, b2, b3));
Anton Yartsev9e968982010-08-19 03:00:09 +00006223}
6224
Bill Seurer703e8482015-06-09 14:39:47 +00006225static vector bool int __ATTRS_o_ai vec_vspltw(vector bool int __a,
6226 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006227 __b *= 4;
Bill Seurer703e8482015-06-09 14:39:47 +00006228 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
6229 return vec_perm(__a, __a,
6230 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
6231 b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006232}
6233
Bill Seurer703e8482015-06-09 14:39:47 +00006234static vector float __ATTRS_o_ai vec_vspltw(vector float __a,
6235 unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006236 __b *= 4;
Bill Seurer703e8482015-06-09 14:39:47 +00006237 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
6238 return vec_perm(__a, __a,
6239 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
6240 b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006241}
6242
6243/* vec_splat_s8 */
6244
6245#define __builtin_altivec_vspltisb vec_splat_s8
6246
6247// FIXME: parameter should be treated as 5-bit signed literal
Bill Seurer703e8482015-06-09 14:39:47 +00006248static vector signed char __ATTRS_o_ai vec_splat_s8(signed char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006249 return (vector signed char)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006250}
6251
6252/* vec_vspltisb */
6253
6254// FIXME: parameter should be treated as 5-bit signed literal
Bill Seurer703e8482015-06-09 14:39:47 +00006255static vector signed char __ATTRS_o_ai vec_vspltisb(signed char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006256 return (vector signed char)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006257}
6258
6259/* vec_splat_s16 */
6260
6261#define __builtin_altivec_vspltish vec_splat_s16
6262
6263// FIXME: parameter should be treated as 5-bit signed literal
Bill Seurer703e8482015-06-09 14:39:47 +00006264static vector short __ATTRS_o_ai vec_splat_s16(signed char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006265 return (vector short)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006266}
6267
6268/* vec_vspltish */
6269
6270// FIXME: parameter should be treated as 5-bit signed literal
Bill Seurer703e8482015-06-09 14:39:47 +00006271static vector short __ATTRS_o_ai vec_vspltish(signed char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006272 return (vector short)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006273}
6274
6275/* vec_splat_s32 */
6276
6277#define __builtin_altivec_vspltisw vec_splat_s32
6278
6279// FIXME: parameter should be treated as 5-bit signed literal
Bill Seurer703e8482015-06-09 14:39:47 +00006280static vector int __ATTRS_o_ai vec_splat_s32(signed char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006281 return (vector int)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006282}
6283
6284/* vec_vspltisw */
6285
6286// FIXME: parameter should be treated as 5-bit signed literal
Bill Seurer703e8482015-06-09 14:39:47 +00006287static vector int __ATTRS_o_ai vec_vspltisw(signed char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006288 return (vector int)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006289}
6290
6291/* vec_splat_u8 */
6292
6293// FIXME: parameter should be treated as 5-bit signed literal
Bill Seurer703e8482015-06-09 14:39:47 +00006294static vector unsigned char __ATTRS_o_ai vec_splat_u8(unsigned char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006295 return (vector unsigned char)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006296}
6297
6298/* vec_splat_u16 */
6299
6300// FIXME: parameter should be treated as 5-bit signed literal
Bill Seurer703e8482015-06-09 14:39:47 +00006301static vector unsigned short __ATTRS_o_ai vec_splat_u16(signed char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006302 return (vector unsigned short)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006303}
6304
6305/* vec_splat_u32 */
6306
6307// FIXME: parameter should be treated as 5-bit signed literal
Bill Seurer703e8482015-06-09 14:39:47 +00006308static vector unsigned int __ATTRS_o_ai vec_splat_u32(signed char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006309 return (vector unsigned int)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006310}
6311
6312/* vec_sr */
6313
Bill Seurer703e8482015-06-09 14:39:47 +00006314static vector signed char __ATTRS_o_ai vec_sr(vector signed char __a,
6315 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006316 return __a >> (vector signed char)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006317}
6318
Bill Seurer703e8482015-06-09 14:39:47 +00006319static vector unsigned char __ATTRS_o_ai vec_sr(vector unsigned char __a,
6320 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006321 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006322}
6323
Bill Seurer703e8482015-06-09 14:39:47 +00006324static vector short __ATTRS_o_ai vec_sr(vector short __a,
6325 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006326 return __a >> (vector short)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006327}
6328
Bill Seurer703e8482015-06-09 14:39:47 +00006329static vector unsigned short __ATTRS_o_ai vec_sr(vector unsigned short __a,
6330 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006331 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006332}
6333
Bill Seurer703e8482015-06-09 14:39:47 +00006334static vector int __ATTRS_o_ai vec_sr(vector int __a, vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006335 return __a >> (vector int)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006336}
6337
Bill Seurer703e8482015-06-09 14:39:47 +00006338static vector unsigned int __ATTRS_o_ai vec_sr(vector unsigned int __a,
6339 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006340 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006341}
6342
Kit Barton8553bec2015-03-11 15:57:19 +00006343#ifdef __POWER8_VECTOR__
6344static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00006345vec_sr(vector signed long long __a, vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00006346 return __a >> (vector long long)__b;
6347}
6348
6349static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00006350vec_sr(vector unsigned long long __a, vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00006351 return __a >> __b;
6352}
6353#endif
6354
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006355/* vec_vsrb */
6356
6357#define __builtin_altivec_vsrb vec_vsrb
6358
Bill Seurer703e8482015-06-09 14:39:47 +00006359static vector signed char __ATTRS_o_ai vec_vsrb(vector signed char __a,
6360 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006361 return __a >> (vector signed char)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006362}
6363
Bill Seurer703e8482015-06-09 14:39:47 +00006364static vector unsigned char __ATTRS_o_ai vec_vsrb(vector unsigned char __a,
6365 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006366 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006367}
6368
6369/* vec_vsrh */
6370
6371#define __builtin_altivec_vsrh vec_vsrh
6372
Bill Seurer703e8482015-06-09 14:39:47 +00006373static vector short __ATTRS_o_ai vec_vsrh(vector short __a,
6374 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006375 return __a >> (vector short)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006376}
6377
Bill Seurer703e8482015-06-09 14:39:47 +00006378static vector unsigned short __ATTRS_o_ai vec_vsrh(vector unsigned short __a,
6379 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006380 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006381}
6382
6383/* vec_vsrw */
6384
6385#define __builtin_altivec_vsrw vec_vsrw
6386
Bill Seurer703e8482015-06-09 14:39:47 +00006387static vector int __ATTRS_o_ai vec_vsrw(vector int __a,
6388 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006389 return __a >> (vector int)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006390}
6391
Bill Seurer703e8482015-06-09 14:39:47 +00006392static vector unsigned int __ATTRS_o_ai vec_vsrw(vector unsigned int __a,
6393 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006394 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006395}
6396
6397/* vec_sra */
6398
Bill Seurer703e8482015-06-09 14:39:47 +00006399static vector signed char __ATTRS_o_ai vec_sra(vector signed char __a,
6400 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006401 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006402}
6403
Bill Seurer703e8482015-06-09 14:39:47 +00006404static vector unsigned char __ATTRS_o_ai vec_sra(vector unsigned char __a,
6405 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006406 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006407}
6408
Bill Seurer703e8482015-06-09 14:39:47 +00006409static vector short __ATTRS_o_ai vec_sra(vector short __a,
6410 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006411 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006412}
6413
Bill Seurer703e8482015-06-09 14:39:47 +00006414static vector unsigned short __ATTRS_o_ai vec_sra(vector unsigned short __a,
6415 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006416 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006417}
6418
Bill Seurer703e8482015-06-09 14:39:47 +00006419static vector int __ATTRS_o_ai vec_sra(vector int __a,
6420 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006421 return __builtin_altivec_vsraw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006422}
6423
Bill Seurer703e8482015-06-09 14:39:47 +00006424static vector unsigned int __ATTRS_o_ai vec_sra(vector unsigned int __a,
6425 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006426 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006427}
6428
Kit Barton8553bec2015-03-11 15:57:19 +00006429#ifdef __POWER8_VECTOR__
6430static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00006431vec_sra(vector signed long long __a, vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +00006432 return __a >> __b;
6433}
6434
6435static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00006436vec_sra(vector unsigned long long __a, vector unsigned long long __b) {
6437 return (vector unsigned long long)((vector signed long long)__a >> __b);
Kit Barton8553bec2015-03-11 15:57:19 +00006438}
6439#endif
6440
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006441/* vec_vsrab */
6442
Bill Seurer703e8482015-06-09 14:39:47 +00006443static vector signed char __ATTRS_o_ai vec_vsrab(vector signed char __a,
6444 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006445 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006446}
6447
Bill Seurer703e8482015-06-09 14:39:47 +00006448static vector unsigned char __ATTRS_o_ai vec_vsrab(vector unsigned char __a,
6449 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006450 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006451}
6452
6453/* vec_vsrah */
6454
Bill Seurer703e8482015-06-09 14:39:47 +00006455static vector short __ATTRS_o_ai vec_vsrah(vector short __a,
6456 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006457 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006458}
6459
Bill Seurer703e8482015-06-09 14:39:47 +00006460static vector unsigned short __ATTRS_o_ai vec_vsrah(vector unsigned short __a,
6461 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006462 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006463}
6464
6465/* vec_vsraw */
6466
Bill Seurer703e8482015-06-09 14:39:47 +00006467static vector int __ATTRS_o_ai vec_vsraw(vector int __a,
6468 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006469 return __builtin_altivec_vsraw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006470}
6471
Bill Seurer703e8482015-06-09 14:39:47 +00006472static vector unsigned int __ATTRS_o_ai vec_vsraw(vector unsigned int __a,
6473 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006474 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006475}
6476
6477/* vec_srl */
6478
Bill Seurer703e8482015-06-09 14:39:47 +00006479static vector signed char __ATTRS_o_ai vec_srl(vector signed char __a,
6480 vector unsigned char __b) {
6481 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
6482 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006483}
6484
Bill Seurer703e8482015-06-09 14:39:47 +00006485static vector signed char __ATTRS_o_ai vec_srl(vector signed char __a,
6486 vector unsigned short __b) {
6487 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
6488 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006489}
6490
Bill Seurer703e8482015-06-09 14:39:47 +00006491static vector signed char __ATTRS_o_ai vec_srl(vector signed char __a,
6492 vector unsigned int __b) {
6493 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
6494 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006495}
6496
Bill Seurer703e8482015-06-09 14:39:47 +00006497static vector unsigned char __ATTRS_o_ai vec_srl(vector unsigned char __a,
6498 vector unsigned char __b) {
6499 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
6500 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006501}
6502
Bill Seurer703e8482015-06-09 14:39:47 +00006503static vector unsigned char __ATTRS_o_ai vec_srl(vector unsigned char __a,
6504 vector unsigned short __b) {
6505 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
6506 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006507}
6508
Bill Seurer703e8482015-06-09 14:39:47 +00006509static vector unsigned char __ATTRS_o_ai vec_srl(vector unsigned char __a,
6510 vector unsigned int __b) {
6511 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
6512 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006513}
6514
Bill Seurer703e8482015-06-09 14:39:47 +00006515static vector bool char __ATTRS_o_ai vec_srl(vector bool char __a,
6516 vector unsigned char __b) {
6517 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
6518 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006519}
6520
Bill Seurer703e8482015-06-09 14:39:47 +00006521static vector bool char __ATTRS_o_ai vec_srl(vector bool char __a,
6522 vector unsigned short __b) {
6523 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
6524 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006525}
6526
Bill Seurer703e8482015-06-09 14:39:47 +00006527static vector bool char __ATTRS_o_ai vec_srl(vector bool char __a,
6528 vector unsigned int __b) {
6529 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
6530 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006531}
6532
Bill Seurer703e8482015-06-09 14:39:47 +00006533static vector short __ATTRS_o_ai vec_srl(vector short __a,
6534 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006535 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006536}
6537
Bill Seurer703e8482015-06-09 14:39:47 +00006538static vector short __ATTRS_o_ai vec_srl(vector short __a,
6539 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006540 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006541}
6542
Bill Seurer703e8482015-06-09 14:39:47 +00006543static vector short __ATTRS_o_ai vec_srl(vector short __a,
6544 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006545 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006546}
6547
Bill Seurer703e8482015-06-09 14:39:47 +00006548static vector unsigned short __ATTRS_o_ai vec_srl(vector unsigned short __a,
6549 vector unsigned char __b) {
6550 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
6551 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006552}
6553
Bill Seurer703e8482015-06-09 14:39:47 +00006554static vector unsigned short __ATTRS_o_ai vec_srl(vector unsigned short __a,
6555 vector unsigned short __b) {
6556 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
6557 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006558}
6559
Bill Seurer703e8482015-06-09 14:39:47 +00006560static vector unsigned short __ATTRS_o_ai vec_srl(vector unsigned short __a,
6561 vector unsigned int __b) {
6562 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
6563 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006564}
6565
Bill Seurer703e8482015-06-09 14:39:47 +00006566static vector bool short __ATTRS_o_ai vec_srl(vector bool short __a,
6567 vector unsigned char __b) {
6568 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
6569 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006570}
6571
Bill Seurer703e8482015-06-09 14:39:47 +00006572static vector bool short __ATTRS_o_ai vec_srl(vector bool short __a,
6573 vector unsigned short __b) {
6574 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
6575 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006576}
6577
Bill Seurer703e8482015-06-09 14:39:47 +00006578static vector bool short __ATTRS_o_ai vec_srl(vector bool short __a,
6579 vector unsigned int __b) {
6580 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
6581 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006582}
6583
Bill Seurer703e8482015-06-09 14:39:47 +00006584static vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
6585 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006586 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006587}
6588
Bill Seurer703e8482015-06-09 14:39:47 +00006589static vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
6590 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006591 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006592}
6593
Bill Seurer703e8482015-06-09 14:39:47 +00006594static vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
6595 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006596 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006597}
6598
Bill Seurer703e8482015-06-09 14:39:47 +00006599static vector int __ATTRS_o_ai vec_srl(vector int __a,
6600 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006601 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006602}
6603
Bill Seurer703e8482015-06-09 14:39:47 +00006604static vector int __ATTRS_o_ai vec_srl(vector int __a,
6605 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006606 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006607}
6608
Bill Seurer703e8482015-06-09 14:39:47 +00006609static vector int __ATTRS_o_ai vec_srl(vector int __a,
6610 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006611 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006612}
6613
Bill Seurer703e8482015-06-09 14:39:47 +00006614static vector unsigned int __ATTRS_o_ai vec_srl(vector unsigned int __a,
6615 vector unsigned char __b) {
6616 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
6617 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006618}
6619
Bill Seurer703e8482015-06-09 14:39:47 +00006620static vector unsigned int __ATTRS_o_ai vec_srl(vector unsigned int __a,
6621 vector unsigned short __b) {
6622 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
6623 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006624}
6625
Bill Seurer703e8482015-06-09 14:39:47 +00006626static vector unsigned int __ATTRS_o_ai vec_srl(vector unsigned int __a,
6627 vector unsigned int __b) {
6628 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
6629 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006630}
6631
Bill Seurer703e8482015-06-09 14:39:47 +00006632static vector bool int __ATTRS_o_ai vec_srl(vector bool int __a,
6633 vector unsigned char __b) {
6634 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
6635 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006636}
6637
Bill Seurer703e8482015-06-09 14:39:47 +00006638static vector bool int __ATTRS_o_ai vec_srl(vector bool int __a,
6639 vector unsigned short __b) {
6640 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
6641 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006642}
6643
Bill Seurer703e8482015-06-09 14:39:47 +00006644static vector bool int __ATTRS_o_ai vec_srl(vector bool int __a,
6645 vector unsigned int __b) {
6646 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
6647 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006648}
6649
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006650/* vec_vsr */
6651
Bill Seurer703e8482015-06-09 14:39:47 +00006652static vector signed char __ATTRS_o_ai vec_vsr(vector signed char __a,
6653 vector unsigned char __b) {
6654 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
6655 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006656}
6657
Bill Seurer703e8482015-06-09 14:39:47 +00006658static vector signed char __ATTRS_o_ai vec_vsr(vector signed char __a,
6659 vector unsigned short __b) {
6660 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
6661 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006662}
6663
Bill Seurer703e8482015-06-09 14:39:47 +00006664static vector signed char __ATTRS_o_ai vec_vsr(vector signed char __a,
6665 vector unsigned int __b) {
6666 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
6667 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006668}
6669
Bill Seurer703e8482015-06-09 14:39:47 +00006670static vector unsigned char __ATTRS_o_ai vec_vsr(vector unsigned char __a,
6671 vector unsigned char __b) {
6672 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
6673 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006674}
6675
Bill Seurer703e8482015-06-09 14:39:47 +00006676static vector unsigned char __ATTRS_o_ai vec_vsr(vector unsigned char __a,
6677 vector unsigned short __b) {
6678 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
6679 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006680}
6681
Bill Seurer703e8482015-06-09 14:39:47 +00006682static vector unsigned char __ATTRS_o_ai vec_vsr(vector unsigned char __a,
6683 vector unsigned int __b) {
6684 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
6685 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006686}
6687
Bill Seurer703e8482015-06-09 14:39:47 +00006688static vector bool char __ATTRS_o_ai vec_vsr(vector bool char __a,
6689 vector unsigned char __b) {
6690 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
6691 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006692}
6693
Bill Seurer703e8482015-06-09 14:39:47 +00006694static vector bool char __ATTRS_o_ai vec_vsr(vector bool char __a,
6695 vector unsigned short __b) {
6696 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
6697 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006698}
6699
Bill Seurer703e8482015-06-09 14:39:47 +00006700static vector bool char __ATTRS_o_ai vec_vsr(vector bool char __a,
6701 vector unsigned int __b) {
6702 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
6703 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006704}
6705
Bill Seurer703e8482015-06-09 14:39:47 +00006706static vector short __ATTRS_o_ai vec_vsr(vector short __a,
6707 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006708 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006709}
6710
Bill Seurer703e8482015-06-09 14:39:47 +00006711static vector short __ATTRS_o_ai vec_vsr(vector short __a,
6712 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006713 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006714}
6715
Bill Seurer703e8482015-06-09 14:39:47 +00006716static vector short __ATTRS_o_ai vec_vsr(vector short __a,
6717 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006718 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006719}
6720
Bill Seurer703e8482015-06-09 14:39:47 +00006721static vector unsigned short __ATTRS_o_ai vec_vsr(vector unsigned short __a,
6722 vector unsigned char __b) {
6723 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
6724 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006725}
6726
Bill Seurer703e8482015-06-09 14:39:47 +00006727static vector unsigned short __ATTRS_o_ai vec_vsr(vector unsigned short __a,
6728 vector unsigned short __b) {
6729 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
6730 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006731}
6732
Bill Seurer703e8482015-06-09 14:39:47 +00006733static vector unsigned short __ATTRS_o_ai vec_vsr(vector unsigned short __a,
6734 vector unsigned int __b) {
6735 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
6736 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006737}
6738
Bill Seurer703e8482015-06-09 14:39:47 +00006739static vector bool short __ATTRS_o_ai vec_vsr(vector bool short __a,
6740 vector unsigned char __b) {
6741 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
6742 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006743}
6744
Bill Seurer703e8482015-06-09 14:39:47 +00006745static vector bool short __ATTRS_o_ai vec_vsr(vector bool short __a,
6746 vector unsigned short __b) {
6747 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
6748 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006749}
6750
Bill Seurer703e8482015-06-09 14:39:47 +00006751static vector bool short __ATTRS_o_ai vec_vsr(vector bool short __a,
6752 vector unsigned int __b) {
6753 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
6754 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006755}
6756
Bill Seurer703e8482015-06-09 14:39:47 +00006757static vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
6758 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006759 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006760}
6761
Bill Seurer703e8482015-06-09 14:39:47 +00006762static vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
6763 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006764 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006765}
6766
Bill Seurer703e8482015-06-09 14:39:47 +00006767static vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
6768 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006769 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006770}
6771
Bill Seurer703e8482015-06-09 14:39:47 +00006772static vector int __ATTRS_o_ai vec_vsr(vector int __a,
6773 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006774 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006775}
6776
Bill Seurer703e8482015-06-09 14:39:47 +00006777static vector int __ATTRS_o_ai vec_vsr(vector int __a,
6778 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006779 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006780}
6781
Bill Seurer703e8482015-06-09 14:39:47 +00006782static vector int __ATTRS_o_ai vec_vsr(vector int __a,
6783 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006784 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006785}
6786
Bill Seurer703e8482015-06-09 14:39:47 +00006787static vector unsigned int __ATTRS_o_ai vec_vsr(vector unsigned int __a,
6788 vector unsigned char __b) {
6789 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
6790 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006791}
6792
Bill Seurer703e8482015-06-09 14:39:47 +00006793static vector unsigned int __ATTRS_o_ai vec_vsr(vector unsigned int __a,
6794 vector unsigned short __b) {
6795 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
6796 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006797}
6798
Bill Seurer703e8482015-06-09 14:39:47 +00006799static vector unsigned int __ATTRS_o_ai vec_vsr(vector unsigned int __a,
6800 vector unsigned int __b) {
6801 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
6802 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006803}
6804
Bill Seurer703e8482015-06-09 14:39:47 +00006805static vector bool int __ATTRS_o_ai vec_vsr(vector bool int __a,
6806 vector unsigned char __b) {
6807 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
6808 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006809}
6810
Bill Seurer703e8482015-06-09 14:39:47 +00006811static vector bool int __ATTRS_o_ai vec_vsr(vector bool int __a,
6812 vector unsigned short __b) {
6813 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
6814 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006815}
6816
Bill Seurer703e8482015-06-09 14:39:47 +00006817static vector bool int __ATTRS_o_ai vec_vsr(vector bool int __a,
6818 vector unsigned int __b) {
6819 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
6820 (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006821}
6822
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006823/* vec_sro */
6824
Bill Seurer703e8482015-06-09 14:39:47 +00006825static vector signed char __ATTRS_o_ai vec_sro(vector signed char __a,
6826 vector signed char __b) {
6827 return (vector signed char)__builtin_altivec_vsro((vector int)__a,
6828 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006829}
6830
Bill Seurer703e8482015-06-09 14:39:47 +00006831static vector signed char __ATTRS_o_ai vec_sro(vector signed char __a,
6832 vector unsigned char __b) {
6833 return (vector signed char)__builtin_altivec_vsro((vector int)__a,
6834 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006835}
6836
Bill Seurer703e8482015-06-09 14:39:47 +00006837static vector unsigned char __ATTRS_o_ai vec_sro(vector unsigned char __a,
6838 vector signed char __b) {
6839 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
6840 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006841}
6842
Bill Seurer703e8482015-06-09 14:39:47 +00006843static vector unsigned char __ATTRS_o_ai vec_sro(vector unsigned char __a,
6844 vector unsigned char __b) {
6845 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
6846 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006847}
6848
Bill Seurer703e8482015-06-09 14:39:47 +00006849static vector short __ATTRS_o_ai vec_sro(vector short __a,
6850 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006851 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006852}
6853
Bill Seurer703e8482015-06-09 14:39:47 +00006854static vector short __ATTRS_o_ai vec_sro(vector short __a,
6855 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006856 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006857}
6858
Bill Seurer703e8482015-06-09 14:39:47 +00006859static vector unsigned short __ATTRS_o_ai vec_sro(vector unsigned short __a,
6860 vector signed char __b) {
6861 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
6862 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006863}
6864
Bill Seurer703e8482015-06-09 14:39:47 +00006865static vector unsigned short __ATTRS_o_ai vec_sro(vector unsigned short __a,
6866 vector unsigned char __b) {
6867 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
6868 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006869}
6870
Bill Seurer703e8482015-06-09 14:39:47 +00006871static vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
6872 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006873 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006874}
6875
Bill Seurer703e8482015-06-09 14:39:47 +00006876static vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
6877 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006878 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006879}
6880
Bill Seurer703e8482015-06-09 14:39:47 +00006881static vector int __ATTRS_o_ai vec_sro(vector int __a, vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006882 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006883}
6884
Bill Seurer703e8482015-06-09 14:39:47 +00006885static vector int __ATTRS_o_ai vec_sro(vector int __a,
6886 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006887 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006888}
6889
Bill Seurer703e8482015-06-09 14:39:47 +00006890static vector unsigned int __ATTRS_o_ai vec_sro(vector unsigned int __a,
6891 vector signed char __b) {
6892 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
6893 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006894}
6895
Bill Seurer703e8482015-06-09 14:39:47 +00006896static vector unsigned int __ATTRS_o_ai vec_sro(vector unsigned int __a,
6897 vector unsigned char __b) {
6898 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
6899 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006900}
6901
Bill Seurer703e8482015-06-09 14:39:47 +00006902static vector float __ATTRS_o_ai vec_sro(vector float __a,
6903 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006904 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006905}
6906
Bill Seurer703e8482015-06-09 14:39:47 +00006907static vector float __ATTRS_o_ai vec_sro(vector float __a,
6908 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006909 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006910}
6911
6912/* vec_vsro */
6913
Bill Seurer703e8482015-06-09 14:39:47 +00006914static vector signed char __ATTRS_o_ai vec_vsro(vector signed char __a,
6915 vector signed char __b) {
6916 return (vector signed char)__builtin_altivec_vsro((vector int)__a,
6917 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006918}
6919
Bill Seurer703e8482015-06-09 14:39:47 +00006920static vector signed char __ATTRS_o_ai vec_vsro(vector signed char __a,
6921 vector unsigned char __b) {
6922 return (vector signed char)__builtin_altivec_vsro((vector int)__a,
6923 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006924}
6925
Bill Seurer703e8482015-06-09 14:39:47 +00006926static vector unsigned char __ATTRS_o_ai vec_vsro(vector unsigned char __a,
6927 vector signed char __b) {
6928 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
6929 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006930}
6931
Bill Seurer703e8482015-06-09 14:39:47 +00006932static vector unsigned char __ATTRS_o_ai vec_vsro(vector unsigned char __a,
6933 vector unsigned char __b) {
6934 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
6935 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006936}
6937
Bill Seurer703e8482015-06-09 14:39:47 +00006938static vector short __ATTRS_o_ai vec_vsro(vector short __a,
6939 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006940 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006941}
6942
Bill Seurer703e8482015-06-09 14:39:47 +00006943static vector short __ATTRS_o_ai vec_vsro(vector short __a,
6944 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006945 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006946}
6947
Bill Seurer703e8482015-06-09 14:39:47 +00006948static vector unsigned short __ATTRS_o_ai vec_vsro(vector unsigned short __a,
6949 vector signed char __b) {
6950 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
6951 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006952}
6953
Bill Seurer703e8482015-06-09 14:39:47 +00006954static vector unsigned short __ATTRS_o_ai vec_vsro(vector unsigned short __a,
6955 vector unsigned char __b) {
6956 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
6957 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006958}
6959
Bill Seurer703e8482015-06-09 14:39:47 +00006960static vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
6961 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006962 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006963}
6964
Bill Seurer703e8482015-06-09 14:39:47 +00006965static vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
6966 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006967 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006968}
6969
Bill Seurer703e8482015-06-09 14:39:47 +00006970static vector int __ATTRS_o_ai vec_vsro(vector int __a,
6971 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006972 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006973}
6974
Bill Seurer703e8482015-06-09 14:39:47 +00006975static vector int __ATTRS_o_ai vec_vsro(vector int __a,
6976 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006977 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006978}
6979
Bill Seurer703e8482015-06-09 14:39:47 +00006980static vector unsigned int __ATTRS_o_ai vec_vsro(vector unsigned int __a,
6981 vector signed char __b) {
6982 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
6983 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006984}
6985
Bill Seurer703e8482015-06-09 14:39:47 +00006986static vector unsigned int __ATTRS_o_ai vec_vsro(vector unsigned int __a,
6987 vector unsigned char __b) {
6988 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
6989 (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006990}
6991
Bill Seurer703e8482015-06-09 14:39:47 +00006992static vector float __ATTRS_o_ai vec_vsro(vector float __a,
6993 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006994 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006995}
6996
Bill Seurer703e8482015-06-09 14:39:47 +00006997static vector float __ATTRS_o_ai vec_vsro(vector float __a,
6998 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00006999 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007000}
7001
7002/* vec_st */
7003
Bill Seurer703e8482015-06-09 14:39:47 +00007004static void __ATTRS_o_ai vec_st(vector signed char __a, int __b,
7005 vector signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007006 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007007}
7008
Bill Seurer703e8482015-06-09 14:39:47 +00007009static void __ATTRS_o_ai vec_st(vector signed char __a, int __b,
7010 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007011 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007012}
7013
Bill Seurer703e8482015-06-09 14:39:47 +00007014static void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b,
7015 vector unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007016 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007017}
7018
Bill Seurer703e8482015-06-09 14:39:47 +00007019static void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b,
7020 unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007021 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007022}
7023
Bill Seurer703e8482015-06-09 14:39:47 +00007024static void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
7025 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007026 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007027}
7028
Bill Seurer703e8482015-06-09 14:39:47 +00007029static void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
7030 unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007031 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007032}
7033
Bill Seurer703e8482015-06-09 14:39:47 +00007034static void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
7035 vector bool char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007036 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007037}
7038
Bill Seurer703e8482015-06-09 14:39:47 +00007039static void __ATTRS_o_ai vec_st(vector short __a, int __b, vector short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007040 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007041}
7042
Bill Seurer703e8482015-06-09 14:39:47 +00007043static void __ATTRS_o_ai vec_st(vector short __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007044 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007045}
7046
Bill Seurer703e8482015-06-09 14:39:47 +00007047static void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b,
7048 vector unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007049 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007050}
7051
Bill Seurer703e8482015-06-09 14:39:47 +00007052static void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b,
7053 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007054 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007055}
7056
Bill Seurer703e8482015-06-09 14:39:47 +00007057static void __ATTRS_o_ai vec_st(vector bool short __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007058 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007059}
7060
Bill Seurer703e8482015-06-09 14:39:47 +00007061static void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
7062 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007063 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007064}
7065
Bill Seurer703e8482015-06-09 14:39:47 +00007066static void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
7067 vector bool short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007068 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007069}
7070
Bill Seurer703e8482015-06-09 14:39:47 +00007071static void __ATTRS_o_ai vec_st(vector pixel __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007072 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007073}
7074
Bill Seurer703e8482015-06-09 14:39:47 +00007075static void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
7076 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007077 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007078}
7079
Bill Seurer703e8482015-06-09 14:39:47 +00007080static void __ATTRS_o_ai vec_st(vector pixel __a, int __b, vector pixel *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007081 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007082}
7083
Bill Seurer703e8482015-06-09 14:39:47 +00007084static void __ATTRS_o_ai vec_st(vector int __a, int __b, vector int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007085 __builtin_altivec_stvx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007086}
7087
Bill Seurer703e8482015-06-09 14:39:47 +00007088static void __ATTRS_o_ai vec_st(vector int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007089 __builtin_altivec_stvx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007090}
7091
Bill Seurer703e8482015-06-09 14:39:47 +00007092static void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b,
7093 vector unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007094 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007095}
7096
Bill Seurer703e8482015-06-09 14:39:47 +00007097static void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b,
7098 unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007099 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007100}
7101
Bill Seurer703e8482015-06-09 14:39:47 +00007102static void __ATTRS_o_ai vec_st(vector bool int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007103 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007104}
7105
Bill Seurer703e8482015-06-09 14:39:47 +00007106static void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
7107 unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007108 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007109}
7110
Bill Seurer703e8482015-06-09 14:39:47 +00007111static void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
7112 vector bool int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007113 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007114}
7115
Bill Seurer703e8482015-06-09 14:39:47 +00007116static void __ATTRS_o_ai vec_st(vector float __a, int __b, vector float *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007117 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007118}
7119
Bill Seurer703e8482015-06-09 14:39:47 +00007120static void __ATTRS_o_ai vec_st(vector float __a, int __b, float *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007121 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007122}
7123
7124/* vec_stvx */
7125
Bill Seurer703e8482015-06-09 14:39:47 +00007126static void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b,
7127 vector signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007128 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007129}
7130
Bill Seurer703e8482015-06-09 14:39:47 +00007131static void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b,
7132 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007133 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007134}
7135
Bill Seurer703e8482015-06-09 14:39:47 +00007136static void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b,
7137 vector unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007138 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007139}
7140
Bill Seurer703e8482015-06-09 14:39:47 +00007141static void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b,
7142 unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007143 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007144}
7145
Bill Seurer703e8482015-06-09 14:39:47 +00007146static void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
7147 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007148 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007149}
7150
Bill Seurer703e8482015-06-09 14:39:47 +00007151static void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
7152 unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007153 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007154}
7155
Bill Seurer703e8482015-06-09 14:39:47 +00007156static void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
7157 vector bool char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007158 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007159}
7160
Bill Seurer703e8482015-06-09 14:39:47 +00007161static void __ATTRS_o_ai vec_stvx(vector short __a, int __b,
7162 vector short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007163 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007164}
7165
Bill Seurer703e8482015-06-09 14:39:47 +00007166static void __ATTRS_o_ai vec_stvx(vector short __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007167 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007168}
7169
Bill Seurer703e8482015-06-09 14:39:47 +00007170static void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b,
7171 vector unsigned short *__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_stvx(vector unsigned short __a, int __b,
7176 unsigned short *__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_stvx(vector bool short __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007181 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007182}
7183
Bill Seurer703e8482015-06-09 14:39:47 +00007184static void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
7185 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007186 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007187}
7188
Bill Seurer703e8482015-06-09 14:39:47 +00007189static void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
7190 vector bool short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007191 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007192}
7193
Bill Seurer703e8482015-06-09 14:39:47 +00007194static void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007195 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007196}
7197
Bill Seurer703e8482015-06-09 14:39:47 +00007198static void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
7199 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007200 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007201}
7202
Bill Seurer703e8482015-06-09 14:39:47 +00007203static void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
7204 vector pixel *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007205 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007206}
7207
Bill Seurer703e8482015-06-09 14:39:47 +00007208static void __ATTRS_o_ai vec_stvx(vector int __a, int __b, vector int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007209 __builtin_altivec_stvx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007210}
7211
Bill Seurer703e8482015-06-09 14:39:47 +00007212static void __ATTRS_o_ai vec_stvx(vector int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007213 __builtin_altivec_stvx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007214}
7215
Bill Seurer703e8482015-06-09 14:39:47 +00007216static void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b,
7217 vector unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007218 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007219}
7220
Bill Seurer703e8482015-06-09 14:39:47 +00007221static void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b,
7222 unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007223 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007224}
7225
Bill Seurer703e8482015-06-09 14:39:47 +00007226static void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007227 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007228}
7229
Bill Seurer703e8482015-06-09 14:39:47 +00007230static void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
7231 unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007232 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007233}
7234
Bill Seurer703e8482015-06-09 14:39:47 +00007235static void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
7236 vector bool int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007237 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007238}
7239
Bill Seurer703e8482015-06-09 14:39:47 +00007240static void __ATTRS_o_ai vec_stvx(vector float __a, int __b,
7241 vector float *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007242 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007243}
7244
Bill Seurer703e8482015-06-09 14:39:47 +00007245static void __ATTRS_o_ai vec_stvx(vector float __a, int __b, float *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007246 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007247}
7248
7249/* vec_ste */
7250
Bill Seurer703e8482015-06-09 14:39:47 +00007251static void __ATTRS_o_ai vec_ste(vector signed char __a, int __b,
7252 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007253 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007254}
7255
Bill Seurer703e8482015-06-09 14:39:47 +00007256static void __ATTRS_o_ai vec_ste(vector unsigned char __a, int __b,
7257 unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007258 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007259}
7260
Bill Seurer703e8482015-06-09 14:39:47 +00007261static void __ATTRS_o_ai vec_ste(vector bool char __a, int __b,
7262 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007263 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007264}
7265
Bill Seurer703e8482015-06-09 14:39:47 +00007266static void __ATTRS_o_ai vec_ste(vector bool char __a, int __b,
7267 unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007268 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007269}
7270
Bill Seurer703e8482015-06-09 14:39:47 +00007271static void __ATTRS_o_ai vec_ste(vector short __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007272 __builtin_altivec_stvehx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007273}
7274
Bill Seurer703e8482015-06-09 14:39:47 +00007275static void __ATTRS_o_ai vec_ste(vector unsigned short __a, int __b,
7276 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007277 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007278}
7279
Bill Seurer703e8482015-06-09 14:39:47 +00007280static void __ATTRS_o_ai vec_ste(vector bool short __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007281 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007282}
7283
Bill Seurer703e8482015-06-09 14:39:47 +00007284static void __ATTRS_o_ai vec_ste(vector bool short __a, int __b,
7285 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007286 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007287}
7288
Bill Seurer703e8482015-06-09 14:39:47 +00007289static void __ATTRS_o_ai vec_ste(vector pixel __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007290 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007291}
7292
Bill Seurer703e8482015-06-09 14:39:47 +00007293static void __ATTRS_o_ai vec_ste(vector pixel __a, int __b,
7294 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007295 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007296}
7297
Bill Seurer703e8482015-06-09 14:39:47 +00007298static void __ATTRS_o_ai vec_ste(vector int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007299 __builtin_altivec_stvewx(__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_ste(vector unsigned int __a, int __b,
7303 unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007304 __builtin_altivec_stvewx((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_ste(vector bool int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007308 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007309}
7310
Bill Seurer703e8482015-06-09 14:39:47 +00007311static void __ATTRS_o_ai vec_ste(vector bool int __a, int __b,
7312 unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007313 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007314}
7315
Bill Seurer703e8482015-06-09 14:39:47 +00007316static void __ATTRS_o_ai vec_ste(vector float __a, int __b, float *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007317 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007318}
7319
7320/* vec_stvebx */
7321
Bill Seurer703e8482015-06-09 14:39:47 +00007322static void __ATTRS_o_ai vec_stvebx(vector signed char __a, int __b,
7323 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007324 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007325}
7326
Bill Seurer703e8482015-06-09 14:39:47 +00007327static void __ATTRS_o_ai vec_stvebx(vector unsigned char __a, int __b,
7328 unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007329 __builtin_altivec_stvebx((vector char)__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_stvebx(vector bool char __a, int __b,
7333 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007334 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007335}
7336
Bill Seurer703e8482015-06-09 14:39:47 +00007337static void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b,
7338 unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007339 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007340}
7341
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007342/* vec_stvehx */
7343
Bill Seurer703e8482015-06-09 14:39:47 +00007344static void __ATTRS_o_ai vec_stvehx(vector short __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007345 __builtin_altivec_stvehx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007346}
7347
Bill Seurer703e8482015-06-09 14:39:47 +00007348static void __ATTRS_o_ai vec_stvehx(vector unsigned short __a, int __b,
7349 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007350 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007351}
7352
Bill Seurer703e8482015-06-09 14:39:47 +00007353static void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b,
7354 short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007355 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007356}
7357
Bill Seurer703e8482015-06-09 14:39:47 +00007358static void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b,
7359 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007360 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007361}
7362
Bill Seurer703e8482015-06-09 14:39:47 +00007363static void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007364 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007365}
7366
Bill Seurer703e8482015-06-09 14:39:47 +00007367static void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b,
7368 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007369 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007370}
7371
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007372/* vec_stvewx */
7373
Bill Seurer703e8482015-06-09 14:39:47 +00007374static void __ATTRS_o_ai vec_stvewx(vector int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007375 __builtin_altivec_stvewx(__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_stvewx(vector unsigned int __a, int __b,
7379 unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007380 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007381}
7382
Bill Seurer703e8482015-06-09 14:39:47 +00007383static void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007384 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007385}
7386
Bill Seurer703e8482015-06-09 14:39:47 +00007387static void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b,
7388 unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007389 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007390}
7391
Bill Seurer703e8482015-06-09 14:39:47 +00007392static void __ATTRS_o_ai vec_stvewx(vector float __a, int __b, float *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007393 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007394}
7395
7396/* vec_stl */
7397
Bill Seurer703e8482015-06-09 14:39:47 +00007398static void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
7399 vector signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007400 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007401}
7402
Bill Seurer703e8482015-06-09 14:39:47 +00007403static void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
7404 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007405 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007406}
7407
Bill Seurer703e8482015-06-09 14:39:47 +00007408static void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
7409 vector unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007410 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007411}
7412
Bill Seurer703e8482015-06-09 14:39:47 +00007413static void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
7414 unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007415 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007416}
7417
Bill Seurer703e8482015-06-09 14:39:47 +00007418static void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
7419 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007420 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007421}
7422
Bill Seurer703e8482015-06-09 14:39:47 +00007423static void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
7424 unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007425 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007426}
7427
Bill Seurer703e8482015-06-09 14:39:47 +00007428static void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
7429 vector bool char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007430 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007431}
7432
Bill Seurer703e8482015-06-09 14:39:47 +00007433static void __ATTRS_o_ai vec_stl(vector short __a, int __b, vector short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007434 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007435}
7436
Bill Seurer703e8482015-06-09 14:39:47 +00007437static void __ATTRS_o_ai vec_stl(vector short __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007438 __builtin_altivec_stvxl((vector int)__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_stl(vector unsigned short __a, int __b,
7442 vector unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007443 __builtin_altivec_stvxl((vector int)__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_stl(vector unsigned short __a, int __b,
7447 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007448 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007449}
7450
Bill Seurer703e8482015-06-09 14:39:47 +00007451static void __ATTRS_o_ai vec_stl(vector bool short __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007452 __builtin_altivec_stvxl((vector int)__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_stl(vector bool short __a, int __b,
7456 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007457 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007458}
7459
Bill Seurer703e8482015-06-09 14:39:47 +00007460static void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
7461 vector bool short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007462 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007463}
7464
Bill Seurer703e8482015-06-09 14:39:47 +00007465static void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007466 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007467}
7468
Bill Seurer703e8482015-06-09 14:39:47 +00007469static void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
7470 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007471 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007472}
7473
Bill Seurer703e8482015-06-09 14:39:47 +00007474static void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, vector pixel *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007475 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007476}
7477
Bill Seurer703e8482015-06-09 14:39:47 +00007478static void __ATTRS_o_ai vec_stl(vector int __a, int __b, vector int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007479 __builtin_altivec_stvxl(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007480}
7481
Bill Seurer703e8482015-06-09 14:39:47 +00007482static void __ATTRS_o_ai vec_stl(vector int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007483 __builtin_altivec_stvxl(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007484}
7485
Bill Seurer703e8482015-06-09 14:39:47 +00007486static void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
7487 vector unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007488 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007489}
7490
Bill Seurer703e8482015-06-09 14:39:47 +00007491static void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
7492 unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007493 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007494}
7495
Bill Seurer703e8482015-06-09 14:39:47 +00007496static void __ATTRS_o_ai vec_stl(vector bool int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007497 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007498}
7499
Bill Seurer703e8482015-06-09 14:39:47 +00007500static void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
7501 unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007502 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007503}
7504
Bill Seurer703e8482015-06-09 14:39:47 +00007505static void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
7506 vector bool int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007507 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007508}
7509
Bill Seurer703e8482015-06-09 14:39:47 +00007510static void __ATTRS_o_ai vec_stl(vector float __a, int __b, vector float *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007511 __builtin_altivec_stvxl((vector int)__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_stl(vector float __a, int __b, float *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007515 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007516}
7517
7518/* vec_stvxl */
7519
Bill Seurer703e8482015-06-09 14:39:47 +00007520static void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
7521 vector signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007522 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007523}
7524
Bill Seurer703e8482015-06-09 14:39:47 +00007525static void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
7526 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007527 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007528}
7529
Bill Seurer703e8482015-06-09 14:39:47 +00007530static void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
7531 vector unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007532 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007533}
7534
Bill Seurer703e8482015-06-09 14:39:47 +00007535static void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
7536 unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007537 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007538}
7539
Bill Seurer703e8482015-06-09 14:39:47 +00007540static void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
7541 signed char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007542 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007543}
7544
Bill Seurer703e8482015-06-09 14:39:47 +00007545static void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
7546 unsigned char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007547 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007548}
7549
Bill Seurer703e8482015-06-09 14:39:47 +00007550static void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
7551 vector bool char *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007552 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007553}
7554
Bill Seurer703e8482015-06-09 14:39:47 +00007555static void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
7556 vector short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007557 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007558}
7559
Bill Seurer703e8482015-06-09 14:39:47 +00007560static void __ATTRS_o_ai vec_stvxl(vector short __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007561 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007562}
7563
Bill Seurer703e8482015-06-09 14:39:47 +00007564static void __ATTRS_o_ai vec_stvxl(vector unsigned short __a, int __b,
7565 vector unsigned short *__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_stvxl(vector unsigned short __a, int __b,
7570 unsigned short *__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_stvxl(vector bool short __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007575 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007576}
7577
Bill Seurer703e8482015-06-09 14:39:47 +00007578static void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
7579 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007580 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007581}
7582
Bill Seurer703e8482015-06-09 14:39:47 +00007583static void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
7584 vector bool short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007585 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007586}
7587
Bill Seurer703e8482015-06-09 14:39:47 +00007588static void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b, short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007589 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007590}
7591
Bill Seurer703e8482015-06-09 14:39:47 +00007592static void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
7593 unsigned short *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007594 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007595}
7596
Bill Seurer703e8482015-06-09 14:39:47 +00007597static void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
7598 vector pixel *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007599 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007600}
7601
Bill Seurer703e8482015-06-09 14:39:47 +00007602static void __ATTRS_o_ai vec_stvxl(vector int __a, int __b, vector int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007603 __builtin_altivec_stvxl(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007604}
7605
Bill Seurer703e8482015-06-09 14:39:47 +00007606static void __ATTRS_o_ai vec_stvxl(vector int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007607 __builtin_altivec_stvxl(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007608}
7609
Bill Seurer703e8482015-06-09 14:39:47 +00007610static void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
7611 vector unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007612 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007613}
7614
Bill Seurer703e8482015-06-09 14:39:47 +00007615static void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
7616 unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007617 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007618}
7619
Bill Seurer703e8482015-06-09 14:39:47 +00007620static void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b, int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007621 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007622}
7623
Bill Seurer703e8482015-06-09 14:39:47 +00007624static void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
7625 unsigned int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007626 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007627}
7628
Bill Seurer703e8482015-06-09 14:39:47 +00007629static void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
7630 vector bool int *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007631 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007632}
7633
Bill Seurer703e8482015-06-09 14:39:47 +00007634static void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
7635 vector float *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007636 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007637}
7638
Bill Seurer703e8482015-06-09 14:39:47 +00007639static void __ATTRS_o_ai vec_stvxl(vector float __a, int __b, float *__c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007640 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007641}
7642
7643/* vec_sub */
7644
Bill Seurer703e8482015-06-09 14:39:47 +00007645static vector signed char __ATTRS_o_ai vec_sub(vector signed char __a,
7646 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007647 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007648}
7649
Bill Seurer703e8482015-06-09 14:39:47 +00007650static vector signed char __ATTRS_o_ai vec_sub(vector bool char __a,
7651 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007652 return (vector signed char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007653}
7654
Bill Seurer703e8482015-06-09 14:39:47 +00007655static vector signed char __ATTRS_o_ai vec_sub(vector signed char __a,
7656 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007657 return __a - (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007658}
7659
Bill Seurer703e8482015-06-09 14:39:47 +00007660static vector unsigned char __ATTRS_o_ai vec_sub(vector unsigned char __a,
7661 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007662 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007663}
7664
Bill Seurer703e8482015-06-09 14:39:47 +00007665static vector unsigned char __ATTRS_o_ai vec_sub(vector bool char __a,
7666 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007667 return (vector unsigned char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007668}
7669
Bill Seurer703e8482015-06-09 14:39:47 +00007670static vector unsigned char __ATTRS_o_ai vec_sub(vector unsigned char __a,
7671 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007672 return __a - (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007673}
7674
Bill Seurer703e8482015-06-09 14:39:47 +00007675static vector short __ATTRS_o_ai vec_sub(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007676 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007677}
7678
Bill Seurer703e8482015-06-09 14:39:47 +00007679static vector short __ATTRS_o_ai vec_sub(vector bool short __a,
7680 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007681 return (vector short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007682}
7683
Bill Seurer703e8482015-06-09 14:39:47 +00007684static vector short __ATTRS_o_ai vec_sub(vector short __a,
7685 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007686 return __a - (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007687}
7688
Bill Seurer703e8482015-06-09 14:39:47 +00007689static vector unsigned short __ATTRS_o_ai vec_sub(vector unsigned short __a,
7690 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007691 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007692}
7693
Bill Seurer703e8482015-06-09 14:39:47 +00007694static vector unsigned short __ATTRS_o_ai vec_sub(vector bool short __a,
7695 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007696 return (vector unsigned short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007697}
7698
Bill Seurer703e8482015-06-09 14:39:47 +00007699static vector unsigned short __ATTRS_o_ai vec_sub(vector unsigned short __a,
7700 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007701 return __a - (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007702}
7703
Bill Seurer703e8482015-06-09 14:39:47 +00007704static vector int __ATTRS_o_ai vec_sub(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007705 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007706}
7707
Bill Seurer703e8482015-06-09 14:39:47 +00007708static vector int __ATTRS_o_ai vec_sub(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007709 return (vector int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007710}
7711
Bill Seurer703e8482015-06-09 14:39:47 +00007712static vector int __ATTRS_o_ai vec_sub(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007713 return __a - (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007714}
7715
Bill Seurer703e8482015-06-09 14:39:47 +00007716static vector unsigned int __ATTRS_o_ai vec_sub(vector unsigned int __a,
7717 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007718 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007719}
7720
Bill Seurer703e8482015-06-09 14:39:47 +00007721static vector unsigned int __ATTRS_o_ai vec_sub(vector bool int __a,
7722 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007723 return (vector unsigned int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007724}
7725
Bill Seurer703e8482015-06-09 14:39:47 +00007726static vector unsigned int __ATTRS_o_ai vec_sub(vector unsigned int __a,
7727 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007728 return __a - (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007729}
7730
Kit Barton5944ee212015-05-25 15:52:45 +00007731#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
Bill Seurer703e8482015-06-09 14:39:47 +00007732static vector signed __int128 __ATTRS_o_ai vec_sub(vector signed __int128 __a,
7733 vector signed __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +00007734 return __a - __b;
7735}
7736
7737static vector unsigned __int128 __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00007738vec_sub(vector unsigned __int128 __a, vector unsigned __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +00007739 return __a - __b;
7740}
7741#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
7742
Bill Seurer703e8482015-06-09 14:39:47 +00007743static vector float __ATTRS_o_ai vec_sub(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007744 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007745}
7746
7747/* vec_vsububm */
7748
7749#define __builtin_altivec_vsububm vec_vsububm
7750
Bill Seurer703e8482015-06-09 14:39:47 +00007751static vector signed char __ATTRS_o_ai vec_vsububm(vector signed char __a,
7752 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007753 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007754}
7755
Bill Seurer703e8482015-06-09 14:39:47 +00007756static vector signed char __ATTRS_o_ai vec_vsububm(vector bool char __a,
7757 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007758 return (vector signed char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007759}
7760
Bill Seurer703e8482015-06-09 14:39:47 +00007761static vector signed char __ATTRS_o_ai vec_vsububm(vector signed char __a,
7762 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007763 return __a - (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007764}
7765
Bill Seurer703e8482015-06-09 14:39:47 +00007766static vector unsigned char __ATTRS_o_ai vec_vsububm(vector unsigned char __a,
7767 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007768 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007769}
7770
Bill Seurer703e8482015-06-09 14:39:47 +00007771static vector unsigned char __ATTRS_o_ai vec_vsububm(vector bool char __a,
7772 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007773 return (vector unsigned char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007774}
7775
Bill Seurer703e8482015-06-09 14:39:47 +00007776static vector unsigned char __ATTRS_o_ai vec_vsububm(vector unsigned char __a,
7777 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007778 return __a - (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007779}
7780
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007781/* vec_vsubuhm */
7782
7783#define __builtin_altivec_vsubuhm vec_vsubuhm
7784
Bill Seurer703e8482015-06-09 14:39:47 +00007785static vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
7786 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007787 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007788}
7789
Bill Seurer703e8482015-06-09 14:39:47 +00007790static vector short __ATTRS_o_ai vec_vsubuhm(vector bool short __a,
7791 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007792 return (vector short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007793}
7794
Bill Seurer703e8482015-06-09 14:39:47 +00007795static vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
7796 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007797 return __a - (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007798}
7799
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007800static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00007801vec_vsubuhm(vector unsigned short __a, vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007802 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007803}
7804
Anton Yartsevfc83c602010-08-19 03:21:36 +00007805static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00007806vec_vsubuhm(vector bool short __a, vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007807 return (vector unsigned short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007808}
7809
Bill Seurer703e8482015-06-09 14:39:47 +00007810static vector unsigned short __ATTRS_o_ai vec_vsubuhm(vector unsigned short __a,
7811 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007812 return __a - (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007813}
7814
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007815/* vec_vsubuwm */
7816
7817#define __builtin_altivec_vsubuwm vec_vsubuwm
7818
Bill Seurer703e8482015-06-09 14:39:47 +00007819static vector int __ATTRS_o_ai vec_vsubuwm(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007820 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007821}
7822
Bill Seurer703e8482015-06-09 14:39:47 +00007823static vector int __ATTRS_o_ai vec_vsubuwm(vector bool int __a,
7824 vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007825 return (vector int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007826}
7827
Bill Seurer703e8482015-06-09 14:39:47 +00007828static vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
7829 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007830 return __a - (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007831}
7832
Bill Seurer703e8482015-06-09 14:39:47 +00007833static vector unsigned int __ATTRS_o_ai vec_vsubuwm(vector unsigned int __a,
7834 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007835 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007836}
7837
Bill Seurer703e8482015-06-09 14:39:47 +00007838static vector unsigned int __ATTRS_o_ai vec_vsubuwm(vector bool int __a,
7839 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007840 return (vector unsigned int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007841}
7842
Bill Seurer703e8482015-06-09 14:39:47 +00007843static vector unsigned int __ATTRS_o_ai vec_vsubuwm(vector unsigned int __a,
7844 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007845 return __a - (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007846}
7847
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007848/* vec_vsubfp */
7849
7850#define __builtin_altivec_vsubfp vec_vsubfp
7851
7852static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00007853vec_vsubfp(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007854 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007855}
7856
7857/* vec_subc */
7858
Bill Seurer703e8482015-06-09 14:39:47 +00007859static vector unsigned int __ATTRS_o_ai vec_subc(vector unsigned int __a,
7860 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007861 return __builtin_altivec_vsubcuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007862}
7863
Kit Barton5944ee212015-05-25 15:52:45 +00007864#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
7865static vector unsigned __int128 __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00007866vec_subc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +00007867 return __builtin_altivec_vsubcuq(__a, __b);
7868}
7869
7870static vector signed __int128 __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00007871vec_subc(vector signed __int128 __a, vector signed __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +00007872 return __builtin_altivec_vsubcuq(__a, __b);
7873}
7874#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
7875
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007876/* vec_vsubcuw */
7877
7878static vector unsigned int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00007879vec_vsubcuw(vector unsigned int __a, vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007880 return __builtin_altivec_vsubcuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007881}
7882
7883/* vec_subs */
7884
Bill Seurer703e8482015-06-09 14:39:47 +00007885static vector signed char __ATTRS_o_ai vec_subs(vector signed char __a,
7886 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007887 return __builtin_altivec_vsubsbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007888}
7889
Bill Seurer703e8482015-06-09 14:39:47 +00007890static vector signed char __ATTRS_o_ai vec_subs(vector bool char __a,
7891 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007892 return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007893}
7894
Bill Seurer703e8482015-06-09 14:39:47 +00007895static vector signed char __ATTRS_o_ai vec_subs(vector signed char __a,
7896 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007897 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007898}
7899
Bill Seurer703e8482015-06-09 14:39:47 +00007900static vector unsigned char __ATTRS_o_ai vec_subs(vector unsigned char __a,
7901 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007902 return __builtin_altivec_vsububs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007903}
7904
Bill Seurer703e8482015-06-09 14:39:47 +00007905static vector unsigned char __ATTRS_o_ai vec_subs(vector bool char __a,
7906 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007907 return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007908}
7909
Bill Seurer703e8482015-06-09 14:39:47 +00007910static vector unsigned char __ATTRS_o_ai vec_subs(vector unsigned char __a,
7911 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007912 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007913}
7914
Bill Seurer703e8482015-06-09 14:39:47 +00007915static vector short __ATTRS_o_ai vec_subs(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007916 return __builtin_altivec_vsubshs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007917}
7918
Bill Seurer703e8482015-06-09 14:39:47 +00007919static vector short __ATTRS_o_ai vec_subs(vector bool short __a,
7920 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007921 return __builtin_altivec_vsubshs((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007922}
7923
Bill Seurer703e8482015-06-09 14:39:47 +00007924static vector short __ATTRS_o_ai vec_subs(vector short __a,
7925 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007926 return __builtin_altivec_vsubshs(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007927}
7928
Bill Seurer703e8482015-06-09 14:39:47 +00007929static vector unsigned short __ATTRS_o_ai vec_subs(vector unsigned short __a,
7930 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007931 return __builtin_altivec_vsubuhs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007932}
7933
Bill Seurer703e8482015-06-09 14:39:47 +00007934static vector unsigned short __ATTRS_o_ai vec_subs(vector bool short __a,
7935 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007936 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007937}
7938
Bill Seurer703e8482015-06-09 14:39:47 +00007939static vector unsigned short __ATTRS_o_ai vec_subs(vector unsigned short __a,
7940 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007941 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007942}
7943
Bill Seurer703e8482015-06-09 14:39:47 +00007944static vector int __ATTRS_o_ai vec_subs(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007945 return __builtin_altivec_vsubsws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007946}
7947
Bill Seurer703e8482015-06-09 14:39:47 +00007948static vector int __ATTRS_o_ai vec_subs(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007949 return __builtin_altivec_vsubsws((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007950}
7951
Bill Seurer703e8482015-06-09 14:39:47 +00007952static vector int __ATTRS_o_ai vec_subs(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007953 return __builtin_altivec_vsubsws(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007954}
7955
Bill Seurer703e8482015-06-09 14:39:47 +00007956static vector unsigned int __ATTRS_o_ai vec_subs(vector unsigned int __a,
7957 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007958 return __builtin_altivec_vsubuws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007959}
7960
Bill Seurer703e8482015-06-09 14:39:47 +00007961static vector unsigned int __ATTRS_o_ai vec_subs(vector bool int __a,
7962 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007963 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007964}
7965
Bill Seurer703e8482015-06-09 14:39:47 +00007966static vector unsigned int __ATTRS_o_ai vec_subs(vector unsigned int __a,
7967 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007968 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007969}
7970
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007971/* vec_vsubsbs */
7972
Bill Seurer703e8482015-06-09 14:39:47 +00007973static vector signed char __ATTRS_o_ai vec_vsubsbs(vector signed char __a,
7974 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007975 return __builtin_altivec_vsubsbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007976}
7977
Bill Seurer703e8482015-06-09 14:39:47 +00007978static vector signed char __ATTRS_o_ai vec_vsubsbs(vector bool char __a,
7979 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007980 return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007981}
7982
Bill Seurer703e8482015-06-09 14:39:47 +00007983static vector signed char __ATTRS_o_ai vec_vsubsbs(vector signed char __a,
7984 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007985 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007986}
7987
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007988/* vec_vsububs */
7989
Bill Seurer703e8482015-06-09 14:39:47 +00007990static vector unsigned char __ATTRS_o_ai vec_vsububs(vector unsigned char __a,
7991 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007992 return __builtin_altivec_vsububs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007993}
7994
Bill Seurer703e8482015-06-09 14:39:47 +00007995static vector unsigned char __ATTRS_o_ai vec_vsububs(vector bool char __a,
7996 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00007997 return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007998}
7999
Bill Seurer703e8482015-06-09 14:39:47 +00008000static vector unsigned char __ATTRS_o_ai vec_vsububs(vector unsigned char __a,
8001 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008002 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008003}
8004
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008005/* vec_vsubshs */
8006
Bill Seurer703e8482015-06-09 14:39:47 +00008007static vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
8008 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008009 return __builtin_altivec_vsubshs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008010}
8011
Bill Seurer703e8482015-06-09 14:39:47 +00008012static vector short __ATTRS_o_ai vec_vsubshs(vector bool short __a,
8013 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008014 return __builtin_altivec_vsubshs((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008015}
8016
Bill Seurer703e8482015-06-09 14:39:47 +00008017static vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
8018 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008019 return __builtin_altivec_vsubshs(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008020}
8021
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008022/* vec_vsubuhs */
8023
Anton Yartsevfc83c602010-08-19 03:21:36 +00008024static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008025vec_vsubuhs(vector unsigned short __a, vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008026 return __builtin_altivec_vsubuhs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008027}
8028
Anton Yartsevfc83c602010-08-19 03:21:36 +00008029static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008030vec_vsubuhs(vector bool short __a, vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008031 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008032}
8033
Bill Seurer703e8482015-06-09 14:39:47 +00008034static vector unsigned short __ATTRS_o_ai vec_vsubuhs(vector unsigned short __a,
8035 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008036 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008037}
8038
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008039/* vec_vsubsws */
8040
Bill Seurer703e8482015-06-09 14:39:47 +00008041static vector int __ATTRS_o_ai vec_vsubsws(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008042 return __builtin_altivec_vsubsws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008043}
8044
Bill Seurer703e8482015-06-09 14:39:47 +00008045static vector int __ATTRS_o_ai vec_vsubsws(vector bool int __a,
8046 vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008047 return __builtin_altivec_vsubsws((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008048}
8049
Bill Seurer703e8482015-06-09 14:39:47 +00008050static vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
8051 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008052 return __builtin_altivec_vsubsws(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008053}
8054
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008055/* vec_vsubuws */
8056
Bill Seurer703e8482015-06-09 14:39:47 +00008057static vector unsigned int __ATTRS_o_ai vec_vsubuws(vector unsigned int __a,
8058 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008059 return __builtin_altivec_vsubuws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008060}
8061
Bill Seurer703e8482015-06-09 14:39:47 +00008062static vector unsigned int __ATTRS_o_ai vec_vsubuws(vector bool int __a,
8063 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008064 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008065}
8066
Bill Seurer703e8482015-06-09 14:39:47 +00008067static vector unsigned int __ATTRS_o_ai vec_vsubuws(vector unsigned int __a,
8068 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008069 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008070}
8071
Kit Barton5944ee212015-05-25 15:52:45 +00008072#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
8073/* vec_vsubuqm */
8074
8075static vector signed __int128 __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008076vec_vsubuqm(vector signed __int128 __a, vector signed __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +00008077 return __a - __b;
8078}
8079
8080static vector unsigned __int128 __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008081vec_vsubuqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +00008082 return __a - __b;
8083}
8084
8085/* vec_vsubeuqm */
8086
8087static vector signed __int128 __ATTRS_o_ai
8088vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b,
Bill Seurer703e8482015-06-09 14:39:47 +00008089 vector signed __int128 __c) {
Kit Barton5944ee212015-05-25 15:52:45 +00008090 return __builtin_altivec_vsubeuqm(__a, __b, __c);
8091}
8092
8093static vector unsigned __int128 __ATTRS_o_ai
8094vec_vsubeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
Bill Seurer703e8482015-06-09 14:39:47 +00008095 vector unsigned __int128 __c) {
Kit Barton5944ee212015-05-25 15:52:45 +00008096 return __builtin_altivec_vsubeuqm(__a, __b, __c);
8097}
8098
8099/* vec_vsubcuq */
8100
8101static vector signed __int128 __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008102vec_vsubcuq(vector signed __int128 __a, vector signed __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +00008103 return __builtin_altivec_vsubcuq(__a, __b);
8104}
8105
8106static vector unsigned __int128 __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008107vec_vsubcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
Kit Barton5944ee212015-05-25 15:52:45 +00008108 return __builtin_altivec_vsubcuq(__a, __b);
8109}
8110
8111/* vec_vsubecuq */
8112
8113static vector signed __int128 __ATTRS_o_ai
8114vec_vsubecuq(vector signed __int128 __a, vector signed __int128 __b,
Bill Seurer703e8482015-06-09 14:39:47 +00008115 vector signed __int128 __c) {
Kit Barton5944ee212015-05-25 15:52:45 +00008116 return __builtin_altivec_vsubecuq(__a, __b, __c);
8117}
8118
8119static vector unsigned __int128 __ATTRS_o_ai
8120vec_vsubecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
Bill Seurer703e8482015-06-09 14:39:47 +00008121 vector unsigned __int128 __c) {
Kit Barton5944ee212015-05-25 15:52:45 +00008122 return __builtin_altivec_vsubecuq(__a, __b, __c);
8123}
8124#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
8125
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008126/* vec_sum4s */
8127
Bill Seurer703e8482015-06-09 14:39:47 +00008128static vector int __ATTRS_o_ai vec_sum4s(vector signed char __a,
8129 vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008130 return __builtin_altivec_vsum4sbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008131}
8132
Bill Seurer703e8482015-06-09 14:39:47 +00008133static vector unsigned int __ATTRS_o_ai vec_sum4s(vector unsigned char __a,
8134 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008135 return __builtin_altivec_vsum4ubs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008136}
8137
Bill Seurer703e8482015-06-09 14:39:47 +00008138static vector int __ATTRS_o_ai vec_sum4s(vector signed short __a,
8139 vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008140 return __builtin_altivec_vsum4shs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008141}
8142
8143/* vec_vsum4sbs */
8144
8145static vector int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00008146vec_vsum4sbs(vector signed char __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008147 return __builtin_altivec_vsum4sbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008148}
8149
8150/* vec_vsum4ubs */
8151
8152static vector unsigned int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00008153vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008154 return __builtin_altivec_vsum4ubs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008155}
8156
8157/* vec_vsum4shs */
8158
8159static vector int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00008160vec_vsum4shs(vector signed short __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008161 return __builtin_altivec_vsum4shs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008162}
8163
8164/* vec_sum2s */
8165
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008166/* The vsum2sws instruction has a big-endian bias, so that the second
8167 input vector and the result always reference big-endian elements
8168 1 and 3 (little-endian element 0 and 2). For ease of porting the
8169 programmer wants elements 1 and 3 in both cases, so for little
8170 endian we must perform some permutes. */
8171
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008172static vector signed int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00008173vec_sum2s(vector int __a, vector int __b) {
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008174#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00008175 vector int __c = (vector signed int)vec_perm(
8176 __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
8177 8, 9, 10, 11));
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008178 __c = __builtin_altivec_vsum2sws(__a, __c);
Bill Seurer703e8482015-06-09 14:39:47 +00008179 return (vector signed int)vec_perm(
8180 __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
8181 8, 9, 10, 11));
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008182#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008183 return __builtin_altivec_vsum2sws(__a, __b);
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008184#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008185}
8186
8187/* vec_vsum2sws */
8188
8189static vector signed int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00008190vec_vsum2sws(vector int __a, vector int __b) {
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008191#ifdef __LITTLE_ENDIAN__
Bill Seurer703e8482015-06-09 14:39:47 +00008192 vector int __c = (vector signed int)vec_perm(
8193 __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
8194 8, 9, 10, 11));
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008195 __c = __builtin_altivec_vsum2sws(__a, __c);
Bill Seurer703e8482015-06-09 14:39:47 +00008196 return (vector signed int)vec_perm(
8197 __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
8198 8, 9, 10, 11));
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008199#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008200 return __builtin_altivec_vsum2sws(__a, __b);
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008201#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008202}
8203
8204/* vec_sums */
8205
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008206/* The vsumsws instruction has a big-endian bias, so that the second
8207 input vector and the result always reference big-endian element 3
8208 (little-endian element 0). For ease of porting the programmer
8209 wants element 3 in both cases, so for little endian we must perform
8210 some permutes. */
8211
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008212static vector signed int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00008213vec_sums(vector signed int __a, vector signed int __b) {
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008214#ifdef __LITTLE_ENDIAN__
Bill Schmidtccbe0a82014-08-04 23:21:26 +00008215 __b = (vector signed int)vec_splat(__b, 3);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008216 __b = __builtin_altivec_vsumsws(__a, __b);
Bill Schmidtccbe0a82014-08-04 23:21:26 +00008217 return (vector signed int)(0, 0, 0, __b[0]);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008218#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008219 return __builtin_altivec_vsumsws(__a, __b);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008220#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008221}
8222
8223/* vec_vsumsws */
8224
8225static vector signed int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00008226vec_vsumsws(vector signed int __a, vector signed int __b) {
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008227#ifdef __LITTLE_ENDIAN__
Bill Schmidtccbe0a82014-08-04 23:21:26 +00008228 __b = (vector signed int)vec_splat(__b, 3);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008229 __b = __builtin_altivec_vsumsws(__a, __b);
Bill Schmidtccbe0a82014-08-04 23:21:26 +00008230 return (vector signed int)(0, 0, 0, __b[0]);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008231#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008232 return __builtin_altivec_vsumsws(__a, __b);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008233#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008234}
8235
8236/* vec_trunc */
8237
8238static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00008239vec_trunc(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008240 return __builtin_altivec_vrfiz(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008241}
8242
8243/* vec_vrfiz */
8244
8245static vector float __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +00008246vec_vrfiz(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008247 return __builtin_altivec_vrfiz(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008248}
8249
8250/* vec_unpackh */
8251
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008252/* The vector unpack instructions all have a big-endian bias, so for
8253 little endian we must reverse the meanings of "high" and "low." */
8254
Bill Seurer703e8482015-06-09 14:39:47 +00008255static vector short __ATTRS_o_ai vec_unpackh(vector signed char __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008256#ifdef __LITTLE_ENDIAN__
8257 return __builtin_altivec_vupklsb((vector char)__a);
8258#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008259 return __builtin_altivec_vupkhsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008260#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008261}
8262
Bill Seurer703e8482015-06-09 14:39:47 +00008263static vector bool short __ATTRS_o_ai vec_unpackh(vector bool char __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008264#ifdef __LITTLE_ENDIAN__
8265 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
8266#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008267 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008268#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008269}
8270
Bill Seurer703e8482015-06-09 14:39:47 +00008271static vector int __ATTRS_o_ai vec_unpackh(vector short __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008272#ifdef __LITTLE_ENDIAN__
8273 return __builtin_altivec_vupklsh(__a);
8274#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008275 return __builtin_altivec_vupkhsh(__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008276#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008277}
8278
Bill Seurer703e8482015-06-09 14:39:47 +00008279static vector bool int __ATTRS_o_ai vec_unpackh(vector bool short __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008280#ifdef __LITTLE_ENDIAN__
8281 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
8282#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008283 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008284#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008285}
8286
Bill Seurer703e8482015-06-09 14:39:47 +00008287static vector unsigned int __ATTRS_o_ai vec_unpackh(vector pixel __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008288#ifdef __LITTLE_ENDIAN__
8289 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
8290#else
8291 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
8292#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008293}
8294
Bill Schmidt41e14c42015-05-16 01:02:25 +00008295#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +00008296static vector long long __ATTRS_o_ai vec_unpackh(vector int __a) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00008297#ifdef __LITTLE_ENDIAN__
8298 return __builtin_altivec_vupklsw(__a);
8299#else
8300 return __builtin_altivec_vupkhsw(__a);
8301#endif
8302}
8303
Bill Seurer703e8482015-06-09 14:39:47 +00008304static vector bool long long __ATTRS_o_ai vec_unpackh(vector bool int __a) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00008305#ifdef __LITTLE_ENDIAN__
8306 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
8307#else
8308 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
8309#endif
8310}
8311#endif
8312
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008313/* vec_vupkhsb */
8314
Bill Seurer703e8482015-06-09 14:39:47 +00008315static vector short __ATTRS_o_ai vec_vupkhsb(vector signed char __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008316#ifdef __LITTLE_ENDIAN__
8317 return __builtin_altivec_vupklsb((vector char)__a);
8318#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008319 return __builtin_altivec_vupkhsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008320#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008321}
8322
Bill Seurer703e8482015-06-09 14:39:47 +00008323static vector bool short __ATTRS_o_ai vec_vupkhsb(vector bool char __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008324#ifdef __LITTLE_ENDIAN__
8325 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
8326#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008327 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008328#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008329}
8330
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008331/* vec_vupkhsh */
8332
Bill Seurer703e8482015-06-09 14:39:47 +00008333static vector int __ATTRS_o_ai vec_vupkhsh(vector short __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008334#ifdef __LITTLE_ENDIAN__
8335 return __builtin_altivec_vupklsh(__a);
8336#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008337 return __builtin_altivec_vupkhsh(__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008338#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008339}
8340
Bill Seurer703e8482015-06-09 14:39:47 +00008341static vector bool int __ATTRS_o_ai vec_vupkhsh(vector bool short __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008342#ifdef __LITTLE_ENDIAN__
8343 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
8344#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008345 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008346#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008347}
8348
Bill Seurer703e8482015-06-09 14:39:47 +00008349static vector unsigned int __ATTRS_o_ai vec_vupkhsh(vector pixel __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008350#ifdef __LITTLE_ENDIAN__
8351 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
8352#else
8353 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
8354#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008355}
8356
Bill Schmidt41e14c42015-05-16 01:02:25 +00008357/* vec_vupkhsw */
8358
8359#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +00008360static vector long long __ATTRS_o_ai vec_vupkhsw(vector int __a) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00008361#ifdef __LITTLE_ENDIAN__
8362 return __builtin_altivec_vupklsw(__a);
8363#else
8364 return __builtin_altivec_vupkhsw(__a);
8365#endif
8366}
8367
Bill Seurer703e8482015-06-09 14:39:47 +00008368static vector bool long long __ATTRS_o_ai vec_vupkhsw(vector bool int __a) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00008369#ifdef __LITTLE_ENDIAN__
8370 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
8371#else
8372 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
8373#endif
8374}
8375#endif
8376
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008377/* vec_unpackl */
8378
Bill Seurer703e8482015-06-09 14:39:47 +00008379static vector short __ATTRS_o_ai vec_unpackl(vector signed char __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008380#ifdef __LITTLE_ENDIAN__
8381 return __builtin_altivec_vupkhsb((vector char)__a);
8382#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008383 return __builtin_altivec_vupklsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008384#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008385}
8386
Bill Seurer703e8482015-06-09 14:39:47 +00008387static vector bool short __ATTRS_o_ai vec_unpackl(vector bool char __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008388#ifdef __LITTLE_ENDIAN__
8389 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
8390#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008391 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008392#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008393}
8394
Bill Seurer703e8482015-06-09 14:39:47 +00008395static vector int __ATTRS_o_ai vec_unpackl(vector short __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008396#ifdef __LITTLE_ENDIAN__
8397 return __builtin_altivec_vupkhsh(__a);
8398#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008399 return __builtin_altivec_vupklsh(__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008400#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008401}
8402
Bill Seurer703e8482015-06-09 14:39:47 +00008403static vector bool int __ATTRS_o_ai vec_unpackl(vector bool short __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008404#ifdef __LITTLE_ENDIAN__
8405 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
8406#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008407 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008408#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008409}
8410
Bill Seurer703e8482015-06-09 14:39:47 +00008411static vector unsigned int __ATTRS_o_ai vec_unpackl(vector pixel __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008412#ifdef __LITTLE_ENDIAN__
8413 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
8414#else
8415 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
8416#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008417}
8418
Bill Schmidt41e14c42015-05-16 01:02:25 +00008419#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +00008420static vector long long __ATTRS_o_ai vec_unpackl(vector int __a) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00008421#ifdef __LITTLE_ENDIAN__
8422 return __builtin_altivec_vupkhsw(__a);
8423#else
8424 return __builtin_altivec_vupklsw(__a);
8425#endif
8426}
8427
Bill Seurer703e8482015-06-09 14:39:47 +00008428static vector bool long long __ATTRS_o_ai vec_unpackl(vector bool int __a) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00008429#ifdef __LITTLE_ENDIAN__
8430 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
8431#else
8432 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
8433#endif
8434}
8435#endif
8436
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008437/* vec_vupklsb */
8438
Bill Seurer703e8482015-06-09 14:39:47 +00008439static vector short __ATTRS_o_ai vec_vupklsb(vector signed char __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008440#ifdef __LITTLE_ENDIAN__
8441 return __builtin_altivec_vupkhsb((vector char)__a);
8442#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008443 return __builtin_altivec_vupklsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008444#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008445}
8446
Bill Seurer703e8482015-06-09 14:39:47 +00008447static vector bool short __ATTRS_o_ai vec_vupklsb(vector bool char __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008448#ifdef __LITTLE_ENDIAN__
8449 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
8450#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008451 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008452#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008453}
8454
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008455/* vec_vupklsh */
8456
Bill Seurer703e8482015-06-09 14:39:47 +00008457static vector int __ATTRS_o_ai vec_vupklsh(vector short __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008458#ifdef __LITTLE_ENDIAN__
8459 return __builtin_altivec_vupkhsh(__a);
8460#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008461 return __builtin_altivec_vupklsh(__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008462#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008463}
8464
Bill Seurer703e8482015-06-09 14:39:47 +00008465static vector bool int __ATTRS_o_ai vec_vupklsh(vector bool short __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008466#ifdef __LITTLE_ENDIAN__
8467 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
8468#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008469 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008470#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008471}
8472
Bill Seurer703e8482015-06-09 14:39:47 +00008473static vector unsigned int __ATTRS_o_ai vec_vupklsh(vector pixel __a) {
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008474#ifdef __LITTLE_ENDIAN__
8475 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
8476#else
8477 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
8478#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008479}
8480
Bill Schmidt41e14c42015-05-16 01:02:25 +00008481/* vec_vupklsw */
8482
8483#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +00008484static vector long long __ATTRS_o_ai vec_vupklsw(vector int __a) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00008485#ifdef __LITTLE_ENDIAN__
8486 return __builtin_altivec_vupkhsw(__a);
8487#else
8488 return __builtin_altivec_vupklsw(__a);
8489#endif
8490}
8491
Bill Seurer703e8482015-06-09 14:39:47 +00008492static vector bool long long __ATTRS_o_ai vec_vupklsw(vector bool int __a) {
Bill Schmidt41e14c42015-05-16 01:02:25 +00008493#ifdef __LITTLE_ENDIAN__
8494 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
8495#else
8496 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
8497#endif
8498}
8499#endif
8500
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008501/* vec_vsx_ld */
8502
8503#ifdef __VSX__
8504
Bill Seurer703e8482015-06-09 14:39:47 +00008505static vector signed int __ATTRS_o_ai vec_vsx_ld(int __a,
8506 const vector signed int *__b) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008507 return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
8508}
8509
8510static vector unsigned int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008511vec_vsx_ld(int __a, const vector unsigned int *__b) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008512 return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
8513}
8514
Bill Seurer703e8482015-06-09 14:39:47 +00008515static vector float __ATTRS_o_ai vec_vsx_ld(int __a, const vector float *__b) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008516 return (vector float)__builtin_vsx_lxvw4x(__a, __b);
8517}
8518
8519static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008520vec_vsx_ld(int __a, const vector signed long long *__b) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008521 return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b);
8522}
8523
8524static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008525vec_vsx_ld(int __a, const vector unsigned long long *__b) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008526 return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b);
8527}
8528
Bill Seurer703e8482015-06-09 14:39:47 +00008529static vector double __ATTRS_o_ai vec_vsx_ld(int __a,
8530 const vector double *__b) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008531 return (vector double)__builtin_vsx_lxvd2x(__a, __b);
8532}
8533
8534#endif
8535
8536/* vec_vsx_st */
8537
8538#ifdef __VSX__
8539
Bill Seurer703e8482015-06-09 14:39:47 +00008540static void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
8541 vector signed int *__c) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008542 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
8543}
8544
Bill Seurer703e8482015-06-09 14:39:47 +00008545static void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
8546 vector unsigned int *__c) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008547 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
8548}
8549
Bill Seurer703e8482015-06-09 14:39:47 +00008550static void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
8551 vector float *__c) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008552 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
8553}
8554
Bill Seurer703e8482015-06-09 14:39:47 +00008555static void __ATTRS_o_ai vec_vsx_st(vector signed long long __a, int __b,
8556 vector signed long long *__c) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008557 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
8558}
8559
Bill Seurer703e8482015-06-09 14:39:47 +00008560static void __ATTRS_o_ai vec_vsx_st(vector unsigned long long __a, int __b,
8561 vector unsigned long long *__c) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008562 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
8563}
8564
Bill Seurer703e8482015-06-09 14:39:47 +00008565static void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
8566 vector double *__c) {
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008567 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
8568}
8569
8570#endif
8571
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008572/* vec_xor */
8573
8574#define __builtin_altivec_vxor vec_xor
8575
Bill Seurer703e8482015-06-09 14:39:47 +00008576static vector signed char __ATTRS_o_ai vec_xor(vector signed char __a,
8577 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008578 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008579}
8580
Bill Seurer703e8482015-06-09 14:39:47 +00008581static vector signed char __ATTRS_o_ai vec_xor(vector bool char __a,
8582 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008583 return (vector signed char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008584}
8585
Bill Seurer703e8482015-06-09 14:39:47 +00008586static vector signed char __ATTRS_o_ai vec_xor(vector signed char __a,
8587 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008588 return __a ^ (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008589}
8590
Bill Seurer703e8482015-06-09 14:39:47 +00008591static vector unsigned char __ATTRS_o_ai vec_xor(vector unsigned char __a,
8592 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008593 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008594}
8595
Bill Seurer703e8482015-06-09 14:39:47 +00008596static vector unsigned char __ATTRS_o_ai vec_xor(vector bool char __a,
8597 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008598 return (vector unsigned char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008599}
8600
Bill Seurer703e8482015-06-09 14:39:47 +00008601static vector unsigned char __ATTRS_o_ai vec_xor(vector unsigned char __a,
8602 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008603 return __a ^ (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008604}
8605
Bill Seurer703e8482015-06-09 14:39:47 +00008606static vector bool char __ATTRS_o_ai vec_xor(vector bool char __a,
8607 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008608 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008609}
8610
Bill Seurer703e8482015-06-09 14:39:47 +00008611static vector short __ATTRS_o_ai vec_xor(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008612 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008613}
8614
Bill Seurer703e8482015-06-09 14:39:47 +00008615static vector short __ATTRS_o_ai vec_xor(vector bool short __a,
8616 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008617 return (vector short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008618}
8619
Bill Seurer703e8482015-06-09 14:39:47 +00008620static vector short __ATTRS_o_ai vec_xor(vector short __a,
8621 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008622 return __a ^ (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008623}
8624
Bill Seurer703e8482015-06-09 14:39:47 +00008625static vector unsigned short __ATTRS_o_ai vec_xor(vector unsigned short __a,
8626 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008627 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008628}
8629
Bill Seurer703e8482015-06-09 14:39:47 +00008630static vector unsigned short __ATTRS_o_ai vec_xor(vector bool short __a,
8631 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008632 return (vector unsigned short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008633}
8634
Bill Seurer703e8482015-06-09 14:39:47 +00008635static vector unsigned short __ATTRS_o_ai vec_xor(vector unsigned short __a,
8636 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008637 return __a ^ (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008638}
8639
Bill Seurer703e8482015-06-09 14:39:47 +00008640static vector bool short __ATTRS_o_ai vec_xor(vector bool short __a,
8641 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008642 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008643}
8644
Bill Seurer703e8482015-06-09 14:39:47 +00008645static vector int __ATTRS_o_ai vec_xor(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008646 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008647}
8648
Bill Seurer703e8482015-06-09 14:39:47 +00008649static vector int __ATTRS_o_ai vec_xor(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008650 return (vector int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008651}
8652
Bill Seurer703e8482015-06-09 14:39:47 +00008653static vector int __ATTRS_o_ai vec_xor(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008654 return __a ^ (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008655}
8656
Bill Seurer703e8482015-06-09 14:39:47 +00008657static vector unsigned int __ATTRS_o_ai vec_xor(vector unsigned int __a,
8658 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008659 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008660}
8661
Bill Seurer703e8482015-06-09 14:39:47 +00008662static vector unsigned int __ATTRS_o_ai vec_xor(vector bool int __a,
8663 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008664 return (vector unsigned int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008665}
8666
Bill Seurer703e8482015-06-09 14:39:47 +00008667static vector unsigned int __ATTRS_o_ai vec_xor(vector unsigned int __a,
8668 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008669 return __a ^ (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008670}
8671
Bill Seurer703e8482015-06-09 14:39:47 +00008672static vector bool int __ATTRS_o_ai vec_xor(vector bool int __a,
8673 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008674 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008675}
8676
Bill Seurer703e8482015-06-09 14:39:47 +00008677static vector float __ATTRS_o_ai vec_xor(vector float __a, vector float __b) {
8678 vector unsigned int __res =
8679 (vector unsigned int)__a ^ (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00008680 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008681}
8682
Bill Seurer703e8482015-06-09 14:39:47 +00008683static vector float __ATTRS_o_ai vec_xor(vector bool int __a,
8684 vector float __b) {
8685 vector unsigned int __res =
8686 (vector unsigned int)__a ^ (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00008687 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008688}
8689
Bill Seurer703e8482015-06-09 14:39:47 +00008690static vector float __ATTRS_o_ai vec_xor(vector float __a,
8691 vector bool int __b) {
8692 vector unsigned int __res =
8693 (vector unsigned int)__a ^ (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00008694 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008695}
8696
Bill Seurer8be14f12015-06-04 18:45:44 +00008697#ifdef __VSX__
8698static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008699vec_xor(vector signed long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00008700 return __a ^ __b;
8701}
8702
8703static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008704vec_xor(vector bool long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00008705 return (vector signed long long)__a ^ __b;
8706}
8707
Bill Seurer703e8482015-06-09 14:39:47 +00008708static vector signed long long __ATTRS_o_ai vec_xor(vector signed long long __a,
8709 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00008710 return __a ^ (vector signed long long)__b;
8711}
8712
8713static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008714vec_xor(vector unsigned long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00008715 return __a ^ __b;
8716}
8717
8718static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008719vec_xor(vector bool long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00008720 return (vector unsigned long long)__a ^ __b;
8721}
8722
8723static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008724vec_xor(vector unsigned long long __a, vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00008725 return __a ^ (vector unsigned long long)__b;
8726}
8727
Bill Seurer703e8482015-06-09 14:39:47 +00008728static vector bool long long __ATTRS_o_ai vec_xor(vector bool long long __a,
8729 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00008730 return __a ^ __b;
8731}
8732#endif
8733
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008734/* vec_vxor */
8735
Bill Seurer703e8482015-06-09 14:39:47 +00008736static vector signed char __ATTRS_o_ai vec_vxor(vector signed char __a,
8737 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008738 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008739}
8740
Bill Seurer703e8482015-06-09 14:39:47 +00008741static vector signed char __ATTRS_o_ai vec_vxor(vector bool char __a,
8742 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008743 return (vector signed char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008744}
8745
Bill Seurer703e8482015-06-09 14:39:47 +00008746static vector signed char __ATTRS_o_ai vec_vxor(vector signed char __a,
8747 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008748 return __a ^ (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008749}
8750
Bill Seurer703e8482015-06-09 14:39:47 +00008751static vector unsigned char __ATTRS_o_ai vec_vxor(vector unsigned char __a,
8752 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008753 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008754}
8755
Bill Seurer703e8482015-06-09 14:39:47 +00008756static vector unsigned char __ATTRS_o_ai vec_vxor(vector bool char __a,
8757 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008758 return (vector unsigned char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008759}
8760
Bill Seurer703e8482015-06-09 14:39:47 +00008761static vector unsigned char __ATTRS_o_ai vec_vxor(vector unsigned char __a,
8762 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008763 return __a ^ (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008764}
8765
Bill Seurer703e8482015-06-09 14:39:47 +00008766static vector bool char __ATTRS_o_ai vec_vxor(vector bool char __a,
8767 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008768 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008769}
8770
Bill Seurer703e8482015-06-09 14:39:47 +00008771static vector short __ATTRS_o_ai vec_vxor(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008772 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008773}
8774
Bill Seurer703e8482015-06-09 14:39:47 +00008775static vector short __ATTRS_o_ai vec_vxor(vector bool short __a,
8776 vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008777 return (vector short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008778}
8779
Bill Seurer703e8482015-06-09 14:39:47 +00008780static vector short __ATTRS_o_ai vec_vxor(vector short __a,
8781 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008782 return __a ^ (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008783}
8784
Bill Seurer703e8482015-06-09 14:39:47 +00008785static vector unsigned short __ATTRS_o_ai vec_vxor(vector unsigned short __a,
8786 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008787 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008788}
8789
Bill Seurer703e8482015-06-09 14:39:47 +00008790static vector unsigned short __ATTRS_o_ai vec_vxor(vector bool short __a,
8791 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008792 return (vector unsigned short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008793}
8794
Bill Seurer703e8482015-06-09 14:39:47 +00008795static vector unsigned short __ATTRS_o_ai vec_vxor(vector unsigned short __a,
8796 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008797 return __a ^ (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008798}
8799
Bill Seurer703e8482015-06-09 14:39:47 +00008800static vector bool short __ATTRS_o_ai vec_vxor(vector bool short __a,
8801 vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008802 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008803}
8804
Bill Seurer703e8482015-06-09 14:39:47 +00008805static vector int __ATTRS_o_ai vec_vxor(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008806 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008807}
8808
Bill Seurer703e8482015-06-09 14:39:47 +00008809static vector int __ATTRS_o_ai vec_vxor(vector bool int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008810 return (vector int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008811}
8812
Bill Seurer703e8482015-06-09 14:39:47 +00008813static vector int __ATTRS_o_ai vec_vxor(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008814 return __a ^ (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008815}
8816
Bill Seurer703e8482015-06-09 14:39:47 +00008817static vector unsigned int __ATTRS_o_ai vec_vxor(vector unsigned int __a,
8818 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008819 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008820}
8821
Bill Seurer703e8482015-06-09 14:39:47 +00008822static vector unsigned int __ATTRS_o_ai vec_vxor(vector bool int __a,
8823 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008824 return (vector unsigned int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008825}
8826
Bill Seurer703e8482015-06-09 14:39:47 +00008827static vector unsigned int __ATTRS_o_ai vec_vxor(vector unsigned int __a,
8828 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008829 return __a ^ (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008830}
8831
Bill Seurer703e8482015-06-09 14:39:47 +00008832static vector bool int __ATTRS_o_ai vec_vxor(vector bool int __a,
8833 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008834 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008835}
8836
Bill Seurer703e8482015-06-09 14:39:47 +00008837static vector float __ATTRS_o_ai vec_vxor(vector float __a, vector float __b) {
8838 vector unsigned int __res =
8839 (vector unsigned int)__a ^ (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00008840 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008841}
Chris Lattnerdad40622010-04-14 03:54:58 +00008842
Bill Seurer703e8482015-06-09 14:39:47 +00008843static vector float __ATTRS_o_ai vec_vxor(vector bool int __a,
8844 vector float __b) {
8845 vector unsigned int __res =
8846 (vector unsigned int)__a ^ (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00008847 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008848}
8849
Bill Seurer703e8482015-06-09 14:39:47 +00008850static vector float __ATTRS_o_ai vec_vxor(vector float __a,
8851 vector bool int __b) {
8852 vector unsigned int __res =
8853 (vector unsigned int)__a ^ (vector unsigned int)__b;
David Blaikie3302f2b2013-01-16 23:08:36 +00008854 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008855}
8856
Bill Seurer8be14f12015-06-04 18:45:44 +00008857#ifdef __VSX__
8858static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008859vec_vxor(vector signed long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00008860 return __a ^ __b;
8861}
8862
8863static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008864vec_vxor(vector bool long long __a, vector signed long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00008865 return (vector signed long long)__a ^ __b;
8866}
8867
8868static vector signed long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008869vec_vxor(vector signed long long __a, vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00008870 return __a ^ (vector signed long long)__b;
8871}
8872
8873static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008874vec_vxor(vector unsigned long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00008875 return __a ^ __b;
8876}
8877
8878static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008879vec_vxor(vector bool long long __a, vector unsigned long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00008880 return (vector unsigned long long)__a ^ __b;
8881}
8882
8883static vector unsigned long long __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008884vec_vxor(vector unsigned long long __a, vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00008885 return __a ^ (vector unsigned long long)__b;
8886}
8887
Bill Seurer703e8482015-06-09 14:39:47 +00008888static vector bool long long __ATTRS_o_ai vec_vxor(vector bool long long __a,
8889 vector bool long long __b) {
Bill Seurer8be14f12015-06-04 18:45:44 +00008890 return __a ^ __b;
8891}
8892#endif
8893
Anton Yartsev79d6af32010-09-18 00:39:16 +00008894/* ------------------------ extensions for CBEA ----------------------------- */
Anton Yartsev73d40232010-10-14 14:37:46 +00008895
8896/* vec_extract */
8897
Bill Seurer703e8482015-06-09 14:39:47 +00008898static signed char __ATTRS_o_ai vec_extract(vector signed char __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008899 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00008900}
8901
Bill Seurer703e8482015-06-09 14:39:47 +00008902static unsigned char __ATTRS_o_ai vec_extract(vector unsigned char __a,
8903 int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008904 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00008905}
8906
Bill Seurer703e8482015-06-09 14:39:47 +00008907static short __ATTRS_o_ai vec_extract(vector short __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008908 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00008909}
8910
Bill Seurer703e8482015-06-09 14:39:47 +00008911static unsigned short __ATTRS_o_ai vec_extract(vector unsigned short __a,
8912 int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008913 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00008914}
8915
Bill Seurer703e8482015-06-09 14:39:47 +00008916static int __ATTRS_o_ai vec_extract(vector int __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008917 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00008918}
8919
Bill Seurer703e8482015-06-09 14:39:47 +00008920static unsigned int __ATTRS_o_ai vec_extract(vector unsigned int __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008921 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00008922}
8923
Bill Seurer703e8482015-06-09 14:39:47 +00008924static float __ATTRS_o_ai vec_extract(vector float __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008925 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00008926}
8927
8928/* vec_insert */
8929
Bill Seurer703e8482015-06-09 14:39:47 +00008930static vector signed char __ATTRS_o_ai vec_insert(signed char __a,
8931 vector signed char __b,
8932 int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008933 __b[__c] = __a;
8934 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00008935}
8936
Bill Seurer703e8482015-06-09 14:39:47 +00008937static vector unsigned char __ATTRS_o_ai vec_insert(unsigned char __a,
8938 vector unsigned char __b,
8939 int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008940 __b[__c] = __a;
8941 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00008942}
8943
Bill Seurer703e8482015-06-09 14:39:47 +00008944static vector short __ATTRS_o_ai vec_insert(short __a, vector short __b,
8945 int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008946 __b[__c] = __a;
8947 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00008948}
8949
Bill Seurer703e8482015-06-09 14:39:47 +00008950static vector unsigned short __ATTRS_o_ai vec_insert(unsigned short __a,
8951 vector unsigned short __b,
8952 int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008953 __b[__c] = __a;
8954 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00008955}
8956
Bill Seurer703e8482015-06-09 14:39:47 +00008957static vector int __ATTRS_o_ai vec_insert(int __a, vector int __b, int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008958 __b[__c] = __a;
8959 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00008960}
8961
Bill Seurer703e8482015-06-09 14:39:47 +00008962static vector unsigned int __ATTRS_o_ai vec_insert(unsigned int __a,
8963 vector unsigned int __b,
8964 int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008965 __b[__c] = __a;
8966 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00008967}
8968
Bill Seurer703e8482015-06-09 14:39:47 +00008969static vector float __ATTRS_o_ai vec_insert(float __a, vector float __b,
8970 int __c) {
David Blaikie3302f2b2013-01-16 23:08:36 +00008971 __b[__c] = __a;
8972 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00008973}
8974
8975/* vec_lvlx */
8976
Bill Seurer703e8482015-06-09 14:39:47 +00008977static vector signed char __ATTRS_o_ai vec_lvlx(int __a,
8978 const signed char *__b) {
8979 return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00008980 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00008981}
8982
Bill Seurer703e8482015-06-09 14:39:47 +00008983static vector signed char __ATTRS_o_ai vec_lvlx(int __a,
8984 const vector signed char *__b) {
8985 return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00008986 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00008987}
8988
Bill Seurer703e8482015-06-09 14:39:47 +00008989static vector unsigned char __ATTRS_o_ai vec_lvlx(int __a,
8990 const unsigned char *__b) {
8991 return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00008992 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00008993}
8994
8995static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00008996vec_lvlx(int __a, const vector unsigned char *__b) {
8997 return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00008998 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00008999}
9000
Bill Seurer703e8482015-06-09 14:39:47 +00009001static vector bool char __ATTRS_o_ai vec_lvlx(int __a,
9002 const vector bool char *__b) {
9003 return vec_perm(vec_ld(__a, __b), (vector bool char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009004 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009005}
9006
Bill Seurer703e8482015-06-09 14:39:47 +00009007static vector short __ATTRS_o_ai vec_lvlx(int __a, const short *__b) {
9008 return vec_perm(vec_ld(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009009}
9010
Bill Seurer703e8482015-06-09 14:39:47 +00009011static vector short __ATTRS_o_ai vec_lvlx(int __a, const vector short *__b) {
9012 return vec_perm(vec_ld(__a, __b), (vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009013 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009014}
9015
Bill Seurer703e8482015-06-09 14:39:47 +00009016static vector unsigned short __ATTRS_o_ai vec_lvlx(int __a,
9017 const unsigned short *__b) {
9018 return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009019 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009020}
9021
9022static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009023vec_lvlx(int __a, const vector unsigned short *__b) {
9024 return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009025 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009026}
9027
Bill Seurer703e8482015-06-09 14:39:47 +00009028static vector bool short __ATTRS_o_ai vec_lvlx(int __a,
9029 const vector bool short *__b) {
9030 return vec_perm(vec_ld(__a, __b), (vector bool short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009031 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009032}
9033
Bill Seurer703e8482015-06-09 14:39:47 +00009034static vector pixel __ATTRS_o_ai vec_lvlx(int __a, const vector pixel *__b) {
9035 return vec_perm(vec_ld(__a, __b), (vector pixel)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009036 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009037}
9038
Bill Seurer703e8482015-06-09 14:39:47 +00009039static vector int __ATTRS_o_ai vec_lvlx(int __a, const int *__b) {
9040 return vec_perm(vec_ld(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009041}
9042
Bill Seurer703e8482015-06-09 14:39:47 +00009043static vector int __ATTRS_o_ai vec_lvlx(int __a, const vector int *__b) {
9044 return vec_perm(vec_ld(__a, __b), (vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009045 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009046}
9047
Bill Seurer703e8482015-06-09 14:39:47 +00009048static vector unsigned int __ATTRS_o_ai vec_lvlx(int __a,
9049 const unsigned int *__b) {
9050 return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009051 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009052}
9053
9054static vector unsigned int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009055vec_lvlx(int __a, const vector unsigned int *__b) {
9056 return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009057 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009058}
9059
Bill Seurer703e8482015-06-09 14:39:47 +00009060static vector bool int __ATTRS_o_ai vec_lvlx(int __a,
9061 const vector bool int *__b) {
9062 return vec_perm(vec_ld(__a, __b), (vector bool int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009063 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009064}
9065
Bill Seurer703e8482015-06-09 14:39:47 +00009066static vector float __ATTRS_o_ai vec_lvlx(int __a, const float *__b) {
9067 return vec_perm(vec_ld(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009068}
9069
Bill Seurer703e8482015-06-09 14:39:47 +00009070static vector float __ATTRS_o_ai vec_lvlx(int __a, const vector float *__b) {
9071 return vec_perm(vec_ld(__a, __b), (vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009072 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009073}
9074
9075/* vec_lvlxl */
9076
Bill Seurer703e8482015-06-09 14:39:47 +00009077static vector signed char __ATTRS_o_ai vec_lvlxl(int __a,
9078 const signed char *__b) {
9079 return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009080 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009081}
9082
9083static vector signed char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009084vec_lvlxl(int __a, const vector signed char *__b) {
9085 return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009086 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009087}
9088
Bill Seurer703e8482015-06-09 14:39:47 +00009089static vector unsigned char __ATTRS_o_ai vec_lvlxl(int __a,
9090 const unsigned char *__b) {
9091 return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009092 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009093}
9094
9095static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009096vec_lvlxl(int __a, const vector unsigned char *__b) {
9097 return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009098 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009099}
9100
Bill Seurer703e8482015-06-09 14:39:47 +00009101static vector bool char __ATTRS_o_ai vec_lvlxl(int __a,
9102 const vector bool char *__b) {
9103 return vec_perm(vec_ldl(__a, __b), (vector bool char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009104 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009105}
9106
Bill Seurer703e8482015-06-09 14:39:47 +00009107static vector short __ATTRS_o_ai vec_lvlxl(int __a, const short *__b) {
9108 return vec_perm(vec_ldl(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009109}
9110
Bill Seurer703e8482015-06-09 14:39:47 +00009111static vector short __ATTRS_o_ai vec_lvlxl(int __a, const vector short *__b) {
9112 return vec_perm(vec_ldl(__a, __b), (vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009113 vec_lvsl(__a, (unsigned char *)__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_lvlxl(int __a,
9117 const unsigned short *__b) {
9118 return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009119 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009120}
9121
9122static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009123vec_lvlxl(int __a, const vector unsigned short *__b) {
9124 return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009125 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009126}
9127
Bill Seurer703e8482015-06-09 14:39:47 +00009128static vector bool short __ATTRS_o_ai vec_lvlxl(int __a,
9129 const vector bool short *__b) {
9130 return vec_perm(vec_ldl(__a, __b), (vector bool short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009131 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009132}
9133
Bill Seurer703e8482015-06-09 14:39:47 +00009134static vector pixel __ATTRS_o_ai vec_lvlxl(int __a, const vector pixel *__b) {
9135 return vec_perm(vec_ldl(__a, __b), (vector pixel)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009136 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009137}
9138
Bill Seurer703e8482015-06-09 14:39:47 +00009139static vector int __ATTRS_o_ai vec_lvlxl(int __a, const int *__b) {
9140 return vec_perm(vec_ldl(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009141}
9142
Bill Seurer703e8482015-06-09 14:39:47 +00009143static vector int __ATTRS_o_ai vec_lvlxl(int __a, const vector int *__b) {
9144 return vec_perm(vec_ldl(__a, __b), (vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009145 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009146}
9147
Bill Seurer703e8482015-06-09 14:39:47 +00009148static vector unsigned int __ATTRS_o_ai vec_lvlxl(int __a,
9149 const unsigned int *__b) {
9150 return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009151 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009152}
9153
9154static vector unsigned int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009155vec_lvlxl(int __a, const vector unsigned int *__b) {
9156 return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009157 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009158}
9159
Bill Seurer703e8482015-06-09 14:39:47 +00009160static vector bool int __ATTRS_o_ai vec_lvlxl(int __a,
9161 const vector bool int *__b) {
9162 return vec_perm(vec_ldl(__a, __b), (vector bool int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009163 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009164}
9165
Bill Seurer703e8482015-06-09 14:39:47 +00009166static vector float __ATTRS_o_ai vec_lvlxl(int __a, const float *__b) {
9167 return vec_perm(vec_ldl(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009168}
9169
Bill Seurer703e8482015-06-09 14:39:47 +00009170static vector float __ATTRS_o_ai vec_lvlxl(int __a, vector float *__b) {
9171 return vec_perm(vec_ldl(__a, __b), (vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009172 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009173}
9174
9175/* vec_lvrx */
9176
Bill Seurer703e8482015-06-09 14:39:47 +00009177static vector signed char __ATTRS_o_ai vec_lvrx(int __a,
9178 const signed char *__b) {
9179 return vec_perm((vector signed char)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009180 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009181}
9182
Bill Seurer703e8482015-06-09 14:39:47 +00009183static vector signed char __ATTRS_o_ai vec_lvrx(int __a,
9184 const vector signed char *__b) {
9185 return vec_perm((vector signed char)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009186 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009187}
9188
Bill Seurer703e8482015-06-09 14:39:47 +00009189static vector unsigned char __ATTRS_o_ai vec_lvrx(int __a,
9190 const unsigned char *__b) {
9191 return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009192 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009193}
9194
9195static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009196vec_lvrx(int __a, const vector unsigned char *__b) {
9197 return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009198 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009199}
9200
Bill Seurer703e8482015-06-09 14:39:47 +00009201static vector bool char __ATTRS_o_ai vec_lvrx(int __a,
9202 const vector bool char *__b) {
9203 return vec_perm((vector bool char)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009204 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009205}
9206
Bill Seurer703e8482015-06-09 14:39:47 +00009207static vector short __ATTRS_o_ai vec_lvrx(int __a, const short *__b) {
9208 return vec_perm((vector short)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009209}
9210
Bill Seurer703e8482015-06-09 14:39:47 +00009211static vector short __ATTRS_o_ai vec_lvrx(int __a, const vector short *__b) {
9212 return vec_perm((vector short)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009213 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009214}
9215
Bill Seurer703e8482015-06-09 14:39:47 +00009216static vector unsigned short __ATTRS_o_ai vec_lvrx(int __a,
9217 const unsigned short *__b) {
9218 return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009219 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009220}
9221
9222static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009223vec_lvrx(int __a, const vector unsigned short *__b) {
9224 return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009225 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009226}
9227
Bill Seurer703e8482015-06-09 14:39:47 +00009228static vector bool short __ATTRS_o_ai vec_lvrx(int __a,
9229 const vector bool short *__b) {
9230 return vec_perm((vector bool short)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009231 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009232}
9233
Bill Seurer703e8482015-06-09 14:39:47 +00009234static vector pixel __ATTRS_o_ai vec_lvrx(int __a, const vector pixel *__b) {
9235 return vec_perm((vector pixel)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009236 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009237}
9238
Bill Seurer703e8482015-06-09 14:39:47 +00009239static vector int __ATTRS_o_ai vec_lvrx(int __a, const int *__b) {
9240 return vec_perm((vector int)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009241}
9242
Bill Seurer703e8482015-06-09 14:39:47 +00009243static vector int __ATTRS_o_ai vec_lvrx(int __a, const vector int *__b) {
9244 return vec_perm((vector int)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009245 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009246}
9247
Bill Seurer703e8482015-06-09 14:39:47 +00009248static vector unsigned int __ATTRS_o_ai vec_lvrx(int __a,
9249 const unsigned int *__b) {
9250 return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009251 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009252}
9253
9254static vector unsigned int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009255vec_lvrx(int __a, const vector unsigned int *__b) {
9256 return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009257 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009258}
9259
Bill Seurer703e8482015-06-09 14:39:47 +00009260static vector bool int __ATTRS_o_ai vec_lvrx(int __a,
9261 const vector bool int *__b) {
9262 return vec_perm((vector bool int)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009263 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009264}
9265
Bill Seurer703e8482015-06-09 14:39:47 +00009266static vector float __ATTRS_o_ai vec_lvrx(int __a, const float *__b) {
9267 return vec_perm((vector float)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009268}
9269
Bill Seurer703e8482015-06-09 14:39:47 +00009270static vector float __ATTRS_o_ai vec_lvrx(int __a, const vector float *__b) {
9271 return vec_perm((vector float)(0), vec_ld(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009272 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009273}
9274
9275/* vec_lvrxl */
9276
Bill Seurer703e8482015-06-09 14:39:47 +00009277static vector signed char __ATTRS_o_ai vec_lvrxl(int __a,
9278 const signed char *__b) {
9279 return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009280 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009281}
9282
9283static vector signed char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009284vec_lvrxl(int __a, const vector signed char *__b) {
9285 return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009286 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009287}
9288
Bill Seurer703e8482015-06-09 14:39:47 +00009289static vector unsigned char __ATTRS_o_ai vec_lvrxl(int __a,
9290 const unsigned char *__b) {
9291 return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009292 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009293}
9294
9295static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009296vec_lvrxl(int __a, const vector unsigned char *__b) {
9297 return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009298 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009299}
9300
Bill Seurer703e8482015-06-09 14:39:47 +00009301static vector bool char __ATTRS_o_ai vec_lvrxl(int __a,
9302 const vector bool char *__b) {
9303 return vec_perm((vector bool char)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009304 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009305}
9306
Bill Seurer703e8482015-06-09 14:39:47 +00009307static vector short __ATTRS_o_ai vec_lvrxl(int __a, const short *__b) {
9308 return vec_perm((vector short)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009309}
9310
Bill Seurer703e8482015-06-09 14:39:47 +00009311static vector short __ATTRS_o_ai vec_lvrxl(int __a, const vector short *__b) {
9312 return vec_perm((vector short)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009313 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009314}
9315
Bill Seurer703e8482015-06-09 14:39:47 +00009316static vector unsigned short __ATTRS_o_ai vec_lvrxl(int __a,
9317 const unsigned short *__b) {
9318 return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009319 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009320}
9321
9322static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009323vec_lvrxl(int __a, const vector unsigned short *__b) {
9324 return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009325 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009326}
9327
Bill Seurer703e8482015-06-09 14:39:47 +00009328static vector bool short __ATTRS_o_ai vec_lvrxl(int __a,
9329 const vector bool short *__b) {
9330 return vec_perm((vector bool short)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009331 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009332}
9333
Bill Seurer703e8482015-06-09 14:39:47 +00009334static vector pixel __ATTRS_o_ai vec_lvrxl(int __a, const vector pixel *__b) {
9335 return vec_perm((vector pixel)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009336 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009337}
9338
Bill Seurer703e8482015-06-09 14:39:47 +00009339static vector int __ATTRS_o_ai vec_lvrxl(int __a, const int *__b) {
9340 return vec_perm((vector int)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009341}
9342
Bill Seurer703e8482015-06-09 14:39:47 +00009343static vector int __ATTRS_o_ai vec_lvrxl(int __a, const vector int *__b) {
9344 return vec_perm((vector int)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009345 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009346}
9347
Bill Seurer703e8482015-06-09 14:39:47 +00009348static vector unsigned int __ATTRS_o_ai vec_lvrxl(int __a,
9349 const unsigned int *__b) {
9350 return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009351 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009352}
9353
9354static vector unsigned int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +00009355vec_lvrxl(int __a, const vector unsigned int *__b) {
9356 return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009357 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009358}
9359
Bill Seurer703e8482015-06-09 14:39:47 +00009360static vector bool int __ATTRS_o_ai vec_lvrxl(int __a,
9361 const vector bool int *__b) {
9362 return vec_perm((vector bool int)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009363 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009364}
9365
Bill Seurer703e8482015-06-09 14:39:47 +00009366static vector float __ATTRS_o_ai vec_lvrxl(int __a, const float *__b) {
9367 return vec_perm((vector float)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009368}
9369
Bill Seurer703e8482015-06-09 14:39:47 +00009370static vector float __ATTRS_o_ai vec_lvrxl(int __a, const vector float *__b) {
9371 return vec_perm((vector float)(0), vec_ldl(__a, __b),
David Blaikie3302f2b2013-01-16 23:08:36 +00009372 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009373}
9374
9375/* vec_stvlx */
9376
Bill Seurer703e8482015-06-09 14:39:47 +00009377static void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
9378 signed char *__c) {
9379 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9380 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009381}
9382
Bill Seurer703e8482015-06-09 14:39:47 +00009383static void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
9384 vector signed char *__c) {
9385 return vec_st(
9386 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9387 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009388}
9389
Bill Seurer703e8482015-06-09 14:39:47 +00009390static void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
9391 unsigned char *__c) {
9392 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9393 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009394}
9395
Bill Seurer703e8482015-06-09 14:39:47 +00009396static void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
9397 vector unsigned char *__c) {
9398 return vec_st(
9399 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9400 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009401}
9402
Bill Seurer703e8482015-06-09 14:39:47 +00009403static void __ATTRS_o_ai vec_stvlx(vector bool char __a, int __b,
9404 vector bool char *__c) {
9405 return vec_st(
9406 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9407 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009408}
9409
Bill Seurer703e8482015-06-09 14:39:47 +00009410static void __ATTRS_o_ai vec_stvlx(vector short __a, int __b, short *__c) {
9411 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9412 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009413}
9414
Bill Seurer703e8482015-06-09 14:39:47 +00009415static void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
9416 vector short *__c) {
9417 return vec_st(
9418 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9419 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009420}
9421
Bill Seurer703e8482015-06-09 14:39:47 +00009422static void __ATTRS_o_ai vec_stvlx(vector unsigned short __a, int __b,
9423 unsigned short *__c) {
9424 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9425 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009426}
9427
Bill Seurer703e8482015-06-09 14:39:47 +00009428static void __ATTRS_o_ai vec_stvlx(vector unsigned short __a, int __b,
9429 vector unsigned short *__c) {
9430 return vec_st(
9431 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9432 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009433}
9434
Bill Seurer703e8482015-06-09 14:39:47 +00009435static void __ATTRS_o_ai vec_stvlx(vector bool short __a, int __b,
9436 vector bool short *__c) {
9437 return vec_st(
9438 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9439 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009440}
9441
Bill Seurer703e8482015-06-09 14:39:47 +00009442static void __ATTRS_o_ai vec_stvlx(vector pixel __a, int __b,
9443 vector pixel *__c) {
9444 return vec_st(
9445 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9446 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009447}
9448
Bill Seurer703e8482015-06-09 14:39:47 +00009449static void __ATTRS_o_ai vec_stvlx(vector int __a, int __b, int *__c) {
9450 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9451 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009452}
9453
Bill Seurer703e8482015-06-09 14:39:47 +00009454static void __ATTRS_o_ai vec_stvlx(vector int __a, int __b, vector int *__c) {
9455 return vec_st(
9456 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9457 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009458}
9459
Bill Seurer703e8482015-06-09 14:39:47 +00009460static void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
9461 unsigned int *__c) {
9462 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9463 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009464}
9465
Bill Seurer703e8482015-06-09 14:39:47 +00009466static void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
9467 vector unsigned int *__c) {
9468 return vec_st(
9469 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9470 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009471}
9472
Bill Seurer703e8482015-06-09 14:39:47 +00009473static void __ATTRS_o_ai vec_stvlx(vector bool int __a, int __b,
9474 vector bool int *__c) {
9475 return vec_st(
9476 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9477 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009478}
9479
Bill Seurer703e8482015-06-09 14:39:47 +00009480static void __ATTRS_o_ai vec_stvlx(vector float __a, int __b,
9481 vector float *__c) {
9482 return vec_st(
9483 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9484 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009485}
9486
9487/* vec_stvlxl */
9488
Bill Seurer703e8482015-06-09 14:39:47 +00009489static void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
9490 signed char *__c) {
9491 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9492 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009493}
9494
Bill Seurer703e8482015-06-09 14:39:47 +00009495static void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
9496 vector signed char *__c) {
9497 return vec_stl(
9498 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9499 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009500}
9501
Bill Seurer703e8482015-06-09 14:39:47 +00009502static void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a, int __b,
9503 unsigned char *__c) {
9504 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9505 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009506}
9507
Bill Seurer703e8482015-06-09 14:39:47 +00009508static void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a, int __b,
9509 vector unsigned char *__c) {
9510 return vec_stl(
9511 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9512 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009513}
9514
Bill Seurer703e8482015-06-09 14:39:47 +00009515static void __ATTRS_o_ai vec_stvlxl(vector bool char __a, int __b,
9516 vector bool char *__c) {
9517 return vec_stl(
9518 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9519 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009520}
9521
Bill Seurer703e8482015-06-09 14:39:47 +00009522static void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b, short *__c) {
9523 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9524 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009525}
9526
Bill Seurer703e8482015-06-09 14:39:47 +00009527static void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
9528 vector short *__c) {
9529 return vec_stl(
9530 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9531 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009532}
9533
Bill Seurer703e8482015-06-09 14:39:47 +00009534static void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a, int __b,
9535 unsigned short *__c) {
9536 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9537 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009538}
9539
Bill Seurer703e8482015-06-09 14:39:47 +00009540static void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a, int __b,
9541 vector unsigned short *__c) {
9542 return vec_stl(
9543 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9544 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009545}
9546
Bill Seurer703e8482015-06-09 14:39:47 +00009547static void __ATTRS_o_ai vec_stvlxl(vector bool short __a, int __b,
9548 vector bool short *__c) {
9549 return vec_stl(
9550 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9551 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009552}
9553
Bill Seurer703e8482015-06-09 14:39:47 +00009554static void __ATTRS_o_ai vec_stvlxl(vector pixel __a, int __b,
9555 vector pixel *__c) {
9556 return vec_stl(
9557 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9558 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009559}
9560
Bill Seurer703e8482015-06-09 14:39:47 +00009561static void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b, int *__c) {
9562 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9563 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009564}
9565
Bill Seurer703e8482015-06-09 14:39:47 +00009566static void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b, vector int *__c) {
9567 return vec_stl(
9568 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9569 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009570}
9571
Bill Seurer703e8482015-06-09 14:39:47 +00009572static void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
9573 unsigned int *__c) {
9574 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
9575 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009576}
9577
Bill Seurer703e8482015-06-09 14:39:47 +00009578static void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
9579 vector unsigned int *__c) {
9580 return vec_stl(
9581 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9582 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009583}
9584
Bill Seurer703e8482015-06-09 14:39:47 +00009585static void __ATTRS_o_ai vec_stvlxl(vector bool int __a, int __b,
9586 vector bool int *__c) {
9587 return vec_stl(
9588 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9589 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009590}
9591
Bill Seurer703e8482015-06-09 14:39:47 +00009592static void __ATTRS_o_ai vec_stvlxl(vector float __a, int __b,
9593 vector float *__c) {
9594 return vec_stl(
9595 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
9596 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009597}
9598
9599/* vec_stvrx */
9600
Bill Seurer703e8482015-06-09 14:39:47 +00009601static void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
9602 signed char *__c) {
9603 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
9604 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009605}
9606
Bill Seurer703e8482015-06-09 14:39:47 +00009607static void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
9608 vector signed char *__c) {
9609 return vec_st(
9610 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9611 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009612}
9613
Bill Seurer703e8482015-06-09 14:39:47 +00009614static void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
9615 unsigned char *__c) {
9616 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), 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_stvrx(vector unsigned char __a, int __b,
9621 vector unsigned char *__c) {
9622 return vec_st(
9623 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9624 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009625}
9626
Bill Seurer703e8482015-06-09 14:39:47 +00009627static void __ATTRS_o_ai vec_stvrx(vector bool char __a, int __b,
9628 vector bool char *__c) {
9629 return vec_st(
9630 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9631 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009632}
9633
Bill Seurer703e8482015-06-09 14:39:47 +00009634static void __ATTRS_o_ai vec_stvrx(vector short __a, int __b, short *__c) {
9635 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
9636 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009637}
9638
Bill Seurer703e8482015-06-09 14:39:47 +00009639static void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
9640 vector short *__c) {
9641 return vec_st(
9642 vec_perm(__a, vec_lvlx(__b, __c), 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_stvrx(vector unsigned short __a, int __b,
9647 unsigned short *__c) {
9648 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
9649 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009650}
9651
Bill Seurer703e8482015-06-09 14:39:47 +00009652static void __ATTRS_o_ai vec_stvrx(vector unsigned short __a, int __b,
9653 vector unsigned short *__c) {
9654 return vec_st(
9655 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9656 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009657}
9658
Bill Seurer703e8482015-06-09 14:39:47 +00009659static void __ATTRS_o_ai vec_stvrx(vector bool short __a, int __b,
9660 vector bool short *__c) {
9661 return vec_st(
9662 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9663 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009664}
9665
Bill Seurer703e8482015-06-09 14:39:47 +00009666static void __ATTRS_o_ai vec_stvrx(vector pixel __a, int __b,
9667 vector pixel *__c) {
9668 return vec_st(
9669 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9670 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009671}
9672
Bill Seurer703e8482015-06-09 14:39:47 +00009673static void __ATTRS_o_ai vec_stvrx(vector int __a, int __b, int *__c) {
9674 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
9675 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009676}
9677
Bill Seurer703e8482015-06-09 14:39:47 +00009678static void __ATTRS_o_ai vec_stvrx(vector int __a, int __b, vector int *__c) {
9679 return vec_st(
9680 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9681 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009682}
9683
Bill Seurer703e8482015-06-09 14:39:47 +00009684static void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
9685 unsigned int *__c) {
9686 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
9687 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009688}
9689
Bill Seurer703e8482015-06-09 14:39:47 +00009690static void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
9691 vector unsigned int *__c) {
9692 return vec_st(
9693 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9694 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009695}
9696
Bill Seurer703e8482015-06-09 14:39:47 +00009697static void __ATTRS_o_ai vec_stvrx(vector bool int __a, int __b,
9698 vector bool int *__c) {
9699 return vec_st(
9700 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9701 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009702}
9703
Bill Seurer703e8482015-06-09 14:39:47 +00009704static void __ATTRS_o_ai vec_stvrx(vector float __a, int __b,
9705 vector float *__c) {
9706 return vec_st(
9707 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9708 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009709}
9710
9711/* vec_stvrxl */
9712
Bill Seurer703e8482015-06-09 14:39:47 +00009713static void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
9714 signed char *__c) {
9715 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
9716 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009717}
9718
Bill Seurer703e8482015-06-09 14:39:47 +00009719static void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
9720 vector signed char *__c) {
9721 return vec_stl(
9722 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9723 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009724}
9725
Bill Seurer703e8482015-06-09 14:39:47 +00009726static void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a, int __b,
9727 unsigned char *__c) {
9728 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), 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_stvrxl(vector unsigned char __a, int __b,
9733 vector unsigned char *__c) {
9734 return vec_stl(
9735 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9736 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009737}
9738
Bill Seurer703e8482015-06-09 14:39:47 +00009739static void __ATTRS_o_ai vec_stvrxl(vector bool char __a, int __b,
9740 vector bool char *__c) {
9741 return vec_stl(
9742 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9743 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009744}
9745
Bill Seurer703e8482015-06-09 14:39:47 +00009746static void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b, short *__c) {
9747 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
9748 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009749}
9750
Bill Seurer703e8482015-06-09 14:39:47 +00009751static void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
9752 vector short *__c) {
9753 return vec_stl(
9754 vec_perm(__a, vec_lvlx(__b, __c), 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_stvrxl(vector unsigned short __a, int __b,
9759 unsigned short *__c) {
9760 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
9761 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009762}
9763
Bill Seurer703e8482015-06-09 14:39:47 +00009764static void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a, int __b,
9765 vector unsigned short *__c) {
9766 return vec_stl(
9767 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9768 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009769}
9770
Bill Seurer703e8482015-06-09 14:39:47 +00009771static void __ATTRS_o_ai vec_stvrxl(vector bool short __a, int __b,
9772 vector bool short *__c) {
9773 return vec_stl(
9774 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9775 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009776}
9777
Bill Seurer703e8482015-06-09 14:39:47 +00009778static void __ATTRS_o_ai vec_stvrxl(vector pixel __a, int __b,
9779 vector pixel *__c) {
9780 return vec_stl(
9781 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9782 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009783}
9784
Bill Seurer703e8482015-06-09 14:39:47 +00009785static void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b, int *__c) {
9786 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
9787 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009788}
9789
Bill Seurer703e8482015-06-09 14:39:47 +00009790static void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b, vector int *__c) {
9791 return vec_stl(
9792 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9793 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009794}
9795
Bill Seurer703e8482015-06-09 14:39:47 +00009796static void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
9797 unsigned int *__c) {
9798 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
9799 __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009800}
9801
Bill Seurer703e8482015-06-09 14:39:47 +00009802static void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
9803 vector unsigned int *__c) {
9804 return vec_stl(
9805 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9806 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009807}
9808
Bill Seurer703e8482015-06-09 14:39:47 +00009809static void __ATTRS_o_ai vec_stvrxl(vector bool int __a, int __b,
9810 vector bool int *__c) {
9811 return vec_stl(
9812 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9813 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009814}
9815
Bill Seurer703e8482015-06-09 14:39:47 +00009816static void __ATTRS_o_ai vec_stvrxl(vector float __a, int __b,
9817 vector float *__c) {
9818 return vec_stl(
9819 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
9820 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009821}
9822
9823/* vec_promote */
9824
Bill Seurer703e8482015-06-09 14:39:47 +00009825static vector signed char __ATTRS_o_ai vec_promote(signed char __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009826 vector signed char __res = (vector signed char)(0);
9827 __res[__b] = __a;
9828 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +00009829}
9830
Bill Seurer703e8482015-06-09 14:39:47 +00009831static vector unsigned char __ATTRS_o_ai vec_promote(unsigned char __a,
9832 int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009833 vector unsigned char __res = (vector unsigned char)(0);
9834 __res[__b] = __a;
9835 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +00009836}
9837
Bill Seurer703e8482015-06-09 14:39:47 +00009838static vector short __ATTRS_o_ai vec_promote(short __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009839 vector short __res = (vector short)(0);
9840 __res[__b] = __a;
9841 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +00009842}
9843
Bill Seurer703e8482015-06-09 14:39:47 +00009844static vector unsigned short __ATTRS_o_ai vec_promote(unsigned short __a,
9845 int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009846 vector unsigned short __res = (vector unsigned short)(0);
9847 __res[__b] = __a;
9848 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +00009849}
9850
Bill Seurer703e8482015-06-09 14:39:47 +00009851static vector int __ATTRS_o_ai vec_promote(int __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009852 vector int __res = (vector int)(0);
9853 __res[__b] = __a;
9854 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +00009855}
9856
Bill Seurer703e8482015-06-09 14:39:47 +00009857static vector unsigned int __ATTRS_o_ai vec_promote(unsigned int __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009858 vector unsigned int __res = (vector unsigned int)(0);
9859 __res[__b] = __a;
9860 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +00009861}
9862
Bill Seurer703e8482015-06-09 14:39:47 +00009863static vector float __ATTRS_o_ai vec_promote(float __a, int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009864 vector float __res = (vector float)(0);
9865 __res[__b] = __a;
9866 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +00009867}
9868
9869/* vec_splats */
9870
Bill Seurer703e8482015-06-09 14:39:47 +00009871static vector signed char __ATTRS_o_ai vec_splats(signed char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009872 return (vector signed char)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +00009873}
9874
Bill Seurer703e8482015-06-09 14:39:47 +00009875static vector unsigned char __ATTRS_o_ai vec_splats(unsigned char __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009876 return (vector unsigned char)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +00009877}
9878
Bill Seurer703e8482015-06-09 14:39:47 +00009879static vector short __ATTRS_o_ai vec_splats(short __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009880 return (vector short)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +00009881}
9882
Bill Seurer703e8482015-06-09 14:39:47 +00009883static vector unsigned short __ATTRS_o_ai vec_splats(unsigned short __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009884 return (vector unsigned short)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +00009885}
9886
Bill Seurer703e8482015-06-09 14:39:47 +00009887static vector int __ATTRS_o_ai vec_splats(int __a) { return (vector int)(__a); }
Anton Yartsev73d40232010-10-14 14:37:46 +00009888
Bill Seurer703e8482015-06-09 14:39:47 +00009889static vector unsigned int __ATTRS_o_ai vec_splats(unsigned int __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009890 return (vector unsigned int)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +00009891}
9892
Bill Seurer703e8482015-06-09 14:39:47 +00009893static vector float __ATTRS_o_ai vec_splats(float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009894 return (vector float)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +00009895}
9896
Anton Yartsev79d6af32010-09-18 00:39:16 +00009897/* ----------------------------- predicates --------------------------------- */
Chris Lattnerdad40622010-04-14 03:54:58 +00009898
Chris Lattnerdad40622010-04-14 03:54:58 +00009899/* vec_all_eq */
9900
Bill Seurer703e8482015-06-09 14:39:47 +00009901static int __ATTRS_o_ai vec_all_eq(vector signed char __a,
9902 vector signed char __b) {
9903 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
9904 (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +00009905}
9906
Bill Seurer703e8482015-06-09 14:39:47 +00009907static int __ATTRS_o_ai vec_all_eq(vector signed char __a,
9908 vector bool char __b) {
9909 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
9910 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +00009911}
9912
Bill Seurer703e8482015-06-09 14:39:47 +00009913static int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
9914 vector unsigned char __b) {
9915 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
9916 (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +00009917}
9918
Bill Seurer703e8482015-06-09 14:39:47 +00009919static int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
9920 vector bool char __b) {
9921 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
9922 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +00009923}
9924
Bill Seurer703e8482015-06-09 14:39:47 +00009925static int __ATTRS_o_ai vec_all_eq(vector bool char __a,
9926 vector signed char __b) {
9927 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
9928 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +00009929}
9930
Bill Seurer703e8482015-06-09 14:39:47 +00009931static int __ATTRS_o_ai vec_all_eq(vector bool char __a,
9932 vector unsigned char __b) {
9933 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
9934 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +00009935}
9936
Bill Seurer703e8482015-06-09 14:39:47 +00009937static int __ATTRS_o_ai vec_all_eq(vector bool char __a, vector bool char __b) {
9938 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
9939 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +00009940}
9941
Bill Seurer703e8482015-06-09 14:39:47 +00009942static int __ATTRS_o_ai vec_all_eq(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009943 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00009944}
9945
Bill Seurer703e8482015-06-09 14:39:47 +00009946static int __ATTRS_o_ai vec_all_eq(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009947 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +00009948}
9949
Bill Seurer703e8482015-06-09 14:39:47 +00009950static int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
9951 vector unsigned short __b) {
9952 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
9953 (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +00009954}
9955
Bill Seurer703e8482015-06-09 14:39:47 +00009956static int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
9957 vector bool short __b) {
9958 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
9959 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +00009960}
9961
Bill Seurer703e8482015-06-09 14:39:47 +00009962static int __ATTRS_o_ai vec_all_eq(vector bool short __a, vector short __b) {
9963 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
9964 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +00009965}
9966
Bill Seurer703e8482015-06-09 14:39:47 +00009967static int __ATTRS_o_ai vec_all_eq(vector bool short __a,
9968 vector unsigned short __b) {
9969 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
9970 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +00009971}
9972
Bill Seurer703e8482015-06-09 14:39:47 +00009973static int __ATTRS_o_ai vec_all_eq(vector bool short __a,
9974 vector bool short __b) {
9975 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
9976 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +00009977}
9978
Bill Seurer703e8482015-06-09 14:39:47 +00009979static int __ATTRS_o_ai vec_all_eq(vector pixel __a, vector pixel __b) {
9980 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
9981 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +00009982}
9983
Bill Seurer703e8482015-06-09 14:39:47 +00009984static int __ATTRS_o_ai vec_all_eq(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009985 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00009986}
9987
Bill Seurer703e8482015-06-09 14:39:47 +00009988static int __ATTRS_o_ai vec_all_eq(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +00009989 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +00009990}
9991
Bill Seurer703e8482015-06-09 14:39:47 +00009992static int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
9993 vector unsigned int __b) {
9994 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
9995 (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +00009996}
9997
Bill Seurer703e8482015-06-09 14:39:47 +00009998static int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
9999 vector bool int __b) {
10000 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
10001 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010002}
10003
Bill Seurer703e8482015-06-09 14:39:47 +000010004static int __ATTRS_o_ai vec_all_eq(vector bool int __a, vector int __b) {
10005 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
10006 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010007}
10008
Bill Seurer703e8482015-06-09 14:39:47 +000010009static int __ATTRS_o_ai vec_all_eq(vector bool int __a,
10010 vector unsigned int __b) {
10011 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
10012 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010013}
10014
Bill Seurer703e8482015-06-09 14:39:47 +000010015static int __ATTRS_o_ai vec_all_eq(vector bool int __a, vector bool int __b) {
10016 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
10017 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010018}
10019
Kit Barton8553bec2015-03-11 15:57:19 +000010020#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000010021static int __ATTRS_o_ai vec_all_eq(vector signed long long __a,
10022 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010023 return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, __b);
10024}
10025
Bill Seurer703e8482015-06-09 14:39:47 +000010026static int __ATTRS_o_ai vec_all_eq(vector long long __a,
10027 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010028 return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, (vector long long)__b);
10029}
10030
Bill Seurer703e8482015-06-09 14:39:47 +000010031static int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
10032 vector unsigned long long __b) {
10033 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000010034 (vector long long)__b);
10035}
10036
Bill Seurer703e8482015-06-09 14:39:47 +000010037static int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
10038 vector bool long long __b) {
10039 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000010040 (vector long long)__b);
10041}
10042
Bill Seurer703e8482015-06-09 14:39:47 +000010043static int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
10044 vector long long __b) {
10045 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000010046 (vector long long)__b);
10047}
10048
Bill Seurer703e8482015-06-09 14:39:47 +000010049static int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
10050 vector unsigned long long __b) {
10051 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000010052 (vector long long)__b);
10053}
10054
Bill Seurer703e8482015-06-09 14:39:47 +000010055static int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
10056 vector bool long long __b) {
10057 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000010058 (vector long long)__b);
10059}
10060#endif
10061
Bill Seurer703e8482015-06-09 14:39:47 +000010062static int __ATTRS_o_ai vec_all_eq(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010063 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010064}
10065
10066/* vec_all_ge */
10067
Bill Seurer703e8482015-06-09 14:39:47 +000010068static int __ATTRS_o_ai vec_all_ge(vector signed char __a,
10069 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010070 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010071}
10072
Bill Seurer703e8482015-06-09 14:39:47 +000010073static int __ATTRS_o_ai vec_all_ge(vector signed char __a,
10074 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010075 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010076}
10077
Bill Seurer703e8482015-06-09 14:39:47 +000010078static int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
10079 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010080 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010081}
10082
Bill Seurer703e8482015-06-09 14:39:47 +000010083static int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
10084 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010085 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010086}
10087
Bill Seurer703e8482015-06-09 14:39:47 +000010088static int __ATTRS_o_ai vec_all_ge(vector bool char __a,
10089 vector signed char __b) {
10090 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010091 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010092}
10093
Bill Seurer703e8482015-06-09 14:39:47 +000010094static int __ATTRS_o_ai vec_all_ge(vector bool char __a,
10095 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010096 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010097}
10098
Bill Seurer703e8482015-06-09 14:39:47 +000010099static int __ATTRS_o_ai vec_all_ge(vector bool char __a, vector bool char __b) {
10100 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010101 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010102}
10103
Bill Seurer703e8482015-06-09 14:39:47 +000010104static int __ATTRS_o_ai vec_all_ge(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010105 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010106}
10107
Bill Seurer703e8482015-06-09 14:39:47 +000010108static int __ATTRS_o_ai vec_all_ge(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010109 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010110}
10111
Bill Seurer703e8482015-06-09 14:39:47 +000010112static int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
10113 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010114 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010115}
10116
Bill Seurer703e8482015-06-09 14:39:47 +000010117static int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
10118 vector bool short __b) {
10119 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
10120 __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010121}
10122
Bill Seurer703e8482015-06-09 14:39:47 +000010123static int __ATTRS_o_ai vec_all_ge(vector bool short __a, vector short __b) {
10124 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010125 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010126}
10127
Bill Seurer703e8482015-06-09 14:39:47 +000010128static int __ATTRS_o_ai vec_all_ge(vector bool short __a,
10129 vector unsigned short __b) {
10130 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010131 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010132}
10133
Bill Seurer703e8482015-06-09 14:39:47 +000010134static int __ATTRS_o_ai vec_all_ge(vector bool short __a,
10135 vector bool short __b) {
10136 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
10137 (vector unsigned short)__a);
10138}
10139
10140static int __ATTRS_o_ai vec_all_ge(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010141 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010142}
10143
Bill Seurer703e8482015-06-09 14:39:47 +000010144static int __ATTRS_o_ai vec_all_ge(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010145 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010146}
10147
Bill Seurer703e8482015-06-09 14:39:47 +000010148static int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
10149 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010150 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010151}
10152
Bill Seurer703e8482015-06-09 14:39:47 +000010153static int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
10154 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010155 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010156}
10157
Bill Seurer703e8482015-06-09 14:39:47 +000010158static int __ATTRS_o_ai vec_all_ge(vector bool int __a, vector int __b) {
10159 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010160 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010161}
10162
Bill Seurer703e8482015-06-09 14:39:47 +000010163static int __ATTRS_o_ai vec_all_ge(vector bool int __a,
10164 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010165 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010166}
10167
Bill Seurer703e8482015-06-09 14:39:47 +000010168static int __ATTRS_o_ai vec_all_ge(vector bool int __a, vector bool int __b) {
10169 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010170 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010171}
10172
Kit Barton8553bec2015-03-11 15:57:19 +000010173#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000010174static int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
10175 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010176 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, __a);
10177}
Bill Seurer703e8482015-06-09 14:39:47 +000010178static int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
10179 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010180 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__b,
10181 __a);
10182}
10183
Bill Seurer703e8482015-06-09 14:39:47 +000010184static int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
10185 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010186 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, __a);
10187}
10188
Bill Seurer703e8482015-06-09 14:39:47 +000010189static int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
10190 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010191 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
10192 __a);
10193}
10194
Bill Seurer703e8482015-06-09 14:39:47 +000010195static int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
10196 vector signed long long __b) {
10197 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
Kit Barton8553bec2015-03-11 15:57:19 +000010198 (vector unsigned long long)__a);
10199}
10200
Bill Seurer703e8482015-06-09 14:39:47 +000010201static int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
10202 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010203 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b,
10204 (vector unsigned long long)__a);
10205}
10206
Bill Seurer703e8482015-06-09 14:39:47 +000010207static int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
10208 vector bool long long __b) {
10209 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
Kit Barton8553bec2015-03-11 15:57:19 +000010210 (vector unsigned long long)__a);
10211}
10212#endif
10213
Bill Seurer703e8482015-06-09 14:39:47 +000010214static int __ATTRS_o_ai vec_all_ge(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010215 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010216}
10217
10218/* vec_all_gt */
10219
Bill Seurer703e8482015-06-09 14:39:47 +000010220static int __ATTRS_o_ai vec_all_gt(vector signed char __a,
10221 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010222 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010223}
10224
Bill Seurer703e8482015-06-09 14:39:47 +000010225static int __ATTRS_o_ai vec_all_gt(vector signed char __a,
10226 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010227 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010228}
10229
Bill Seurer703e8482015-06-09 14:39:47 +000010230static int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
10231 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010232 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010233}
10234
Bill Seurer703e8482015-06-09 14:39:47 +000010235static int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
10236 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010237 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010238}
10239
Bill Seurer703e8482015-06-09 14:39:47 +000010240static int __ATTRS_o_ai vec_all_gt(vector bool char __a,
10241 vector signed char __b) {
10242 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010243 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010244}
10245
Bill Seurer703e8482015-06-09 14:39:47 +000010246static int __ATTRS_o_ai vec_all_gt(vector bool char __a,
10247 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010248 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010249}
10250
Bill Seurer703e8482015-06-09 14:39:47 +000010251static int __ATTRS_o_ai vec_all_gt(vector bool char __a, vector bool char __b) {
10252 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010253 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010254}
10255
Bill Seurer703e8482015-06-09 14:39:47 +000010256static int __ATTRS_o_ai vec_all_gt(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010257 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010258}
10259
Bill Seurer703e8482015-06-09 14:39:47 +000010260static int __ATTRS_o_ai vec_all_gt(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010261 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010262}
10263
Bill Seurer703e8482015-06-09 14:39:47 +000010264static int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
10265 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010266 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010267}
10268
Bill Seurer703e8482015-06-09 14:39:47 +000010269static int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
10270 vector bool short __b) {
10271 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010272 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010273}
10274
Bill Seurer703e8482015-06-09 14:39:47 +000010275static int __ATTRS_o_ai vec_all_gt(vector bool short __a, vector short __b) {
10276 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010277 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010278}
10279
Bill Seurer703e8482015-06-09 14:39:47 +000010280static int __ATTRS_o_ai vec_all_gt(vector bool short __a,
10281 vector unsigned short __b) {
10282 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
10283 __b);
10284}
10285
10286static int __ATTRS_o_ai vec_all_gt(vector bool short __a,
10287 vector bool short __b) {
10288 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
10289 (vector unsigned short)__b);
10290}
10291
10292static int __ATTRS_o_ai vec_all_gt(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010293 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010294}
10295
Bill Seurer703e8482015-06-09 14:39:47 +000010296static int __ATTRS_o_ai vec_all_gt(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010297 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010298}
10299
Bill Seurer703e8482015-06-09 14:39:47 +000010300static int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
10301 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010302 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010303}
10304
Bill Seurer703e8482015-06-09 14:39:47 +000010305static int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
10306 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010307 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010308}
10309
Bill Seurer703e8482015-06-09 14:39:47 +000010310static int __ATTRS_o_ai vec_all_gt(vector bool int __a, vector int __b) {
10311 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010312 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010313}
10314
Bill Seurer703e8482015-06-09 14:39:47 +000010315static int __ATTRS_o_ai vec_all_gt(vector bool int __a,
10316 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010317 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010318}
10319
Bill Seurer703e8482015-06-09 14:39:47 +000010320static int __ATTRS_o_ai vec_all_gt(vector bool int __a, vector bool int __b) {
10321 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010322 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010323}
10324
Kit Barton8553bec2015-03-11 15:57:19 +000010325#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000010326static int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
10327 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010328 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, __b);
10329}
Bill Seurer703e8482015-06-09 14:39:47 +000010330static int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
10331 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010332 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a,
10333 (vector signed long long)__b);
10334}
10335
Bill Seurer703e8482015-06-09 14:39:47 +000010336static int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
10337 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010338 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, __b);
10339}
10340
Bill Seurer703e8482015-06-09 14:39:47 +000010341static int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
10342 vector bool long long __b) {
10343 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a,
Kit Barton8553bec2015-03-11 15:57:19 +000010344 (vector unsigned long long)__b);
10345}
10346
Bill Seurer703e8482015-06-09 14:39:47 +000010347static int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
10348 vector signed long long __b) {
10349 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000010350 (vector unsigned long long)__b);
10351}
10352
Bill Seurer703e8482015-06-09 14:39:47 +000010353static int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
10354 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010355 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
10356 __b);
10357}
10358
Bill Seurer703e8482015-06-09 14:39:47 +000010359static int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
10360 vector bool long long __b) {
10361 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000010362 (vector unsigned long long)__b);
10363}
10364#endif
10365
Bill Seurer703e8482015-06-09 14:39:47 +000010366static int __ATTRS_o_ai vec_all_gt(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010367 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010368}
10369
10370/* vec_all_in */
10371
10372static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000010373vec_all_in(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010374 return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010375}
10376
10377/* vec_all_le */
10378
Bill Seurer703e8482015-06-09 14:39:47 +000010379static int __ATTRS_o_ai vec_all_le(vector signed char __a,
10380 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010381 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010382}
10383
Bill Seurer703e8482015-06-09 14:39:47 +000010384static int __ATTRS_o_ai vec_all_le(vector signed char __a,
10385 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010386 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010387}
10388
Bill Seurer703e8482015-06-09 14:39:47 +000010389static int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
10390 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010391 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010392}
10393
Bill Seurer703e8482015-06-09 14:39:47 +000010394static int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
10395 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010396 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010397}
10398
Bill Seurer703e8482015-06-09 14:39:47 +000010399static int __ATTRS_o_ai vec_all_le(vector bool char __a,
10400 vector signed char __b) {
10401 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010402 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010403}
10404
Bill Seurer703e8482015-06-09 14:39:47 +000010405static int __ATTRS_o_ai vec_all_le(vector bool char __a,
10406 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010407 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010408}
10409
Bill Seurer703e8482015-06-09 14:39:47 +000010410static int __ATTRS_o_ai vec_all_le(vector bool char __a, vector bool char __b) {
10411 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010412 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010413}
10414
Bill Seurer703e8482015-06-09 14:39:47 +000010415static int __ATTRS_o_ai vec_all_le(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010416 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010417}
10418
Bill Seurer703e8482015-06-09 14:39:47 +000010419static int __ATTRS_o_ai vec_all_le(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010420 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010421}
10422
Bill Seurer703e8482015-06-09 14:39:47 +000010423static int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
10424 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010425 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010426}
10427
Bill Seurer703e8482015-06-09 14:39:47 +000010428static int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
10429 vector bool short __b) {
10430 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010431 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010432}
10433
Bill Seurer703e8482015-06-09 14:39:47 +000010434static int __ATTRS_o_ai vec_all_le(vector bool short __a, vector short __b) {
10435 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010436 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010437}
10438
Bill Seurer703e8482015-06-09 14:39:47 +000010439static int __ATTRS_o_ai vec_all_le(vector bool short __a,
10440 vector unsigned short __b) {
10441 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
10442 __b);
10443}
10444
10445static int __ATTRS_o_ai vec_all_le(vector bool short __a,
10446 vector bool short __b) {
10447 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
10448 (vector unsigned short)__b);
10449}
10450
10451static int __ATTRS_o_ai vec_all_le(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010452 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010453}
10454
Bill Seurer703e8482015-06-09 14:39:47 +000010455static int __ATTRS_o_ai vec_all_le(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010456 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010457}
10458
Bill Seurer703e8482015-06-09 14:39:47 +000010459static int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
10460 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010461 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010462}
10463
Bill Seurer703e8482015-06-09 14:39:47 +000010464static int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
10465 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010466 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010467}
10468
Bill Seurer703e8482015-06-09 14:39:47 +000010469static int __ATTRS_o_ai vec_all_le(vector bool int __a, vector int __b) {
10470 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010471 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010472}
10473
Bill Seurer703e8482015-06-09 14:39:47 +000010474static int __ATTRS_o_ai vec_all_le(vector bool int __a,
10475 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010476 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010477}
10478
Bill Seurer703e8482015-06-09 14:39:47 +000010479static int __ATTRS_o_ai vec_all_le(vector bool int __a, vector bool int __b) {
10480 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010481 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010482}
10483
Kit Barton8553bec2015-03-11 15:57:19 +000010484#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000010485static int __ATTRS_o_ai vec_all_le(vector signed long long __a,
10486 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010487 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, __b);
10488}
10489
Bill Seurer703e8482015-06-09 14:39:47 +000010490static int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
10491 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010492 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, __b);
10493}
10494
Bill Seurer703e8482015-06-09 14:39:47 +000010495static int __ATTRS_o_ai vec_all_le(vector signed long long __a,
10496 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010497 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a,
10498 (vector signed long long)__b);
10499}
10500
Bill Seurer703e8482015-06-09 14:39:47 +000010501static int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
10502 vector bool long long __b) {
10503 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a,
Kit Barton8553bec2015-03-11 15:57:19 +000010504 (vector unsigned long long)__b);
10505}
10506
Bill Seurer703e8482015-06-09 14:39:47 +000010507static int __ATTRS_o_ai vec_all_le(vector bool long long __a,
10508 vector signed long long __b) {
10509 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__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_le(vector bool long long __a,
10514 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010515 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
10516 __b);
10517}
10518
Bill Seurer703e8482015-06-09 14:39:47 +000010519static int __ATTRS_o_ai vec_all_le(vector bool long long __a,
10520 vector bool long long __b) {
10521 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000010522 (vector unsigned long long)__b);
10523}
10524#endif
10525
Bill Seurer703e8482015-06-09 14:39:47 +000010526static int __ATTRS_o_ai vec_all_le(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010527 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010528}
10529
10530/* vec_all_lt */
10531
Bill Seurer703e8482015-06-09 14:39:47 +000010532static int __ATTRS_o_ai vec_all_lt(vector signed char __a,
10533 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010534 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010535}
10536
Bill Seurer703e8482015-06-09 14:39:47 +000010537static int __ATTRS_o_ai vec_all_lt(vector signed char __a,
10538 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010539 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010540}
10541
Bill Seurer703e8482015-06-09 14:39:47 +000010542static int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
10543 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010544 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010545}
10546
Bill Seurer703e8482015-06-09 14:39:47 +000010547static int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
10548 vector bool char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010549 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010550}
10551
Bill Seurer703e8482015-06-09 14:39:47 +000010552static int __ATTRS_o_ai vec_all_lt(vector bool char __a,
10553 vector signed char __b) {
10554 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010555 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010556}
10557
Bill Seurer703e8482015-06-09 14:39:47 +000010558static int __ATTRS_o_ai vec_all_lt(vector bool char __a,
10559 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010560 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010561}
10562
Bill Seurer703e8482015-06-09 14:39:47 +000010563static int __ATTRS_o_ai vec_all_lt(vector bool char __a, vector bool char __b) {
10564 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010565 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010566}
10567
Bill Seurer703e8482015-06-09 14:39:47 +000010568static int __ATTRS_o_ai vec_all_lt(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010569 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010570}
10571
Bill Seurer703e8482015-06-09 14:39:47 +000010572static int __ATTRS_o_ai vec_all_lt(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010573 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010574}
10575
Bill Seurer703e8482015-06-09 14:39:47 +000010576static int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
10577 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010578 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010579}
10580
Bill Seurer703e8482015-06-09 14:39:47 +000010581static int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
10582 vector bool short __b) {
10583 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
10584 __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010585}
10586
Bill Seurer703e8482015-06-09 14:39:47 +000010587static int __ATTRS_o_ai vec_all_lt(vector bool short __a, vector short __b) {
10588 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010589 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010590}
10591
Bill Seurer703e8482015-06-09 14:39:47 +000010592static int __ATTRS_o_ai vec_all_lt(vector bool short __a,
10593 vector unsigned short __b) {
10594 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010595 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010596}
10597
Bill Seurer703e8482015-06-09 14:39:47 +000010598static int __ATTRS_o_ai vec_all_lt(vector bool short __a,
10599 vector bool short __b) {
10600 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
10601 (vector unsigned short)__a);
10602}
10603
10604static int __ATTRS_o_ai vec_all_lt(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010605 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010606}
10607
Bill Seurer703e8482015-06-09 14:39:47 +000010608static int __ATTRS_o_ai vec_all_lt(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010609 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010610}
10611
Bill Seurer703e8482015-06-09 14:39:47 +000010612static int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
10613 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010614 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010615}
10616
Bill Seurer703e8482015-06-09 14:39:47 +000010617static int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
10618 vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010619 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010620}
10621
Bill Seurer703e8482015-06-09 14:39:47 +000010622static int __ATTRS_o_ai vec_all_lt(vector bool int __a, vector int __b) {
10623 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010624 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010625}
10626
Bill Seurer703e8482015-06-09 14:39:47 +000010627static int __ATTRS_o_ai vec_all_lt(vector bool int __a,
10628 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010629 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010630}
10631
Bill Seurer703e8482015-06-09 14:39:47 +000010632static int __ATTRS_o_ai vec_all_lt(vector bool int __a, vector bool int __b) {
10633 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000010634 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010635}
10636
Kit Barton8553bec2015-03-11 15:57:19 +000010637#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000010638static int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
10639 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010640 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, __a);
10641}
10642
Bill Seurer703e8482015-06-09 14:39:47 +000010643static int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
10644 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010645 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, __a);
10646}
10647
Bill Seurer703e8482015-06-09 14:39:47 +000010648static int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
10649 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010650 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__b,
10651 __a);
10652}
10653
Bill Seurer703e8482015-06-09 14:39:47 +000010654static int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
10655 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010656 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
10657 __a);
10658}
10659
Bill Seurer703e8482015-06-09 14:39:47 +000010660static int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
10661 vector signed long long __b) {
10662 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
Kit Barton8553bec2015-03-11 15:57:19 +000010663 (vector unsigned long long)__a);
10664}
10665
Bill Seurer703e8482015-06-09 14:39:47 +000010666static int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
10667 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010668 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b,
10669 (vector unsigned long long)__a);
10670}
10671
Bill Seurer703e8482015-06-09 14:39:47 +000010672static int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
10673 vector bool long long __b) {
10674 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
Kit Barton8553bec2015-03-11 15:57:19 +000010675 (vector unsigned long long)__a);
10676}
10677#endif
10678
Bill Seurer703e8482015-06-09 14:39:47 +000010679static int __ATTRS_o_ai vec_all_lt(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010680 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010681}
10682
10683/* vec_all_nan */
10684
Bill Seurer703e8482015-06-09 14:39:47 +000010685static int __attribute__((__always_inline__)) vec_all_nan(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010686 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010687}
10688
10689/* vec_all_ne */
10690
Bill Seurer703e8482015-06-09 14:39:47 +000010691static int __ATTRS_o_ai vec_all_ne(vector signed char __a,
10692 vector signed char __b) {
10693 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
10694 (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010695}
10696
Bill Seurer703e8482015-06-09 14:39:47 +000010697static int __ATTRS_o_ai vec_all_ne(vector signed char __a,
10698 vector bool char __b) {
10699 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
10700 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010701}
10702
Bill Seurer703e8482015-06-09 14:39:47 +000010703static int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
10704 vector unsigned char __b) {
10705 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
10706 (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010707}
10708
Bill Seurer703e8482015-06-09 14:39:47 +000010709static int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
10710 vector bool char __b) {
10711 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
10712 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010713}
10714
Bill Seurer703e8482015-06-09 14:39:47 +000010715static int __ATTRS_o_ai vec_all_ne(vector bool char __a,
10716 vector signed char __b) {
10717 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
10718 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010719}
10720
Bill Seurer703e8482015-06-09 14:39:47 +000010721static int __ATTRS_o_ai vec_all_ne(vector bool char __a,
10722 vector unsigned char __b) {
10723 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
10724 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010725}
10726
Bill Seurer703e8482015-06-09 14:39:47 +000010727static int __ATTRS_o_ai vec_all_ne(vector bool char __a, vector bool char __b) {
10728 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
10729 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010730}
10731
Bill Seurer703e8482015-06-09 14:39:47 +000010732static int __ATTRS_o_ai vec_all_ne(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010733 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010734}
10735
Bill Seurer703e8482015-06-09 14:39:47 +000010736static int __ATTRS_o_ai vec_all_ne(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010737 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010738}
10739
Bill Seurer703e8482015-06-09 14:39:47 +000010740static int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
10741 vector unsigned short __b) {
10742 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
10743 (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010744}
10745
Bill Seurer703e8482015-06-09 14:39:47 +000010746static int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
10747 vector bool short __b) {
10748 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
10749 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010750}
10751
Bill Seurer703e8482015-06-09 14:39:47 +000010752static int __ATTRS_o_ai vec_all_ne(vector bool short __a, vector short __b) {
10753 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
10754 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010755}
10756
Bill Seurer703e8482015-06-09 14:39:47 +000010757static int __ATTRS_o_ai vec_all_ne(vector bool short __a,
10758 vector unsigned short __b) {
10759 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
10760 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010761}
10762
Bill Seurer703e8482015-06-09 14:39:47 +000010763static int __ATTRS_o_ai vec_all_ne(vector bool short __a,
10764 vector bool short __b) {
10765 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
10766 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010767}
10768
Bill Seurer703e8482015-06-09 14:39:47 +000010769static int __ATTRS_o_ai vec_all_ne(vector pixel __a, vector pixel __b) {
10770 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
10771 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010772}
10773
Bill Seurer703e8482015-06-09 14:39:47 +000010774static int __ATTRS_o_ai vec_all_ne(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010775 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010776}
10777
Bill Seurer703e8482015-06-09 14:39:47 +000010778static int __ATTRS_o_ai vec_all_ne(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010779 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010780}
10781
Bill Seurer703e8482015-06-09 14:39:47 +000010782static int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
10783 vector unsigned int __b) {
10784 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
10785 (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010786}
10787
Bill Seurer703e8482015-06-09 14:39:47 +000010788static int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
10789 vector bool int __b) {
10790 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
10791 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010792}
10793
Bill Seurer703e8482015-06-09 14:39:47 +000010794static int __ATTRS_o_ai vec_all_ne(vector bool int __a, vector int __b) {
10795 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
10796 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010797}
10798
Bill Seurer703e8482015-06-09 14:39:47 +000010799static int __ATTRS_o_ai vec_all_ne(vector bool int __a,
10800 vector unsigned int __b) {
10801 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
10802 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010803}
10804
Bill Seurer703e8482015-06-09 14:39:47 +000010805static int __ATTRS_o_ai vec_all_ne(vector bool int __a, vector bool int __b) {
10806 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
10807 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010808}
10809
Kit Barton8553bec2015-03-11 15:57:19 +000010810#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000010811static int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
10812 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010813 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, __b);
10814}
10815
Bill Seurer703e8482015-06-09 14:39:47 +000010816static int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
10817 vector unsigned long long __b) {
10818 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000010819 (vector long long)__b);
10820}
10821
Bill Seurer703e8482015-06-09 14:39:47 +000010822static int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
10823 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010824 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a,
10825 (vector signed long long)__b);
10826}
10827
Bill Seurer703e8482015-06-09 14:39:47 +000010828static int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
10829 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000010830 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
10831 (vector signed long long)__b);
10832}
10833
Bill Seurer703e8482015-06-09 14:39:47 +000010834static int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
10835 vector signed long long __b) {
10836 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000010837 (vector signed long long)__b);
10838}
10839
Bill Seurer703e8482015-06-09 14:39:47 +000010840static int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
10841 vector unsigned long long __b) {
10842 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
10843 (vector signed long long)__b);
10844}
10845
10846static int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
10847 vector bool long long __b) {
10848 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
Kit Barton8553bec2015-03-11 15:57:19 +000010849 (vector signed long long)__b);
10850}
10851#endif
10852
Bill Seurer703e8482015-06-09 14:39:47 +000010853static int __ATTRS_o_ai vec_all_ne(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010854 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010855}
10856
10857/* vec_all_nge */
10858
10859static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000010860vec_all_nge(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010861 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010862}
10863
10864/* vec_all_ngt */
10865
10866static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000010867vec_all_ngt(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010868 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010869}
10870
10871/* vec_all_nle */
10872
10873static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000010874vec_all_nle(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010875 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010876}
10877
10878/* vec_all_nlt */
10879
10880static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000010881vec_all_nlt(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010882 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010883}
10884
10885/* vec_all_numeric */
10886
10887static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000010888vec_all_numeric(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010889 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010890}
10891
10892/* vec_any_eq */
10893
Bill Seurer703e8482015-06-09 14:39:47 +000010894static int __ATTRS_o_ai vec_any_eq(vector signed char __a,
10895 vector signed char __b) {
10896 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
10897 (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010898}
10899
Bill Seurer703e8482015-06-09 14:39:47 +000010900static int __ATTRS_o_ai vec_any_eq(vector signed char __a,
10901 vector bool char __b) {
10902 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
10903 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010904}
10905
Bill Seurer703e8482015-06-09 14:39:47 +000010906static int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
10907 vector unsigned char __b) {
10908 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
10909 (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010910}
10911
Bill Seurer703e8482015-06-09 14:39:47 +000010912static int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
10913 vector bool char __b) {
10914 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
10915 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010916}
10917
Bill Seurer703e8482015-06-09 14:39:47 +000010918static int __ATTRS_o_ai vec_any_eq(vector bool char __a,
10919 vector signed char __b) {
10920 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
10921 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010922}
10923
Bill Seurer703e8482015-06-09 14:39:47 +000010924static int __ATTRS_o_ai vec_any_eq(vector bool char __a,
10925 vector unsigned char __b) {
10926 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
10927 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010928}
10929
Bill Seurer703e8482015-06-09 14:39:47 +000010930static int __ATTRS_o_ai vec_any_eq(vector bool char __a, vector bool char __b) {
10931 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
10932 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010933}
10934
Bill Seurer703e8482015-06-09 14:39:47 +000010935static int __ATTRS_o_ai vec_any_eq(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010936 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010937}
10938
Bill Seurer703e8482015-06-09 14:39:47 +000010939static int __ATTRS_o_ai vec_any_eq(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010940 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010941}
10942
Bill Seurer703e8482015-06-09 14:39:47 +000010943static int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
10944 vector unsigned short __b) {
10945 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010946 (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010947}
10948
Bill Seurer703e8482015-06-09 14:39:47 +000010949static int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
10950 vector bool short __b) {
10951 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010952 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010953}
10954
Bill Seurer703e8482015-06-09 14:39:47 +000010955static int __ATTRS_o_ai vec_any_eq(vector bool short __a, vector short __b) {
10956 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010957 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010958}
10959
Bill Seurer703e8482015-06-09 14:39:47 +000010960static int __ATTRS_o_ai vec_any_eq(vector bool short __a,
10961 vector unsigned short __b) {
10962 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010963 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010964}
10965
Bill Seurer703e8482015-06-09 14:39:47 +000010966static int __ATTRS_o_ai vec_any_eq(vector bool short __a,
10967 vector bool short __b) {
10968 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010969 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010970}
10971
Bill Seurer703e8482015-06-09 14:39:47 +000010972static int __ATTRS_o_ai vec_any_eq(vector pixel __a, vector pixel __b) {
10973 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000010974 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010975}
10976
Bill Seurer703e8482015-06-09 14:39:47 +000010977static int __ATTRS_o_ai vec_any_eq(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010978 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010979}
10980
Bill Seurer703e8482015-06-09 14:39:47 +000010981static int __ATTRS_o_ai vec_any_eq(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000010982 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010983}
10984
Bill Seurer703e8482015-06-09 14:39:47 +000010985static int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
10986 vector unsigned int __b) {
10987 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
10988 (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010989}
10990
Bill Seurer703e8482015-06-09 14:39:47 +000010991static int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
10992 vector bool int __b) {
10993 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
10994 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010995}
10996
Bill Seurer703e8482015-06-09 14:39:47 +000010997static int __ATTRS_o_ai vec_any_eq(vector bool int __a, vector int __b) {
10998 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
10999 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011000}
11001
Bill Seurer703e8482015-06-09 14:39:47 +000011002static int __ATTRS_o_ai vec_any_eq(vector bool int __a,
11003 vector unsigned int __b) {
11004 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
11005 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011006}
11007
Bill Seurer703e8482015-06-09 14:39:47 +000011008static int __ATTRS_o_ai vec_any_eq(vector bool int __a, vector bool int __b) {
11009 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
11010 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011011}
11012
Kit Barton8553bec2015-03-11 15:57:19 +000011013#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000011014static int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
11015 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011016 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, __b);
11017}
11018
Bill Seurer703e8482015-06-09 14:39:47 +000011019static int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
11020 vector unsigned long long __b) {
11021 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector long long)__a,
11022 (vector long long)__b);
Kit Barton8553bec2015-03-11 15:57:19 +000011023}
11024
Bill Seurer703e8482015-06-09 14:39:47 +000011025static int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
11026 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011027 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a,
11028 (vector signed long long)__b);
11029}
11030
Bill Seurer703e8482015-06-09 14:39:47 +000011031static int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
11032 vector bool long long __b) {
11033 return __builtin_altivec_vcmpequd_p(
11034 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
Kit Barton8553bec2015-03-11 15:57:19 +000011035}
11036
Bill Seurer703e8482015-06-09 14:39:47 +000011037static int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
11038 vector signed long long __b) {
11039 return __builtin_altivec_vcmpequd_p(
11040 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
Kit Barton8553bec2015-03-11 15:57:19 +000011041}
11042
Bill Seurer703e8482015-06-09 14:39:47 +000011043static int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
11044 vector unsigned long long __b) {
11045 return __builtin_altivec_vcmpequd_p(
11046 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
Kit Barton8553bec2015-03-11 15:57:19 +000011047}
11048
Bill Seurer703e8482015-06-09 14:39:47 +000011049static int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
11050 vector bool long long __b) {
11051 return __builtin_altivec_vcmpequd_p(
11052 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
Kit Barton8553bec2015-03-11 15:57:19 +000011053}
11054#endif
11055
Bill Seurer703e8482015-06-09 14:39:47 +000011056static int __ATTRS_o_ai vec_any_eq(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011057 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011058}
11059
11060/* vec_any_ge */
11061
Bill Seurer703e8482015-06-09 14:39:47 +000011062static int __ATTRS_o_ai vec_any_ge(vector signed char __a,
11063 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011064 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011065}
11066
Bill Seurer703e8482015-06-09 14:39:47 +000011067static int __ATTRS_o_ai vec_any_ge(vector signed char __a,
11068 vector bool char __b) {
11069 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b,
11070 __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011071}
11072
Bill Seurer703e8482015-06-09 14:39:47 +000011073static int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
11074 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011075 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011076}
11077
Bill Seurer703e8482015-06-09 14:39:47 +000011078static int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
11079 vector bool char __b) {
11080 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
11081 __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011082}
11083
Bill Seurer703e8482015-06-09 14:39:47 +000011084static int __ATTRS_o_ai vec_any_ge(vector bool char __a,
11085 vector signed char __b) {
11086 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011087 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011088}
11089
Bill Seurer703e8482015-06-09 14:39:47 +000011090static int __ATTRS_o_ai vec_any_ge(vector bool char __a,
11091 vector unsigned char __b) {
11092 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011093 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011094}
11095
Bill Seurer703e8482015-06-09 14:39:47 +000011096static int __ATTRS_o_ai vec_any_ge(vector bool char __a, vector bool char __b) {
11097 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
11098 (vector unsigned char)__a);
11099}
11100
11101static int __ATTRS_o_ai vec_any_ge(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011102 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011103}
11104
Bill Seurer703e8482015-06-09 14:39:47 +000011105static int __ATTRS_o_ai vec_any_ge(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011106 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011107}
11108
Bill Seurer703e8482015-06-09 14:39:47 +000011109static int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
11110 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011111 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011112}
11113
Bill Seurer703e8482015-06-09 14:39:47 +000011114static int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
11115 vector bool short __b) {
11116 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
11117 __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011118}
11119
Bill Seurer703e8482015-06-09 14:39:47 +000011120static int __ATTRS_o_ai vec_any_ge(vector bool short __a, vector short __b) {
11121 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011122 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011123}
11124
Bill Seurer703e8482015-06-09 14:39:47 +000011125static int __ATTRS_o_ai vec_any_ge(vector bool short __a,
11126 vector unsigned short __b) {
11127 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011128 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011129}
11130
Bill Seurer703e8482015-06-09 14:39:47 +000011131static int __ATTRS_o_ai vec_any_ge(vector bool short __a,
11132 vector bool short __b) {
11133 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
11134 (vector unsigned short)__a);
11135}
11136
11137static int __ATTRS_o_ai vec_any_ge(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011138 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011139}
11140
Bill Seurer703e8482015-06-09 14:39:47 +000011141static int __ATTRS_o_ai vec_any_ge(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011142 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011143}
11144
Bill Seurer703e8482015-06-09 14:39:47 +000011145static int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
11146 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011147 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011148}
11149
Bill Seurer703e8482015-06-09 14:39:47 +000011150static int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
11151 vector bool int __b) {
11152 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
11153 __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011154}
11155
Bill Seurer703e8482015-06-09 14:39:47 +000011156static int __ATTRS_o_ai vec_any_ge(vector bool int __a, vector int __b) {
11157 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011158 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011159}
11160
Bill Seurer703e8482015-06-09 14:39:47 +000011161static int __ATTRS_o_ai vec_any_ge(vector bool int __a,
11162 vector unsigned int __b) {
11163 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b,
11164 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011165}
11166
Bill Seurer703e8482015-06-09 14:39:47 +000011167static int __ATTRS_o_ai vec_any_ge(vector bool int __a, vector bool int __b) {
11168 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011169 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011170}
11171
Kit Barton8553bec2015-03-11 15:57:19 +000011172#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000011173static int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
11174 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011175 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, __a);
11176}
11177
Bill Seurer703e8482015-06-09 14:39:47 +000011178static int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
11179 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011180 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, __a);
11181}
11182
Bill Seurer703e8482015-06-09 14:39:47 +000011183static int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
11184 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011185 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV,
11186 (vector signed long long)__b, __a);
11187}
11188
Bill Seurer703e8482015-06-09 14:39:47 +000011189static int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
11190 vector bool long long __b) {
11191 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
Kit Barton8553bec2015-03-11 15:57:19 +000011192 (vector unsigned long long)__b, __a);
11193}
11194
Bill Seurer703e8482015-06-09 14:39:47 +000011195static int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
11196 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011197 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
11198 (vector unsigned long long)__b,
11199 (vector unsigned long long)__a);
11200}
11201
Bill Seurer703e8482015-06-09 14:39:47 +000011202static int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
11203 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011204 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b,
11205 (vector unsigned long long)__a);
11206}
11207
Bill Seurer703e8482015-06-09 14:39:47 +000011208static int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
11209 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011210 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
11211 (vector unsigned long long)__b,
11212 (vector unsigned long long)__a);
11213}
11214#endif
11215
Bill Seurer703e8482015-06-09 14:39:47 +000011216static int __ATTRS_o_ai vec_any_ge(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011217 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011218}
11219
11220/* vec_any_gt */
11221
Bill Seurer703e8482015-06-09 14:39:47 +000011222static int __ATTRS_o_ai vec_any_gt(vector signed char __a,
11223 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011224 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011225}
11226
Bill Seurer703e8482015-06-09 14:39:47 +000011227static int __ATTRS_o_ai vec_any_gt(vector signed char __a,
11228 vector bool char __b) {
11229 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a,
11230 (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011231}
11232
Bill Seurer703e8482015-06-09 14:39:47 +000011233static int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
11234 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011235 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011236}
11237
Bill Seurer703e8482015-06-09 14:39:47 +000011238static int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
11239 vector bool char __b) {
11240 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011241 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011242}
11243
Bill Seurer703e8482015-06-09 14:39:47 +000011244static int __ATTRS_o_ai vec_any_gt(vector bool char __a,
11245 vector signed char __b) {
11246 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011247 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011248}
11249
Bill Seurer703e8482015-06-09 14:39:47 +000011250static int __ATTRS_o_ai vec_any_gt(vector bool char __a,
11251 vector unsigned char __b) {
11252 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
11253 __b);
11254}
11255
11256static int __ATTRS_o_ai vec_any_gt(vector bool char __a, vector bool char __b) {
11257 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
11258 (vector unsigned char)__b);
11259}
11260
11261static int __ATTRS_o_ai vec_any_gt(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011262 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011263}
11264
Bill Seurer703e8482015-06-09 14:39:47 +000011265static int __ATTRS_o_ai vec_any_gt(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011266 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011267}
11268
Bill Seurer703e8482015-06-09 14:39:47 +000011269static int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
11270 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011271 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011272}
11273
Bill Seurer703e8482015-06-09 14:39:47 +000011274static int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
11275 vector bool short __b) {
11276 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011277 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011278}
11279
Bill Seurer703e8482015-06-09 14:39:47 +000011280static int __ATTRS_o_ai vec_any_gt(vector bool short __a, vector short __b) {
11281 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011282 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011283}
11284
Bill Seurer703e8482015-06-09 14:39:47 +000011285static int __ATTRS_o_ai vec_any_gt(vector bool short __a,
11286 vector unsigned short __b) {
11287 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
11288 __b);
11289}
11290
11291static int __ATTRS_o_ai vec_any_gt(vector bool short __a,
11292 vector bool short __b) {
11293 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
11294 (vector unsigned short)__b);
11295}
11296
11297static int __ATTRS_o_ai vec_any_gt(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011298 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011299}
11300
Bill Seurer703e8482015-06-09 14:39:47 +000011301static int __ATTRS_o_ai vec_any_gt(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011302 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011303}
11304
Bill Seurer703e8482015-06-09 14:39:47 +000011305static int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
11306 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011307 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011308}
11309
Bill Seurer703e8482015-06-09 14:39:47 +000011310static int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
11311 vector bool int __b) {
11312 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011313 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011314}
11315
Bill Seurer703e8482015-06-09 14:39:47 +000011316static int __ATTRS_o_ai vec_any_gt(vector bool int __a, vector int __b) {
11317 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
11318 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011319}
11320
Bill Seurer703e8482015-06-09 14:39:47 +000011321static int __ATTRS_o_ai vec_any_gt(vector bool int __a,
11322 vector unsigned int __b) {
11323 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
11324 __b);
11325}
11326
11327static int __ATTRS_o_ai vec_any_gt(vector bool int __a, vector bool int __b) {
11328 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011329 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011330}
11331
Kit Barton8553bec2015-03-11 15:57:19 +000011332#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000011333static int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
11334 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011335 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, __b);
11336}
11337
Bill Seurer703e8482015-06-09 14:39:47 +000011338static int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
11339 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011340 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, __b);
11341}
11342
Bill Seurer703e8482015-06-09 14:39:47 +000011343static int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
11344 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011345 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a,
11346 (vector signed long long)__b);
11347}
11348
Bill Seurer703e8482015-06-09 14:39:47 +000011349static int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
11350 vector bool long long __b) {
11351 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a,
Kit Barton8553bec2015-03-11 15:57:19 +000011352 (vector unsigned long long)__b);
11353}
11354
Bill Seurer703e8482015-06-09 14:39:47 +000011355static int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
11356 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011357 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
11358 (vector unsigned long long)__a,
11359 (vector unsigned long long)__b);
11360}
11361
Bill Seurer703e8482015-06-09 14:39:47 +000011362static int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
11363 vector unsigned long long __b) {
11364 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
Kit Barton8553bec2015-03-11 15:57:19 +000011365 (vector unsigned long long)__a, __b);
11366}
11367
Bill Seurer703e8482015-06-09 14:39:47 +000011368static int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
11369 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011370 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
11371 (vector unsigned long long)__a,
11372 (vector unsigned long long)__b);
11373}
11374#endif
11375
Bill Seurer703e8482015-06-09 14:39:47 +000011376static int __ATTRS_o_ai vec_any_gt(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011377 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011378}
11379
11380/* vec_any_le */
11381
Bill Seurer703e8482015-06-09 14:39:47 +000011382static int __ATTRS_o_ai vec_any_le(vector signed char __a,
11383 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011384 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011385}
11386
Bill Seurer703e8482015-06-09 14:39:47 +000011387static int __ATTRS_o_ai vec_any_le(vector signed char __a,
11388 vector bool char __b) {
11389 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a,
11390 (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011391}
11392
Bill Seurer703e8482015-06-09 14:39:47 +000011393static int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
11394 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011395 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011396}
11397
Bill Seurer703e8482015-06-09 14:39:47 +000011398static int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
11399 vector bool char __b) {
11400 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011401 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011402}
11403
Bill Seurer703e8482015-06-09 14:39:47 +000011404static int __ATTRS_o_ai vec_any_le(vector bool char __a,
11405 vector signed char __b) {
11406 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__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_le(vector bool char __a,
11411 vector unsigned char __b) {
11412 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
11413 __b);
11414}
11415
11416static int __ATTRS_o_ai vec_any_le(vector bool char __a, vector bool char __b) {
11417 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
11418 (vector unsigned char)__b);
11419}
11420
11421static int __ATTRS_o_ai vec_any_le(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011422 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011423}
11424
Bill Seurer703e8482015-06-09 14:39:47 +000011425static int __ATTRS_o_ai vec_any_le(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011426 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011427}
11428
Bill Seurer703e8482015-06-09 14:39:47 +000011429static int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
11430 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011431 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011432}
11433
Bill Seurer703e8482015-06-09 14:39:47 +000011434static int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
11435 vector bool short __b) {
11436 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011437 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011438}
11439
Bill Seurer703e8482015-06-09 14:39:47 +000011440static int __ATTRS_o_ai vec_any_le(vector bool short __a, vector short __b) {
11441 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011442 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011443}
11444
Bill Seurer703e8482015-06-09 14:39:47 +000011445static int __ATTRS_o_ai vec_any_le(vector bool short __a,
11446 vector unsigned short __b) {
11447 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
11448 __b);
11449}
11450
11451static int __ATTRS_o_ai vec_any_le(vector bool short __a,
11452 vector bool short __b) {
11453 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
11454 (vector unsigned short)__b);
11455}
11456
11457static int __ATTRS_o_ai vec_any_le(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011458 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011459}
11460
Bill Seurer703e8482015-06-09 14:39:47 +000011461static int __ATTRS_o_ai vec_any_le(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011462 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011463}
11464
Bill Seurer703e8482015-06-09 14:39:47 +000011465static int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
11466 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011467 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011468}
11469
Bill Seurer703e8482015-06-09 14:39:47 +000011470static int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
11471 vector bool int __b) {
11472 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011473 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011474}
11475
Bill Seurer703e8482015-06-09 14:39:47 +000011476static int __ATTRS_o_ai vec_any_le(vector bool int __a, vector int __b) {
11477 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
11478 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011479}
11480
Bill Seurer703e8482015-06-09 14:39:47 +000011481static int __ATTRS_o_ai vec_any_le(vector bool int __a,
11482 vector unsigned int __b) {
11483 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
11484 __b);
11485}
11486
11487static int __ATTRS_o_ai vec_any_le(vector bool int __a, vector bool int __b) {
11488 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011489 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011490}
11491
Kit Barton8553bec2015-03-11 15:57:19 +000011492#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000011493static int __ATTRS_o_ai vec_any_le(vector signed long long __a,
11494 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011495 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, __b);
11496}
11497
Bill Seurer703e8482015-06-09 14:39:47 +000011498static int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
11499 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011500 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, __b);
11501}
11502
Bill Seurer703e8482015-06-09 14:39:47 +000011503static int __ATTRS_o_ai vec_any_le(vector signed long long __a,
11504 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011505 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a,
11506 (vector signed long long)__b);
11507}
11508
Bill Seurer703e8482015-06-09 14:39:47 +000011509static int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
11510 vector bool long long __b) {
11511 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a,
Kit Barton8553bec2015-03-11 15:57:19 +000011512 (vector unsigned long long)__b);
11513}
11514
Bill Seurer703e8482015-06-09 14:39:47 +000011515static int __ATTRS_o_ai vec_any_le(vector bool long long __a,
11516 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011517 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
11518 (vector unsigned long long)__a,
11519 (vector unsigned long long)__b);
11520}
11521
Bill Seurer703e8482015-06-09 14:39:47 +000011522static int __ATTRS_o_ai vec_any_le(vector bool long long __a,
11523 vector unsigned long long __b) {
11524 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
Kit Barton8553bec2015-03-11 15:57:19 +000011525 (vector unsigned long long)__a, __b);
11526}
11527
Bill Seurer703e8482015-06-09 14:39:47 +000011528static int __ATTRS_o_ai vec_any_le(vector bool long long __a,
11529 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011530 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
11531 (vector unsigned long long)__a,
11532 (vector unsigned long long)__b);
11533}
11534#endif
11535
Bill Seurer703e8482015-06-09 14:39:47 +000011536static int __ATTRS_o_ai vec_any_le(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011537 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011538}
11539
11540/* vec_any_lt */
11541
Bill Seurer703e8482015-06-09 14:39:47 +000011542static int __ATTRS_o_ai vec_any_lt(vector signed char __a,
11543 vector signed char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011544 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011545}
11546
Bill Seurer703e8482015-06-09 14:39:47 +000011547static int __ATTRS_o_ai vec_any_lt(vector signed char __a,
11548 vector bool char __b) {
11549 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b,
11550 __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011551}
11552
Bill Seurer703e8482015-06-09 14:39:47 +000011553static int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
11554 vector unsigned char __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011555 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011556}
11557
Bill Seurer703e8482015-06-09 14:39:47 +000011558static int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
11559 vector bool char __b) {
11560 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
11561 __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011562}
11563
Bill Seurer703e8482015-06-09 14:39:47 +000011564static int __ATTRS_o_ai vec_any_lt(vector bool char __a,
11565 vector signed char __b) {
11566 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011567 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011568}
11569
Bill Seurer703e8482015-06-09 14:39:47 +000011570static int __ATTRS_o_ai vec_any_lt(vector bool char __a,
11571 vector unsigned char __b) {
11572 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011573 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011574}
11575
Bill Seurer703e8482015-06-09 14:39:47 +000011576static int __ATTRS_o_ai vec_any_lt(vector bool char __a, vector bool char __b) {
11577 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
11578 (vector unsigned char)__a);
11579}
11580
11581static int __ATTRS_o_ai vec_any_lt(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011582 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011583}
11584
Bill Seurer703e8482015-06-09 14:39:47 +000011585static int __ATTRS_o_ai vec_any_lt(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011586 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011587}
11588
Bill Seurer703e8482015-06-09 14:39:47 +000011589static int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
11590 vector unsigned short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011591 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011592}
11593
Bill Seurer703e8482015-06-09 14:39:47 +000011594static int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
11595 vector bool short __b) {
11596 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
11597 __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011598}
11599
Bill Seurer703e8482015-06-09 14:39:47 +000011600static int __ATTRS_o_ai vec_any_lt(vector bool short __a, vector short __b) {
11601 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011602 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011603}
11604
Bill Seurer703e8482015-06-09 14:39:47 +000011605static int __ATTRS_o_ai vec_any_lt(vector bool short __a,
11606 vector unsigned short __b) {
11607 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011608 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011609}
11610
Bill Seurer703e8482015-06-09 14:39:47 +000011611static int __ATTRS_o_ai vec_any_lt(vector bool short __a,
11612 vector bool short __b) {
11613 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
11614 (vector unsigned short)__a);
11615}
11616
11617static int __ATTRS_o_ai vec_any_lt(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011618 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011619}
11620
Bill Seurer703e8482015-06-09 14:39:47 +000011621static int __ATTRS_o_ai vec_any_lt(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011622 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011623}
11624
Bill Seurer703e8482015-06-09 14:39:47 +000011625static int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
11626 vector unsigned int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011627 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011628}
11629
Bill Seurer703e8482015-06-09 14:39:47 +000011630static int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
11631 vector bool int __b) {
11632 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
11633 __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011634}
11635
Bill Seurer703e8482015-06-09 14:39:47 +000011636static int __ATTRS_o_ai vec_any_lt(vector bool int __a, vector int __b) {
11637 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011638 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011639}
11640
Bill Seurer703e8482015-06-09 14:39:47 +000011641static int __ATTRS_o_ai vec_any_lt(vector bool int __a,
11642 vector unsigned int __b) {
11643 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b,
11644 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011645}
11646
Bill Seurer703e8482015-06-09 14:39:47 +000011647static int __ATTRS_o_ai vec_any_lt(vector bool int __a, vector bool int __b) {
11648 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
David Blaikie3302f2b2013-01-16 23:08:36 +000011649 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011650}
11651
Kit Barton8553bec2015-03-11 15:57:19 +000011652#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000011653static int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
11654 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011655 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, __a);
11656}
11657
Bill Seurer703e8482015-06-09 14:39:47 +000011658static int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
11659 vector unsigned long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011660 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, __a);
11661}
11662
Bill Seurer703e8482015-06-09 14:39:47 +000011663static int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
11664 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011665 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV,
11666 (vector signed long long)__b, __a);
11667}
11668
Bill Seurer703e8482015-06-09 14:39:47 +000011669static int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
11670 vector bool long long __b) {
11671 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
Kit Barton8553bec2015-03-11 15:57:19 +000011672 (vector unsigned long long)__b, __a);
11673}
11674
Bill Seurer703e8482015-06-09 14:39:47 +000011675static int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
11676 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011677 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
11678 (vector unsigned long long)__b,
11679 (vector unsigned long long)__a);
11680}
11681
Bill Seurer703e8482015-06-09 14:39:47 +000011682static int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
11683 vector unsigned long long __b) {
11684 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b,
Kit Barton8553bec2015-03-11 15:57:19 +000011685 (vector unsigned long long)__a);
11686}
11687
Bill Seurer703e8482015-06-09 14:39:47 +000011688static int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
11689 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011690 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
11691 (vector unsigned long long)__b,
11692 (vector unsigned long long)__a);
11693}
11694#endif
11695
Bill Seurer703e8482015-06-09 14:39:47 +000011696static int __ATTRS_o_ai vec_any_lt(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011697 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011698}
11699
11700/* vec_any_nan */
11701
Bill Seurer703e8482015-06-09 14:39:47 +000011702static int __attribute__((__always_inline__)) vec_any_nan(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011703 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011704}
11705
11706/* vec_any_ne */
11707
Bill Seurer703e8482015-06-09 14:39:47 +000011708static int __ATTRS_o_ai vec_any_ne(vector signed char __a,
11709 vector signed char __b) {
11710 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
11711 (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011712}
11713
Bill Seurer703e8482015-06-09 14:39:47 +000011714static int __ATTRS_o_ai vec_any_ne(vector signed char __a,
11715 vector bool char __b) {
11716 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
11717 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011718}
11719
Bill Seurer703e8482015-06-09 14:39:47 +000011720static int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
11721 vector unsigned char __b) {
11722 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
11723 (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011724}
11725
Bill Seurer703e8482015-06-09 14:39:47 +000011726static int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
11727 vector bool char __b) {
11728 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
11729 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011730}
11731
Bill Seurer703e8482015-06-09 14:39:47 +000011732static int __ATTRS_o_ai vec_any_ne(vector bool char __a,
11733 vector signed char __b) {
11734 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
11735 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011736}
11737
Bill Seurer703e8482015-06-09 14:39:47 +000011738static int __ATTRS_o_ai vec_any_ne(vector bool char __a,
11739 vector unsigned char __b) {
11740 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
11741 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011742}
11743
Bill Seurer703e8482015-06-09 14:39:47 +000011744static int __ATTRS_o_ai vec_any_ne(vector bool char __a, vector bool char __b) {
11745 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
11746 (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011747}
11748
Bill Seurer703e8482015-06-09 14:39:47 +000011749static int __ATTRS_o_ai vec_any_ne(vector short __a, vector short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011750 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011751}
11752
Bill Seurer703e8482015-06-09 14:39:47 +000011753static int __ATTRS_o_ai vec_any_ne(vector short __a, vector bool short __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011754 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011755}
11756
Bill Seurer703e8482015-06-09 14:39:47 +000011757static int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
11758 vector unsigned short __b) {
11759 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011760 (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011761}
11762
Bill Seurer703e8482015-06-09 14:39:47 +000011763static int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
11764 vector bool short __b) {
11765 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011766 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011767}
11768
Bill Seurer703e8482015-06-09 14:39:47 +000011769static int __ATTRS_o_ai vec_any_ne(vector bool short __a, vector short __b) {
11770 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011771 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011772}
11773
Bill Seurer703e8482015-06-09 14:39:47 +000011774static int __ATTRS_o_ai vec_any_ne(vector bool short __a,
11775 vector unsigned short __b) {
11776 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011777 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011778}
11779
Bill Seurer703e8482015-06-09 14:39:47 +000011780static int __ATTRS_o_ai vec_any_ne(vector bool short __a,
11781 vector bool short __b) {
11782 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011783 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011784}
11785
Bill Seurer703e8482015-06-09 14:39:47 +000011786static int __ATTRS_o_ai vec_any_ne(vector pixel __a, vector pixel __b) {
11787 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
David Blaikie3302f2b2013-01-16 23:08:36 +000011788 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011789}
11790
Bill Seurer703e8482015-06-09 14:39:47 +000011791static int __ATTRS_o_ai vec_any_ne(vector int __a, vector int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011792 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011793}
11794
Bill Seurer703e8482015-06-09 14:39:47 +000011795static int __ATTRS_o_ai vec_any_ne(vector int __a, vector bool int __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011796 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011797}
11798
Bill Seurer703e8482015-06-09 14:39:47 +000011799static int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
11800 vector unsigned int __b) {
11801 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
11802 (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011803}
11804
Bill Seurer703e8482015-06-09 14:39:47 +000011805static int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
11806 vector bool int __b) {
11807 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
11808 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011809}
11810
Bill Seurer703e8482015-06-09 14:39:47 +000011811static int __ATTRS_o_ai vec_any_ne(vector bool int __a, vector int __b) {
11812 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
11813 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011814}
11815
Bill Seurer703e8482015-06-09 14:39:47 +000011816static int __ATTRS_o_ai vec_any_ne(vector bool int __a,
11817 vector unsigned int __b) {
11818 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
11819 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011820}
11821
Bill Seurer703e8482015-06-09 14:39:47 +000011822static int __ATTRS_o_ai vec_any_ne(vector bool int __a, vector bool int __b) {
11823 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
11824 (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011825}
11826
Kit Barton8553bec2015-03-11 15:57:19 +000011827#ifdef __POWER8_VECTOR__
Bill Seurer703e8482015-06-09 14:39:47 +000011828static int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
11829 vector signed long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011830 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, __b);
11831}
11832
Bill Seurer703e8482015-06-09 14:39:47 +000011833static int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
11834 vector unsigned long long __b) {
11835 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector long long)__a,
11836 (vector long long)__b);
Kit Barton8553bec2015-03-11 15:57:19 +000011837}
11838
Bill Seurer703e8482015-06-09 14:39:47 +000011839static int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
11840 vector bool long long __b) {
Kit Barton8553bec2015-03-11 15:57:19 +000011841 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a,
11842 (vector signed long long)__b);
11843}
11844
Bill Seurer703e8482015-06-09 14:39:47 +000011845static int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
11846 vector bool long long __b) {
11847 return __builtin_altivec_vcmpequd_p(
11848 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
Kit Barton8553bec2015-03-11 15:57:19 +000011849}
11850
Bill Seurer703e8482015-06-09 14:39:47 +000011851static int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
11852 vector signed long long __b) {
11853 return __builtin_altivec_vcmpequd_p(
11854 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
Kit Barton8553bec2015-03-11 15:57:19 +000011855}
11856
Bill Seurer703e8482015-06-09 14:39:47 +000011857static int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
11858 vector unsigned long long __b) {
11859 return __builtin_altivec_vcmpequd_p(
11860 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
Kit Barton8553bec2015-03-11 15:57:19 +000011861}
11862
Bill Seurer703e8482015-06-09 14:39:47 +000011863static int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
11864 vector bool long long __b) {
11865 return __builtin_altivec_vcmpequd_p(
11866 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
Kit Barton8553bec2015-03-11 15:57:19 +000011867}
11868#endif
11869
Bill Seurer703e8482015-06-09 14:39:47 +000011870static int __ATTRS_o_ai vec_any_ne(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011871 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011872}
11873
11874/* vec_any_nge */
11875
11876static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000011877vec_any_nge(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011878 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011879}
11880
11881/* vec_any_ngt */
11882
11883static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000011884vec_any_ngt(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011885 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011886}
11887
11888/* vec_any_nle */
11889
11890static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000011891vec_any_nle(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011892 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011893}
11894
11895/* vec_any_nlt */
11896
11897static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000011898vec_any_nlt(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011899 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011900}
11901
11902/* vec_any_numeric */
11903
11904static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000011905vec_any_numeric(vector float __a) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011906 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011907}
11908
11909/* vec_any_out */
11910
11911static int __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000011912vec_any_out(vector float __a, vector float __b) {
David Blaikie3302f2b2013-01-16 23:08:36 +000011913 return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011914}
11915
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000011916/* Power 8 Crypto functions
11917Note: We diverge from the current GCC implementation with regard
11918to cryptography and related functions as follows:
11919- Only the SHA and AES instructions and builtins are disabled by -mno-crypto
11920- The remaining ones are only available on Power8 and up so
11921 require -mpower8-vector
11922The justification for this is that export requirements require that
11923Category:Vector.Crypto is optional (i.e. compliant hardware may not provide
11924support). As a result, we need to be able to turn off support for those.
11925The remaining ones (currently controlled by -mcrypto for GCC) still
11926need to be provided on compliant hardware even if Vector.Crypto is not
11927provided.
11928FIXME: the naming convention for the builtins will be adjusted due
11929to the inconsistency (__builtin_crypto_ prefix on builtins that cannot be
11930removed with -mno-crypto). This is under development.
11931*/
11932#ifdef __CRYPTO__
11933static vector unsigned long long __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000011934__builtin_crypto_vsbox(vector unsigned long long __a) {
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000011935 return __builtin_altivec_crypto_vsbox(__a);
11936}
11937
11938static vector unsigned long long __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000011939__builtin_crypto_vcipher(vector unsigned long long __a,
11940 vector unsigned long long __b) {
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000011941 return __builtin_altivec_crypto_vcipher(__a, __b);
11942}
11943
11944static vector unsigned long long __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000011945__builtin_crypto_vcipherlast(vector unsigned long long __a,
11946 vector unsigned long long __b) {
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000011947 return __builtin_altivec_crypto_vcipherlast(__a, __b);
11948}
11949
11950static vector unsigned long long __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000011951__builtin_crypto_vncipher(vector unsigned long long __a,
11952 vector unsigned long long __b) {
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000011953 return __builtin_altivec_crypto_vncipher(__a, __b);
11954}
11955
11956static vector unsigned long long __attribute__((__always_inline__))
Bill Seurer703e8482015-06-09 14:39:47 +000011957__builtin_crypto_vncipherlast(vector unsigned long long __a,
11958 vector unsigned long long __b) {
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000011959 return __builtin_altivec_crypto_vncipherlast(__a, __b);
11960}
11961
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000011962#define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad
11963#define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw
11964#endif
11965
11966#ifdef __POWER8_VECTOR__
11967static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +000011968__builtin_crypto_vpermxor(vector unsigned char __a, vector unsigned char __b,
11969 vector unsigned char __c) {
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000011970 return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
11971}
11972
11973static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +000011974__builtin_crypto_vpermxor(vector unsigned short __a, vector unsigned short __b,
11975 vector unsigned short __c) {
11976 return (vector unsigned short)__builtin_altivec_crypto_vpermxor(
11977 (vector unsigned char)__a, (vector unsigned char)__b,
11978 (vector unsigned char)__c);
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000011979}
11980
Bill Seurer703e8482015-06-09 14:39:47 +000011981static vector unsigned int __ATTRS_o_ai __builtin_crypto_vpermxor(
11982 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
11983 return (vector unsigned int)__builtin_altivec_crypto_vpermxor(
11984 (vector unsigned char)__a, (vector unsigned char)__b,
11985 (vector unsigned char)__c);
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000011986}
11987
Bill Seurer703e8482015-06-09 14:39:47 +000011988static vector unsigned long long __ATTRS_o_ai __builtin_crypto_vpermxor(
11989 vector unsigned long long __a, vector unsigned long long __b,
11990 vector unsigned long long __c) {
11991 return (vector unsigned long long)__builtin_altivec_crypto_vpermxor(
11992 (vector unsigned char)__a, (vector unsigned char)__b,
11993 (vector unsigned char)__c);
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000011994}
11995
11996static vector unsigned char __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +000011997__builtin_crypto_vpmsumb(vector unsigned char __a, vector unsigned char __b) {
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000011998 return __builtin_altivec_crypto_vpmsumb(__a, __b);
11999}
12000
12001static vector unsigned short __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +000012002__builtin_crypto_vpmsumb(vector unsigned short __a, vector unsigned short __b) {
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012003 return __builtin_altivec_crypto_vpmsumh(__a, __b);
12004}
12005
12006static vector unsigned int __ATTRS_o_ai
Bill Seurer703e8482015-06-09 14:39:47 +000012007__builtin_crypto_vpmsumb(vector unsigned int __a, vector unsigned int __b) {
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012008 return __builtin_altivec_crypto_vpmsumw(__a, __b);
12009}
12010
Bill Seurer703e8482015-06-09 14:39:47 +000012011static vector unsigned long long __ATTRS_o_ai __builtin_crypto_vpmsumb(
12012 vector unsigned long long __a, vector unsigned long long __b) {
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012013 return __builtin_altivec_crypto_vpmsumd(__a, __b);
12014}
12015#endif
12016
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012017#undef __ATTRS_o_ai
Chris Lattnerdad40622010-04-14 03:54:58 +000012018
12019#endif /* __ALTIVEC_H */