blob: 1f8c831bb73928680968820c1e63c9399f3f17fe [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
32#define __CR6_EQ 0
33#define __CR6_EQ_REV 1
34#define __CR6_LT 2
35#define __CR6_LT_REV 3
36
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000037#define __ATTRS_o_ai __attribute__((__overloadable__, __always_inline__))
38
39static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000040vec_perm(vector signed char __a, vector signed char __b, vector unsigned char __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000041
42static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000043vec_perm(vector unsigned char __a,
44 vector unsigned char __b,
45 vector unsigned char __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000046
Anton Yartsev9e968982010-08-19 03:00:09 +000047static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000048vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c);
Anton Yartsev9e968982010-08-19 03:00:09 +000049
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000050static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000051vec_perm(vector short __a, vector short __b, vector unsigned char __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000052
53static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000054vec_perm(vector unsigned short __a,
55 vector unsigned short __b,
56 vector unsigned char __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000057
Anton Yartsev9e968982010-08-19 03:00:09 +000058static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000059vec_perm(vector bool short __a, vector bool short __b, vector unsigned char __c);
Anton Yartsev9e968982010-08-19 03:00:09 +000060
61static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000062vec_perm(vector pixel __a, vector pixel __b, vector unsigned char __c);
Anton Yartsev9e968982010-08-19 03:00:09 +000063
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000064static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000065vec_perm(vector int __a, vector int __b, vector unsigned char __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000066
67static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000068vec_perm(vector unsigned int __a, vector unsigned int __b, vector unsigned char __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000069
Anton Yartsev9e968982010-08-19 03:00:09 +000070static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000071vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c);
Anton Yartsev9e968982010-08-19 03:00:09 +000072
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000073static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000074vec_perm(vector float __a, vector float __b, vector unsigned char __c);
Chris Lattnerdad40622010-04-14 03:54:58 +000075
Bill Schmidt41e14c42015-05-16 01:02:25 +000076#ifdef __VSX__
77static vector long long __ATTRS_o_ai
78vec_perm(vector long long __a, vector long long __b, vector unsigned char __c);
79
80static vector unsigned long long __ATTRS_o_ai
81vec_perm(vector unsigned long long __a, vector unsigned long long __b,
82 vector unsigned char __c);
83
84static vector double __ATTRS_o_ai
85vec_perm(vector double __a, vector double __b, vector unsigned char __c);
86#endif
87
Bill Schmidtf7e289c2014-06-05 19:07:40 +000088static vector unsigned char __ATTRS_o_ai
89vec_xor(vector unsigned char __a, vector unsigned char __b);
90
Chris Lattnerdad40622010-04-14 03:54:58 +000091/* vec_abs */
92
Chris Lattnerdad40622010-04-14 03:54:58 +000093#define __builtin_altivec_abs_v16qi vec_abs
94#define __builtin_altivec_abs_v8hi vec_abs
95#define __builtin_altivec_abs_v4si vec_abs
96
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000097static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000098vec_abs(vector signed char __a)
Chris Lattnerdad40622010-04-14 03:54:58 +000099{
David Blaikie3302f2b2013-01-16 23:08:36 +0000100 return __builtin_altivec_vmaxsb(__a, -__a);
Chris Lattnerdad40622010-04-14 03:54:58 +0000101}
102
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000103static vector signed short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000104vec_abs(vector signed short __a)
Chris Lattnerdad40622010-04-14 03:54:58 +0000105{
David Blaikie3302f2b2013-01-16 23:08:36 +0000106 return __builtin_altivec_vmaxsh(__a, -__a);
Chris Lattnerdad40622010-04-14 03:54:58 +0000107}
108
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000109static vector signed int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000110vec_abs(vector signed int __a)
Chris Lattnerdad40622010-04-14 03:54:58 +0000111{
David Blaikie3302f2b2013-01-16 23:08:36 +0000112 return __builtin_altivec_vmaxsw(__a, -__a);
Chris Lattnerdad40622010-04-14 03:54:58 +0000113}
114
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000115static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000116vec_abs(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +0000117{
David Blaikie3302f2b2013-01-16 23:08:36 +0000118 vector unsigned int __res = (vector unsigned int)__a
Anton Yartsev79d6af32010-09-18 00:39:16 +0000119 & (vector unsigned int)(0x7FFFFFFF);
David Blaikie3302f2b2013-01-16 23:08:36 +0000120 return (vector float)__res;
Chris Lattnerdad40622010-04-14 03:54:58 +0000121}
122
123/* vec_abss */
124
Chris Lattnerdad40622010-04-14 03:54:58 +0000125#define __builtin_altivec_abss_v16qi vec_abss
126#define __builtin_altivec_abss_v8hi vec_abss
127#define __builtin_altivec_abss_v4si vec_abss
128
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000129static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000130vec_abss(vector signed char __a)
Chris Lattnerdad40622010-04-14 03:54:58 +0000131{
Anton Yartsev79d6af32010-09-18 00:39:16 +0000132 return __builtin_altivec_vmaxsb
David Blaikie3302f2b2013-01-16 23:08:36 +0000133 (__a, __builtin_altivec_vsubsbs((vector signed char)(0), __a));
Chris Lattnerdad40622010-04-14 03:54:58 +0000134}
135
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000136static vector signed short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000137vec_abss(vector signed short __a)
Chris Lattnerdad40622010-04-14 03:54:58 +0000138{
Anton Yartsev79d6af32010-09-18 00:39:16 +0000139 return __builtin_altivec_vmaxsh
David Blaikie3302f2b2013-01-16 23:08:36 +0000140 (__a, __builtin_altivec_vsubshs((vector signed short)(0), __a));
Chris Lattnerdad40622010-04-14 03:54:58 +0000141}
142
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000143static vector signed int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000144vec_abss(vector signed int __a)
Chris Lattnerdad40622010-04-14 03:54:58 +0000145{
Anton Yartsev79d6af32010-09-18 00:39:16 +0000146 return __builtin_altivec_vmaxsw
David Blaikie3302f2b2013-01-16 23:08:36 +0000147 (__a, __builtin_altivec_vsubsws((vector signed int)(0), __a));
Chris Lattnerdad40622010-04-14 03:54:58 +0000148}
149
150/* vec_add */
151
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000152static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000153vec_add(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000154{
David Blaikie3302f2b2013-01-16 23:08:36 +0000155 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000156}
157
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000158static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000159vec_add(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000160{
David Blaikie3302f2b2013-01-16 23:08:36 +0000161 return (vector signed char)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000162}
163
164static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000165vec_add(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000166{
David Blaikie3302f2b2013-01-16 23:08:36 +0000167 return __a + (vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000168}
169
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000170static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000171vec_add(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000172{
David Blaikie3302f2b2013-01-16 23:08:36 +0000173 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000174}
175
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000176static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000177vec_add(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000178{
David Blaikie3302f2b2013-01-16 23:08:36 +0000179 return (vector unsigned char)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000180}
181
182static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000183vec_add(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000184{
David Blaikie3302f2b2013-01-16 23:08:36 +0000185 return __a + (vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000186}
187
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000188static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000189vec_add(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000190{
David Blaikie3302f2b2013-01-16 23:08:36 +0000191 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000192}
193
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000194static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000195vec_add(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000196{
David Blaikie3302f2b2013-01-16 23:08:36 +0000197 return (vector short)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000198}
199
200static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000201vec_add(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000202{
David Blaikie3302f2b2013-01-16 23:08:36 +0000203 return __a + (vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000204}
205
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000206static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000207vec_add(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000208{
David Blaikie3302f2b2013-01-16 23:08:36 +0000209 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000210}
211
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000212static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000213vec_add(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000214{
David Blaikie3302f2b2013-01-16 23:08:36 +0000215 return (vector unsigned short)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000216}
217
218static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000219vec_add(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000220{
David Blaikie3302f2b2013-01-16 23:08:36 +0000221 return __a + (vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000222}
223
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000224static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000225vec_add(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000226{
David Blaikie3302f2b2013-01-16 23:08:36 +0000227 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000228}
229
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000230static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000231vec_add(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000232{
David Blaikie3302f2b2013-01-16 23:08:36 +0000233 return (vector int)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000234}
235
236static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000237vec_add(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000238{
David Blaikie3302f2b2013-01-16 23:08:36 +0000239 return __a + (vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000240}
241
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000242static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000243vec_add(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000244{
David Blaikie3302f2b2013-01-16 23:08:36 +0000245 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000246}
247
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000248static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000249vec_add(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000250{
David Blaikie3302f2b2013-01-16 23:08:36 +0000251 return (vector unsigned int)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000252}
253
254static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000255vec_add(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000256{
David Blaikie3302f2b2013-01-16 23:08:36 +0000257 return __a + (vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000258}
259
Kit Barton5944ee212015-05-25 15:52:45 +0000260#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
261static vector signed __int128 __ATTRS_o_ai
262vec_add(vector signed __int128 __a, vector signed __int128 __b)
263{
264 return __a + __b;
265}
266
267static vector unsigned __int128 __ATTRS_o_ai
268vec_add(vector unsigned __int128 __a, vector unsigned __int128 __b)
269{
270 return __a + __b;
271}
272#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
273
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000274static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000275vec_add(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000276{
David Blaikie3302f2b2013-01-16 23:08:36 +0000277 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000278}
279
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000280/* vec_vaddubm */
281
282#define __builtin_altivec_vaddubm vec_vaddubm
283
284static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000285vec_vaddubm(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000286{
David Blaikie3302f2b2013-01-16 23:08:36 +0000287 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000288}
289
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000290static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000291vec_vaddubm(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000292{
David Blaikie3302f2b2013-01-16 23:08:36 +0000293 return (vector signed char)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000294}
295
296static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000297vec_vaddubm(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000298{
David Blaikie3302f2b2013-01-16 23:08:36 +0000299 return __a + (vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000300}
301
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000302static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000303vec_vaddubm(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000304{
David Blaikie3302f2b2013-01-16 23:08:36 +0000305 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000306}
307
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000308static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000309vec_vaddubm(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000310{
David Blaikie3302f2b2013-01-16 23:08:36 +0000311 return (vector unsigned char)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000312}
313
314static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000315vec_vaddubm(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000316{
David Blaikie3302f2b2013-01-16 23:08:36 +0000317 return __a + (vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000318}
319
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000320/* vec_vadduhm */
321
322#define __builtin_altivec_vadduhm vec_vadduhm
323
324static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000325vec_vadduhm(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000326{
David Blaikie3302f2b2013-01-16 23:08:36 +0000327 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000328}
329
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000330static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000331vec_vadduhm(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000332{
David Blaikie3302f2b2013-01-16 23:08:36 +0000333 return (vector short)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000334}
335
336static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000337vec_vadduhm(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000338{
David Blaikie3302f2b2013-01-16 23:08:36 +0000339 return __a + (vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000340}
341
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000342static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000343vec_vadduhm(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000344{
David Blaikie3302f2b2013-01-16 23:08:36 +0000345 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000346}
347
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000348static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000349vec_vadduhm(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000350{
David Blaikie3302f2b2013-01-16 23:08:36 +0000351 return (vector unsigned short)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000352}
353
354static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000355vec_vadduhm(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000356{
David Blaikie3302f2b2013-01-16 23:08:36 +0000357 return __a + (vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000358}
359
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000360/* vec_vadduwm */
361
362#define __builtin_altivec_vadduwm vec_vadduwm
363
364static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000365vec_vadduwm(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000366{
David Blaikie3302f2b2013-01-16 23:08:36 +0000367 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000368}
369
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000370static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000371vec_vadduwm(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000372{
David Blaikie3302f2b2013-01-16 23:08:36 +0000373 return (vector int)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000374}
375
376static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000377vec_vadduwm(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000378{
David Blaikie3302f2b2013-01-16 23:08:36 +0000379 return __a + (vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000380}
381
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000382static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000383vec_vadduwm(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000384{
David Blaikie3302f2b2013-01-16 23:08:36 +0000385 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000386}
387
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000388static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000389vec_vadduwm(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000390{
David Blaikie3302f2b2013-01-16 23:08:36 +0000391 return (vector unsigned int)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000392}
393
394static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000395vec_vadduwm(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000396{
David Blaikie3302f2b2013-01-16 23:08:36 +0000397 return __a + (vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000398}
399
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000400/* vec_vaddfp */
401
402#define __builtin_altivec_vaddfp vec_vaddfp
403
404static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +0000405vec_vaddfp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000406{
David Blaikie3302f2b2013-01-16 23:08:36 +0000407 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000408}
409
Chris Lattnerdad40622010-04-14 03:54:58 +0000410/* vec_addc */
411
Kit Barton5944ee212015-05-25 15:52:45 +0000412static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000413vec_addc(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000414{
David Blaikie3302f2b2013-01-16 23:08:36 +0000415 return __builtin_altivec_vaddcuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000416}
417
Kit Barton5944ee212015-05-25 15:52:45 +0000418#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
419static vector signed __int128 __ATTRS_o_ai
420vec_addc(vector signed __int128 __a, vector signed __int128 __b) {
421 return __builtin_altivec_vaddcuq(__a, __b);
422}
423
424static vector unsigned __int128 __ATTRS_o_ai
425vec_addc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
426 return __builtin_altivec_vaddcuq(__a, __b);
427}
428#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
429
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000430/* vec_vaddcuw */
431
432static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +0000433vec_vaddcuw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000434{
David Blaikie3302f2b2013-01-16 23:08:36 +0000435 return __builtin_altivec_vaddcuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000436}
Chris Lattnerdad40622010-04-14 03:54:58 +0000437
438/* vec_adds */
439
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000440static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000441vec_adds(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000442{
David Blaikie3302f2b2013-01-16 23:08:36 +0000443 return __builtin_altivec_vaddsbs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000444}
445
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000446static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000447vec_adds(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000448{
David Blaikie3302f2b2013-01-16 23:08:36 +0000449 return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000450}
451
452static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000453vec_adds(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000454{
David Blaikie3302f2b2013-01-16 23:08:36 +0000455 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000456}
457
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000458static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000459vec_adds(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000460{
David Blaikie3302f2b2013-01-16 23:08:36 +0000461 return __builtin_altivec_vaddubs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000462}
463
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000464static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000465vec_adds(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000466{
David Blaikie3302f2b2013-01-16 23:08:36 +0000467 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000468}
469
470static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000471vec_adds(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000472{
David Blaikie3302f2b2013-01-16 23:08:36 +0000473 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000474}
475
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000476static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000477vec_adds(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000478{
David Blaikie3302f2b2013-01-16 23:08:36 +0000479 return __builtin_altivec_vaddshs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000480}
481
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000482static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000483vec_adds(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000484{
David Blaikie3302f2b2013-01-16 23:08:36 +0000485 return __builtin_altivec_vaddshs((vector short)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000486}
487
488static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000489vec_adds(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000490{
David Blaikie3302f2b2013-01-16 23:08:36 +0000491 return __builtin_altivec_vaddshs(__a, (vector short)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000492}
493
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000494static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000495vec_adds(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000496{
David Blaikie3302f2b2013-01-16 23:08:36 +0000497 return __builtin_altivec_vadduhs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000498}
499
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000500static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000501vec_adds(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000502{
David Blaikie3302f2b2013-01-16 23:08:36 +0000503 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000504}
505
506static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000507vec_adds(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000508{
David Blaikie3302f2b2013-01-16 23:08:36 +0000509 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000510}
511
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000512static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000513vec_adds(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000514{
David Blaikie3302f2b2013-01-16 23:08:36 +0000515 return __builtin_altivec_vaddsws(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000516}
517
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000518static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000519vec_adds(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000520{
David Blaikie3302f2b2013-01-16 23:08:36 +0000521 return __builtin_altivec_vaddsws((vector int)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000522}
523
524static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000525vec_adds(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000526{
David Blaikie3302f2b2013-01-16 23:08:36 +0000527 return __builtin_altivec_vaddsws(__a, (vector int)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000528}
529
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000530static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000531vec_adds(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000532{
David Blaikie3302f2b2013-01-16 23:08:36 +0000533 return __builtin_altivec_vadduws(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000534}
535
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000536static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000537vec_adds(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000538{
David Blaikie3302f2b2013-01-16 23:08:36 +0000539 return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000540}
541
542static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000543vec_adds(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000544{
David Blaikie3302f2b2013-01-16 23:08:36 +0000545 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000546}
547
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000548/* vec_vaddsbs */
Chris Lattnerdad40622010-04-14 03:54:58 +0000549
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000550static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000551vec_vaddsbs(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000552{
David Blaikie3302f2b2013-01-16 23:08:36 +0000553 return __builtin_altivec_vaddsbs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000554}
555
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000556static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000557vec_vaddsbs(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000558{
David Blaikie3302f2b2013-01-16 23:08:36 +0000559 return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000560}
561
562static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000563vec_vaddsbs(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000564{
David Blaikie3302f2b2013-01-16 23:08:36 +0000565 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000566}
567
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000568/* vec_vaddubs */
569
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000570static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000571vec_vaddubs(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000572{
David Blaikie3302f2b2013-01-16 23:08:36 +0000573 return __builtin_altivec_vaddubs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000574}
575
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000576static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000577vec_vaddubs(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000578{
David Blaikie3302f2b2013-01-16 23:08:36 +0000579 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000580}
581
582static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000583vec_vaddubs(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000584{
David Blaikie3302f2b2013-01-16 23:08:36 +0000585 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000586}
587
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000588/* vec_vaddshs */
589
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000590static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000591vec_vaddshs(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000592{
David Blaikie3302f2b2013-01-16 23:08:36 +0000593 return __builtin_altivec_vaddshs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000594}
595
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000596static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000597vec_vaddshs(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000598{
David Blaikie3302f2b2013-01-16 23:08:36 +0000599 return __builtin_altivec_vaddshs((vector short)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000600}
601
602static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000603vec_vaddshs(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000604{
David Blaikie3302f2b2013-01-16 23:08:36 +0000605 return __builtin_altivec_vaddshs(__a, (vector short)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000606}
607
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000608/* vec_vadduhs */
609
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000610static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000611vec_vadduhs(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000612{
David Blaikie3302f2b2013-01-16 23:08:36 +0000613 return __builtin_altivec_vadduhs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000614}
615
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000616static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000617vec_vadduhs(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000618{
David Blaikie3302f2b2013-01-16 23:08:36 +0000619 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000620}
621
622static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000623vec_vadduhs(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000624{
David Blaikie3302f2b2013-01-16 23:08:36 +0000625 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000626}
627
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000628/* vec_vaddsws */
629
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000630static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000631vec_vaddsws(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000632{
David Blaikie3302f2b2013-01-16 23:08:36 +0000633 return __builtin_altivec_vaddsws(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000634}
635
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000636static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000637vec_vaddsws(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000638{
David Blaikie3302f2b2013-01-16 23:08:36 +0000639 return __builtin_altivec_vaddsws((vector int)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000640}
641
642static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000643vec_vaddsws(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000644{
David Blaikie3302f2b2013-01-16 23:08:36 +0000645 return __builtin_altivec_vaddsws(__a, (vector int)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000646}
647
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000648/* vec_vadduws */
649
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000650static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000651vec_vadduws(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000652{
David Blaikie3302f2b2013-01-16 23:08:36 +0000653 return __builtin_altivec_vadduws(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000654}
655
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000656static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000657vec_vadduws(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000658{
David Blaikie3302f2b2013-01-16 23:08:36 +0000659 return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000660}
661
662static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000663vec_vadduws(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000664{
David Blaikie3302f2b2013-01-16 23:08:36 +0000665 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000666}
667
Kit Barton5944ee212015-05-25 15:52:45 +0000668#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
669/* vec_vadduqm */
670
671static vector signed __int128 __ATTRS_o_ai
672vec_vadduqm(vector signed __int128 __a, vector signed __int128 __b)
673{
674 return __a + __b;
675}
676
677static vector unsigned __int128 __ATTRS_o_ai
678vec_vadduqm(vector unsigned __int128 __a, vector unsigned __int128 __b)
679{
680 return __a + __b;
681}
682
683/* vec_vaddeuqm */
684
685static vector signed __int128 __ATTRS_o_ai
686vec_vaddeuqm(vector signed __int128 __a, vector signed __int128 __b,
687 vector signed __int128 __c) {
688 return __builtin_altivec_vaddeuqm(__a, __b, __c);
689}
690
691static vector unsigned __int128 __ATTRS_o_ai
692vec_vaddeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
693 vector unsigned __int128 __c) {
694 return __builtin_altivec_vaddeuqm(__a, __b, __c);
695}
696
697/* vec_vaddcuq */
698
699static vector signed __int128 __ATTRS_o_ai
700vec_vaddcuq(vector signed __int128 __a, vector signed __int128 __b)
701{
702 return __builtin_altivec_vaddcuq(__a, __b);
703}
704
705static vector unsigned __int128 __ATTRS_o_ai
706vec_vaddcuq(vector unsigned __int128 __a, vector unsigned __int128 __b)
707{
708 return __builtin_altivec_vaddcuq(__a, __b);
709}
710
711/* vec_vaddecuq */
712
713static vector signed __int128 __ATTRS_o_ai
714vec_vaddecuq(vector signed __int128 __a, vector signed __int128 __b,
715 vector signed __int128 __c) {
716 return __builtin_altivec_vaddecuq(__a, __b, __c);
717}
718
719static vector unsigned __int128 __ATTRS_o_ai
720vec_vaddecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
721 vector unsigned __int128 __c) {
722 return __builtin_altivec_vaddecuq(__a, __b, __c);
723}
724#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
725
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000726/* vec_and */
727
728#define __builtin_altivec_vand vec_and
729
730static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000731vec_and(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000732{
David Blaikie3302f2b2013-01-16 23:08:36 +0000733 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000734}
735
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000736static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000737vec_and(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000738{
David Blaikie3302f2b2013-01-16 23:08:36 +0000739 return (vector signed char)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000740}
741
742static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000743vec_and(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000744{
David Blaikie3302f2b2013-01-16 23:08:36 +0000745 return __a & (vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000746}
747
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000748static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000749vec_and(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000750{
David Blaikie3302f2b2013-01-16 23:08:36 +0000751 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000752}
753
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000754static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000755vec_and(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000756{
David Blaikie3302f2b2013-01-16 23:08:36 +0000757 return (vector unsigned char)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000758}
759
760static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000761vec_and(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000762{
David Blaikie3302f2b2013-01-16 23:08:36 +0000763 return __a & (vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000764}
765
766static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000767vec_and(vector bool char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000768{
David Blaikie3302f2b2013-01-16 23:08:36 +0000769 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000770}
771
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000772static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000773vec_and(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000774{
David Blaikie3302f2b2013-01-16 23:08:36 +0000775 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000776}
777
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000778static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000779vec_and(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000780{
David Blaikie3302f2b2013-01-16 23:08:36 +0000781 return (vector short)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000782}
783
784static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000785vec_and(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000786{
David Blaikie3302f2b2013-01-16 23:08:36 +0000787 return __a & (vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000788}
789
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000790static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000791vec_and(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000792{
David Blaikie3302f2b2013-01-16 23:08:36 +0000793 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000794}
795
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000796static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000797vec_and(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000798{
David Blaikie3302f2b2013-01-16 23:08:36 +0000799 return (vector unsigned short)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000800}
801
802static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000803vec_and(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000804{
David Blaikie3302f2b2013-01-16 23:08:36 +0000805 return __a & (vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000806}
807
808static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000809vec_and(vector bool short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000810{
David Blaikie3302f2b2013-01-16 23:08:36 +0000811 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000812}
813
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000814static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000815vec_and(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000816{
David Blaikie3302f2b2013-01-16 23:08:36 +0000817 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000818}
819
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000820static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000821vec_and(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000822{
David Blaikie3302f2b2013-01-16 23:08:36 +0000823 return (vector int)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000824}
825
826static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000827vec_and(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000828{
David Blaikie3302f2b2013-01-16 23:08:36 +0000829 return __a & (vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000830}
831
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000832static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000833vec_and(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000834{
David Blaikie3302f2b2013-01-16 23:08:36 +0000835 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000836}
837
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000838static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000839vec_and(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000840{
David Blaikie3302f2b2013-01-16 23:08:36 +0000841 return (vector unsigned int)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000842}
843
844static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000845vec_and(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000846{
David Blaikie3302f2b2013-01-16 23:08:36 +0000847 return __a & (vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000848}
849
850static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000851vec_and(vector bool int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000852{
David Blaikie3302f2b2013-01-16 23:08:36 +0000853 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000854}
855
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000856static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000857vec_and(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000858{
David Blaikie3302f2b2013-01-16 23:08:36 +0000859 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
860 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000861}
862
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000863static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000864vec_and(vector bool int __a, vector float __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000865{
David Blaikie3302f2b2013-01-16 23:08:36 +0000866 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
867 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000868}
869
870static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000871vec_and(vector float __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000872{
David Blaikie3302f2b2013-01-16 23:08:36 +0000873 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
874 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000875}
876
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000877/* vec_vand */
878
879static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000880vec_vand(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000881{
David Blaikie3302f2b2013-01-16 23:08:36 +0000882 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000883}
884
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000885static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000886vec_vand(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000887{
David Blaikie3302f2b2013-01-16 23:08:36 +0000888 return (vector signed char)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000889}
890
891static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000892vec_vand(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000893{
David Blaikie3302f2b2013-01-16 23:08:36 +0000894 return __a & (vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000895}
896
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000897static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000898vec_vand(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000899{
David Blaikie3302f2b2013-01-16 23:08:36 +0000900 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000901}
902
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000903static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000904vec_vand(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000905{
David Blaikie3302f2b2013-01-16 23:08:36 +0000906 return (vector unsigned char)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000907}
908
909static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000910vec_vand(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000911{
David Blaikie3302f2b2013-01-16 23:08:36 +0000912 return __a & (vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000913}
914
915static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000916vec_vand(vector bool char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000917{
David Blaikie3302f2b2013-01-16 23:08:36 +0000918 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000919}
920
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000921static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000922vec_vand(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000923{
David Blaikie3302f2b2013-01-16 23:08:36 +0000924 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000925}
926
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000927static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000928vec_vand(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000929{
David Blaikie3302f2b2013-01-16 23:08:36 +0000930 return (vector short)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000931}
932
933static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000934vec_vand(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000935{
David Blaikie3302f2b2013-01-16 23:08:36 +0000936 return __a & (vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000937}
938
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000939static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000940vec_vand(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000941{
David Blaikie3302f2b2013-01-16 23:08:36 +0000942 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000943}
944
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000945static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000946vec_vand(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000947{
David Blaikie3302f2b2013-01-16 23:08:36 +0000948 return (vector unsigned short)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000949}
950
951static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000952vec_vand(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000953{
David Blaikie3302f2b2013-01-16 23:08:36 +0000954 return __a & (vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000955}
956
957static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000958vec_vand(vector bool short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000959{
David Blaikie3302f2b2013-01-16 23:08:36 +0000960 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000961}
962
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000963static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000964vec_vand(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000965{
David Blaikie3302f2b2013-01-16 23:08:36 +0000966 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000967}
968
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000969static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000970vec_vand(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000971{
David Blaikie3302f2b2013-01-16 23:08:36 +0000972 return (vector int)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000973}
974
975static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000976vec_vand(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000977{
David Blaikie3302f2b2013-01-16 23:08:36 +0000978 return __a & (vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000979}
980
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000981static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000982vec_vand(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000983{
David Blaikie3302f2b2013-01-16 23:08:36 +0000984 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000985}
986
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000987static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000988vec_vand(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000989{
David Blaikie3302f2b2013-01-16 23:08:36 +0000990 return (vector unsigned int)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000991}
992
993static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000994vec_vand(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000995{
David Blaikie3302f2b2013-01-16 23:08:36 +0000996 return __a & (vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000997}
998
999static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001000vec_vand(vector bool int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001001{
David Blaikie3302f2b2013-01-16 23:08:36 +00001002 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001003}
1004
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001005static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001006vec_vand(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001007{
David Blaikie3302f2b2013-01-16 23:08:36 +00001008 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
1009 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001010}
1011
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001012static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001013vec_vand(vector bool int __a, vector float __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001014{
David Blaikie3302f2b2013-01-16 23:08:36 +00001015 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
1016 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001017}
1018
1019static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001020vec_vand(vector float __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001021{
David Blaikie3302f2b2013-01-16 23:08:36 +00001022 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
1023 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001024}
1025
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001026/* vec_andc */
1027
1028#define __builtin_altivec_vandc vec_andc
1029
1030static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001031vec_andc(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001032{
David Blaikie3302f2b2013-01-16 23:08:36 +00001033 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001034}
1035
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001036static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001037vec_andc(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001038{
David Blaikie3302f2b2013-01-16 23:08:36 +00001039 return (vector signed char)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001040}
1041
1042static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001043vec_andc(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001044{
David Blaikie3302f2b2013-01-16 23:08:36 +00001045 return __a & ~(vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001046}
1047
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001048static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001049vec_andc(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001050{
David Blaikie3302f2b2013-01-16 23:08:36 +00001051 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001052}
1053
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001054static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001055vec_andc(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001056{
David Blaikie3302f2b2013-01-16 23:08:36 +00001057 return (vector unsigned char)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001058}
1059
1060static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001061vec_andc(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001062{
David Blaikie3302f2b2013-01-16 23:08:36 +00001063 return __a & ~(vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001064}
1065
1066static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001067vec_andc(vector bool char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001068{
David Blaikie3302f2b2013-01-16 23:08:36 +00001069 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001070}
1071
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001072static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001073vec_andc(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001074{
David Blaikie3302f2b2013-01-16 23:08:36 +00001075 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001076}
1077
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001078static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001079vec_andc(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001080{
David Blaikie3302f2b2013-01-16 23:08:36 +00001081 return (vector short)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001082}
1083
1084static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001085vec_andc(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001086{
David Blaikie3302f2b2013-01-16 23:08:36 +00001087 return __a & ~(vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001088}
1089
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001090static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001091vec_andc(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001092{
David Blaikie3302f2b2013-01-16 23:08:36 +00001093 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001094}
1095
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001096static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001097vec_andc(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001098{
David Blaikie3302f2b2013-01-16 23:08:36 +00001099 return (vector unsigned short)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001100}
1101
1102static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001103vec_andc(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001104{
David Blaikie3302f2b2013-01-16 23:08:36 +00001105 return __a & ~(vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001106}
1107
1108static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001109vec_andc(vector bool short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001110{
David Blaikie3302f2b2013-01-16 23:08:36 +00001111 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001112}
1113
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001114static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001115vec_andc(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001116{
David Blaikie3302f2b2013-01-16 23:08:36 +00001117 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001118}
1119
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001120static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001121vec_andc(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001122{
David Blaikie3302f2b2013-01-16 23:08:36 +00001123 return (vector int)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001124}
1125
1126static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001127vec_andc(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001128{
David Blaikie3302f2b2013-01-16 23:08:36 +00001129 return __a & ~(vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001130}
1131
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001132static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001133vec_andc(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001134{
David Blaikie3302f2b2013-01-16 23:08:36 +00001135 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001136}
1137
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001138static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001139vec_andc(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001140{
David Blaikie3302f2b2013-01-16 23:08:36 +00001141 return (vector unsigned int)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001142}
1143
1144static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001145vec_andc(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001146{
David Blaikie3302f2b2013-01-16 23:08:36 +00001147 return __a & ~(vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001148}
1149
1150static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001151vec_andc(vector bool int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001152{
David Blaikie3302f2b2013-01-16 23:08:36 +00001153 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001154}
1155
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001156static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001157vec_andc(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001158{
David Blaikie3302f2b2013-01-16 23:08:36 +00001159 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1160 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001161}
1162
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001163static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001164vec_andc(vector bool int __a, vector float __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001165{
David Blaikie3302f2b2013-01-16 23:08:36 +00001166 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1167 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001168}
1169
1170static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001171vec_andc(vector float __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001172{
David Blaikie3302f2b2013-01-16 23:08:36 +00001173 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1174 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001175}
1176
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001177/* vec_vandc */
1178
1179static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001180vec_vandc(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001181{
David Blaikie3302f2b2013-01-16 23:08:36 +00001182 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001183}
1184
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001185static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001186vec_vandc(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001187{
David Blaikie3302f2b2013-01-16 23:08:36 +00001188 return (vector signed char)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001189}
1190
1191static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001192vec_vandc(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001193{
David Blaikie3302f2b2013-01-16 23:08:36 +00001194 return __a & ~(vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001195}
1196
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001197static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001198vec_vandc(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001199{
David Blaikie3302f2b2013-01-16 23:08:36 +00001200 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001201}
1202
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001203static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001204vec_vandc(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001205{
David Blaikie3302f2b2013-01-16 23:08:36 +00001206 return (vector unsigned char)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001207}
1208
1209static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001210vec_vandc(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001211{
David Blaikie3302f2b2013-01-16 23:08:36 +00001212 return __a & ~(vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001213}
1214
1215static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001216vec_vandc(vector bool char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001217{
David Blaikie3302f2b2013-01-16 23:08:36 +00001218 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001219}
1220
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001221static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001222vec_vandc(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001223{
David Blaikie3302f2b2013-01-16 23:08:36 +00001224 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001225}
1226
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001227static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001228vec_vandc(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001229{
David Blaikie3302f2b2013-01-16 23:08:36 +00001230 return (vector short)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001231}
1232
1233static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001234vec_vandc(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001235{
David Blaikie3302f2b2013-01-16 23:08:36 +00001236 return __a & ~(vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001237}
1238
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001239static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001240vec_vandc(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001241{
David Blaikie3302f2b2013-01-16 23:08:36 +00001242 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001243}
1244
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001245static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001246vec_vandc(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001247{
David Blaikie3302f2b2013-01-16 23:08:36 +00001248 return (vector unsigned short)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001249}
1250
1251static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001252vec_vandc(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001253{
David Blaikie3302f2b2013-01-16 23:08:36 +00001254 return __a & ~(vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001255}
1256
1257static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001258vec_vandc(vector bool short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001259{
David Blaikie3302f2b2013-01-16 23:08:36 +00001260 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001261}
1262
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001263static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001264vec_vandc(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001265{
David Blaikie3302f2b2013-01-16 23:08:36 +00001266 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001267}
1268
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001269static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001270vec_vandc(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001271{
David Blaikie3302f2b2013-01-16 23:08:36 +00001272 return (vector int)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001273}
1274
1275static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001276vec_vandc(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001277{
David Blaikie3302f2b2013-01-16 23:08:36 +00001278 return __a & ~(vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001279}
1280
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001281static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001282vec_vandc(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001283{
David Blaikie3302f2b2013-01-16 23:08:36 +00001284 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001285}
1286
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001287static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001288vec_vandc(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001289{
David Blaikie3302f2b2013-01-16 23:08:36 +00001290 return (vector unsigned int)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001291}
1292
1293static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001294vec_vandc(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001295{
David Blaikie3302f2b2013-01-16 23:08:36 +00001296 return __a & ~(vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001297}
1298
1299static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001300vec_vandc(vector bool int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001301{
David Blaikie3302f2b2013-01-16 23:08:36 +00001302 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001303}
1304
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001305static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001306vec_vandc(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001307{
David Blaikie3302f2b2013-01-16 23:08:36 +00001308 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1309 return (vector float)__res;
Chris Lattnerdad40622010-04-14 03:54:58 +00001310}
1311
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001312static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001313vec_vandc(vector bool int __a, vector float __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001314{
David Blaikie3302f2b2013-01-16 23:08:36 +00001315 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1316 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001317}
1318
1319static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001320vec_vandc(vector float __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001321{
David Blaikie3302f2b2013-01-16 23:08:36 +00001322 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1323 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001324}
1325
Chris Lattnerdad40622010-04-14 03:54:58 +00001326/* vec_avg */
1327
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001328static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001329vec_avg(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001330{
David Blaikie3302f2b2013-01-16 23:08:36 +00001331 return __builtin_altivec_vavgsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001332}
1333
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001334static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001335vec_avg(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001336{
David Blaikie3302f2b2013-01-16 23:08:36 +00001337 return __builtin_altivec_vavgub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001338}
1339
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001340static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001341vec_avg(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001342{
David Blaikie3302f2b2013-01-16 23:08:36 +00001343 return __builtin_altivec_vavgsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001344}
1345
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001346static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001347vec_avg(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001348{
David Blaikie3302f2b2013-01-16 23:08:36 +00001349 return __builtin_altivec_vavguh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001350}
1351
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001352static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001353vec_avg(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001354{
David Blaikie3302f2b2013-01-16 23:08:36 +00001355 return __builtin_altivec_vavgsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001356}
1357
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001358static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001359vec_avg(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001360{
David Blaikie3302f2b2013-01-16 23:08:36 +00001361 return __builtin_altivec_vavguw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001362}
1363
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001364/* vec_vavgsb */
Chris Lattnerdad40622010-04-14 03:54:58 +00001365
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001366static vector signed char __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001367vec_vavgsb(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001368{
David Blaikie3302f2b2013-01-16 23:08:36 +00001369 return __builtin_altivec_vavgsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001370}
1371
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001372/* vec_vavgub */
1373
1374static vector unsigned char __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001375vec_vavgub(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001376{
David Blaikie3302f2b2013-01-16 23:08:36 +00001377 return __builtin_altivec_vavgub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001378}
1379
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001380/* vec_vavgsh */
1381
1382static vector short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001383vec_vavgsh(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001384{
David Blaikie3302f2b2013-01-16 23:08:36 +00001385 return __builtin_altivec_vavgsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001386}
1387
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001388/* vec_vavguh */
1389
1390static vector unsigned short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001391vec_vavguh(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001392{
David Blaikie3302f2b2013-01-16 23:08:36 +00001393 return __builtin_altivec_vavguh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001394}
1395
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001396/* vec_vavgsw */
1397
1398static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001399vec_vavgsw(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001400{
David Blaikie3302f2b2013-01-16 23:08:36 +00001401 return __builtin_altivec_vavgsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001402}
1403
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001404/* vec_vavguw */
1405
1406static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001407vec_vavguw(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001408{
David Blaikie3302f2b2013-01-16 23:08:36 +00001409 return __builtin_altivec_vavguw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001410}
1411
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001412/* vec_ceil */
1413
1414static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001415vec_ceil(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +00001416{
David Blaikie3302f2b2013-01-16 23:08:36 +00001417 return __builtin_altivec_vrfip(__a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001418}
1419
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001420/* vec_vrfip */
Chris Lattnerdad40622010-04-14 03:54:58 +00001421
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001422static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001423vec_vrfip(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +00001424{
David Blaikie3302f2b2013-01-16 23:08:36 +00001425 return __builtin_altivec_vrfip(__a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001426}
1427
1428/* vec_cmpb */
1429
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001430static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001431vec_cmpb(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001432{
David Blaikie3302f2b2013-01-16 23:08:36 +00001433 return __builtin_altivec_vcmpbfp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001434}
1435
1436/* vec_vcmpbfp */
1437
1438static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001439vec_vcmpbfp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001440{
David Blaikie3302f2b2013-01-16 23:08:36 +00001441 return __builtin_altivec_vcmpbfp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001442}
Chris Lattnerdad40622010-04-14 03:54:58 +00001443
1444/* vec_cmpeq */
1445
Anton Yartsevfc83c602010-08-19 03:21:36 +00001446static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001447vec_cmpeq(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001448{
Anton Yartsevfc83c602010-08-19 03:21:36 +00001449 return (vector bool char)
David Blaikie3302f2b2013-01-16 23:08:36 +00001450 __builtin_altivec_vcmpequb((vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001451}
1452
Anton Yartsevfc83c602010-08-19 03:21:36 +00001453static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001454vec_cmpeq(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001455{
Anton Yartsevfc83c602010-08-19 03:21:36 +00001456 return (vector bool char)
David Blaikie3302f2b2013-01-16 23:08:36 +00001457 __builtin_altivec_vcmpequb((vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001458}
1459
Anton Yartsevfc83c602010-08-19 03:21:36 +00001460static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001461vec_cmpeq(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001462{
David Blaikie3302f2b2013-01-16 23:08:36 +00001463 return (vector bool short)__builtin_altivec_vcmpequh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001464}
1465
Anton Yartsevfc83c602010-08-19 03:21:36 +00001466static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001467vec_cmpeq(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001468{
Anton Yartsevfc83c602010-08-19 03:21:36 +00001469 return (vector bool short)
David Blaikie3302f2b2013-01-16 23:08:36 +00001470 __builtin_altivec_vcmpequh((vector short)__a, (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001471}
1472
Anton Yartsevfc83c602010-08-19 03:21:36 +00001473static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001474vec_cmpeq(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001475{
David Blaikie3302f2b2013-01-16 23:08:36 +00001476 return (vector bool int)__builtin_altivec_vcmpequw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001477}
1478
Anton Yartsevfc83c602010-08-19 03:21:36 +00001479static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001480vec_cmpeq(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001481{
Anton Yartsevfc83c602010-08-19 03:21:36 +00001482 return (vector bool int)
David Blaikie3302f2b2013-01-16 23:08:36 +00001483 __builtin_altivec_vcmpequw((vector int)__a, (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001484}
1485
Kit Barton8553bec2015-03-11 15:57:19 +00001486#ifdef __POWER8_VECTOR__
1487static vector bool long long __ATTRS_o_ai
1488vec_cmpeq(vector signed long long __a, vector signed long long __b)
1489{
1490 return (vector bool long long) __builtin_altivec_vcmpequd(__a, __b);
1491}
1492
1493static vector bool long long __ATTRS_o_ai
1494vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b)
1495{
1496 return (vector bool long long)
1497 __builtin_altivec_vcmpequd((vector long long)__a, (vector long long) __b);
1498}
1499#endif
1500
Anton Yartsevfc83c602010-08-19 03:21:36 +00001501static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001502vec_cmpeq(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001503{
David Blaikie3302f2b2013-01-16 23:08:36 +00001504 return (vector bool int)__builtin_altivec_vcmpeqfp(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001505}
1506
1507/* vec_cmpge */
1508
Anton Yartsevfc83c602010-08-19 03:21:36 +00001509static vector bool int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001510vec_cmpge(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001511{
David Blaikie3302f2b2013-01-16 23:08:36 +00001512 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001513}
1514
1515/* vec_vcmpgefp */
1516
Anton Yartsevfc83c602010-08-19 03:21:36 +00001517static vector bool int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001518vec_vcmpgefp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001519{
David Blaikie3302f2b2013-01-16 23:08:36 +00001520 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001521}
Chris Lattnerdad40622010-04-14 03:54:58 +00001522
1523/* vec_cmpgt */
1524
Anton Yartsevfc83c602010-08-19 03:21:36 +00001525static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001526vec_cmpgt(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001527{
David Blaikie3302f2b2013-01-16 23:08:36 +00001528 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001529}
1530
Anton Yartsevfc83c602010-08-19 03:21:36 +00001531static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001532vec_cmpgt(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001533{
David Blaikie3302f2b2013-01-16 23:08:36 +00001534 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001535}
1536
Anton Yartsevfc83c602010-08-19 03:21:36 +00001537static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001538vec_cmpgt(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001539{
David Blaikie3302f2b2013-01-16 23:08:36 +00001540 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001541}
1542
Anton Yartsevfc83c602010-08-19 03:21:36 +00001543static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001544vec_cmpgt(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001545{
David Blaikie3302f2b2013-01-16 23:08:36 +00001546 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001547}
1548
Anton Yartsevfc83c602010-08-19 03:21:36 +00001549static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001550vec_cmpgt(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001551{
David Blaikie3302f2b2013-01-16 23:08:36 +00001552 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001553}
1554
Anton Yartsevfc83c602010-08-19 03:21:36 +00001555static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001556vec_cmpgt(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001557{
David Blaikie3302f2b2013-01-16 23:08:36 +00001558 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001559}
1560
Kit Barton8553bec2015-03-11 15:57:19 +00001561#ifdef __POWER8_VECTOR__
1562static vector bool long long __ATTRS_o_ai
1563vec_cmpgt(vector signed long long __a, vector signed long long __b)
1564{
1565 return (vector bool long long)__builtin_altivec_vcmpgtsd(__a, __b);
1566}
1567
1568static vector bool long long __ATTRS_o_ai
1569vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b)
1570{
1571 return (vector bool long long)__builtin_altivec_vcmpgtud(__a, __b);
1572}
1573#endif
1574
Anton Yartsevfc83c602010-08-19 03:21:36 +00001575static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001576vec_cmpgt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001577{
David Blaikie3302f2b2013-01-16 23:08:36 +00001578 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001579}
1580
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001581/* vec_vcmpgtsb */
Chris Lattnerdad40622010-04-14 03:54:58 +00001582
Anton Yartsevfc83c602010-08-19 03:21:36 +00001583static vector bool char __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001584vec_vcmpgtsb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001585{
David Blaikie3302f2b2013-01-16 23:08:36 +00001586 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001587}
1588
1589/* vec_vcmpgtub */
1590
Anton Yartsevfc83c602010-08-19 03:21:36 +00001591static vector bool char __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001592vec_vcmpgtub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001593{
David Blaikie3302f2b2013-01-16 23:08:36 +00001594 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001595}
1596
1597/* vec_vcmpgtsh */
1598
Anton Yartsevfc83c602010-08-19 03:21:36 +00001599static vector bool short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001600vec_vcmpgtsh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001601{
David Blaikie3302f2b2013-01-16 23:08:36 +00001602 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001603}
1604
1605/* vec_vcmpgtuh */
1606
Anton Yartsevfc83c602010-08-19 03:21:36 +00001607static vector bool short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001608vec_vcmpgtuh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001609{
David Blaikie3302f2b2013-01-16 23:08:36 +00001610 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001611}
1612
1613/* vec_vcmpgtsw */
1614
Anton Yartsevfc83c602010-08-19 03:21:36 +00001615static vector bool int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001616vec_vcmpgtsw(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001617{
David Blaikie3302f2b2013-01-16 23:08:36 +00001618 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001619}
1620
1621/* vec_vcmpgtuw */
1622
Anton Yartsevfc83c602010-08-19 03:21:36 +00001623static vector bool int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001624vec_vcmpgtuw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001625{
David Blaikie3302f2b2013-01-16 23:08:36 +00001626 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001627}
1628
1629/* vec_vcmpgtfp */
1630
Anton Yartsevfc83c602010-08-19 03:21:36 +00001631static vector bool int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001632vec_vcmpgtfp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001633{
David Blaikie3302f2b2013-01-16 23:08:36 +00001634 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001635}
1636
1637/* vec_cmple */
Chris Lattnerdad40622010-04-14 03:54:58 +00001638
Anton Yartsevfc83c602010-08-19 03:21:36 +00001639static vector bool int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001640vec_cmple(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001641{
David Blaikie3302f2b2013-01-16 23:08:36 +00001642 return (vector bool int)__builtin_altivec_vcmpgefp(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001643}
1644
1645/* vec_cmplt */
1646
Anton Yartsevfc83c602010-08-19 03:21:36 +00001647static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001648vec_cmplt(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001649{
David Blaikie3302f2b2013-01-16 23:08:36 +00001650 return (vector bool char)__builtin_altivec_vcmpgtsb(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001651}
1652
Anton Yartsevfc83c602010-08-19 03:21:36 +00001653static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001654vec_cmplt(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001655{
David Blaikie3302f2b2013-01-16 23:08:36 +00001656 return (vector bool char)__builtin_altivec_vcmpgtub(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001657}
1658
Anton Yartsevfc83c602010-08-19 03:21:36 +00001659static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001660vec_cmplt(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001661{
David Blaikie3302f2b2013-01-16 23:08:36 +00001662 return (vector bool short)__builtin_altivec_vcmpgtsh(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001663}
1664
Anton Yartsevfc83c602010-08-19 03:21:36 +00001665static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001666vec_cmplt(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001667{
David Blaikie3302f2b2013-01-16 23:08:36 +00001668 return (vector bool short)__builtin_altivec_vcmpgtuh(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001669}
1670
Anton Yartsevfc83c602010-08-19 03:21:36 +00001671static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001672vec_cmplt(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001673{
David Blaikie3302f2b2013-01-16 23:08:36 +00001674 return (vector bool int)__builtin_altivec_vcmpgtsw(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001675}
1676
Anton Yartsevfc83c602010-08-19 03:21:36 +00001677static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001678vec_cmplt(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001679{
David Blaikie3302f2b2013-01-16 23:08:36 +00001680 return (vector bool int)__builtin_altivec_vcmpgtuw(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001681}
1682
Anton Yartsevfc83c602010-08-19 03:21:36 +00001683static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001684vec_cmplt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001685{
David Blaikie3302f2b2013-01-16 23:08:36 +00001686 return (vector bool int)__builtin_altivec_vcmpgtfp(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001687}
1688
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001689/* vec_ctf */
1690
1691static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001692vec_ctf(vector int __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001693{
David Blaikie3302f2b2013-01-16 23:08:36 +00001694 return __builtin_altivec_vcfsx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001695}
1696
1697static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001698vec_ctf(vector unsigned int __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001699{
David Blaikie3302f2b2013-01-16 23:08:36 +00001700 return __builtin_altivec_vcfux((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001701}
1702
1703/* vec_vcfsx */
1704
1705static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001706vec_vcfsx(vector int __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001707{
David Blaikie3302f2b2013-01-16 23:08:36 +00001708 return __builtin_altivec_vcfsx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001709}
1710
1711/* vec_vcfux */
1712
1713static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001714vec_vcfux(vector unsigned int __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001715{
David Blaikie3302f2b2013-01-16 23:08:36 +00001716 return __builtin_altivec_vcfux((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001717}
1718
1719/* vec_cts */
1720
1721static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001722vec_cts(vector float __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001723{
David Blaikie3302f2b2013-01-16 23:08:36 +00001724 return __builtin_altivec_vctsxs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001725}
1726
1727/* vec_vctsxs */
1728
1729static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001730vec_vctsxs(vector float __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001731{
David Blaikie3302f2b2013-01-16 23:08:36 +00001732 return __builtin_altivec_vctsxs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001733}
1734
1735/* vec_ctu */
1736
1737static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001738vec_ctu(vector float __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001739{
David Blaikie3302f2b2013-01-16 23:08:36 +00001740 return __builtin_altivec_vctuxs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001741}
1742
1743/* vec_vctuxs */
1744
1745static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001746vec_vctuxs(vector float __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001747{
David Blaikie3302f2b2013-01-16 23:08:36 +00001748 return __builtin_altivec_vctuxs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001749}
1750
Bill Schmidtcee13a22014-11-14 12:10:51 +00001751/* vec_div */
1752#ifdef __VSX__
1753static vector float __ATTRS_o_ai
1754vec_div(vector float __a, vector float __b)
1755{
1756 return __builtin_vsx_xvdivsp(__a, __b);
1757}
1758
1759static vector double __ATTRS_o_ai
1760vec_div(vector double __a, vector double __b)
1761{
1762 return __builtin_vsx_xvdivdp(__a, __b);
1763}
1764#endif
1765
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001766/* vec_dss */
1767
1768static void __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001769vec_dss(int __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001770{
David Blaikie3302f2b2013-01-16 23:08:36 +00001771 __builtin_altivec_dss(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001772}
1773
1774/* vec_dssall */
1775
1776static void __attribute__((__always_inline__))
1777vec_dssall(void)
1778{
1779 __builtin_altivec_dssall();
1780}
1781
1782/* vec_dst */
1783
1784static void __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001785vec_dst(const void *__a, int __b, int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001786{
David Blaikie3302f2b2013-01-16 23:08:36 +00001787 __builtin_altivec_dst(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001788}
1789
1790/* vec_dstst */
1791
1792static void __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001793vec_dstst(const void *__a, int __b, int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001794{
David Blaikie3302f2b2013-01-16 23:08:36 +00001795 __builtin_altivec_dstst(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001796}
1797
1798/* vec_dststt */
1799
1800static void __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001801vec_dststt(const void *__a, int __b, int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001802{
David Blaikie3302f2b2013-01-16 23:08:36 +00001803 __builtin_altivec_dststt(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001804}
1805
1806/* vec_dstt */
1807
1808static void __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001809vec_dstt(const void *__a, int __b, int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001810{
David Blaikie3302f2b2013-01-16 23:08:36 +00001811 __builtin_altivec_dstt(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001812}
1813
1814/* vec_expte */
1815
1816static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001817vec_expte(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001818{
David Blaikie3302f2b2013-01-16 23:08:36 +00001819 return __builtin_altivec_vexptefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001820}
1821
1822/* vec_vexptefp */
1823
1824static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001825vec_vexptefp(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001826{
David Blaikie3302f2b2013-01-16 23:08:36 +00001827 return __builtin_altivec_vexptefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001828}
1829
1830/* vec_floor */
1831
1832static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001833vec_floor(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001834{
David Blaikie3302f2b2013-01-16 23:08:36 +00001835 return __builtin_altivec_vrfim(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001836}
1837
1838/* vec_vrfim */
1839
1840static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001841vec_vrfim(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001842{
David Blaikie3302f2b2013-01-16 23:08:36 +00001843 return __builtin_altivec_vrfim(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001844}
1845
1846/* vec_ld */
1847
1848static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001849vec_ld(int __a, const vector signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001850{
David Blaikie3302f2b2013-01-16 23:08:36 +00001851 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001852}
1853
1854static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001855vec_ld(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001856{
David Blaikie3302f2b2013-01-16 23:08:36 +00001857 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001858}
1859
1860static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001861vec_ld(int __a, const vector unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001862{
David Blaikie3302f2b2013-01-16 23:08:36 +00001863 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001864}
1865
1866static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001867vec_ld(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001868{
David Blaikie3302f2b2013-01-16 23:08:36 +00001869 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001870}
1871
Anton Yartsevfc83c602010-08-19 03:21:36 +00001872static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001873vec_ld(int __a, const vector bool char *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001874{
David Blaikie3302f2b2013-01-16 23:08:36 +00001875 return (vector bool char)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001876}
1877
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001878static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001879vec_ld(int __a, const vector short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001880{
David Blaikie3302f2b2013-01-16 23:08:36 +00001881 return (vector short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001882}
1883
1884static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001885vec_ld(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001886{
David Blaikie3302f2b2013-01-16 23:08:36 +00001887 return (vector short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001888}
1889
1890static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001891vec_ld(int __a, const vector unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001892{
David Blaikie3302f2b2013-01-16 23:08:36 +00001893 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001894}
1895
1896static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001897vec_ld(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001898{
David Blaikie3302f2b2013-01-16 23:08:36 +00001899 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001900}
1901
Anton Yartsevfc83c602010-08-19 03:21:36 +00001902static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001903vec_ld(int __a, const vector bool short *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001904{
David Blaikie3302f2b2013-01-16 23:08:36 +00001905 return (vector bool short)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001906}
1907
1908static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001909vec_ld(int __a, const vector pixel *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001910{
David Blaikie3302f2b2013-01-16 23:08:36 +00001911 return (vector pixel)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001912}
1913
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001914static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001915vec_ld(int __a, const vector int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001916{
David Blaikie3302f2b2013-01-16 23:08:36 +00001917 return (vector int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001918}
1919
1920static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001921vec_ld(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001922{
David Blaikie3302f2b2013-01-16 23:08:36 +00001923 return (vector int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001924}
1925
1926static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001927vec_ld(int __a, const vector unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001928{
David Blaikie3302f2b2013-01-16 23:08:36 +00001929 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001930}
1931
1932static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001933vec_ld(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001934{
David Blaikie3302f2b2013-01-16 23:08:36 +00001935 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001936}
1937
Anton Yartsevfc83c602010-08-19 03:21:36 +00001938static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001939vec_ld(int __a, const vector bool int *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001940{
David Blaikie3302f2b2013-01-16 23:08:36 +00001941 return (vector bool int)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001942}
1943
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001944static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001945vec_ld(int __a, const vector float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001946{
David Blaikie3302f2b2013-01-16 23:08:36 +00001947 return (vector float)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001948}
1949
1950static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001951vec_ld(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001952{
David Blaikie3302f2b2013-01-16 23:08:36 +00001953 return (vector float)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001954}
1955
1956/* vec_lvx */
1957
1958static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001959vec_lvx(int __a, const vector signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001960{
David Blaikie3302f2b2013-01-16 23:08:36 +00001961 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001962}
1963
1964static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001965vec_lvx(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001966{
David Blaikie3302f2b2013-01-16 23:08:36 +00001967 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001968}
1969
1970static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001971vec_lvx(int __a, const vector unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001972{
David Blaikie3302f2b2013-01-16 23:08:36 +00001973 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001974}
1975
1976static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001977vec_lvx(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001978{
David Blaikie3302f2b2013-01-16 23:08:36 +00001979 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001980}
1981
Anton Yartsevfc83c602010-08-19 03:21:36 +00001982static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001983vec_lvx(int __a, const vector bool char *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001984{
David Blaikie3302f2b2013-01-16 23:08:36 +00001985 return (vector bool char)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001986}
1987
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001988static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001989vec_lvx(int __a, const vector short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001990{
David Blaikie3302f2b2013-01-16 23:08:36 +00001991 return (vector short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001992}
1993
1994static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001995vec_lvx(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001996{
David Blaikie3302f2b2013-01-16 23:08:36 +00001997 return (vector short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001998}
1999
2000static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002001vec_lvx(int __a, const vector unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002002{
David Blaikie3302f2b2013-01-16 23:08:36 +00002003 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002004}
2005
2006static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002007vec_lvx(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002008{
David Blaikie3302f2b2013-01-16 23:08:36 +00002009 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002010}
2011
Anton Yartsevfc83c602010-08-19 03:21:36 +00002012static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002013vec_lvx(int __a, const vector bool short *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002014{
David Blaikie3302f2b2013-01-16 23:08:36 +00002015 return (vector bool short)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002016}
2017
2018static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002019vec_lvx(int __a, const vector pixel *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002020{
David Blaikie3302f2b2013-01-16 23:08:36 +00002021 return (vector pixel)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002022}
2023
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002024static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002025vec_lvx(int __a, const vector int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002026{
David Blaikie3302f2b2013-01-16 23:08:36 +00002027 return (vector int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002028}
2029
2030static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002031vec_lvx(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002032{
David Blaikie3302f2b2013-01-16 23:08:36 +00002033 return (vector int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002034}
2035
2036static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002037vec_lvx(int __a, const vector unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002038{
David Blaikie3302f2b2013-01-16 23:08:36 +00002039 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002040}
2041
2042static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002043vec_lvx(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002044{
David Blaikie3302f2b2013-01-16 23:08:36 +00002045 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002046}
2047
Anton Yartsevfc83c602010-08-19 03:21:36 +00002048static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002049vec_lvx(int __a, const vector bool int *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002050{
David Blaikie3302f2b2013-01-16 23:08:36 +00002051 return (vector bool int)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002052}
2053
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002054static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002055vec_lvx(int __a, const vector float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002056{
David Blaikie3302f2b2013-01-16 23:08:36 +00002057 return (vector float)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002058}
2059
2060static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002061vec_lvx(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002062{
David Blaikie3302f2b2013-01-16 23:08:36 +00002063 return (vector float)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002064}
2065
2066/* vec_lde */
2067
2068static vector signed char __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002069vec_lde(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002070{
David Blaikie3302f2b2013-01-16 23:08:36 +00002071 return (vector signed char)__builtin_altivec_lvebx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002072}
2073
2074static vector unsigned char __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002075vec_lde(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002076{
David Blaikie3302f2b2013-01-16 23:08:36 +00002077 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002078}
2079
2080static vector short __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002081vec_lde(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002082{
David Blaikie3302f2b2013-01-16 23:08:36 +00002083 return (vector short)__builtin_altivec_lvehx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002084}
2085
2086static vector unsigned short __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002087vec_lde(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002088{
David Blaikie3302f2b2013-01-16 23:08:36 +00002089 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002090}
2091
2092static vector int __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002093vec_lde(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002094{
David Blaikie3302f2b2013-01-16 23:08:36 +00002095 return (vector int)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002096}
2097
2098static vector unsigned int __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002099vec_lde(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002100{
David Blaikie3302f2b2013-01-16 23:08:36 +00002101 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002102}
2103
2104static vector float __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002105vec_lde(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002106{
David Blaikie3302f2b2013-01-16 23:08:36 +00002107 return (vector float)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002108}
2109
2110/* vec_lvebx */
2111
2112static vector signed char __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002113vec_lvebx(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002114{
David Blaikie3302f2b2013-01-16 23:08:36 +00002115 return (vector signed char)__builtin_altivec_lvebx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002116}
2117
2118static vector unsigned char __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002119vec_lvebx(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002120{
David Blaikie3302f2b2013-01-16 23:08:36 +00002121 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002122}
2123
2124/* vec_lvehx */
2125
2126static vector short __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002127vec_lvehx(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002128{
David Blaikie3302f2b2013-01-16 23:08:36 +00002129 return (vector short)__builtin_altivec_lvehx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002130}
2131
2132static vector unsigned short __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002133vec_lvehx(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002134{
David Blaikie3302f2b2013-01-16 23:08:36 +00002135 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002136}
2137
2138/* vec_lvewx */
2139
2140static vector int __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002141vec_lvewx(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002142{
David Blaikie3302f2b2013-01-16 23:08:36 +00002143 return (vector int)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002144}
2145
2146static vector unsigned int __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002147vec_lvewx(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002148{
David Blaikie3302f2b2013-01-16 23:08:36 +00002149 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002150}
2151
2152static vector float __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002153vec_lvewx(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002154{
David Blaikie3302f2b2013-01-16 23:08:36 +00002155 return (vector float)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002156}
2157
2158/* vec_ldl */
2159
2160static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002161vec_ldl(int __a, const vector signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002162{
David Blaikie3302f2b2013-01-16 23:08:36 +00002163 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002164}
2165
2166static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002167vec_ldl(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002168{
David Blaikie3302f2b2013-01-16 23:08:36 +00002169 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002170}
2171
2172static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002173vec_ldl(int __a, const vector unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002174{
David Blaikie3302f2b2013-01-16 23:08:36 +00002175 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002176}
2177
2178static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002179vec_ldl(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002180{
David Blaikie3302f2b2013-01-16 23:08:36 +00002181 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002182}
2183
Anton Yartsevfc83c602010-08-19 03:21:36 +00002184static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002185vec_ldl(int __a, const vector bool char *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002186{
David Blaikie3302f2b2013-01-16 23:08:36 +00002187 return (vector bool char)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002188}
2189
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002190static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002191vec_ldl(int __a, const vector short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002192{
David Blaikie3302f2b2013-01-16 23:08:36 +00002193 return (vector short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002194}
2195
2196static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002197vec_ldl(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002198{
David Blaikie3302f2b2013-01-16 23:08:36 +00002199 return (vector short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002200}
2201
2202static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002203vec_ldl(int __a, const vector unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002204{
David Blaikie3302f2b2013-01-16 23:08:36 +00002205 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002206}
2207
2208static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002209vec_ldl(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002210{
David Blaikie3302f2b2013-01-16 23:08:36 +00002211 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002212}
2213
Anton Yartsevfc83c602010-08-19 03:21:36 +00002214static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002215vec_ldl(int __a, const vector bool short *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002216{
David Blaikie3302f2b2013-01-16 23:08:36 +00002217 return (vector bool short)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002218}
2219
2220static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002221vec_ldl(int __a, const vector pixel *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002222{
David Blaikie3302f2b2013-01-16 23:08:36 +00002223 return (vector pixel short)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002224}
2225
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002226static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002227vec_ldl(int __a, const vector int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002228{
David Blaikie3302f2b2013-01-16 23:08:36 +00002229 return (vector int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002230}
2231
2232static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002233vec_ldl(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002234{
David Blaikie3302f2b2013-01-16 23:08:36 +00002235 return (vector int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002236}
2237
2238static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002239vec_ldl(int __a, const vector unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002240{
David Blaikie3302f2b2013-01-16 23:08:36 +00002241 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002242}
2243
2244static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002245vec_ldl(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002246{
David Blaikie3302f2b2013-01-16 23:08:36 +00002247 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002248}
2249
Anton Yartsevfc83c602010-08-19 03:21:36 +00002250static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002251vec_ldl(int __a, const vector bool int *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002252{
David Blaikie3302f2b2013-01-16 23:08:36 +00002253 return (vector bool int)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002254}
2255
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002256static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002257vec_ldl(int __a, const vector float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002258{
David Blaikie3302f2b2013-01-16 23:08:36 +00002259 return (vector float)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002260}
2261
2262static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002263vec_ldl(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002264{
David Blaikie3302f2b2013-01-16 23:08:36 +00002265 return (vector float)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002266}
2267
2268/* vec_lvxl */
2269
2270static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002271vec_lvxl(int __a, const vector signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002272{
David Blaikie3302f2b2013-01-16 23:08:36 +00002273 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002274}
2275
2276static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002277vec_lvxl(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002278{
David Blaikie3302f2b2013-01-16 23:08:36 +00002279 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002280}
2281
2282static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002283vec_lvxl(int __a, const vector unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002284{
David Blaikie3302f2b2013-01-16 23:08:36 +00002285 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002286}
2287
2288static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002289vec_lvxl(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002290{
David Blaikie3302f2b2013-01-16 23:08:36 +00002291 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002292}
2293
Anton Yartsevfc83c602010-08-19 03:21:36 +00002294static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002295vec_lvxl(int __a, const vector bool char *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002296{
David Blaikie3302f2b2013-01-16 23:08:36 +00002297 return (vector bool char)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002298}
2299
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002300static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002301vec_lvxl(int __a, const vector short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002302{
David Blaikie3302f2b2013-01-16 23:08:36 +00002303 return (vector short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002304}
2305
2306static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002307vec_lvxl(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002308{
David Blaikie3302f2b2013-01-16 23:08:36 +00002309 return (vector short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002310}
2311
2312static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002313vec_lvxl(int __a, const vector unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002314{
David Blaikie3302f2b2013-01-16 23:08:36 +00002315 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002316}
2317
2318static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002319vec_lvxl(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002320{
David Blaikie3302f2b2013-01-16 23:08:36 +00002321 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002322}
2323
Anton Yartsevfc83c602010-08-19 03:21:36 +00002324static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002325vec_lvxl(int __a, const vector bool short *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002326{
David Blaikie3302f2b2013-01-16 23:08:36 +00002327 return (vector bool short)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002328}
2329
2330static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002331vec_lvxl(int __a, const vector pixel *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002332{
David Blaikie3302f2b2013-01-16 23:08:36 +00002333 return (vector pixel)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002334}
2335
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002336static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002337vec_lvxl(int __a, const vector int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002338{
David Blaikie3302f2b2013-01-16 23:08:36 +00002339 return (vector int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002340}
2341
2342static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002343vec_lvxl(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002344{
David Blaikie3302f2b2013-01-16 23:08:36 +00002345 return (vector int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002346}
2347
2348static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002349vec_lvxl(int __a, const vector unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002350{
David Blaikie3302f2b2013-01-16 23:08:36 +00002351 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002352}
2353
2354static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002355vec_lvxl(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002356{
David Blaikie3302f2b2013-01-16 23:08:36 +00002357 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002358}
2359
Anton Yartsevfc83c602010-08-19 03:21:36 +00002360static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002361vec_lvxl(int __a, const vector bool int *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002362{
David Blaikie3302f2b2013-01-16 23:08:36 +00002363 return (vector bool int)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002364}
2365
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002366static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002367vec_lvxl(int __a, const vector float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002368{
David Blaikie3302f2b2013-01-16 23:08:36 +00002369 return (vector float)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002370}
2371
2372static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002373vec_lvxl(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002374{
David Blaikie3302f2b2013-01-16 23:08:36 +00002375 return (vector float)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002376}
2377
2378/* vec_loge */
2379
2380static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002381vec_loge(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002382{
David Blaikie3302f2b2013-01-16 23:08:36 +00002383 return __builtin_altivec_vlogefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002384}
2385
2386/* vec_vlogefp */
2387
2388static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002389vec_vlogefp(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002390{
David Blaikie3302f2b2013-01-16 23:08:36 +00002391 return __builtin_altivec_vlogefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002392}
2393
2394/* vec_lvsl */
2395
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002396#ifdef __LITTLE_ENDIAN__
2397static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002398__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002399loads/stores")))
2400vec_lvsl(int __a, const signed char *__b)
2401{
2402 vector unsigned char mask =
2403 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2404 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2405 return vec_perm(mask, mask, reverse);
2406}
2407#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002408static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002409vec_lvsl(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002410{
David Blaikie3302f2b2013-01-16 23:08:36 +00002411 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002412}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002413#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002414
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002415#ifdef __LITTLE_ENDIAN__
2416static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002417__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002418loads/stores")))
2419vec_lvsl(int __a, const unsigned char *__b)
2420{
2421 vector unsigned char mask =
2422 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2423 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2424 return vec_perm(mask, mask, reverse);
2425}
2426#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002427static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002428vec_lvsl(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002429{
David Blaikie3302f2b2013-01-16 23:08:36 +00002430 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002431}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002432#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002433
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002434#ifdef __LITTLE_ENDIAN__
2435static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002436__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002437loads/stores")))
2438vec_lvsl(int __a, const short *__b)
2439{
2440 vector unsigned char mask =
2441 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2442 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2443 return vec_perm(mask, mask, reverse);
2444}
2445#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002446static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002447vec_lvsl(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002448{
David Blaikie3302f2b2013-01-16 23:08:36 +00002449 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002450}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002451#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002452
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002453#ifdef __LITTLE_ENDIAN__
2454static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002455__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002456loads/stores")))
2457vec_lvsl(int __a, const unsigned short *__b)
2458{
2459 vector unsigned char mask =
2460 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2461 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2462 return vec_perm(mask, mask, reverse);
2463}
2464#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002465static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002466vec_lvsl(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002467{
David Blaikie3302f2b2013-01-16 23:08:36 +00002468 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002469}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002470#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002471
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002472#ifdef __LITTLE_ENDIAN__
2473static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002474__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002475loads/stores")))
2476vec_lvsl(int __a, const int *__b)
2477{
2478 vector unsigned char mask =
2479 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2480 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2481 return vec_perm(mask, mask, reverse);
2482}
2483#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002484static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002485vec_lvsl(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002486{
David Blaikie3302f2b2013-01-16 23:08:36 +00002487 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002488}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002489#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002490
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002491#ifdef __LITTLE_ENDIAN__
2492static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002493__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002494loads/stores")))
2495vec_lvsl(int __a, const unsigned int *__b)
2496{
2497 vector unsigned char mask =
2498 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2499 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2500 return vec_perm(mask, mask, reverse);
2501}
2502#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002503static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002504vec_lvsl(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002505{
David Blaikie3302f2b2013-01-16 23:08:36 +00002506 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002507}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002508#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002509
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002510#ifdef __LITTLE_ENDIAN__
2511static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002512__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002513loads/stores")))
2514vec_lvsl(int __a, const float *__b)
2515{
2516 vector unsigned char mask =
2517 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2518 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2519 return vec_perm(mask, mask, reverse);
2520}
2521#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002522static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002523vec_lvsl(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002524{
David Blaikie3302f2b2013-01-16 23:08:36 +00002525 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002526}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002527#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002528
2529/* vec_lvsr */
2530
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002531#ifdef __LITTLE_ENDIAN__
2532static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002533__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002534loads/stores")))
2535vec_lvsr(int __a, const signed char *__b)
2536{
2537 vector unsigned char mask =
2538 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2539 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2540 return vec_perm(mask, mask, reverse);
2541}
2542#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002543static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002544vec_lvsr(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002545{
David Blaikie3302f2b2013-01-16 23:08:36 +00002546 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002547}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002548#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002549
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002550#ifdef __LITTLE_ENDIAN__
2551static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002552__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002553loads/stores")))
2554vec_lvsr(int __a, const unsigned char *__b)
2555{
2556 vector unsigned char mask =
2557 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2558 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2559 return vec_perm(mask, mask, reverse);
2560}
2561#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002562static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002563vec_lvsr(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002564{
David Blaikie3302f2b2013-01-16 23:08:36 +00002565 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002566}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002567#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002568
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002569#ifdef __LITTLE_ENDIAN__
2570static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002571__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002572loads/stores")))
2573vec_lvsr(int __a, const short *__b)
2574{
2575 vector unsigned char mask =
2576 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2577 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2578 return vec_perm(mask, mask, reverse);
2579}
2580#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002581static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002582vec_lvsr(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002583{
David Blaikie3302f2b2013-01-16 23:08:36 +00002584 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002585}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002586#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002587
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002588#ifdef __LITTLE_ENDIAN__
2589static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002590__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002591loads/stores")))
2592vec_lvsr(int __a, const unsigned short *__b)
2593{
2594 vector unsigned char mask =
2595 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2596 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2597 return vec_perm(mask, mask, reverse);
2598}
2599#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002600static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002601vec_lvsr(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002602{
David Blaikie3302f2b2013-01-16 23:08:36 +00002603 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002604}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002605#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002606
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002607#ifdef __LITTLE_ENDIAN__
2608static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002609__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002610loads/stores")))
2611vec_lvsr(int __a, const int *__b)
2612{
2613 vector unsigned char mask =
2614 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2615 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2616 return vec_perm(mask, mask, reverse);
2617}
2618#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002619static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002620vec_lvsr(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002621{
David Blaikie3302f2b2013-01-16 23:08:36 +00002622 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002623}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002624#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002625
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002626#ifdef __LITTLE_ENDIAN__
2627static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002628__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002629loads/stores")))
2630vec_lvsr(int __a, const unsigned int *__b)
2631{
2632 vector unsigned char mask =
2633 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2634 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2635 return vec_perm(mask, mask, reverse);
2636}
2637#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002638static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002639vec_lvsr(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002640{
David Blaikie3302f2b2013-01-16 23:08:36 +00002641 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002642}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002643#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002644
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002645#ifdef __LITTLE_ENDIAN__
2646static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002647__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002648loads/stores")))
2649vec_lvsr(int __a, const float *__b)
2650{
2651 vector unsigned char mask =
2652 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2653 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2654 return vec_perm(mask, mask, reverse);
2655}
2656#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002657static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002658vec_lvsr(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002659{
David Blaikie3302f2b2013-01-16 23:08:36 +00002660 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002661}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002662#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002663
2664/* vec_madd */
2665
2666static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002667vec_madd(vector float __a, vector float __b, vector float __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002668{
David Blaikie3302f2b2013-01-16 23:08:36 +00002669 return __builtin_altivec_vmaddfp(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002670}
2671
2672/* vec_vmaddfp */
2673
2674static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002675vec_vmaddfp(vector float __a, vector float __b, vector float __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002676{
David Blaikie3302f2b2013-01-16 23:08:36 +00002677 return __builtin_altivec_vmaddfp(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002678}
2679
2680/* vec_madds */
2681
2682static vector signed short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002683vec_madds(vector signed short __a, vector signed short __b, vector signed short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002684{
David Blaikie3302f2b2013-01-16 23:08:36 +00002685 return __builtin_altivec_vmhaddshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002686}
2687
2688/* vec_vmhaddshs */
2689static vector signed short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002690vec_vmhaddshs(vector signed short __a,
2691 vector signed short __b,
2692 vector signed short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002693{
David Blaikie3302f2b2013-01-16 23:08:36 +00002694 return __builtin_altivec_vmhaddshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002695}
2696
Chris Lattnerdad40622010-04-14 03:54:58 +00002697/* vec_max */
2698
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002699static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002700vec_max(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002701{
David Blaikie3302f2b2013-01-16 23:08:36 +00002702 return __builtin_altivec_vmaxsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002703}
2704
Anton Yartsevfc83c602010-08-19 03:21:36 +00002705static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002706vec_max(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002707{
David Blaikie3302f2b2013-01-16 23:08:36 +00002708 return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002709}
2710
2711static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002712vec_max(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002713{
David Blaikie3302f2b2013-01-16 23:08:36 +00002714 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002715}
2716
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002717static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002718vec_max(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002719{
David Blaikie3302f2b2013-01-16 23:08:36 +00002720 return __builtin_altivec_vmaxub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002721}
2722
Anton Yartsevfc83c602010-08-19 03:21:36 +00002723static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002724vec_max(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002725{
David Blaikie3302f2b2013-01-16 23:08:36 +00002726 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002727}
2728
2729static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002730vec_max(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002731{
David Blaikie3302f2b2013-01-16 23:08:36 +00002732 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002733}
2734
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002735static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002736vec_max(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002737{
David Blaikie3302f2b2013-01-16 23:08:36 +00002738 return __builtin_altivec_vmaxsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002739}
2740
Anton Yartsevfc83c602010-08-19 03:21:36 +00002741static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002742vec_max(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002743{
David Blaikie3302f2b2013-01-16 23:08:36 +00002744 return __builtin_altivec_vmaxsh((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002745}
2746
2747static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002748vec_max(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002749{
David Blaikie3302f2b2013-01-16 23:08:36 +00002750 return __builtin_altivec_vmaxsh(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002751}
2752
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002753static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002754vec_max(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002755{
David Blaikie3302f2b2013-01-16 23:08:36 +00002756 return __builtin_altivec_vmaxuh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002757}
2758
Anton Yartsevfc83c602010-08-19 03:21:36 +00002759static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002760vec_max(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002761{
David Blaikie3302f2b2013-01-16 23:08:36 +00002762 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002763}
2764
2765static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002766vec_max(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002767{
David Blaikie3302f2b2013-01-16 23:08:36 +00002768 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002769}
2770
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002771static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002772vec_max(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002773{
David Blaikie3302f2b2013-01-16 23:08:36 +00002774 return __builtin_altivec_vmaxsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002775}
2776
Anton Yartsevfc83c602010-08-19 03:21:36 +00002777static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002778vec_max(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002779{
David Blaikie3302f2b2013-01-16 23:08:36 +00002780 return __builtin_altivec_vmaxsw((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002781}
2782
2783static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002784vec_max(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002785{
David Blaikie3302f2b2013-01-16 23:08:36 +00002786 return __builtin_altivec_vmaxsw(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002787}
2788
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002789static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002790vec_max(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002791{
David Blaikie3302f2b2013-01-16 23:08:36 +00002792 return __builtin_altivec_vmaxuw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002793}
2794
Anton Yartsevfc83c602010-08-19 03:21:36 +00002795static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002796vec_max(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002797{
David Blaikie3302f2b2013-01-16 23:08:36 +00002798 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002799}
2800
2801static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002802vec_max(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002803{
David Blaikie3302f2b2013-01-16 23:08:36 +00002804 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002805}
2806
Kit Barton8553bec2015-03-11 15:57:19 +00002807#ifdef __POWER8_VECTOR__
2808static vector signed long long __ATTRS_o_ai
2809vec_max(vector signed long long __a, vector signed long long __b)
2810{
2811 return __builtin_altivec_vmaxsd(__a, __b);
2812}
2813
2814static vector unsigned long long __ATTRS_o_ai
2815vec_max(vector unsigned long long __a, vector unsigned long long __b)
2816{
2817 return __builtin_altivec_vmaxud(__a, __b);
2818}
2819#endif
2820
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002821static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002822vec_max(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002823{
Bill Schmidt691e01d2014-10-31 19:19:24 +00002824#ifdef __VSX__
2825 return __builtin_vsx_xvmaxsp(__a, __b);
2826#else
David Blaikie3302f2b2013-01-16 23:08:36 +00002827 return __builtin_altivec_vmaxfp(__a, __b);
Bill Schmidt691e01d2014-10-31 19:19:24 +00002828#endif
Chris Lattnerdad40622010-04-14 03:54:58 +00002829}
2830
Bill Schmidt691e01d2014-10-31 19:19:24 +00002831#ifdef __VSX__
2832static vector double __ATTRS_o_ai
2833vec_max(vector double __a, vector double __b)
2834{
2835 return __builtin_vsx_xvmaxdp(__a, __b);
2836}
2837#endif
2838
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002839/* vec_vmaxsb */
2840
Anton Yartsevfc83c602010-08-19 03:21:36 +00002841static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002842vec_vmaxsb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002843{
David Blaikie3302f2b2013-01-16 23:08:36 +00002844 return __builtin_altivec_vmaxsb(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002845}
2846
Anton Yartsevfc83c602010-08-19 03:21:36 +00002847static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002848vec_vmaxsb(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002849{
David Blaikie3302f2b2013-01-16 23:08:36 +00002850 return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002851}
2852
2853static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002854vec_vmaxsb(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002855{
David Blaikie3302f2b2013-01-16 23:08:36 +00002856 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002857}
2858
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002859/* vec_vmaxub */
2860
Anton Yartsevfc83c602010-08-19 03:21:36 +00002861static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002862vec_vmaxub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002863{
David Blaikie3302f2b2013-01-16 23:08:36 +00002864 return __builtin_altivec_vmaxub(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002865}
2866
Anton Yartsevfc83c602010-08-19 03:21:36 +00002867static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002868vec_vmaxub(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002869{
David Blaikie3302f2b2013-01-16 23:08:36 +00002870 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002871}
2872
2873static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002874vec_vmaxub(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002875{
David Blaikie3302f2b2013-01-16 23:08:36 +00002876 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002877}
2878
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002879/* vec_vmaxsh */
2880
Anton Yartsevfc83c602010-08-19 03:21:36 +00002881static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002882vec_vmaxsh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002883{
David Blaikie3302f2b2013-01-16 23:08:36 +00002884 return __builtin_altivec_vmaxsh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002885}
2886
Anton Yartsevfc83c602010-08-19 03:21:36 +00002887static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002888vec_vmaxsh(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002889{
David Blaikie3302f2b2013-01-16 23:08:36 +00002890 return __builtin_altivec_vmaxsh((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002891}
2892
2893static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002894vec_vmaxsh(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002895{
David Blaikie3302f2b2013-01-16 23:08:36 +00002896 return __builtin_altivec_vmaxsh(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002897}
2898
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002899/* vec_vmaxuh */
2900
Anton Yartsevfc83c602010-08-19 03:21:36 +00002901static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002902vec_vmaxuh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002903{
David Blaikie3302f2b2013-01-16 23:08:36 +00002904 return __builtin_altivec_vmaxuh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002905}
2906
Anton Yartsevfc83c602010-08-19 03:21:36 +00002907static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002908vec_vmaxuh(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002909{
David Blaikie3302f2b2013-01-16 23:08:36 +00002910 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002911}
2912
2913static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002914vec_vmaxuh(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002915{
David Blaikie3302f2b2013-01-16 23:08:36 +00002916 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002917}
2918
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002919/* vec_vmaxsw */
2920
Anton Yartsevfc83c602010-08-19 03:21:36 +00002921static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002922vec_vmaxsw(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002923{
David Blaikie3302f2b2013-01-16 23:08:36 +00002924 return __builtin_altivec_vmaxsw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002925}
2926
Anton Yartsevfc83c602010-08-19 03:21:36 +00002927static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002928vec_vmaxsw(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002929{
David Blaikie3302f2b2013-01-16 23:08:36 +00002930 return __builtin_altivec_vmaxsw((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002931}
2932
2933static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002934vec_vmaxsw(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002935{
David Blaikie3302f2b2013-01-16 23:08:36 +00002936 return __builtin_altivec_vmaxsw(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002937}
2938
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002939/* vec_vmaxuw */
2940
Anton Yartsevfc83c602010-08-19 03:21:36 +00002941static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002942vec_vmaxuw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002943{
David Blaikie3302f2b2013-01-16 23:08:36 +00002944 return __builtin_altivec_vmaxuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002945}
2946
Anton Yartsevfc83c602010-08-19 03:21:36 +00002947static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002948vec_vmaxuw(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002949{
David Blaikie3302f2b2013-01-16 23:08:36 +00002950 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002951}
2952
2953static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002954vec_vmaxuw(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002955{
David Blaikie3302f2b2013-01-16 23:08:36 +00002956 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002957}
2958
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002959/* vec_vmaxfp */
2960
2961static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002962vec_vmaxfp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002963{
Bill Schmidt691e01d2014-10-31 19:19:24 +00002964#ifdef __VSX__
2965 return __builtin_vsx_xvmaxsp(__a, __b);
2966#else
David Blaikie3302f2b2013-01-16 23:08:36 +00002967 return __builtin_altivec_vmaxfp(__a, __b);
Bill Schmidt691e01d2014-10-31 19:19:24 +00002968#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002969}
2970
2971/* vec_mergeh */
2972
2973static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002974vec_mergeh(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002975{
David Blaikie3302f2b2013-01-16 23:08:36 +00002976 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002977 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2978 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2979}
2980
2981static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002982vec_mergeh(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002983{
David Blaikie3302f2b2013-01-16 23:08:36 +00002984 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002985 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2986 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2987}
2988
Anton Yartsev9e968982010-08-19 03:00:09 +00002989static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002990vec_mergeh(vector bool char __a, vector bool char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002991{
David Blaikie3302f2b2013-01-16 23:08:36 +00002992 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002993 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2994 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2995}
2996
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002997static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002998vec_mergeh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002999{
David Blaikie3302f2b2013-01-16 23:08:36 +00003000 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003001 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
3002 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
3003}
3004
3005static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003006vec_mergeh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003007{
David Blaikie3302f2b2013-01-16 23:08:36 +00003008 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003009 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
3010 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
3011}
3012
Anton Yartsev9e968982010-08-19 03:00:09 +00003013static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003014vec_mergeh(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003015{
David Blaikie3302f2b2013-01-16 23:08:36 +00003016 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003017 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
3018 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
3019}
3020
3021static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003022vec_mergeh(vector pixel __a, vector pixel __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003023{
David Blaikie3302f2b2013-01-16 23:08:36 +00003024 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003025 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
3026 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
3027}
3028
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003029static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003030vec_mergeh(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003031{
David Blaikie3302f2b2013-01-16 23:08:36 +00003032 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003033 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
3034 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
3035}
3036
3037static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003038vec_mergeh(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003039{
David Blaikie3302f2b2013-01-16 23:08:36 +00003040 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003041 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
3042 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
3043}
3044
Anton Yartsev9e968982010-08-19 03:00:09 +00003045static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003046vec_mergeh(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003047{
David Blaikie3302f2b2013-01-16 23:08:36 +00003048 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003049 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
3050 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
3051}
3052
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003053static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003054vec_mergeh(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003055{
David Blaikie3302f2b2013-01-16 23:08:36 +00003056 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003057 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
3058 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
3059}
3060
3061/* vec_vmrghb */
3062
3063#define __builtin_altivec_vmrghb vec_vmrghb
3064
3065static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003066vec_vmrghb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003067{
David Blaikie3302f2b2013-01-16 23:08:36 +00003068 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003069 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
3070 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
3071}
3072
3073static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003074vec_vmrghb(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003075{
David Blaikie3302f2b2013-01-16 23:08:36 +00003076 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003077 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
3078 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
3079}
3080
Anton Yartsev9e968982010-08-19 03:00:09 +00003081static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003082vec_vmrghb(vector bool char __a, vector bool char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003083{
David Blaikie3302f2b2013-01-16 23:08:36 +00003084 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003085 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
3086 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
3087}
3088
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003089/* vec_vmrghh */
3090
3091#define __builtin_altivec_vmrghh vec_vmrghh
3092
3093static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003094vec_vmrghh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003095{
David Blaikie3302f2b2013-01-16 23:08:36 +00003096 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003097 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
3098 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
3099}
3100
3101static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003102vec_vmrghh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003103{
David Blaikie3302f2b2013-01-16 23:08:36 +00003104 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003105 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
3106 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
3107}
3108
Anton Yartsev9e968982010-08-19 03:00:09 +00003109static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003110vec_vmrghh(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003111{
David Blaikie3302f2b2013-01-16 23:08:36 +00003112 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003113 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
3114 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
3115}
3116
3117static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003118vec_vmrghh(vector pixel __a, vector pixel __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003119{
David Blaikie3302f2b2013-01-16 23:08:36 +00003120 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003121 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
3122 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
3123}
3124
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003125/* vec_vmrghw */
3126
3127#define __builtin_altivec_vmrghw vec_vmrghw
3128
3129static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003130vec_vmrghw(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003131{
David Blaikie3302f2b2013-01-16 23:08:36 +00003132 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003133 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
3134 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
3135}
3136
3137static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003138vec_vmrghw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003139{
David Blaikie3302f2b2013-01-16 23:08:36 +00003140 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003141 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
3142 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
3143}
3144
Anton Yartsev9e968982010-08-19 03:00:09 +00003145static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003146vec_vmrghw(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003147{
David Blaikie3302f2b2013-01-16 23:08:36 +00003148 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003149 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
3150 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
3151}
3152
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003153static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003154vec_vmrghw(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003155{
David Blaikie3302f2b2013-01-16 23:08:36 +00003156 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003157 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
3158 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
3159}
3160
3161/* vec_mergel */
3162
3163static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003164vec_mergel(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003165{
David Blaikie3302f2b2013-01-16 23:08:36 +00003166 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003167 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
3168 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
3169}
3170
3171static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003172vec_mergel(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003173{
David Blaikie3302f2b2013-01-16 23:08:36 +00003174 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003175 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
3176 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
3177}
3178
Anton Yartsev9e968982010-08-19 03:00:09 +00003179static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003180vec_mergel(vector bool char __a, vector bool char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003181{
David Blaikie3302f2b2013-01-16 23:08:36 +00003182 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003183 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
3184 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
3185}
3186
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003187static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003188vec_mergel(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003189{
David Blaikie3302f2b2013-01-16 23:08:36 +00003190 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003191 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3192 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3193}
3194
3195static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003196vec_mergel(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003197{
David Blaikie3302f2b2013-01-16 23:08:36 +00003198 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003199 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3200 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3201}
3202
Anton Yartsev9e968982010-08-19 03:00:09 +00003203static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003204vec_mergel(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003205{
David Blaikie3302f2b2013-01-16 23:08:36 +00003206 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003207 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3208 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3209}
3210
3211static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003212vec_mergel(vector pixel __a, vector pixel __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003213{
David Blaikie3302f2b2013-01-16 23:08:36 +00003214 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003215 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3216 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3217}
3218
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003219static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003220vec_mergel(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003221{
David Blaikie3302f2b2013-01-16 23:08:36 +00003222 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003223 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3224 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3225}
3226
3227static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003228vec_mergel(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003229{
David Blaikie3302f2b2013-01-16 23:08:36 +00003230 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003231 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3232 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3233}
3234
Anton Yartsev9e968982010-08-19 03:00:09 +00003235static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003236vec_mergel(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003237{
David Blaikie3302f2b2013-01-16 23:08:36 +00003238 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003239 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3240 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3241}
3242
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003243static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003244vec_mergel(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003245{
David Blaikie3302f2b2013-01-16 23:08:36 +00003246 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003247 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3248 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3249}
3250
3251/* vec_vmrglb */
3252
3253#define __builtin_altivec_vmrglb vec_vmrglb
3254
3255static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003256vec_vmrglb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003257{
David Blaikie3302f2b2013-01-16 23:08:36 +00003258 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003259 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
3260 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
3261}
3262
3263static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003264vec_vmrglb(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003265{
David Blaikie3302f2b2013-01-16 23:08:36 +00003266 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003267 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
3268 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
3269}
3270
Anton Yartsev9e968982010-08-19 03:00:09 +00003271static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003272vec_vmrglb(vector bool char __a, vector bool char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003273{
David Blaikie3302f2b2013-01-16 23:08:36 +00003274 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003275 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
3276 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
3277}
3278
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003279/* vec_vmrglh */
3280
3281#define __builtin_altivec_vmrglh vec_vmrglh
3282
3283static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003284vec_vmrglh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003285{
David Blaikie3302f2b2013-01-16 23:08:36 +00003286 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003287 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3288 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3289}
3290
3291static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003292vec_vmrglh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003293{
David Blaikie3302f2b2013-01-16 23:08:36 +00003294 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003295 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3296 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3297}
3298
Anton Yartsev9e968982010-08-19 03:00:09 +00003299static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003300vec_vmrglh(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003301{
David Blaikie3302f2b2013-01-16 23:08:36 +00003302 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003303 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3304 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3305}
3306
3307static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003308vec_vmrglh(vector pixel __a, vector pixel __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003309{
David Blaikie3302f2b2013-01-16 23:08:36 +00003310 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003311 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3312 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3313}
3314
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003315/* vec_vmrglw */
3316
3317#define __builtin_altivec_vmrglw vec_vmrglw
3318
3319static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003320vec_vmrglw(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003321{
David Blaikie3302f2b2013-01-16 23:08:36 +00003322 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003323 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3324 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3325}
3326
3327static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003328vec_vmrglw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003329{
David Blaikie3302f2b2013-01-16 23:08:36 +00003330 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003331 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3332 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3333}
3334
Anton Yartsev9e968982010-08-19 03:00:09 +00003335static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003336vec_vmrglw(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003337{
David Blaikie3302f2b2013-01-16 23:08:36 +00003338 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003339 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3340 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3341}
3342
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003343static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003344vec_vmrglw(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003345{
David Blaikie3302f2b2013-01-16 23:08:36 +00003346 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003347 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3348 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3349}
3350
Chris Lattnerdad40622010-04-14 03:54:58 +00003351/* vec_mfvscr */
3352
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003353static vector unsigned short __attribute__((__always_inline__))
3354vec_mfvscr(void)
3355{
3356 return __builtin_altivec_mfvscr();
3357}
Chris Lattnerdad40622010-04-14 03:54:58 +00003358
3359/* vec_min */
3360
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003361static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003362vec_min(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003363{
David Blaikie3302f2b2013-01-16 23:08:36 +00003364 return __builtin_altivec_vminsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003365}
3366
Anton Yartsevfc83c602010-08-19 03:21:36 +00003367static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003368vec_min(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003369{
David Blaikie3302f2b2013-01-16 23:08:36 +00003370 return __builtin_altivec_vminsb((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003371}
3372
3373static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003374vec_min(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003375{
David Blaikie3302f2b2013-01-16 23:08:36 +00003376 return __builtin_altivec_vminsb(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003377}
3378
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003379static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003380vec_min(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003381{
David Blaikie3302f2b2013-01-16 23:08:36 +00003382 return __builtin_altivec_vminub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003383}
3384
Anton Yartsevfc83c602010-08-19 03:21:36 +00003385static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003386vec_min(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003387{
David Blaikie3302f2b2013-01-16 23:08:36 +00003388 return __builtin_altivec_vminub((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003389}
3390
3391static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003392vec_min(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003393{
David Blaikie3302f2b2013-01-16 23:08:36 +00003394 return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003395}
3396
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003397static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003398vec_min(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003399{
David Blaikie3302f2b2013-01-16 23:08:36 +00003400 return __builtin_altivec_vminsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003401}
3402
Anton Yartsevfc83c602010-08-19 03:21:36 +00003403static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003404vec_min(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003405{
David Blaikie3302f2b2013-01-16 23:08:36 +00003406 return __builtin_altivec_vminsh((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003407}
3408
3409static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003410vec_min(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003411{
David Blaikie3302f2b2013-01-16 23:08:36 +00003412 return __builtin_altivec_vminsh(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003413}
3414
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003415static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003416vec_min(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003417{
David Blaikie3302f2b2013-01-16 23:08:36 +00003418 return __builtin_altivec_vminuh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003419}
3420
Anton Yartsevfc83c602010-08-19 03:21:36 +00003421static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003422vec_min(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003423{
David Blaikie3302f2b2013-01-16 23:08:36 +00003424 return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003425}
3426
3427static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003428vec_min(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003429{
David Blaikie3302f2b2013-01-16 23:08:36 +00003430 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003431}
3432
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003433static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003434vec_min(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003435{
David Blaikie3302f2b2013-01-16 23:08:36 +00003436 return __builtin_altivec_vminsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003437}
3438
Anton Yartsevfc83c602010-08-19 03:21:36 +00003439static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003440vec_min(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003441{
David Blaikie3302f2b2013-01-16 23:08:36 +00003442 return __builtin_altivec_vminsw((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003443}
3444
3445static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003446vec_min(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003447{
David Blaikie3302f2b2013-01-16 23:08:36 +00003448 return __builtin_altivec_vminsw(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003449}
3450
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003451static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003452vec_min(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003453{
David Blaikie3302f2b2013-01-16 23:08:36 +00003454 return __builtin_altivec_vminuw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003455}
3456
Anton Yartsevfc83c602010-08-19 03:21:36 +00003457static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003458vec_min(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003459{
David Blaikie3302f2b2013-01-16 23:08:36 +00003460 return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003461}
3462
3463static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003464vec_min(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003465{
David Blaikie3302f2b2013-01-16 23:08:36 +00003466 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003467}
3468
Kit Barton8553bec2015-03-11 15:57:19 +00003469#ifdef __POWER8_VECTOR__
3470static vector signed long long __ATTRS_o_ai
3471vec_min(vector signed long long __a, vector signed long long __b)
3472{
3473 return __builtin_altivec_vminsd(__a, __b);
3474}
3475
3476static vector unsigned long long __ATTRS_o_ai
3477vec_min(vector unsigned long long __a, vector unsigned long long __b)
3478{
3479 return __builtin_altivec_vminud(__a, __b);
3480}
3481#endif
3482
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003483static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003484vec_min(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003485{
Bill Schmidt691e01d2014-10-31 19:19:24 +00003486#ifdef __VSX__
3487 return __builtin_vsx_xvminsp(__a, __b);
3488#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003489 return __builtin_altivec_vminfp(__a, __b);
Bill Schmidt691e01d2014-10-31 19:19:24 +00003490#endif
Chris Lattnerdad40622010-04-14 03:54:58 +00003491}
3492
Bill Schmidt691e01d2014-10-31 19:19:24 +00003493#ifdef __VSX__
3494static vector double __ATTRS_o_ai
3495vec_min(vector double __a, vector double __b)
3496{
3497 return __builtin_vsx_xvmindp(__a, __b);
3498}
3499#endif
3500
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003501/* vec_vminsb */
3502
Anton Yartsevfc83c602010-08-19 03:21:36 +00003503static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003504vec_vminsb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003505{
David Blaikie3302f2b2013-01-16 23:08:36 +00003506 return __builtin_altivec_vminsb(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003507}
3508
Anton Yartsevfc83c602010-08-19 03:21:36 +00003509static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003510vec_vminsb(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003511{
David Blaikie3302f2b2013-01-16 23:08:36 +00003512 return __builtin_altivec_vminsb((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003513}
3514
3515static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003516vec_vminsb(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003517{
David Blaikie3302f2b2013-01-16 23:08:36 +00003518 return __builtin_altivec_vminsb(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003519}
3520
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003521/* vec_vminub */
3522
Anton Yartsevfc83c602010-08-19 03:21:36 +00003523static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003524vec_vminub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003525{
David Blaikie3302f2b2013-01-16 23:08:36 +00003526 return __builtin_altivec_vminub(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003527}
3528
Anton Yartsevfc83c602010-08-19 03:21:36 +00003529static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003530vec_vminub(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003531{
David Blaikie3302f2b2013-01-16 23:08:36 +00003532 return __builtin_altivec_vminub((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003533}
3534
3535static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003536vec_vminub(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003537{
David Blaikie3302f2b2013-01-16 23:08:36 +00003538 return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003539}
3540
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003541/* vec_vminsh */
3542
Anton Yartsevfc83c602010-08-19 03:21:36 +00003543static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003544vec_vminsh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003545{
David Blaikie3302f2b2013-01-16 23:08:36 +00003546 return __builtin_altivec_vminsh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003547}
3548
Anton Yartsevfc83c602010-08-19 03:21:36 +00003549static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003550vec_vminsh(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003551{
David Blaikie3302f2b2013-01-16 23:08:36 +00003552 return __builtin_altivec_vminsh((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003553}
3554
3555static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003556vec_vminsh(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003557{
David Blaikie3302f2b2013-01-16 23:08:36 +00003558 return __builtin_altivec_vminsh(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003559}
3560
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003561/* vec_vminuh */
3562
Anton Yartsevfc83c602010-08-19 03:21:36 +00003563static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003564vec_vminuh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003565{
David Blaikie3302f2b2013-01-16 23:08:36 +00003566 return __builtin_altivec_vminuh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003567}
3568
Anton Yartsevfc83c602010-08-19 03:21:36 +00003569static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003570vec_vminuh(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003571{
David Blaikie3302f2b2013-01-16 23:08:36 +00003572 return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003573}
3574
3575static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003576vec_vminuh(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003577{
David Blaikie3302f2b2013-01-16 23:08:36 +00003578 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003579}
3580
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003581/* vec_vminsw */
3582
Anton Yartsevfc83c602010-08-19 03:21:36 +00003583static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003584vec_vminsw(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003585{
David Blaikie3302f2b2013-01-16 23:08:36 +00003586 return __builtin_altivec_vminsw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003587}
3588
Anton Yartsevfc83c602010-08-19 03:21:36 +00003589static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003590vec_vminsw(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003591{
David Blaikie3302f2b2013-01-16 23:08:36 +00003592 return __builtin_altivec_vminsw((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003593}
3594
3595static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003596vec_vminsw(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003597{
David Blaikie3302f2b2013-01-16 23:08:36 +00003598 return __builtin_altivec_vminsw(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003599}
3600
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003601/* vec_vminuw */
3602
Anton Yartsevfc83c602010-08-19 03:21:36 +00003603static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003604vec_vminuw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003605{
David Blaikie3302f2b2013-01-16 23:08:36 +00003606 return __builtin_altivec_vminuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003607}
3608
Anton Yartsevfc83c602010-08-19 03:21:36 +00003609static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003610vec_vminuw(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003611{
David Blaikie3302f2b2013-01-16 23:08:36 +00003612 return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003613}
3614
3615static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003616vec_vminuw(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003617{
David Blaikie3302f2b2013-01-16 23:08:36 +00003618 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003619}
3620
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003621/* vec_vminfp */
3622
3623static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003624vec_vminfp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003625{
Bill Schmidt691e01d2014-10-31 19:19:24 +00003626#ifdef __VSX__
3627 return __builtin_vsx_xvminsp(__a, __b);
3628#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003629 return __builtin_altivec_vminfp(__a, __b);
Bill Schmidt691e01d2014-10-31 19:19:24 +00003630#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003631}
3632
3633/* vec_mladd */
3634
3635#define __builtin_altivec_vmladduhm vec_mladd
3636
3637static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003638vec_mladd(vector short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003639{
David Blaikie3302f2b2013-01-16 23:08:36 +00003640 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003641}
3642
3643static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003644vec_mladd(vector short __a, vector unsigned short __b, vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003645{
David Blaikie3302f2b2013-01-16 23:08:36 +00003646 return __a * (vector short)__b + (vector short)__c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003647}
3648
3649static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003650vec_mladd(vector unsigned short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003651{
David Blaikie3302f2b2013-01-16 23:08:36 +00003652 return (vector short)__a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003653}
3654
3655static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003656vec_mladd(vector unsigned short __a,
3657 vector unsigned short __b,
3658 vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003659{
David Blaikie3302f2b2013-01-16 23:08:36 +00003660 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003661}
3662
3663/* vec_vmladduhm */
3664
3665static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003666vec_vmladduhm(vector short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003667{
David Blaikie3302f2b2013-01-16 23:08:36 +00003668 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003669}
3670
3671static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003672vec_vmladduhm(vector short __a, vector unsigned short __b, vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003673{
David Blaikie3302f2b2013-01-16 23:08:36 +00003674 return __a * (vector short)__b + (vector short)__c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003675}
3676
3677static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003678vec_vmladduhm(vector unsigned short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003679{
David Blaikie3302f2b2013-01-16 23:08:36 +00003680 return (vector short)__a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003681}
3682
3683static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003684vec_vmladduhm(vector unsigned short __a,
3685 vector unsigned short __b,
3686 vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003687{
David Blaikie3302f2b2013-01-16 23:08:36 +00003688 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003689}
3690
3691/* vec_mradds */
3692
3693static vector short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003694vec_mradds(vector short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003695{
David Blaikie3302f2b2013-01-16 23:08:36 +00003696 return __builtin_altivec_vmhraddshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003697}
3698
3699/* vec_vmhraddshs */
3700
3701static vector short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003702vec_vmhraddshs(vector short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003703{
David Blaikie3302f2b2013-01-16 23:08:36 +00003704 return __builtin_altivec_vmhraddshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003705}
3706
3707/* vec_msum */
3708
3709static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003710vec_msum(vector signed char __a, vector unsigned char __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003711{
David Blaikie3302f2b2013-01-16 23:08:36 +00003712 return __builtin_altivec_vmsummbm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003713}
3714
3715static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003716vec_msum(vector unsigned char __a, vector unsigned char __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003717{
David Blaikie3302f2b2013-01-16 23:08:36 +00003718 return __builtin_altivec_vmsumubm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003719}
3720
3721static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003722vec_msum(vector short __a, vector short __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003723{
David Blaikie3302f2b2013-01-16 23:08:36 +00003724 return __builtin_altivec_vmsumshm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003725}
3726
3727static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003728vec_msum(vector unsigned short __a,
3729 vector unsigned short __b,
3730 vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003731{
David Blaikie3302f2b2013-01-16 23:08:36 +00003732 return __builtin_altivec_vmsumuhm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003733}
3734
3735/* vec_vmsummbm */
3736
3737static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003738vec_vmsummbm(vector signed char __a, vector unsigned char __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003739{
David Blaikie3302f2b2013-01-16 23:08:36 +00003740 return __builtin_altivec_vmsummbm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003741}
3742
3743/* vec_vmsumubm */
3744
3745static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003746vec_vmsumubm(vector unsigned char __a,
3747 vector unsigned char __b,
3748 vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003749{
David Blaikie3302f2b2013-01-16 23:08:36 +00003750 return __builtin_altivec_vmsumubm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003751}
3752
3753/* vec_vmsumshm */
3754
3755static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003756vec_vmsumshm(vector short __a, vector short __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003757{
David Blaikie3302f2b2013-01-16 23:08:36 +00003758 return __builtin_altivec_vmsumshm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003759}
3760
3761/* vec_vmsumuhm */
3762
3763static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003764vec_vmsumuhm(vector unsigned short __a,
3765 vector unsigned short __b,
3766 vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003767{
David Blaikie3302f2b2013-01-16 23:08:36 +00003768 return __builtin_altivec_vmsumuhm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003769}
3770
3771/* vec_msums */
3772
3773static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003774vec_msums(vector short __a, vector short __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003775{
David Blaikie3302f2b2013-01-16 23:08:36 +00003776 return __builtin_altivec_vmsumshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003777}
3778
3779static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003780vec_msums(vector unsigned short __a,
3781 vector unsigned short __b,
3782 vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003783{
David Blaikie3302f2b2013-01-16 23:08:36 +00003784 return __builtin_altivec_vmsumuhs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003785}
3786
3787/* vec_vmsumshs */
3788
3789static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003790vec_vmsumshs(vector short __a, vector short __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003791{
David Blaikie3302f2b2013-01-16 23:08:36 +00003792 return __builtin_altivec_vmsumshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003793}
3794
3795/* vec_vmsumuhs */
3796
3797static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003798vec_vmsumuhs(vector unsigned short __a,
3799 vector unsigned short __b,
3800 vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003801{
David Blaikie3302f2b2013-01-16 23:08:36 +00003802 return __builtin_altivec_vmsumuhs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003803}
3804
Chris Lattnerdad40622010-04-14 03:54:58 +00003805/* vec_mtvscr */
3806
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003807static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003808vec_mtvscr(vector signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003809{
David Blaikie3302f2b2013-01-16 23:08:36 +00003810 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003811}
3812
3813static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003814vec_mtvscr(vector unsigned char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003815{
David Blaikie3302f2b2013-01-16 23:08:36 +00003816 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003817}
3818
3819static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003820vec_mtvscr(vector bool char __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003821{
David Blaikie3302f2b2013-01-16 23:08:36 +00003822 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003823}
3824
3825static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003826vec_mtvscr(vector short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003827{
David Blaikie3302f2b2013-01-16 23:08:36 +00003828 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003829}
3830
3831static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003832vec_mtvscr(vector unsigned short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003833{
David Blaikie3302f2b2013-01-16 23:08:36 +00003834 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003835}
3836
3837static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003838vec_mtvscr(vector bool short __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003839{
David Blaikie3302f2b2013-01-16 23:08:36 +00003840 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003841}
3842
3843static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003844vec_mtvscr(vector pixel __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003845{
David Blaikie3302f2b2013-01-16 23:08:36 +00003846 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003847}
3848
3849static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003850vec_mtvscr(vector int __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003851{
David Blaikie3302f2b2013-01-16 23:08:36 +00003852 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003853}
3854
3855static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003856vec_mtvscr(vector unsigned int __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003857{
David Blaikie3302f2b2013-01-16 23:08:36 +00003858 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003859}
3860
3861static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003862vec_mtvscr(vector bool int __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003863{
David Blaikie3302f2b2013-01-16 23:08:36 +00003864 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003865}
3866
3867static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003868vec_mtvscr(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003869{
David Blaikie3302f2b2013-01-16 23:08:36 +00003870 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003871}
3872
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003873/* The vmulos* and vmules* instructions have a big endian bias, so
3874 we must reverse the meaning of "even" and "odd" for little endian. */
3875
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003876/* vec_mule */
3877
3878static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003879vec_mule(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003880{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003881#ifdef __LITTLE_ENDIAN__
3882 return __builtin_altivec_vmulosb(__a, __b);
3883#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003884 return __builtin_altivec_vmulesb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003885#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003886}
3887
3888static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003889vec_mule(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003890{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003891#ifdef __LITTLE_ENDIAN__
3892 return __builtin_altivec_vmuloub(__a, __b);
3893#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003894 return __builtin_altivec_vmuleub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003895#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003896}
3897
3898static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003899vec_mule(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003900{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003901#ifdef __LITTLE_ENDIAN__
3902 return __builtin_altivec_vmulosh(__a, __b);
3903#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003904 return __builtin_altivec_vmulesh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003905#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003906}
3907
3908static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003909vec_mule(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003910{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003911#ifdef __LITTLE_ENDIAN__
3912 return __builtin_altivec_vmulouh(__a, __b);
3913#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003914 return __builtin_altivec_vmuleuh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003915#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003916}
3917
Kit Barton8553bec2015-03-11 15:57:19 +00003918#ifdef __POWER8_VECTOR__
3919static vector signed long long __ATTRS_o_ai
3920vec_mule(vector signed int __a, vector signed int __b)
3921{
3922#ifdef __LITTLE_ENDIAN__
3923 return __builtin_altivec_vmulosw(__a, __b);
3924#else
3925 return __builtin_altivec_vmulesw(__a, __b);
3926#endif
3927}
3928
3929static vector unsigned long long __ATTRS_o_ai
3930vec_mule(vector unsigned int __a, vector unsigned int __b)
3931{
3932#ifdef __LITTLE_ENDIAN__
3933 return __builtin_altivec_vmulouw(__a, __b);
3934#else
3935 return __builtin_altivec_vmuleuw(__a, __b);
3936#endif
3937}
3938#endif
3939
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003940/* vec_vmulesb */
3941
3942static vector short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003943vec_vmulesb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003944{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003945#ifdef __LITTLE_ENDIAN__
3946 return __builtin_altivec_vmulosb(__a, __b);
3947#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003948 return __builtin_altivec_vmulesb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003949#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003950}
3951
3952/* vec_vmuleub */
3953
3954static vector unsigned short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003955vec_vmuleub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003956{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003957#ifdef __LITTLE_ENDIAN__
3958 return __builtin_altivec_vmuloub(__a, __b);
3959#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003960 return __builtin_altivec_vmuleub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003961#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003962}
3963
3964/* vec_vmulesh */
3965
3966static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003967vec_vmulesh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003968{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003969#ifdef __LITTLE_ENDIAN__
3970 return __builtin_altivec_vmulosh(__a, __b);
3971#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003972 return __builtin_altivec_vmulesh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003973#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003974}
3975
3976/* vec_vmuleuh */
3977
3978static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003979vec_vmuleuh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003980{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003981#ifdef __LITTLE_ENDIAN__
3982 return __builtin_altivec_vmulouh(__a, __b);
3983#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003984 return __builtin_altivec_vmuleuh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003985#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003986}
3987
3988/* vec_mulo */
3989
3990static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003991vec_mulo(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003992{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003993#ifdef __LITTLE_ENDIAN__
3994 return __builtin_altivec_vmulesb(__a, __b);
3995#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003996 return __builtin_altivec_vmulosb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003997#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003998}
3999
4000static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004001vec_mulo(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004002{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00004003#ifdef __LITTLE_ENDIAN__
4004 return __builtin_altivec_vmuleub(__a, __b);
4005#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004006 return __builtin_altivec_vmuloub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00004007#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004008}
4009
4010static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004011vec_mulo(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004012{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00004013#ifdef __LITTLE_ENDIAN__
4014 return __builtin_altivec_vmulesh(__a, __b);
4015#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004016 return __builtin_altivec_vmulosh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00004017#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004018}
4019
4020static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004021vec_mulo(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004022{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00004023#ifdef __LITTLE_ENDIAN__
4024 return __builtin_altivec_vmuleuh(__a, __b);
4025#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004026 return __builtin_altivec_vmulouh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00004027#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004028}
4029
Kit Barton8553bec2015-03-11 15:57:19 +00004030#ifdef __POWER8_VECTOR__
4031static vector signed long long __ATTRS_o_ai
4032vec_mulo(vector signed int __a, vector signed int __b)
4033{
4034#ifdef __LITTLE_ENDIAN__
4035 return __builtin_altivec_vmulesw(__a, __b);
4036#else
4037 return __builtin_altivec_vmulosw(__a, __b);
4038#endif
4039}
4040
4041static vector unsigned long long __ATTRS_o_ai
4042vec_mulo(vector unsigned int __a, vector unsigned int __b)
4043{
4044#ifdef __LITTLE_ENDIAN__
4045 return __builtin_altivec_vmuleuw(__a, __b);
4046#else
4047 return __builtin_altivec_vmulouw(__a, __b);
4048#endif
4049}
4050#endif
4051
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004052/* vec_vmulosb */
4053
4054static vector short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004055vec_vmulosb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004056{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00004057#ifdef __LITTLE_ENDIAN__
4058 return __builtin_altivec_vmulesb(__a, __b);
4059#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004060 return __builtin_altivec_vmulosb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00004061#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004062}
4063
4064/* vec_vmuloub */
4065
4066static vector unsigned short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004067vec_vmuloub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004068{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00004069#ifdef __LITTLE_ENDIAN__
4070 return __builtin_altivec_vmuleub(__a, __b);
4071#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004072 return __builtin_altivec_vmuloub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00004073#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004074}
4075
4076/* vec_vmulosh */
4077
4078static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004079vec_vmulosh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004080{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00004081#ifdef __LITTLE_ENDIAN__
4082 return __builtin_altivec_vmulesh(__a, __b);
4083#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004084 return __builtin_altivec_vmulosh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00004085#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004086}
4087
4088/* vec_vmulouh */
4089
4090static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004091vec_vmulouh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004092{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00004093#ifdef __LITTLE_ENDIAN__
4094 return __builtin_altivec_vmuleuh(__a, __b);
4095#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004096 return __builtin_altivec_vmulouh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00004097#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004098}
4099
4100/* vec_nmsub */
4101
4102static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004103vec_nmsub(vector float __a, vector float __b, vector float __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004104{
David Blaikie3302f2b2013-01-16 23:08:36 +00004105 return __builtin_altivec_vnmsubfp(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004106}
4107
4108/* vec_vnmsubfp */
4109
4110static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004111vec_vnmsubfp(vector float __a, vector float __b, vector float __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004112{
David Blaikie3302f2b2013-01-16 23:08:36 +00004113 return __builtin_altivec_vnmsubfp(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004114}
4115
4116/* vec_nor */
4117
4118#define __builtin_altivec_vnor vec_nor
4119
4120static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004121vec_nor(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004122{
David Blaikie3302f2b2013-01-16 23:08:36 +00004123 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004124}
4125
4126static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004127vec_nor(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004128{
David Blaikie3302f2b2013-01-16 23:08:36 +00004129 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004130}
4131
Anton Yartsevfc83c602010-08-19 03:21:36 +00004132static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004133vec_nor(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004134{
David Blaikie3302f2b2013-01-16 23:08:36 +00004135 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00004136}
4137
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004138static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004139vec_nor(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004140{
David Blaikie3302f2b2013-01-16 23:08:36 +00004141 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004142}
4143
4144static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004145vec_nor(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004146{
David Blaikie3302f2b2013-01-16 23:08:36 +00004147 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004148}
4149
Anton Yartsevfc83c602010-08-19 03:21:36 +00004150static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004151vec_nor(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004152{
David Blaikie3302f2b2013-01-16 23:08:36 +00004153 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00004154}
4155
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004156static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004157vec_nor(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004158{
David Blaikie3302f2b2013-01-16 23:08:36 +00004159 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004160}
4161
4162static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004163vec_nor(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004164{
David Blaikie3302f2b2013-01-16 23:08:36 +00004165 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004166}
4167
Anton Yartsevfc83c602010-08-19 03:21:36 +00004168static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004169vec_nor(vector bool int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004170{
David Blaikie3302f2b2013-01-16 23:08:36 +00004171 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00004172}
4173
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004174static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004175vec_nor(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004176{
David Blaikie3302f2b2013-01-16 23:08:36 +00004177 vector unsigned int __res = ~((vector unsigned int)__a | (vector unsigned int)__b);
4178 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004179}
4180
4181/* vec_vnor */
4182
4183static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004184vec_vnor(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004185{
David Blaikie3302f2b2013-01-16 23:08:36 +00004186 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004187}
4188
4189static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004190vec_vnor(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004191{
David Blaikie3302f2b2013-01-16 23:08:36 +00004192 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004193}
4194
Anton Yartsevfc83c602010-08-19 03:21:36 +00004195static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004196vec_vnor(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004197{
David Blaikie3302f2b2013-01-16 23:08:36 +00004198 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00004199}
4200
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004201static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004202vec_vnor(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004203{
David Blaikie3302f2b2013-01-16 23:08:36 +00004204 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004205}
4206
4207static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004208vec_vnor(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004209{
David Blaikie3302f2b2013-01-16 23:08:36 +00004210 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004211}
4212
Anton Yartsevfc83c602010-08-19 03:21:36 +00004213static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004214vec_vnor(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004215{
David Blaikie3302f2b2013-01-16 23:08:36 +00004216 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00004217}
4218
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004219static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004220vec_vnor(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004221{
David Blaikie3302f2b2013-01-16 23:08:36 +00004222 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004223}
4224
4225static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004226vec_vnor(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004227{
David Blaikie3302f2b2013-01-16 23:08:36 +00004228 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004229}
4230
Anton Yartsevfc83c602010-08-19 03:21:36 +00004231static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004232vec_vnor(vector bool int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004233{
David Blaikie3302f2b2013-01-16 23:08:36 +00004234 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00004235}
4236
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004237static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004238vec_vnor(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004239{
David Blaikie3302f2b2013-01-16 23:08:36 +00004240 vector unsigned int __res = ~((vector unsigned int)__a | (vector unsigned int)__b);
4241 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004242}
4243
4244/* vec_or */
4245
4246#define __builtin_altivec_vor vec_or
4247
4248static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004249vec_or(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004250{
David Blaikie3302f2b2013-01-16 23:08:36 +00004251 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004252}
4253
Anton Yartsevfc83c602010-08-19 03:21:36 +00004254static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004255vec_or(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004256{
David Blaikie3302f2b2013-01-16 23:08:36 +00004257 return (vector signed char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004258}
4259
4260static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004261vec_or(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004262{
David Blaikie3302f2b2013-01-16 23:08:36 +00004263 return __a | (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004264}
4265
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004266static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004267vec_or(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004268{
David Blaikie3302f2b2013-01-16 23:08:36 +00004269 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004270}
4271
Anton Yartsevfc83c602010-08-19 03:21:36 +00004272static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004273vec_or(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004274{
David Blaikie3302f2b2013-01-16 23:08:36 +00004275 return (vector unsigned char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004276}
4277
4278static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004279vec_or(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004280{
David Blaikie3302f2b2013-01-16 23:08:36 +00004281 return __a | (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004282}
4283
4284static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004285vec_or(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004286{
David Blaikie3302f2b2013-01-16 23:08:36 +00004287 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004288}
4289
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004290static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004291vec_or(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004292{
David Blaikie3302f2b2013-01-16 23:08:36 +00004293 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004294}
4295
Anton Yartsevfc83c602010-08-19 03:21:36 +00004296static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004297vec_or(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004298{
David Blaikie3302f2b2013-01-16 23:08:36 +00004299 return (vector short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004300}
4301
4302static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004303vec_or(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004304{
David Blaikie3302f2b2013-01-16 23:08:36 +00004305 return __a | (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004306}
4307
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004308static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004309vec_or(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004310{
David Blaikie3302f2b2013-01-16 23:08:36 +00004311 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004312}
4313
Anton Yartsevfc83c602010-08-19 03:21:36 +00004314static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004315vec_or(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004316{
David Blaikie3302f2b2013-01-16 23:08:36 +00004317 return (vector unsigned short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004318}
4319
4320static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004321vec_or(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004322{
David Blaikie3302f2b2013-01-16 23:08:36 +00004323 return __a | (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004324}
4325
4326static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004327vec_or(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004328{
David Blaikie3302f2b2013-01-16 23:08:36 +00004329 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004330}
4331
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004332static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004333vec_or(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004334{
David Blaikie3302f2b2013-01-16 23:08:36 +00004335 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004336}
4337
Anton Yartsevfc83c602010-08-19 03:21:36 +00004338static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004339vec_or(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004340{
David Blaikie3302f2b2013-01-16 23:08:36 +00004341 return (vector int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004342}
4343
4344static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004345vec_or(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004346{
David Blaikie3302f2b2013-01-16 23:08:36 +00004347 return __a | (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004348}
4349
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004350static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004351vec_or(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004352{
David Blaikie3302f2b2013-01-16 23:08:36 +00004353 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004354}
4355
Anton Yartsevfc83c602010-08-19 03:21:36 +00004356static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004357vec_or(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004358{
David Blaikie3302f2b2013-01-16 23:08:36 +00004359 return (vector unsigned int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004360}
4361
4362static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004363vec_or(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004364{
David Blaikie3302f2b2013-01-16 23:08:36 +00004365 return __a | (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004366}
4367
4368static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004369vec_or(vector bool int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004370{
David Blaikie3302f2b2013-01-16 23:08:36 +00004371 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004372}
4373
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004374static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004375vec_or(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004376{
David Blaikie3302f2b2013-01-16 23:08:36 +00004377 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4378 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004379}
4380
Anton Yartsevfc83c602010-08-19 03:21:36 +00004381static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004382vec_or(vector bool int __a, vector float __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004383{
David Blaikie3302f2b2013-01-16 23:08:36 +00004384 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4385 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004386}
4387
4388static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004389vec_or(vector float __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004390{
David Blaikie3302f2b2013-01-16 23:08:36 +00004391 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4392 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004393}
4394
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004395/* vec_vor */
4396
4397static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004398vec_vor(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004399{
David Blaikie3302f2b2013-01-16 23:08:36 +00004400 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004401}
4402
Anton Yartsevfc83c602010-08-19 03:21:36 +00004403static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004404vec_vor(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004405{
David Blaikie3302f2b2013-01-16 23:08:36 +00004406 return (vector signed char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004407}
4408
4409static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004410vec_vor(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004411{
David Blaikie3302f2b2013-01-16 23:08:36 +00004412 return __a | (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004413}
4414
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004415static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004416vec_vor(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004417{
David Blaikie3302f2b2013-01-16 23:08:36 +00004418 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004419}
4420
Anton Yartsevfc83c602010-08-19 03:21:36 +00004421static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004422vec_vor(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004423{
David Blaikie3302f2b2013-01-16 23:08:36 +00004424 return (vector unsigned char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004425}
4426
4427static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004428vec_vor(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004429{
David Blaikie3302f2b2013-01-16 23:08:36 +00004430 return __a | (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004431}
4432
4433static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004434vec_vor(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004435{
David Blaikie3302f2b2013-01-16 23:08:36 +00004436 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004437}
4438
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004439static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004440vec_vor(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004441{
David Blaikie3302f2b2013-01-16 23:08:36 +00004442 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004443}
4444
Anton Yartsevfc83c602010-08-19 03:21:36 +00004445static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004446vec_vor(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004447{
David Blaikie3302f2b2013-01-16 23:08:36 +00004448 return (vector short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004449}
4450
4451static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004452vec_vor(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004453{
David Blaikie3302f2b2013-01-16 23:08:36 +00004454 return __a | (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004455}
4456
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004457static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004458vec_vor(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004459{
David Blaikie3302f2b2013-01-16 23:08:36 +00004460 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004461}
4462
Anton Yartsevfc83c602010-08-19 03:21:36 +00004463static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004464vec_vor(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004465{
David Blaikie3302f2b2013-01-16 23:08:36 +00004466 return (vector unsigned short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004467}
4468
4469static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004470vec_vor(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004471{
David Blaikie3302f2b2013-01-16 23:08:36 +00004472 return __a | (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004473}
4474
4475static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004476vec_vor(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004477{
David Blaikie3302f2b2013-01-16 23:08:36 +00004478 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004479}
4480
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004481static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004482vec_vor(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004483{
David Blaikie3302f2b2013-01-16 23:08:36 +00004484 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004485}
4486
Anton Yartsevfc83c602010-08-19 03:21:36 +00004487static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004488vec_vor(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004489{
David Blaikie3302f2b2013-01-16 23:08:36 +00004490 return (vector int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004491}
4492
4493static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004494vec_vor(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004495{
David Blaikie3302f2b2013-01-16 23:08:36 +00004496 return __a | (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004497}
4498
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004499static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004500vec_vor(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004501{
David Blaikie3302f2b2013-01-16 23:08:36 +00004502 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004503}
4504
Anton Yartsevfc83c602010-08-19 03:21:36 +00004505static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004506vec_vor(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004507{
David Blaikie3302f2b2013-01-16 23:08:36 +00004508 return (vector unsigned int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004509}
4510
4511static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004512vec_vor(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004513{
David Blaikie3302f2b2013-01-16 23:08:36 +00004514 return __a | (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004515}
4516
4517static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004518vec_vor(vector bool int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004519{
David Blaikie3302f2b2013-01-16 23:08:36 +00004520 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004521}
4522
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004523static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004524vec_vor(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004525{
David Blaikie3302f2b2013-01-16 23:08:36 +00004526 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4527 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004528}
4529
Anton Yartsevfc83c602010-08-19 03:21:36 +00004530static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004531vec_vor(vector bool int __a, vector float __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004532{
David Blaikie3302f2b2013-01-16 23:08:36 +00004533 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4534 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004535}
4536
4537static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004538vec_vor(vector float __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004539{
David Blaikie3302f2b2013-01-16 23:08:36 +00004540 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4541 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004542}
4543
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004544/* vec_pack */
4545
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004546/* The various vector pack instructions have a big-endian bias, so for
4547 little endian we must handle reversed element numbering. */
4548
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004549static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004550vec_pack(vector signed short __a, vector signed short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004551{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004552#ifdef __LITTLE_ENDIAN__
4553 return (vector signed char)vec_perm(__a, __b, (vector unsigned char)
4554 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4555 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4556#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004557 return (vector signed char)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004558 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4559 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004560#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004561}
4562
4563static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004564vec_pack(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004565{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004566#ifdef __LITTLE_ENDIAN__
4567 return (vector unsigned char)vec_perm(__a, __b, (vector unsigned char)
4568 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4569 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4570#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004571 return (vector unsigned char)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004572 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4573 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004574#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004575}
4576
Anton Yartsev9e968982010-08-19 03:00:09 +00004577static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004578vec_pack(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00004579{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004580#ifdef __LITTLE_ENDIAN__
4581 return (vector bool char)vec_perm(__a, __b, (vector unsigned char)
4582 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4583 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4584#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004585 return (vector bool char)vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00004586 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4587 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004588#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004589}
4590
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004591static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004592vec_pack(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004593{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004594#ifdef __LITTLE_ENDIAN__
4595 return (vector short)vec_perm(__a, __b, (vector unsigned char)
4596 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4597 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4598#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004599 return (vector short)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004600 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4601 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004602#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004603}
4604
4605static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004606vec_pack(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004607{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004608#ifdef __LITTLE_ENDIAN__
4609 return (vector unsigned short)vec_perm(__a, __b, (vector unsigned char)
4610 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4611 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4612#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004613 return (vector unsigned short)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004614 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4615 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004616#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004617}
4618
Anton Yartsev9e968982010-08-19 03:00:09 +00004619static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004620vec_pack(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00004621{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004622#ifdef __LITTLE_ENDIAN__
Bill Schmidt1cf7c642014-06-13 18:30:06 +00004623 return (vector bool short)vec_perm(__a, __b, (vector unsigned char)
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004624 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4625 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4626#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004627 return (vector bool short)vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00004628 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4629 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004630#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004631}
4632
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004633/* vec_vpkuhum */
4634
4635#define __builtin_altivec_vpkuhum vec_vpkuhum
4636
4637static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004638vec_vpkuhum(vector signed short __a, vector signed short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004639{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004640#ifdef __LITTLE_ENDIAN__
4641 return (vector signed char)vec_perm(__a, __b, (vector unsigned char)
4642 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4643 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4644#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004645 return (vector signed char)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004646 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4647 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004648#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004649}
4650
4651static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004652vec_vpkuhum(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004653{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004654#ifdef __LITTLE_ENDIAN__
4655 return (vector unsigned char)vec_perm(__a, __b, (vector unsigned char)
4656 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4657 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4658#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004659 return (vector unsigned char)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004660 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4661 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004662#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004663}
4664
Anton Yartsev9e968982010-08-19 03:00:09 +00004665static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004666vec_vpkuhum(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00004667{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004668#ifdef __LITTLE_ENDIAN__
4669 return (vector bool char)vec_perm(__a, __b, (vector unsigned char)
4670 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4671 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4672#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004673 return (vector bool char)vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00004674 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4675 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004676#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004677}
4678
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004679/* vec_vpkuwum */
4680
4681#define __builtin_altivec_vpkuwum vec_vpkuwum
4682
4683static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004684vec_vpkuwum(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004685{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004686#ifdef __LITTLE_ENDIAN__
4687 return (vector short)vec_perm(__a, __b, (vector unsigned char)
4688 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4689 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4690#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004691 return (vector short)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004692 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4693 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004694#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004695}
4696
4697static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004698vec_vpkuwum(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004699{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004700#ifdef __LITTLE_ENDIAN__
4701 return (vector unsigned short)vec_perm(__a, __b, (vector unsigned char)
4702 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4703 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4704#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004705 return (vector unsigned short)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004706 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4707 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004708#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004709}
4710
Anton Yartsev9e968982010-08-19 03:00:09 +00004711static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004712vec_vpkuwum(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00004713{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004714#ifdef __LITTLE_ENDIAN__
4715 return (vector bool short)vec_perm(__a, __b, (vector unsigned char)
4716 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4717 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4718#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004719 return (vector bool short)vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00004720 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4721 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004722#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004723}
4724
Bill Schmidt41e14c42015-05-16 01:02:25 +00004725/* vec_vpkudum */
4726
4727#ifdef __POWER8_VECTOR__
4728#define __builtin_altivec_vpkudum vec_vpkudum
4729
4730static vector int __ATTRS_o_ai
4731vec_vpkudum(vector long long __a, vector long long __b)
4732{
4733#ifdef __LITTLE_ENDIAN__
4734 return (vector int)vec_perm(__a, __b, (vector unsigned char)
4735 (0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
4736 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
4737#else
4738 return (vector int)vec_perm(__a, __b, (vector unsigned char)
4739 (0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
4740 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
4741#endif
4742}
4743
4744static vector unsigned int __ATTRS_o_ai
4745vec_vpkudum(vector unsigned long long __a, vector unsigned long long __b)
4746{
4747#ifdef __LITTLE_ENDIAN__
4748 return (vector unsigned int)vec_perm(__a, __b, (vector unsigned char)
4749 (0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
4750 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
4751#else
4752 return (vector unsigned int)vec_perm(__a, __b, (vector unsigned char)
4753 (0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
4754 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
4755#endif
4756}
4757
4758static vector bool int __ATTRS_o_ai
4759vec_vpkudum(vector bool long long __a, vector bool long long __b)
4760{
4761#ifdef __LITTLE_ENDIAN__
4762 return (vector bool int)vec_perm((vector long long)__a,
4763 (vector long long)__b,
4764 (vector unsigned char)
4765 (0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
4766 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
4767#else
4768 return (vector bool int)vec_perm((vector long long)__a,
4769 (vector long long)__b,
4770 (vector unsigned char)
4771 (0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
4772 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
4773#endif
4774}
4775#endif
4776
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004777/* vec_packpx */
4778
4779static vector pixel __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004780vec_packpx(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004781{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004782#ifdef __LITTLE_ENDIAN__
4783 return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
4784#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004785 return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004786#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004787}
4788
4789/* vec_vpkpx */
4790
4791static vector pixel __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004792vec_vpkpx(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004793{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004794#ifdef __LITTLE_ENDIAN__
4795 return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
4796#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004797 return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004798#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004799}
4800
4801/* vec_packs */
4802
4803static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004804vec_packs(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004805{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004806#ifdef __LITTLE_ENDIAN__
4807 return __builtin_altivec_vpkshss(__b, __a);
4808#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004809 return __builtin_altivec_vpkshss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004810#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004811}
4812
4813static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004814vec_packs(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004815{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004816#ifdef __LITTLE_ENDIAN__
4817 return __builtin_altivec_vpkuhus(__b, __a);
4818#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004819 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004820#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004821}
4822
4823static vector signed short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004824vec_packs(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004825{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004826#ifdef __LITTLE_ENDIAN__
4827 return __builtin_altivec_vpkswss(__b, __a);
4828#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004829 return __builtin_altivec_vpkswss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004830#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004831}
4832
4833static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004834vec_packs(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004835{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004836#ifdef __LITTLE_ENDIAN__
4837 return __builtin_altivec_vpkuwus(__b, __a);
4838#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004839 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004840#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004841}
4842
Bill Schmidt41e14c42015-05-16 01:02:25 +00004843#ifdef __POWER8_VECTOR__
4844static vector int __ATTRS_o_ai
4845vec_packs(vector long long __a, vector long long __b)
4846{
4847#ifdef __LITTLE_ENDIAN__
4848 return __builtin_altivec_vpksdss(__b, __a);
4849#else
4850 return __builtin_altivec_vpksdss(__a, __b);
4851#endif
4852}
4853
4854static vector unsigned int __ATTRS_o_ai
4855vec_packs(vector unsigned long long __a, vector unsigned long long __b)
4856{
4857#ifdef __LITTLE_ENDIAN__
4858 return __builtin_altivec_vpkudus(__b, __a);
4859#else
4860 return __builtin_altivec_vpkudus(__a, __b);
4861#endif
4862}
4863#endif
4864
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004865/* vec_vpkshss */
4866
4867static vector signed char __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004868vec_vpkshss(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004869{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004870#ifdef __LITTLE_ENDIAN__
4871 return __builtin_altivec_vpkshss(__b, __a);
4872#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004873 return __builtin_altivec_vpkshss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004874#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004875}
4876
Bill Schmidt41e14c42015-05-16 01:02:25 +00004877/* vec_vpksdss */
4878
4879#ifdef __POWER8_VECTOR__
4880static vector int __ATTRS_o_ai
4881vec_vpksdss(vector long long __a, vector long long __b)
4882{
4883#ifdef __LITTLE_ENDIAN__
4884 return __builtin_altivec_vpksdss(__b, __a);
4885#else
4886 return __builtin_altivec_vpksdss(__a, __b);
4887#endif
4888}
4889#endif
4890
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004891/* vec_vpkuhus */
4892
4893static vector unsigned char __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004894vec_vpkuhus(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004895{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004896#ifdef __LITTLE_ENDIAN__
4897 return __builtin_altivec_vpkuhus(__b, __a);
4898#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004899 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004900#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004901}
4902
Bill Schmidt41e14c42015-05-16 01:02:25 +00004903/* vec_vpkudus */
4904
4905#ifdef __POWER8_VECTOR__
4906static vector unsigned int __attribute__((__always_inline__))
4907vec_vpkudus(vector unsigned long long __a, vector unsigned long long __b)
4908{
4909#ifdef __LITTLE_ENDIAN__
4910 return __builtin_altivec_vpkudus(__b, __a);
4911#else
4912 return __builtin_altivec_vpkudus(__a, __b);
4913#endif
4914}
4915#endif
4916
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004917/* vec_vpkswss */
4918
4919static vector signed short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004920vec_vpkswss(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004921{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004922#ifdef __LITTLE_ENDIAN__
4923 return __builtin_altivec_vpkswss(__b, __a);
4924#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004925 return __builtin_altivec_vpkswss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004926#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004927}
4928
4929/* vec_vpkuwus */
4930
4931static vector unsigned short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004932vec_vpkuwus(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004933{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004934#ifdef __LITTLE_ENDIAN__
4935 return __builtin_altivec_vpkuwus(__b, __a);
4936#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004937 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004938#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004939}
4940
4941/* vec_packsu */
4942
4943static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004944vec_packsu(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004945{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004946#ifdef __LITTLE_ENDIAN__
4947 return __builtin_altivec_vpkshus(__b, __a);
4948#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004949 return __builtin_altivec_vpkshus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004950#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004951}
4952
4953static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004954vec_packsu(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004955{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004956#ifdef __LITTLE_ENDIAN__
4957 return __builtin_altivec_vpkuhus(__b, __a);
4958#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004959 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004960#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004961}
4962
4963static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004964vec_packsu(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004965{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004966#ifdef __LITTLE_ENDIAN__
4967 return __builtin_altivec_vpkswus(__b, __a);
4968#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004969 return __builtin_altivec_vpkswus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004970#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004971}
4972
4973static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004974vec_packsu(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004975{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004976#ifdef __LITTLE_ENDIAN__
4977 return __builtin_altivec_vpkuwus(__b, __a);
4978#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004979 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004980#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004981}
4982
Bill Schmidt41e14c42015-05-16 01:02:25 +00004983#ifdef __POWER8_VECTOR__
4984static vector unsigned int __ATTRS_o_ai
4985vec_packsu(vector long long __a, vector long long __b)
4986{
4987#ifdef __LITTLE_ENDIAN__
4988 return __builtin_altivec_vpksdus(__b, __a);
4989#else
4990 return __builtin_altivec_vpksdus(__a, __b);
4991#endif
4992}
4993
4994static vector unsigned int __ATTRS_o_ai
4995vec_packsu(vector unsigned long long __a, vector unsigned long long __b)
4996{
4997#ifdef __LITTLE_ENDIAN__
4998 return __builtin_altivec_vpkudus(__b, __a);
4999#else
5000 return __builtin_altivec_vpkudus(__a, __b);
5001#endif
5002}
5003#endif
5004
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005005/* vec_vpkshus */
5006
5007static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005008vec_vpkshus(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005009{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00005010#ifdef __LITTLE_ENDIAN__
5011 return __builtin_altivec_vpkshus(__b, __a);
5012#else
David Blaikie3302f2b2013-01-16 23:08:36 +00005013 return __builtin_altivec_vpkshus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00005014#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005015}
5016
5017static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005018vec_vpkshus(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005019{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00005020#ifdef __LITTLE_ENDIAN__
5021 return __builtin_altivec_vpkuhus(__b, __a);
5022#else
David Blaikie3302f2b2013-01-16 23:08:36 +00005023 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00005024#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005025}
5026
5027/* vec_vpkswus */
5028
5029static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005030vec_vpkswus(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005031{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00005032#ifdef __LITTLE_ENDIAN__
5033 return __builtin_altivec_vpkswus(__b, __a);
5034#else
David Blaikie3302f2b2013-01-16 23:08:36 +00005035 return __builtin_altivec_vpkswus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00005036#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005037}
5038
5039static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005040vec_vpkswus(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005041{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00005042#ifdef __LITTLE_ENDIAN__
5043 return __builtin_altivec_vpkuwus(__b, __a);
5044#else
David Blaikie3302f2b2013-01-16 23:08:36 +00005045 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00005046#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005047}
5048
Bill Schmidt41e14c42015-05-16 01:02:25 +00005049/* vec_vpksdus */
5050
5051#ifdef __POWER8_VECTOR__
5052static vector unsigned int __ATTRS_o_ai
5053vec_vpksdus(vector long long __a, vector long long __b)
5054{
5055#ifdef __LITTLE_ENDIAN__
5056 return __builtin_altivec_vpksdus(__b, __a);
5057#else
5058 return __builtin_altivec_vpksdus(__a, __b);
5059#endif
5060}
5061#endif
5062
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005063/* vec_perm */
5064
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005065// The vperm instruction is defined architecturally with a big-endian bias.
5066// For little endian, we swap the input operands and invert the permute
5067// control vector. Only the rightmost 5 bits matter, so we could use
5068// a vector of all 31s instead of all 255s to perform the inversion.
5069// However, when the PCV is not a constant, using 255 has an advantage
5070// in that the vec_xor can be recognized as a vec_nor (and for P8 and
5071// later, possibly a vec_nand).
5072
Eric Christopherc67e1b62014-12-10 00:57:43 +00005073static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005074vec_perm(vector signed char __a, vector signed char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005075{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005076#ifdef __LITTLE_ENDIAN__
5077 vector unsigned char __d = {255,255,255,255,255,255,255,255,
5078 255,255,255,255,255,255,255,255};
5079 __d = vec_xor(__c, __d);
5080 return (vector signed char)
5081 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
5082#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00005083 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005084 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005085#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005086}
5087
Eric Christopherc67e1b62014-12-10 00:57:43 +00005088static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005089vec_perm(vector unsigned char __a,
5090 vector unsigned char __b,
5091 vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005092{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005093#ifdef __LITTLE_ENDIAN__
5094 vector unsigned char __d = {255,255,255,255,255,255,255,255,
5095 255,255,255,255,255,255,255,255};
5096 __d = vec_xor(__c, __d);
5097 return (vector unsigned char)
5098 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
5099#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00005100 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005101 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005102#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005103}
5104
Eric Christopherc67e1b62014-12-10 00:57:43 +00005105static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005106vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00005107{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005108#ifdef __LITTLE_ENDIAN__
5109 vector unsigned char __d = {255,255,255,255,255,255,255,255,
5110 255,255,255,255,255,255,255,255};
5111 __d = vec_xor(__c, __d);
5112 return (vector bool char)
5113 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
5114#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00005115 return (vector bool char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005116 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005117#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00005118}
5119
Eric Christopherc67e1b62014-12-10 00:57:43 +00005120static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005121vec_perm(vector short __a, vector short __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005122{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005123#ifdef __LITTLE_ENDIAN__
5124 vector unsigned char __d = {255,255,255,255,255,255,255,255,
5125 255,255,255,255,255,255,255,255};
5126 __d = vec_xor(__c, __d);
5127 return (vector short)
5128 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
5129#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00005130 return (vector short)
David Blaikie3302f2b2013-01-16 23:08:36 +00005131 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005132#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005133}
5134
Eric Christopherc67e1b62014-12-10 00:57:43 +00005135static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005136vec_perm(vector unsigned short __a,
5137 vector unsigned short __b,
5138 vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005139{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005140#ifdef __LITTLE_ENDIAN__
5141 vector unsigned char __d = {255,255,255,255,255,255,255,255,
5142 255,255,255,255,255,255,255,255};
5143 __d = vec_xor(__c, __d);
5144 return (vector unsigned short)
5145 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
5146#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00005147 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00005148 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005149#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005150}
5151
Eric Christopherc67e1b62014-12-10 00:57:43 +00005152static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005153vec_perm(vector bool short __a, vector bool short __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00005154{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005155#ifdef __LITTLE_ENDIAN__
5156 vector unsigned char __d = {255,255,255,255,255,255,255,255,
5157 255,255,255,255,255,255,255,255};
5158 __d = vec_xor(__c, __d);
5159 return (vector bool short)
5160 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
5161#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00005162 return (vector bool short)
David Blaikie3302f2b2013-01-16 23:08:36 +00005163 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005164#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00005165}
5166
Eric Christopherc67e1b62014-12-10 00:57:43 +00005167static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005168vec_perm(vector pixel __a, vector pixel __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00005169{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005170#ifdef __LITTLE_ENDIAN__
5171 vector unsigned char __d = {255,255,255,255,255,255,255,255,
5172 255,255,255,255,255,255,255,255};
5173 __d = vec_xor(__c, __d);
5174 return (vector pixel)
5175 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
5176#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00005177 return (vector pixel)
David Blaikie3302f2b2013-01-16 23:08:36 +00005178 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005179#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00005180}
5181
Eric Christopherc67e1b62014-12-10 00:57:43 +00005182static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005183vec_perm(vector int __a, vector int __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005184{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005185#ifdef __LITTLE_ENDIAN__
5186 vector unsigned char __d = {255,255,255,255,255,255,255,255,
5187 255,255,255,255,255,255,255,255};
5188 __d = vec_xor(__c, __d);
5189 return (vector int)__builtin_altivec_vperm_4si(__b, __a, __d);
5190#else
David Blaikie3302f2b2013-01-16 23:08:36 +00005191 return (vector int)__builtin_altivec_vperm_4si(__a, __b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005192#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005193}
5194
Eric Christopherc67e1b62014-12-10 00:57:43 +00005195static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005196vec_perm(vector unsigned int __a, vector unsigned int __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005197{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005198#ifdef __LITTLE_ENDIAN__
5199 vector unsigned char __d = {255,255,255,255,255,255,255,255,
5200 255,255,255,255,255,255,255,255};
5201 __d = vec_xor(__c, __d);
5202 return (vector unsigned int)
5203 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
5204#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00005205 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00005206 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005207#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005208}
5209
Eric Christopherc67e1b62014-12-10 00:57:43 +00005210static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005211vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00005212{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005213#ifdef __LITTLE_ENDIAN__
5214 vector unsigned char __d = {255,255,255,255,255,255,255,255,
5215 255,255,255,255,255,255,255,255};
5216 __d = vec_xor(__c, __d);
5217 return (vector bool int)
5218 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
5219#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00005220 return (vector bool int)
David Blaikie3302f2b2013-01-16 23:08:36 +00005221 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005222#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00005223}
5224
Eric Christopherc67e1b62014-12-10 00:57:43 +00005225static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005226vec_perm(vector float __a, vector float __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005227{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005228#ifdef __LITTLE_ENDIAN__
5229 vector unsigned char __d = {255,255,255,255,255,255,255,255,
5230 255,255,255,255,255,255,255,255};
5231 __d = vec_xor(__c, __d);
5232 return (vector float)
5233 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
5234#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00005235 return (vector float)
David Blaikie3302f2b2013-01-16 23:08:36 +00005236 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005237#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005238}
5239
Bill Schmidt8ff672d2014-11-14 13:10:13 +00005240#ifdef __VSX__
Eric Christopherc67e1b62014-12-10 00:57:43 +00005241static vector long long __ATTRS_o_ai
Bill Schmidt8ff672d2014-11-14 13:10:13 +00005242vec_perm(vector long long __a, vector long long __b, vector unsigned char __c)
5243{
5244#ifdef __LITTLE_ENDIAN__
5245 vector unsigned char __d = {255,255,255,255,255,255,255,255,
5246 255,255,255,255,255,255,255,255};
5247 __d = vec_xor(__c, __d);
5248 return (vector long long)__builtin_altivec_vperm_4si(__b, __a, __d);
5249#else
5250 return (vector long long)__builtin_altivec_vperm_4si(__a, __b, __c);
5251#endif
5252}
5253
Eric Christopherc67e1b62014-12-10 00:57:43 +00005254static vector unsigned long long __ATTRS_o_ai
Bill Schmidt8ff672d2014-11-14 13:10:13 +00005255vec_perm(vector unsigned long long __a, vector unsigned long long __b,
5256 vector unsigned char __c)
5257{
5258#ifdef __LITTLE_ENDIAN__
5259 vector unsigned char __d = {255,255,255,255,255,255,255,255,
5260 255,255,255,255,255,255,255,255};
5261 __d = vec_xor(__c, __d);
5262 return (vector unsigned long long)
5263 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
5264#else
5265 return (vector unsigned long long)
5266 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
5267#endif
5268}
5269
Eric Christopherc67e1b62014-12-10 00:57:43 +00005270static vector double __ATTRS_o_ai
Bill Schmidt8ff672d2014-11-14 13:10:13 +00005271vec_perm(vector double __a, vector double __b, vector unsigned char __c)
5272{
5273#ifdef __LITTLE_ENDIAN__
5274 vector unsigned char __d = {255,255,255,255,255,255,255,255,
5275 255,255,255,255,255,255,255,255};
5276 __d = vec_xor(__c, __d);
5277 return (vector double)
5278 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
5279#else
5280 return (vector double)
5281 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
5282#endif
5283}
5284#endif
5285
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005286/* vec_vperm */
5287
Ulrich Weigand9936f132012-10-31 18:17:07 +00005288static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005289vec_vperm(vector signed char __a, vector signed char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005290{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005291 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005292}
5293
Ulrich Weigand9936f132012-10-31 18:17:07 +00005294static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005295vec_vperm(vector unsigned char __a,
5296 vector unsigned char __b,
5297 vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005298{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005299 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005300}
5301
Ulrich Weigand9936f132012-10-31 18:17:07 +00005302static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005303vec_vperm(vector bool char __a, vector bool char __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00005304{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005305 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00005306}
5307
Ulrich Weigand9936f132012-10-31 18:17:07 +00005308static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005309vec_vperm(vector short __a, vector short __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005310{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005311 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005312}
5313
Ulrich Weigand9936f132012-10-31 18:17:07 +00005314static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005315vec_vperm(vector unsigned short __a,
5316 vector unsigned short __b,
5317 vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005318{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005319 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005320}
5321
Ulrich Weigand9936f132012-10-31 18:17:07 +00005322static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005323vec_vperm(vector bool short __a, vector bool short __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00005324{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005325 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00005326}
5327
Ulrich Weigand9936f132012-10-31 18:17:07 +00005328static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005329vec_vperm(vector pixel __a, vector pixel __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00005330{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005331 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00005332}
5333
Ulrich Weigand9936f132012-10-31 18:17:07 +00005334static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005335vec_vperm(vector int __a, vector int __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005336{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005337 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005338}
5339
Ulrich Weigand9936f132012-10-31 18:17:07 +00005340static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005341vec_vperm(vector unsigned int __a, vector unsigned int __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005342{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005343 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005344}
5345
Ulrich Weigand9936f132012-10-31 18:17:07 +00005346static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005347vec_vperm(vector bool int __a, vector bool int __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00005348{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005349 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00005350}
5351
Ulrich Weigand9936f132012-10-31 18:17:07 +00005352static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005353vec_vperm(vector float __a, vector float __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005354{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005355 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005356}
5357
Bill Schmidt8ff672d2014-11-14 13:10:13 +00005358#ifdef __VSX__
5359static vector long long __ATTRS_o_ai
5360vec_vperm(vector long long __a, vector long long __b, vector unsigned char __c)
5361{
5362 return vec_perm(__a, __b, __c);
5363}
5364
5365static vector unsigned long long __ATTRS_o_ai
5366vec_vperm(vector unsigned long long __a, vector unsigned long long __b,
5367 vector unsigned char __c)
5368{
5369 return vec_perm(__a, __b, __c);
5370}
5371
5372static vector double __ATTRS_o_ai
5373vec_vperm(vector double __a, vector double __b, vector unsigned char __c)
5374{
5375 return vec_perm(__a, __b, __c);
5376}
5377#endif
5378
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005379/* vec_re */
5380
Ulrich Weigand9936f132012-10-31 18:17:07 +00005381static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00005382vec_re(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005383{
David Blaikie3302f2b2013-01-16 23:08:36 +00005384 return __builtin_altivec_vrefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005385}
5386
5387/* vec_vrefp */
5388
Ulrich Weigand9936f132012-10-31 18:17:07 +00005389static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00005390vec_vrefp(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005391{
David Blaikie3302f2b2013-01-16 23:08:36 +00005392 return __builtin_altivec_vrefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005393}
5394
5395/* vec_rl */
5396
5397static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005398vec_rl(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005399{
David Blaikie3302f2b2013-01-16 23:08:36 +00005400 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005401}
5402
5403static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005404vec_rl(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005405{
David Blaikie3302f2b2013-01-16 23:08:36 +00005406 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005407}
5408
5409static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005410vec_rl(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005411{
David Blaikie3302f2b2013-01-16 23:08:36 +00005412 return __builtin_altivec_vrlh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005413}
5414
5415static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005416vec_rl(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005417{
David Blaikie3302f2b2013-01-16 23:08:36 +00005418 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005419}
5420
5421static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005422vec_rl(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005423{
David Blaikie3302f2b2013-01-16 23:08:36 +00005424 return __builtin_altivec_vrlw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005425}
5426
5427static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005428vec_rl(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005429{
David Blaikie3302f2b2013-01-16 23:08:36 +00005430 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005431}
5432
Kit Barton8553bec2015-03-11 15:57:19 +00005433#ifdef __POWER8_VECTOR__
5434static vector signed long long __ATTRS_o_ai
5435vec_rl(vector signed long long __a, vector unsigned long long __b)
5436{
5437 return __builtin_altivec_vrld(__a, __b);
5438}
5439
5440static vector unsigned long long __ATTRS_o_ai
5441vec_rl(vector unsigned long long __a, vector unsigned long long __b)
5442{
5443 return __builtin_altivec_vrld(__a, __b);
5444}
5445#endif
5446
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005447/* vec_vrlb */
5448
5449static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005450vec_vrlb(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005451{
David Blaikie3302f2b2013-01-16 23:08:36 +00005452 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005453}
5454
5455static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005456vec_vrlb(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005457{
David Blaikie3302f2b2013-01-16 23:08:36 +00005458 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005459}
5460
5461/* vec_vrlh */
5462
5463static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005464vec_vrlh(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005465{
David Blaikie3302f2b2013-01-16 23:08:36 +00005466 return __builtin_altivec_vrlh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005467}
5468
5469static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005470vec_vrlh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005471{
David Blaikie3302f2b2013-01-16 23:08:36 +00005472 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005473}
5474
5475/* vec_vrlw */
5476
5477static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005478vec_vrlw(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005479{
David Blaikie3302f2b2013-01-16 23:08:36 +00005480 return __builtin_altivec_vrlw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005481}
5482
5483static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005484vec_vrlw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005485{
David Blaikie3302f2b2013-01-16 23:08:36 +00005486 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005487}
5488
5489/* vec_round */
5490
5491static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00005492vec_round(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005493{
David Blaikie3302f2b2013-01-16 23:08:36 +00005494 return __builtin_altivec_vrfin(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005495}
5496
5497/* vec_vrfin */
5498
5499static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00005500vec_vrfin(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005501{
David Blaikie3302f2b2013-01-16 23:08:36 +00005502 return __builtin_altivec_vrfin(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005503}
5504
5505/* vec_rsqrte */
5506
5507static __vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00005508vec_rsqrte(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005509{
David Blaikie3302f2b2013-01-16 23:08:36 +00005510 return __builtin_altivec_vrsqrtefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005511}
5512
5513/* vec_vrsqrtefp */
5514
5515static __vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00005516vec_vrsqrtefp(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005517{
David Blaikie3302f2b2013-01-16 23:08:36 +00005518 return __builtin_altivec_vrsqrtefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005519}
5520
5521/* vec_sel */
5522
5523#define __builtin_altivec_vsel_4si vec_sel
5524
5525static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005526vec_sel(vector signed char __a, vector signed char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005527{
David Blaikie3302f2b2013-01-16 23:08:36 +00005528 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005529}
5530
Anton Yartsevfc83c602010-08-19 03:21:36 +00005531static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005532vec_sel(vector signed char __a, vector signed char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005533{
David Blaikie3302f2b2013-01-16 23:08:36 +00005534 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005535}
5536
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005537static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005538vec_sel(vector unsigned char __a, vector unsigned char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005539{
David Blaikie3302f2b2013-01-16 23:08:36 +00005540 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005541}
5542
Anton Yartsevfc83c602010-08-19 03:21:36 +00005543static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005544vec_sel(vector unsigned char __a, vector unsigned char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005545{
David Blaikie3302f2b2013-01-16 23:08:36 +00005546 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005547}
5548
5549static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005550vec_sel(vector bool char __a, vector bool char __b, vector unsigned char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005551{
David Blaikie3302f2b2013-01-16 23:08:36 +00005552 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005553}
5554
5555static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005556vec_sel(vector bool char __a, vector bool char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005557{
David Blaikie3302f2b2013-01-16 23:08:36 +00005558 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005559}
5560
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005561static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005562vec_sel(vector short __a, vector short __b, vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005563{
David Blaikie3302f2b2013-01-16 23:08:36 +00005564 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005565}
5566
Anton Yartsevfc83c602010-08-19 03:21:36 +00005567static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005568vec_sel(vector short __a, vector short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005569{
David Blaikie3302f2b2013-01-16 23:08:36 +00005570 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005571}
5572
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005573static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005574vec_sel(vector unsigned short __a,
5575 vector unsigned short __b,
5576 vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005577{
David Blaikie3302f2b2013-01-16 23:08:36 +00005578 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005579}
5580
Anton Yartsevfc83c602010-08-19 03:21:36 +00005581static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005582vec_sel(vector unsigned short __a, vector unsigned short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005583{
David Blaikie3302f2b2013-01-16 23:08:36 +00005584 return (__a & ~(vector unsigned short)__c) | (__b & (vector unsigned short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005585}
5586
5587static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005588vec_sel(vector bool short __a, vector bool short __b, vector unsigned short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005589{
David Blaikie3302f2b2013-01-16 23:08:36 +00005590 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005591}
5592
5593static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005594vec_sel(vector bool short __a, vector bool short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005595{
David Blaikie3302f2b2013-01-16 23:08:36 +00005596 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005597}
5598
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005599static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005600vec_sel(vector int __a, vector int __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005601{
David Blaikie3302f2b2013-01-16 23:08:36 +00005602 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005603}
5604
Anton Yartsevfc83c602010-08-19 03:21:36 +00005605static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005606vec_sel(vector int __a, vector int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005607{
David Blaikie3302f2b2013-01-16 23:08:36 +00005608 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005609}
5610
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005611static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005612vec_sel(vector unsigned int __a, vector unsigned int __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005613{
David Blaikie3302f2b2013-01-16 23:08:36 +00005614 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005615}
5616
Anton Yartsevfc83c602010-08-19 03:21:36 +00005617static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005618vec_sel(vector unsigned int __a, vector unsigned int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005619{
David Blaikie3302f2b2013-01-16 23:08:36 +00005620 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005621}
5622
5623static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005624vec_sel(vector bool int __a, vector bool int __b, vector unsigned int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005625{
David Blaikie3302f2b2013-01-16 23:08:36 +00005626 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005627}
5628
5629static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005630vec_sel(vector bool int __a, vector bool int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005631{
David Blaikie3302f2b2013-01-16 23:08:36 +00005632 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005633}
5634
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005635static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005636vec_sel(vector float __a, vector float __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005637{
David Blaikie3302f2b2013-01-16 23:08:36 +00005638 vector int __res = ((vector int)__a & ~(vector int)__c)
5639 | ((vector int)__b & (vector int)__c);
5640 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005641}
5642
Anton Yartsevfc83c602010-08-19 03:21:36 +00005643static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005644vec_sel(vector float __a, vector float __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005645{
David Blaikie3302f2b2013-01-16 23:08:36 +00005646 vector int __res = ((vector int)__a & ~(vector int)__c)
5647 | ((vector int)__b & (vector int)__c);
5648 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00005649}
5650
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005651/* vec_vsel */
5652
5653static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005654vec_vsel(vector signed char __a, vector signed char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005655{
David Blaikie3302f2b2013-01-16 23:08:36 +00005656 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005657}
5658
Anton Yartsevfc83c602010-08-19 03:21:36 +00005659static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005660vec_vsel(vector signed char __a, vector signed char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005661{
David Blaikie3302f2b2013-01-16 23:08:36 +00005662 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005663}
5664
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005665static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005666vec_vsel(vector unsigned char __a, vector unsigned char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005667{
David Blaikie3302f2b2013-01-16 23:08:36 +00005668 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005669}
5670
Anton Yartsevfc83c602010-08-19 03:21:36 +00005671static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005672vec_vsel(vector unsigned char __a, vector unsigned char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005673{
David Blaikie3302f2b2013-01-16 23:08:36 +00005674 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005675}
5676
5677static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005678vec_vsel(vector bool char __a, vector bool char __b, vector unsigned char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005679{
David Blaikie3302f2b2013-01-16 23:08:36 +00005680 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005681}
5682
5683static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005684vec_vsel(vector bool char __a, vector bool char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005685{
David Blaikie3302f2b2013-01-16 23:08:36 +00005686 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005687}
5688
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005689static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005690vec_vsel(vector short __a, vector short __b, vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005691{
David Blaikie3302f2b2013-01-16 23:08:36 +00005692 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005693}
5694
Anton Yartsevfc83c602010-08-19 03:21:36 +00005695static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005696vec_vsel(vector short __a, vector short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005697{
David Blaikie3302f2b2013-01-16 23:08:36 +00005698 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005699}
5700
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005701static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005702vec_vsel(vector unsigned short __a,
5703 vector unsigned short __b,
5704 vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005705{
David Blaikie3302f2b2013-01-16 23:08:36 +00005706 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005707}
5708
Anton Yartsevfc83c602010-08-19 03:21:36 +00005709static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005710vec_vsel(vector unsigned short __a, vector unsigned short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005711{
David Blaikie3302f2b2013-01-16 23:08:36 +00005712 return (__a & ~(vector unsigned short)__c) | (__b & (vector unsigned short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005713}
5714
5715static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005716vec_vsel(vector bool short __a, vector bool short __b, vector unsigned short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005717{
David Blaikie3302f2b2013-01-16 23:08:36 +00005718 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005719}
5720
5721static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005722vec_vsel(vector bool short __a, vector bool short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005723{
David Blaikie3302f2b2013-01-16 23:08:36 +00005724 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005725}
5726
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005727static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005728vec_vsel(vector int __a, vector int __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005729{
David Blaikie3302f2b2013-01-16 23:08:36 +00005730 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005731}
5732
Anton Yartsevfc83c602010-08-19 03:21:36 +00005733static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005734vec_vsel(vector int __a, vector int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005735{
David Blaikie3302f2b2013-01-16 23:08:36 +00005736 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005737}
5738
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005739static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005740vec_vsel(vector unsigned int __a, vector unsigned int __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005741{
David Blaikie3302f2b2013-01-16 23:08:36 +00005742 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005743}
5744
Anton Yartsevfc83c602010-08-19 03:21:36 +00005745static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005746vec_vsel(vector unsigned int __a, vector unsigned int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005747{
David Blaikie3302f2b2013-01-16 23:08:36 +00005748 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005749}
5750
5751static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005752vec_vsel(vector bool int __a, vector bool int __b, vector unsigned int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005753{
David Blaikie3302f2b2013-01-16 23:08:36 +00005754 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005755}
5756
5757static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005758vec_vsel(vector bool int __a, vector bool int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005759{
David Blaikie3302f2b2013-01-16 23:08:36 +00005760 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005761}
5762
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005763static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005764vec_vsel(vector float __a, vector float __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005765{
David Blaikie3302f2b2013-01-16 23:08:36 +00005766 vector int __res = ((vector int)__a & ~(vector int)__c)
5767 | ((vector int)__b & (vector int)__c);
5768 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005769}
5770
Anton Yartsevfc83c602010-08-19 03:21:36 +00005771static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005772vec_vsel(vector float __a, vector float __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005773{
David Blaikie3302f2b2013-01-16 23:08:36 +00005774 vector int __res = ((vector int)__a & ~(vector int)__c)
5775 | ((vector int)__b & (vector int)__c);
5776 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00005777}
5778
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005779/* vec_sl */
5780
5781static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005782vec_sl(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005783{
David Blaikie3302f2b2013-01-16 23:08:36 +00005784 return __a << (vector signed char)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005785}
5786
5787static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005788vec_sl(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005789{
David Blaikie3302f2b2013-01-16 23:08:36 +00005790 return __a << __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005791}
5792
5793static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005794vec_sl(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005795{
David Blaikie3302f2b2013-01-16 23:08:36 +00005796 return __a << (vector short)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005797}
5798
5799static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005800vec_sl(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005801{
David Blaikie3302f2b2013-01-16 23:08:36 +00005802 return __a << __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005803}
5804
5805static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005806vec_sl(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005807{
David Blaikie3302f2b2013-01-16 23:08:36 +00005808 return __a << (vector int)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005809}
5810
5811static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005812vec_sl(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005813{
David Blaikie3302f2b2013-01-16 23:08:36 +00005814 return __a << __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005815}
5816
Kit Barton8553bec2015-03-11 15:57:19 +00005817#ifdef __POWER8_VECTOR__
5818static vector signed long long __ATTRS_o_ai
5819vec_sl(vector signed long long __a, vector unsigned long long __b)
5820{
5821 return __a << (vector long long)__b;
5822}
5823
5824static vector unsigned long long __ATTRS_o_ai
5825vec_sl(vector unsigned long long __a, vector unsigned long long __b)
5826{
5827 return __a << __b;
5828}
5829#endif
5830
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005831/* vec_vslb */
5832
5833#define __builtin_altivec_vslb vec_vslb
5834
5835static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005836vec_vslb(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005837{
David Blaikie3302f2b2013-01-16 23:08:36 +00005838 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005839}
5840
5841static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005842vec_vslb(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005843{
David Blaikie3302f2b2013-01-16 23:08:36 +00005844 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005845}
5846
5847/* vec_vslh */
5848
5849#define __builtin_altivec_vslh vec_vslh
5850
5851static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005852vec_vslh(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005853{
David Blaikie3302f2b2013-01-16 23:08:36 +00005854 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005855}
5856
5857static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005858vec_vslh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005859{
David Blaikie3302f2b2013-01-16 23:08:36 +00005860 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005861}
5862
5863/* vec_vslw */
5864
5865#define __builtin_altivec_vslw vec_vslw
5866
5867static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005868vec_vslw(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005869{
David Blaikie3302f2b2013-01-16 23:08:36 +00005870 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005871}
5872
5873static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005874vec_vslw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005875{
David Blaikie3302f2b2013-01-16 23:08:36 +00005876 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005877}
5878
5879/* vec_sld */
5880
5881#define __builtin_altivec_vsldoi_4si vec_sld
5882
5883static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005884vec_sld(vector signed char __a, vector signed char __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005885{
David Blaikie3302f2b2013-01-16 23:08:36 +00005886 return vec_perm(__a, __b, (vector unsigned char)
5887 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5888 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005889}
5890
5891static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005892vec_sld(vector unsigned char __a, vector unsigned char __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005893{
David Blaikie3302f2b2013-01-16 23:08:36 +00005894 return vec_perm(__a, __b, (vector unsigned char)
5895 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5896 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005897}
5898
5899static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005900vec_sld(vector short __a, vector short __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005901{
David Blaikie3302f2b2013-01-16 23:08:36 +00005902 return vec_perm(__a, __b, (vector unsigned char)
5903 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5904 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005905}
5906
5907static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005908vec_sld(vector unsigned short __a, vector unsigned short __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005909{
David Blaikie3302f2b2013-01-16 23:08:36 +00005910 return vec_perm(__a, __b, (vector unsigned char)
5911 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5912 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Yartsev9e968982010-08-19 03:00:09 +00005913}
5914
5915static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005916vec_sld(vector pixel __a, vector pixel __b, unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00005917{
David Blaikie3302f2b2013-01-16 23:08:36 +00005918 return vec_perm(__a, __b, (vector unsigned char)
5919 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5920 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005921}
5922
5923static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005924vec_sld(vector int __a, vector int __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005925{
David Blaikie3302f2b2013-01-16 23:08:36 +00005926 return vec_perm(__a, __b, (vector unsigned char)
5927 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5928 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005929}
5930
5931static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005932vec_sld(vector unsigned int __a, vector unsigned int __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005933{
David Blaikie3302f2b2013-01-16 23:08:36 +00005934 return vec_perm(__a, __b, (vector unsigned char)
5935 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5936 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005937}
5938
5939static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005940vec_sld(vector float __a, vector float __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005941{
David Blaikie3302f2b2013-01-16 23:08:36 +00005942 return vec_perm(__a, __b, (vector unsigned char)
5943 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5944 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005945}
5946
5947/* vec_vsldoi */
5948
5949static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005950vec_vsldoi(vector signed char __a, vector signed char __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005951{
David Blaikie3302f2b2013-01-16 23:08:36 +00005952 return vec_perm(__a, __b, (vector unsigned char)
5953 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5954 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005955}
5956
5957static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005958vec_vsldoi(vector unsigned char __a, vector unsigned char __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005959{
David Blaikie3302f2b2013-01-16 23:08:36 +00005960 return vec_perm(__a, __b, (vector unsigned char)
5961 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5962 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005963}
5964
5965static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005966vec_vsldoi(vector short __a, vector short __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005967{
David Blaikie3302f2b2013-01-16 23:08:36 +00005968 return vec_perm(__a, __b, (vector unsigned char)
5969 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5970 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005971}
5972
5973static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005974vec_vsldoi(vector unsigned short __a, vector unsigned short __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005975{
David Blaikie3302f2b2013-01-16 23:08:36 +00005976 return vec_perm(__a, __b, (vector unsigned char)
5977 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5978 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Yartsev9e968982010-08-19 03:00:09 +00005979}
5980
5981static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005982vec_vsldoi(vector pixel __a, vector pixel __b, unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00005983{
David Blaikie3302f2b2013-01-16 23:08:36 +00005984 return vec_perm(__a, __b, (vector unsigned char)
5985 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5986 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005987}
5988
5989static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005990vec_vsldoi(vector int __a, vector int __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005991{
David Blaikie3302f2b2013-01-16 23:08:36 +00005992 return vec_perm(__a, __b, (vector unsigned char)
5993 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5994 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005995}
5996
5997static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005998vec_vsldoi(vector unsigned int __a, vector unsigned int __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005999{
David Blaikie3302f2b2013-01-16 23:08:36 +00006000 return vec_perm(__a, __b, (vector unsigned char)
6001 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
6002 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006003}
6004
6005static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006006vec_vsldoi(vector float __a, vector float __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006007{
David Blaikie3302f2b2013-01-16 23:08:36 +00006008 return vec_perm(__a, __b, (vector unsigned char)
6009 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
6010 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006011}
6012
6013/* vec_sll */
6014
6015static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006016vec_sll(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006017{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006018 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006019 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006020}
6021
6022static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006023vec_sll(vector signed char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006024{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006025 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006026 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006027}
6028
6029static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006030vec_sll(vector signed char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006031{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006032 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006033 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006034}
6035
6036static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006037vec_sll(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006038{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006039 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006040 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006041}
6042
6043static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006044vec_sll(vector unsigned char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006045{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006046 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006047 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006048}
6049
6050static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006051vec_sll(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006052{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006053 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006054 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006055}
6056
Anton Yartsevfc83c602010-08-19 03:21:36 +00006057static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006058vec_sll(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006059{
David Blaikie3302f2b2013-01-16 23:08:36 +00006060 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006061}
6062
6063static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006064vec_sll(vector bool char __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006065{
David Blaikie3302f2b2013-01-16 23:08:36 +00006066 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006067}
6068
6069static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006070vec_sll(vector bool char __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006071{
David Blaikie3302f2b2013-01-16 23:08:36 +00006072 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006073}
6074
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006075static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006076vec_sll(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006077{
David Blaikie3302f2b2013-01-16 23:08:36 +00006078 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006079}
6080
6081static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006082vec_sll(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006083{
David Blaikie3302f2b2013-01-16 23:08:36 +00006084 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006085}
6086
6087static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006088vec_sll(vector short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006089{
David Blaikie3302f2b2013-01-16 23:08:36 +00006090 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006091}
6092
6093static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006094vec_sll(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006095{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006096 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006097 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006098}
6099
6100static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006101vec_sll(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006102{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006103 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006104 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006105}
6106
6107static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006108vec_sll(vector unsigned short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006109{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006110 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006111 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006112}
6113
Anton Yartsevfc83c602010-08-19 03:21:36 +00006114static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006115vec_sll(vector bool short __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006116{
David Blaikie3302f2b2013-01-16 23:08:36 +00006117 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006118}
6119
6120static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006121vec_sll(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006122{
David Blaikie3302f2b2013-01-16 23:08:36 +00006123 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006124}
6125
6126static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006127vec_sll(vector bool short __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006128{
David Blaikie3302f2b2013-01-16 23:08:36 +00006129 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006130}
6131
6132static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006133vec_sll(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006134{
David Blaikie3302f2b2013-01-16 23:08:36 +00006135 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006136}
6137
6138static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006139vec_sll(vector pixel __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006140{
David Blaikie3302f2b2013-01-16 23:08:36 +00006141 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006142}
6143
6144static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006145vec_sll(vector pixel __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006146{
David Blaikie3302f2b2013-01-16 23:08:36 +00006147 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006148}
6149
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006150static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006151vec_sll(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006152{
David Blaikie3302f2b2013-01-16 23:08:36 +00006153 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006154}
6155
6156static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006157vec_sll(vector int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006158{
David Blaikie3302f2b2013-01-16 23:08:36 +00006159 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006160}
6161
6162static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006163vec_sll(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006164{
David Blaikie3302f2b2013-01-16 23:08:36 +00006165 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006166}
6167
6168static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006169vec_sll(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006170{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006171 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006172 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006173}
6174
6175static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006176vec_sll(vector unsigned int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006177{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006178 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006179 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006180}
6181
6182static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006183vec_sll(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006184{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006185 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006186 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006187}
6188
Anton Yartsevfc83c602010-08-19 03:21:36 +00006189static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006190vec_sll(vector bool int __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006191{
David Blaikie3302f2b2013-01-16 23:08:36 +00006192 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006193}
6194
6195static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006196vec_sll(vector bool int __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006197{
David Blaikie3302f2b2013-01-16 23:08:36 +00006198 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006199}
6200
6201static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006202vec_sll(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006203{
David Blaikie3302f2b2013-01-16 23:08:36 +00006204 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006205}
6206
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006207/* vec_vsl */
6208
6209static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006210vec_vsl(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006211{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006212 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006213 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006214}
6215
6216static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006217vec_vsl(vector signed char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006218{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006219 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006220 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006221}
6222
6223static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006224vec_vsl(vector signed char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006225{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006226 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006227 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006228}
6229
6230static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006231vec_vsl(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006232{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006233 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006234 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006235}
6236
6237static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006238vec_vsl(vector unsigned char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006239{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006240 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006241 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006242}
6243
6244static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006245vec_vsl(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006246{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006247 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006248 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006249}
6250
Anton Yartsevfc83c602010-08-19 03:21:36 +00006251static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006252vec_vsl(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006253{
David Blaikie3302f2b2013-01-16 23:08:36 +00006254 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006255}
6256
6257static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006258vec_vsl(vector bool char __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006259{
David Blaikie3302f2b2013-01-16 23:08:36 +00006260 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006261}
6262
6263static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006264vec_vsl(vector bool char __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006265{
David Blaikie3302f2b2013-01-16 23:08:36 +00006266 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006267}
6268
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006269static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006270vec_vsl(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006271{
David Blaikie3302f2b2013-01-16 23:08:36 +00006272 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006273}
6274
6275static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006276vec_vsl(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006277{
David Blaikie3302f2b2013-01-16 23:08:36 +00006278 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006279}
6280
6281static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006282vec_vsl(vector short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006283{
David Blaikie3302f2b2013-01-16 23:08:36 +00006284 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006285}
6286
6287static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006288vec_vsl(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006289{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006290 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006291 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006292}
6293
6294static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006295vec_vsl(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006296{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006297 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006298 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006299}
6300
6301static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006302vec_vsl(vector unsigned short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006303{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006304 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006305 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006306}
6307
Anton Yartsevfc83c602010-08-19 03:21:36 +00006308static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006309vec_vsl(vector bool short __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006310{
David Blaikie3302f2b2013-01-16 23:08:36 +00006311 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006312}
6313
6314static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006315vec_vsl(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006316{
David Blaikie3302f2b2013-01-16 23:08:36 +00006317 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006318}
6319
6320static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006321vec_vsl(vector bool short __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006322{
David Blaikie3302f2b2013-01-16 23:08:36 +00006323 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006324}
6325
6326static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006327vec_vsl(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006328{
David Blaikie3302f2b2013-01-16 23:08:36 +00006329 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006330}
6331
6332static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006333vec_vsl(vector pixel __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006334{
David Blaikie3302f2b2013-01-16 23:08:36 +00006335 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006336}
6337
6338static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006339vec_vsl(vector pixel __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006340{
David Blaikie3302f2b2013-01-16 23:08:36 +00006341 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006342}
6343
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006344static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006345vec_vsl(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006346{
David Blaikie3302f2b2013-01-16 23:08:36 +00006347 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006348}
6349
6350static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006351vec_vsl(vector int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006352{
David Blaikie3302f2b2013-01-16 23:08:36 +00006353 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006354}
6355
6356static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006357vec_vsl(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006358{
David Blaikie3302f2b2013-01-16 23:08:36 +00006359 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006360}
6361
6362static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006363vec_vsl(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006364{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006365 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006366 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006367}
6368
6369static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006370vec_vsl(vector unsigned int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006371{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006372 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006373 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006374}
6375
6376static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006377vec_vsl(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006378{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006379 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006380 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006381}
6382
Anton Yartsevfc83c602010-08-19 03:21:36 +00006383static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006384vec_vsl(vector bool int __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006385{
David Blaikie3302f2b2013-01-16 23:08:36 +00006386 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006387}
6388
6389static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006390vec_vsl(vector bool int __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006391{
David Blaikie3302f2b2013-01-16 23:08:36 +00006392 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006393}
6394
6395static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006396vec_vsl(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006397{
David Blaikie3302f2b2013-01-16 23:08:36 +00006398 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006399}
6400
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006401/* vec_slo */
6402
6403static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006404vec_slo(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006405{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006406 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006407 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006408}
6409
6410static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006411vec_slo(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006412{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006413 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006414 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006415}
6416
6417static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006418vec_slo(vector unsigned char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006419{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006420 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006421 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006422}
6423
6424static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006425vec_slo(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006426{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006427 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006428 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006429}
6430
6431static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006432vec_slo(vector short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006433{
David Blaikie3302f2b2013-01-16 23:08:36 +00006434 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006435}
6436
6437static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006438vec_slo(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006439{
David Blaikie3302f2b2013-01-16 23:08:36 +00006440 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006441}
6442
6443static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006444vec_slo(vector unsigned short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006445{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006446 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006447 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006448}
6449
6450static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006451vec_slo(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006452{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006453 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006454 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006455}
6456
Anton Yartsevfc83c602010-08-19 03:21:36 +00006457static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006458vec_slo(vector pixel __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006459{
David Blaikie3302f2b2013-01-16 23:08:36 +00006460 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006461}
6462
6463static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006464vec_slo(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006465{
David Blaikie3302f2b2013-01-16 23:08:36 +00006466 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006467}
6468
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006469static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006470vec_slo(vector int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006471{
David Blaikie3302f2b2013-01-16 23:08:36 +00006472 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006473}
6474
6475static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006476vec_slo(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006477{
David Blaikie3302f2b2013-01-16 23:08:36 +00006478 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006479}
6480
6481static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006482vec_slo(vector unsigned int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006483{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006484 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006485 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006486}
6487
6488static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006489vec_slo(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006490{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006491 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006492 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006493}
6494
6495static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006496vec_slo(vector float __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006497{
David Blaikie3302f2b2013-01-16 23:08:36 +00006498 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006499}
6500
6501static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006502vec_slo(vector float __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006503{
David Blaikie3302f2b2013-01-16 23:08:36 +00006504 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006505}
6506
6507/* vec_vslo */
6508
6509static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006510vec_vslo(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006511{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006512 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006513 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006514}
6515
6516static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006517vec_vslo(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006518{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006519 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006520 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006521}
6522
6523static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006524vec_vslo(vector unsigned char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006525{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006526 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006527 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006528}
6529
6530static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006531vec_vslo(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006532{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006533 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006534 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006535}
6536
6537static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006538vec_vslo(vector short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006539{
David Blaikie3302f2b2013-01-16 23:08:36 +00006540 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006541}
6542
6543static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006544vec_vslo(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006545{
David Blaikie3302f2b2013-01-16 23:08:36 +00006546 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006547}
6548
6549static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006550vec_vslo(vector unsigned short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006551{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006552 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006553 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006554}
6555
6556static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006557vec_vslo(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006558{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006559 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006560 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006561}
6562
Anton Yartsevfc83c602010-08-19 03:21:36 +00006563static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006564vec_vslo(vector pixel __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006565{
David Blaikie3302f2b2013-01-16 23:08:36 +00006566 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006567}
6568
6569static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006570vec_vslo(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006571{
David Blaikie3302f2b2013-01-16 23:08:36 +00006572 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006573}
6574
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006575static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006576vec_vslo(vector int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006577{
David Blaikie3302f2b2013-01-16 23:08:36 +00006578 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006579}
6580
6581static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006582vec_vslo(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006583{
David Blaikie3302f2b2013-01-16 23:08:36 +00006584 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006585}
6586
6587static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006588vec_vslo(vector unsigned int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006589{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006590 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006591 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006592}
6593
6594static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006595vec_vslo(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006596{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006597 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006598 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006599}
6600
6601static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006602vec_vslo(vector float __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006603{
David Blaikie3302f2b2013-01-16 23:08:36 +00006604 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006605}
6606
6607static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006608vec_vslo(vector float __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006609{
David Blaikie3302f2b2013-01-16 23:08:36 +00006610 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006611}
6612
6613/* vec_splat */
6614
6615static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006616vec_splat(vector signed char __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006617{
David Blaikie3302f2b2013-01-16 23:08:36 +00006618 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006619}
6620
6621static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006622vec_splat(vector unsigned char __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006623{
David Blaikie3302f2b2013-01-16 23:08:36 +00006624 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Yartsev9e968982010-08-19 03:00:09 +00006625}
6626
6627static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006628vec_splat(vector bool char __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006629{
David Blaikie3302f2b2013-01-16 23:08:36 +00006630 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006631}
6632
6633static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006634vec_splat(vector short __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006635{
David Blaikie3302f2b2013-01-16 23:08:36 +00006636 __b *= 2;
6637 unsigned char b1=__b+1;
6638 return vec_perm(__a, __a, (vector unsigned char)
6639 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006640}
6641
6642static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006643vec_splat(vector unsigned short __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006644{
David Blaikie3302f2b2013-01-16 23:08:36 +00006645 __b *= 2;
6646 unsigned char b1=__b+1;
6647 return vec_perm(__a, __a, (vector unsigned char)
6648 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00006649}
6650
6651static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006652vec_splat(vector bool short __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006653{
David Blaikie3302f2b2013-01-16 23:08:36 +00006654 __b *= 2;
6655 unsigned char b1=__b+1;
6656 return vec_perm(__a, __a, (vector unsigned char)
6657 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00006658}
6659
6660static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006661vec_splat(vector pixel __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006662{
David Blaikie3302f2b2013-01-16 23:08:36 +00006663 __b *= 2;
6664 unsigned char b1=__b+1;
6665 return vec_perm(__a, __a, (vector unsigned char)
6666 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006667}
6668
6669static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006670vec_splat(vector int __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006671{
David Blaikie3302f2b2013-01-16 23:08:36 +00006672 __b *= 4;
6673 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6674 return vec_perm(__a, __a, (vector unsigned char)
6675 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006676}
6677
6678static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006679vec_splat(vector unsigned int __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006680{
David Blaikie3302f2b2013-01-16 23:08:36 +00006681 __b *= 4;
6682 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6683 return vec_perm(__a, __a, (vector unsigned char)
6684 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Yartsev9e968982010-08-19 03:00:09 +00006685}
6686
6687static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006688vec_splat(vector bool int __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006689{
David Blaikie3302f2b2013-01-16 23:08:36 +00006690 __b *= 4;
6691 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6692 return vec_perm(__a, __a, (vector unsigned char)
6693 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006694}
6695
6696static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006697vec_splat(vector float __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006698{
David Blaikie3302f2b2013-01-16 23:08:36 +00006699 __b *= 4;
6700 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6701 return vec_perm(__a, __a, (vector unsigned char)
6702 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006703}
6704
6705/* vec_vspltb */
6706
6707#define __builtin_altivec_vspltb vec_vspltb
6708
6709static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006710vec_vspltb(vector signed char __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006711{
David Blaikie3302f2b2013-01-16 23:08:36 +00006712 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006713}
6714
6715static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006716vec_vspltb(vector unsigned char __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006717{
David Blaikie3302f2b2013-01-16 23:08:36 +00006718 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Yartsev9e968982010-08-19 03:00:09 +00006719}
6720
6721static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006722vec_vspltb(vector bool char __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006723{
David Blaikie3302f2b2013-01-16 23:08:36 +00006724 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006725}
6726
6727/* vec_vsplth */
6728
6729#define __builtin_altivec_vsplth vec_vsplth
6730
6731static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006732vec_vsplth(vector short __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006733{
David Blaikie3302f2b2013-01-16 23:08:36 +00006734 __b *= 2;
6735 unsigned char b1=__b+1;
6736 return vec_perm(__a, __a, (vector unsigned char)
6737 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006738}
6739
6740static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006741vec_vsplth(vector unsigned short __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006742{
David Blaikie3302f2b2013-01-16 23:08:36 +00006743 __b *= 2;
6744 unsigned char b1=__b+1;
6745 return vec_perm(__a, __a, (vector unsigned char)
6746 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00006747}
6748
6749static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006750vec_vsplth(vector bool short __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006751{
David Blaikie3302f2b2013-01-16 23:08:36 +00006752 __b *= 2;
6753 unsigned char b1=__b+1;
6754 return vec_perm(__a, __a, (vector unsigned char)
6755 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00006756}
6757
6758static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006759vec_vsplth(vector pixel __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006760{
David Blaikie3302f2b2013-01-16 23:08:36 +00006761 __b *= 2;
6762 unsigned char b1=__b+1;
6763 return vec_perm(__a, __a, (vector unsigned char)
6764 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006765}
6766
6767/* vec_vspltw */
6768
6769#define __builtin_altivec_vspltw vec_vspltw
6770
6771static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006772vec_vspltw(vector int __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006773{
David Blaikie3302f2b2013-01-16 23:08:36 +00006774 __b *= 4;
6775 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6776 return vec_perm(__a, __a, (vector unsigned char)
6777 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006778}
6779
6780static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006781vec_vspltw(vector unsigned int __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006782{
David Blaikie3302f2b2013-01-16 23:08:36 +00006783 __b *= 4;
6784 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6785 return vec_perm(__a, __a, (vector unsigned char)
6786 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Yartsev9e968982010-08-19 03:00:09 +00006787}
6788
6789static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006790vec_vspltw(vector bool int __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006791{
David Blaikie3302f2b2013-01-16 23:08:36 +00006792 __b *= 4;
6793 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6794 return vec_perm(__a, __a, (vector unsigned char)
6795 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006796}
6797
6798static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006799vec_vspltw(vector float __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006800{
David Blaikie3302f2b2013-01-16 23:08:36 +00006801 __b *= 4;
6802 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6803 return vec_perm(__a, __a, (vector unsigned char)
6804 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006805}
6806
6807/* vec_splat_s8 */
6808
6809#define __builtin_altivec_vspltisb vec_splat_s8
6810
6811// FIXME: parameter should be treated as 5-bit signed literal
6812static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006813vec_splat_s8(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006814{
David Blaikie3302f2b2013-01-16 23:08:36 +00006815 return (vector signed char)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006816}
6817
6818/* vec_vspltisb */
6819
6820// FIXME: parameter should be treated as 5-bit signed literal
6821static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006822vec_vspltisb(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006823{
David Blaikie3302f2b2013-01-16 23:08:36 +00006824 return (vector signed char)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006825}
6826
6827/* vec_splat_s16 */
6828
6829#define __builtin_altivec_vspltish vec_splat_s16
6830
6831// FIXME: parameter should be treated as 5-bit signed literal
6832static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006833vec_splat_s16(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006834{
David Blaikie3302f2b2013-01-16 23:08:36 +00006835 return (vector short)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006836}
6837
6838/* vec_vspltish */
6839
6840// FIXME: parameter should be treated as 5-bit signed literal
6841static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006842vec_vspltish(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006843{
David Blaikie3302f2b2013-01-16 23:08:36 +00006844 return (vector short)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006845}
6846
6847/* vec_splat_s32 */
6848
6849#define __builtin_altivec_vspltisw vec_splat_s32
6850
6851// FIXME: parameter should be treated as 5-bit signed literal
6852static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006853vec_splat_s32(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006854{
David Blaikie3302f2b2013-01-16 23:08:36 +00006855 return (vector int)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006856}
6857
6858/* vec_vspltisw */
6859
6860// FIXME: parameter should be treated as 5-bit signed literal
6861static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006862vec_vspltisw(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006863{
David Blaikie3302f2b2013-01-16 23:08:36 +00006864 return (vector int)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006865}
6866
6867/* vec_splat_u8 */
6868
6869// FIXME: parameter should be treated as 5-bit signed literal
6870static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006871vec_splat_u8(unsigned char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006872{
David Blaikie3302f2b2013-01-16 23:08:36 +00006873 return (vector unsigned char)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006874}
6875
6876/* vec_splat_u16 */
6877
6878// FIXME: parameter should be treated as 5-bit signed literal
6879static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006880vec_splat_u16(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006881{
David Blaikie3302f2b2013-01-16 23:08:36 +00006882 return (vector unsigned short)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006883}
6884
6885/* vec_splat_u32 */
6886
6887// FIXME: parameter should be treated as 5-bit signed literal
6888static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006889vec_splat_u32(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006890{
David Blaikie3302f2b2013-01-16 23:08:36 +00006891 return (vector unsigned int)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006892}
6893
6894/* vec_sr */
6895
6896static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006897vec_sr(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006898{
David Blaikie3302f2b2013-01-16 23:08:36 +00006899 return __a >> (vector signed char)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006900}
6901
6902static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006903vec_sr(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006904{
David Blaikie3302f2b2013-01-16 23:08:36 +00006905 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006906}
6907
6908static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006909vec_sr(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006910{
David Blaikie3302f2b2013-01-16 23:08:36 +00006911 return __a >> (vector short)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006912}
6913
6914static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006915vec_sr(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006916{
David Blaikie3302f2b2013-01-16 23:08:36 +00006917 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006918}
6919
6920static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006921vec_sr(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006922{
David Blaikie3302f2b2013-01-16 23:08:36 +00006923 return __a >> (vector int)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006924}
6925
6926static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006927vec_sr(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006928{
David Blaikie3302f2b2013-01-16 23:08:36 +00006929 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006930}
6931
Kit Barton8553bec2015-03-11 15:57:19 +00006932#ifdef __POWER8_VECTOR__
6933static vector signed long long __ATTRS_o_ai
6934vec_sr(vector signed long long __a, vector unsigned long long __b)
6935{
6936 return __a >> (vector long long)__b;
6937}
6938
6939static vector unsigned long long __ATTRS_o_ai
6940vec_sr(vector unsigned long long __a, vector unsigned long long __b)
6941{
6942 return __a >> __b;
6943}
6944#endif
6945
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006946/* vec_vsrb */
6947
6948#define __builtin_altivec_vsrb vec_vsrb
6949
6950static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006951vec_vsrb(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006952{
David Blaikie3302f2b2013-01-16 23:08:36 +00006953 return __a >> (vector signed char)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006954}
6955
6956static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006957vec_vsrb(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006958{
David Blaikie3302f2b2013-01-16 23:08:36 +00006959 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006960}
6961
6962/* vec_vsrh */
6963
6964#define __builtin_altivec_vsrh vec_vsrh
6965
6966static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006967vec_vsrh(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006968{
David Blaikie3302f2b2013-01-16 23:08:36 +00006969 return __a >> (vector short)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006970}
6971
6972static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006973vec_vsrh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006974{
David Blaikie3302f2b2013-01-16 23:08:36 +00006975 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006976}
6977
6978/* vec_vsrw */
6979
6980#define __builtin_altivec_vsrw vec_vsrw
6981
6982static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006983vec_vsrw(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006984{
David Blaikie3302f2b2013-01-16 23:08:36 +00006985 return __a >> (vector int)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006986}
6987
6988static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006989vec_vsrw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006990{
David Blaikie3302f2b2013-01-16 23:08:36 +00006991 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006992}
6993
6994/* vec_sra */
6995
6996static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006997vec_sra(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006998{
David Blaikie3302f2b2013-01-16 23:08:36 +00006999 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007000}
7001
7002static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007003vec_sra(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007004{
David Blaikie3302f2b2013-01-16 23:08:36 +00007005 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007006}
7007
7008static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007009vec_sra(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007010{
David Blaikie3302f2b2013-01-16 23:08:36 +00007011 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007012}
7013
7014static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007015vec_sra(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007016{
David Blaikie3302f2b2013-01-16 23:08:36 +00007017 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007018}
7019
7020static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007021vec_sra(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007022{
David Blaikie3302f2b2013-01-16 23:08:36 +00007023 return __builtin_altivec_vsraw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007024}
7025
7026static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007027vec_sra(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007028{
David Blaikie3302f2b2013-01-16 23:08:36 +00007029 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007030}
7031
Kit Barton8553bec2015-03-11 15:57:19 +00007032#ifdef __POWER8_VECTOR__
7033static vector signed long long __ATTRS_o_ai
7034vec_sra(vector signed long long __a, vector unsigned long long __b)
7035{
7036 return __a >> __b;
7037}
7038
7039static vector unsigned long long __ATTRS_o_ai
7040vec_sra(vector unsigned long long __a, vector unsigned long long __b)
7041{
7042 return (vector unsigned long long) ( (vector signed long long) __a >> __b);
7043}
7044#endif
7045
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007046/* vec_vsrab */
7047
7048static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007049vec_vsrab(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007050{
David Blaikie3302f2b2013-01-16 23:08:36 +00007051 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007052}
7053
7054static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007055vec_vsrab(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007056{
David Blaikie3302f2b2013-01-16 23:08:36 +00007057 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007058}
7059
7060/* vec_vsrah */
7061
7062static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007063vec_vsrah(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007064{
David Blaikie3302f2b2013-01-16 23:08:36 +00007065 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007066}
7067
7068static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007069vec_vsrah(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007070{
David Blaikie3302f2b2013-01-16 23:08:36 +00007071 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007072}
7073
7074/* vec_vsraw */
7075
7076static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007077vec_vsraw(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007078{
David Blaikie3302f2b2013-01-16 23:08:36 +00007079 return __builtin_altivec_vsraw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007080}
7081
7082static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007083vec_vsraw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007084{
David Blaikie3302f2b2013-01-16 23:08:36 +00007085 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007086}
7087
7088/* vec_srl */
7089
7090static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007091vec_srl(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007092{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007093 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007094 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007095}
7096
7097static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007098vec_srl(vector signed char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007099{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007100 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007101 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007102}
7103
7104static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007105vec_srl(vector signed char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007106{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007107 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007108 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007109}
7110
7111static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007112vec_srl(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007113{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007114 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007115 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007116}
7117
7118static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007119vec_srl(vector unsigned char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007120{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007121 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007122 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007123}
7124
7125static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007126vec_srl(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007127{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007128 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007129 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007130}
7131
Anton Yartsevfc83c602010-08-19 03:21:36 +00007132static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007133vec_srl(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007134{
David Blaikie3302f2b2013-01-16 23:08:36 +00007135 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007136}
7137
7138static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007139vec_srl(vector bool char __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007140{
David Blaikie3302f2b2013-01-16 23:08:36 +00007141 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007142}
7143
7144static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007145vec_srl(vector bool char __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007146{
David Blaikie3302f2b2013-01-16 23:08:36 +00007147 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007148}
7149
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007150static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007151vec_srl(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007152{
David Blaikie3302f2b2013-01-16 23:08:36 +00007153 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007154}
7155
7156static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007157vec_srl(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007158{
David Blaikie3302f2b2013-01-16 23:08:36 +00007159 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007160}
7161
7162static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007163vec_srl(vector short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007164{
David Blaikie3302f2b2013-01-16 23:08:36 +00007165 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007166}
7167
7168static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007169vec_srl(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007170{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007171 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00007172 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007173}
7174
7175static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007176vec_srl(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007177{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007178 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00007179 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007180}
7181
7182static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007183vec_srl(vector unsigned short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007184{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007185 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00007186 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007187}
7188
Anton Yartsevfc83c602010-08-19 03:21:36 +00007189static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007190vec_srl(vector bool short __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007191{
David Blaikie3302f2b2013-01-16 23:08:36 +00007192 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007193}
7194
7195static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007196vec_srl(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007197{
David Blaikie3302f2b2013-01-16 23:08:36 +00007198 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007199}
7200
7201static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007202vec_srl(vector bool short __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007203{
David Blaikie3302f2b2013-01-16 23:08:36 +00007204 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007205}
7206
7207static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007208vec_srl(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007209{
David Blaikie3302f2b2013-01-16 23:08:36 +00007210 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007211}
7212
7213static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007214vec_srl(vector pixel __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007215{
David Blaikie3302f2b2013-01-16 23:08:36 +00007216 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007217}
7218
7219static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007220vec_srl(vector pixel __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007221{
David Blaikie3302f2b2013-01-16 23:08:36 +00007222 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007223}
7224
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007225static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007226vec_srl(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007227{
David Blaikie3302f2b2013-01-16 23:08:36 +00007228 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007229}
7230
7231static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007232vec_srl(vector int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007233{
David Blaikie3302f2b2013-01-16 23:08:36 +00007234 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007235}
7236
7237static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007238vec_srl(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007239{
David Blaikie3302f2b2013-01-16 23:08:36 +00007240 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007241}
7242
7243static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007244vec_srl(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007245{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007246 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007247 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007248}
7249
7250static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007251vec_srl(vector unsigned int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007252{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007253 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007254 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007255}
7256
7257static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007258vec_srl(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007259{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007260 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007261 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007262}
7263
Anton Yartsevfc83c602010-08-19 03:21:36 +00007264static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007265vec_srl(vector bool int __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007266{
David Blaikie3302f2b2013-01-16 23:08:36 +00007267 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007268}
7269
7270static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007271vec_srl(vector bool int __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007272{
David Blaikie3302f2b2013-01-16 23:08:36 +00007273 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007274}
7275
7276static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007277vec_srl(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007278{
David Blaikie3302f2b2013-01-16 23:08:36 +00007279 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007280}
7281
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007282/* vec_vsr */
7283
7284static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007285vec_vsr(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007286{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007287 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007288 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007289}
7290
7291static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007292vec_vsr(vector signed char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007293{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007294 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007295 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007296}
7297
7298static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007299vec_vsr(vector signed char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007300{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007301 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007302 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007303}
7304
7305static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007306vec_vsr(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007307{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007308 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007309 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007310}
7311
7312static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007313vec_vsr(vector unsigned char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007314{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007315 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007316 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007317}
7318
7319static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007320vec_vsr(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007321{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007322 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007323 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007324}
7325
Anton Yartsevfc83c602010-08-19 03:21:36 +00007326static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007327vec_vsr(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007328{
David Blaikie3302f2b2013-01-16 23:08:36 +00007329 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007330}
7331
7332static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007333vec_vsr(vector bool char __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007334{
David Blaikie3302f2b2013-01-16 23:08:36 +00007335 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007336}
7337
7338static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007339vec_vsr(vector bool char __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007340{
David Blaikie3302f2b2013-01-16 23:08:36 +00007341 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007342}
7343
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007344static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007345vec_vsr(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007346{
David Blaikie3302f2b2013-01-16 23:08:36 +00007347 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007348}
7349
7350static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007351vec_vsr(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007352{
David Blaikie3302f2b2013-01-16 23:08:36 +00007353 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007354}
7355
7356static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007357vec_vsr(vector short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007358{
David Blaikie3302f2b2013-01-16 23:08:36 +00007359 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007360}
7361
7362static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007363vec_vsr(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007364{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007365 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00007366 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007367}
7368
7369static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007370vec_vsr(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007371{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007372 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00007373 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007374}
7375
7376static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007377vec_vsr(vector unsigned short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007378{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007379 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00007380 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007381}
7382
Anton Yartsevfc83c602010-08-19 03:21:36 +00007383static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007384vec_vsr(vector bool short __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007385{
David Blaikie3302f2b2013-01-16 23:08:36 +00007386 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007387}
7388
7389static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007390vec_vsr(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007391{
David Blaikie3302f2b2013-01-16 23:08:36 +00007392 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007393}
7394
7395static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007396vec_vsr(vector bool short __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007397{
David Blaikie3302f2b2013-01-16 23:08:36 +00007398 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007399}
7400
7401static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007402vec_vsr(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007403{
David Blaikie3302f2b2013-01-16 23:08:36 +00007404 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007405}
7406
7407static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007408vec_vsr(vector pixel __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007409{
David Blaikie3302f2b2013-01-16 23:08:36 +00007410 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007411}
7412
7413static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007414vec_vsr(vector pixel __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007415{
David Blaikie3302f2b2013-01-16 23:08:36 +00007416 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007417}
7418
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007419static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007420vec_vsr(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007421{
David Blaikie3302f2b2013-01-16 23:08:36 +00007422 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007423}
7424
7425static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007426vec_vsr(vector int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007427{
David Blaikie3302f2b2013-01-16 23:08:36 +00007428 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007429}
7430
7431static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007432vec_vsr(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007433{
David Blaikie3302f2b2013-01-16 23:08:36 +00007434 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007435}
7436
7437static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007438vec_vsr(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007439{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007440 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007441 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007442}
7443
7444static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007445vec_vsr(vector unsigned int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007446{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007447 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007448 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007449}
7450
7451static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007452vec_vsr(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007453{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007454 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007455 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007456}
7457
Anton Yartsevfc83c602010-08-19 03:21:36 +00007458static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007459vec_vsr(vector bool int __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007460{
David Blaikie3302f2b2013-01-16 23:08:36 +00007461 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007462}
7463
7464static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007465vec_vsr(vector bool int __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007466{
David Blaikie3302f2b2013-01-16 23:08:36 +00007467 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007468}
7469
7470static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007471vec_vsr(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007472{
David Blaikie3302f2b2013-01-16 23:08:36 +00007473 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007474}
7475
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007476/* vec_sro */
7477
7478static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007479vec_sro(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007480{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007481 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007482 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007483}
7484
7485static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007486vec_sro(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007487{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007488 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007489 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007490}
7491
7492static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007493vec_sro(vector unsigned char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007494{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007495 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007496 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007497}
7498
7499static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007500vec_sro(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007501{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007502 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007503 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007504}
7505
7506static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007507vec_sro(vector short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007508{
David Blaikie3302f2b2013-01-16 23:08:36 +00007509 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007510}
7511
7512static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007513vec_sro(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007514{
David Blaikie3302f2b2013-01-16 23:08:36 +00007515 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007516}
7517
7518static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007519vec_sro(vector unsigned short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007520{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007521 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00007522 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007523}
7524
7525static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007526vec_sro(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007527{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007528 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00007529 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007530}
7531
Anton Yartsevfc83c602010-08-19 03:21:36 +00007532static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007533vec_sro(vector pixel __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007534{
David Blaikie3302f2b2013-01-16 23:08:36 +00007535 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007536}
7537
7538static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007539vec_sro(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007540{
David Blaikie3302f2b2013-01-16 23:08:36 +00007541 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007542}
7543
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007544static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007545vec_sro(vector int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007546{
David Blaikie3302f2b2013-01-16 23:08:36 +00007547 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007548}
7549
7550static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007551vec_sro(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007552{
David Blaikie3302f2b2013-01-16 23:08:36 +00007553 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007554}
7555
7556static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007557vec_sro(vector unsigned int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007558{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007559 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007560 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007561}
7562
7563static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007564vec_sro(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007565{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007566 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007567 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007568}
7569
7570static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007571vec_sro(vector float __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007572{
David Blaikie3302f2b2013-01-16 23:08:36 +00007573 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007574}
7575
7576static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007577vec_sro(vector float __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007578{
David Blaikie3302f2b2013-01-16 23:08:36 +00007579 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007580}
7581
7582/* vec_vsro */
7583
7584static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007585vec_vsro(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007586{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007587 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007588 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007589}
7590
7591static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007592vec_vsro(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007593{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007594 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007595 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007596}
7597
7598static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007599vec_vsro(vector unsigned char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007600{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007601 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007602 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007603}
7604
7605static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007606vec_vsro(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007607{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007608 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007609 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007610}
7611
7612static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007613vec_vsro(vector short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007614{
David Blaikie3302f2b2013-01-16 23:08:36 +00007615 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007616}
7617
7618static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007619vec_vsro(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007620{
David Blaikie3302f2b2013-01-16 23:08:36 +00007621 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007622}
7623
7624static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007625vec_vsro(vector unsigned short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007626{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007627 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00007628 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007629}
7630
7631static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007632vec_vsro(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007633{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007634 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00007635 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007636}
7637
Anton Yartsevfc83c602010-08-19 03:21:36 +00007638static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007639vec_vsro(vector pixel __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007640{
David Blaikie3302f2b2013-01-16 23:08:36 +00007641 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007642}
7643
7644static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007645vec_vsro(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007646{
David Blaikie3302f2b2013-01-16 23:08:36 +00007647 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007648}
7649
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007650static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007651vec_vsro(vector int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007652{
David Blaikie3302f2b2013-01-16 23:08:36 +00007653 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007654}
7655
7656static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007657vec_vsro(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007658{
David Blaikie3302f2b2013-01-16 23:08:36 +00007659 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007660}
7661
7662static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007663vec_vsro(vector unsigned int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007664{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007665 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007666 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007667}
7668
7669static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007670vec_vsro(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007671{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007672 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007673 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007674}
7675
7676static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007677vec_vsro(vector float __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007678{
David Blaikie3302f2b2013-01-16 23:08:36 +00007679 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007680}
7681
7682static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007683vec_vsro(vector float __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007684{
David Blaikie3302f2b2013-01-16 23:08:36 +00007685 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007686}
7687
7688/* vec_st */
7689
7690static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007691vec_st(vector signed char __a, int __b, vector signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007692{
David Blaikie3302f2b2013-01-16 23:08:36 +00007693 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007694}
7695
7696static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007697vec_st(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007698{
David Blaikie3302f2b2013-01-16 23:08:36 +00007699 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007700}
7701
7702static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007703vec_st(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007704{
David Blaikie3302f2b2013-01-16 23:08:36 +00007705 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007706}
7707
7708static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007709vec_st(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007710{
David Blaikie3302f2b2013-01-16 23:08:36 +00007711 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007712}
7713
7714static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007715vec_st(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007716{
David Blaikie3302f2b2013-01-16 23:08:36 +00007717 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007718}
7719
7720static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007721vec_st(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007722{
David Blaikie3302f2b2013-01-16 23:08:36 +00007723 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007724}
7725
7726static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007727vec_st(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007728{
David Blaikie3302f2b2013-01-16 23:08:36 +00007729 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007730}
7731
7732static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007733vec_st(vector short __a, int __b, vector short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007734{
David Blaikie3302f2b2013-01-16 23:08:36 +00007735 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007736}
7737
7738static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007739vec_st(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007740{
David Blaikie3302f2b2013-01-16 23:08:36 +00007741 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007742}
7743
7744static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007745vec_st(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007746{
David Blaikie3302f2b2013-01-16 23:08:36 +00007747 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007748}
7749
7750static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007751vec_st(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007752{
David Blaikie3302f2b2013-01-16 23:08:36 +00007753 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007754}
7755
7756static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007757vec_st(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007758{
David Blaikie3302f2b2013-01-16 23:08:36 +00007759 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007760}
7761
7762static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007763vec_st(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007764{
David Blaikie3302f2b2013-01-16 23:08:36 +00007765 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007766}
7767
7768static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007769vec_st(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007770{
David Blaikie3302f2b2013-01-16 23:08:36 +00007771 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007772}
7773
7774static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007775vec_st(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007776{
David Blaikie3302f2b2013-01-16 23:08:36 +00007777 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007778}
7779
7780static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007781vec_st(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007782{
David Blaikie3302f2b2013-01-16 23:08:36 +00007783 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007784}
7785
7786static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007787vec_st(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007788{
David Blaikie3302f2b2013-01-16 23:08:36 +00007789 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007790}
7791
7792static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007793vec_st(vector int __a, int __b, vector int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007794{
David Blaikie3302f2b2013-01-16 23:08:36 +00007795 __builtin_altivec_stvx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007796}
7797
7798static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007799vec_st(vector int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007800{
David Blaikie3302f2b2013-01-16 23:08:36 +00007801 __builtin_altivec_stvx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007802}
7803
7804static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007805vec_st(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007806{
David Blaikie3302f2b2013-01-16 23:08:36 +00007807 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007808}
7809
7810static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007811vec_st(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007812{
David Blaikie3302f2b2013-01-16 23:08:36 +00007813 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007814}
7815
7816static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007817vec_st(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007818{
David Blaikie3302f2b2013-01-16 23:08:36 +00007819 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007820}
7821
7822static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007823vec_st(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007824{
David Blaikie3302f2b2013-01-16 23:08:36 +00007825 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007826}
7827
7828static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007829vec_st(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007830{
David Blaikie3302f2b2013-01-16 23:08:36 +00007831 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007832}
7833
7834static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007835vec_st(vector float __a, int __b, vector float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007836{
David Blaikie3302f2b2013-01-16 23:08:36 +00007837 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007838}
7839
7840static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007841vec_st(vector float __a, int __b, float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007842{
David Blaikie3302f2b2013-01-16 23:08:36 +00007843 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007844}
7845
7846/* vec_stvx */
7847
7848static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007849vec_stvx(vector signed char __a, int __b, vector signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007850{
David Blaikie3302f2b2013-01-16 23:08:36 +00007851 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007852}
7853
7854static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007855vec_stvx(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007856{
David Blaikie3302f2b2013-01-16 23:08:36 +00007857 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007858}
7859
7860static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007861vec_stvx(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007862{
David Blaikie3302f2b2013-01-16 23:08:36 +00007863 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007864}
7865
7866static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007867vec_stvx(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007868{
David Blaikie3302f2b2013-01-16 23:08:36 +00007869 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007870}
7871
7872static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007873vec_stvx(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007874{
David Blaikie3302f2b2013-01-16 23:08:36 +00007875 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007876}
7877
7878static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007879vec_stvx(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007880{
David Blaikie3302f2b2013-01-16 23:08:36 +00007881 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007882}
7883
7884static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007885vec_stvx(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007886{
David Blaikie3302f2b2013-01-16 23:08:36 +00007887 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007888}
7889
7890static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007891vec_stvx(vector short __a, int __b, vector short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007892{
David Blaikie3302f2b2013-01-16 23:08:36 +00007893 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007894}
7895
7896static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007897vec_stvx(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007898{
David Blaikie3302f2b2013-01-16 23:08:36 +00007899 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007900}
7901
7902static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007903vec_stvx(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007904{
David Blaikie3302f2b2013-01-16 23:08:36 +00007905 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007906}
7907
7908static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007909vec_stvx(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007910{
David Blaikie3302f2b2013-01-16 23:08:36 +00007911 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007912}
7913
7914static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007915vec_stvx(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007916{
David Blaikie3302f2b2013-01-16 23:08:36 +00007917 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007918}
7919
7920static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007921vec_stvx(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007922{
David Blaikie3302f2b2013-01-16 23:08:36 +00007923 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007924}
7925
7926static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007927vec_stvx(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007928{
David Blaikie3302f2b2013-01-16 23:08:36 +00007929 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007930}
7931
7932static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007933vec_stvx(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007934{
David Blaikie3302f2b2013-01-16 23:08:36 +00007935 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007936}
7937
7938static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007939vec_stvx(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007940{
David Blaikie3302f2b2013-01-16 23:08:36 +00007941 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007942}
7943
7944static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007945vec_stvx(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007946{
David Blaikie3302f2b2013-01-16 23:08:36 +00007947 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007948}
7949
7950static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007951vec_stvx(vector int __a, int __b, vector int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007952{
David Blaikie3302f2b2013-01-16 23:08:36 +00007953 __builtin_altivec_stvx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007954}
7955
7956static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007957vec_stvx(vector int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007958{
David Blaikie3302f2b2013-01-16 23:08:36 +00007959 __builtin_altivec_stvx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007960}
7961
7962static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007963vec_stvx(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007964{
David Blaikie3302f2b2013-01-16 23:08:36 +00007965 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007966}
7967
7968static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007969vec_stvx(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007970{
David Blaikie3302f2b2013-01-16 23:08:36 +00007971 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007972}
7973
7974static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007975vec_stvx(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007976{
David Blaikie3302f2b2013-01-16 23:08:36 +00007977 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007978}
7979
7980static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007981vec_stvx(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007982{
David Blaikie3302f2b2013-01-16 23:08:36 +00007983 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007984}
7985
7986static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007987vec_stvx(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007988{
David Blaikie3302f2b2013-01-16 23:08:36 +00007989 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007990}
7991
7992static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007993vec_stvx(vector float __a, int __b, vector float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007994{
David Blaikie3302f2b2013-01-16 23:08:36 +00007995 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007996}
7997
7998static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007999vec_stvx(vector float __a, int __b, float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008000{
David Blaikie3302f2b2013-01-16 23:08:36 +00008001 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008002}
8003
8004/* vec_ste */
8005
8006static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008007vec_ste(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008008{
David Blaikie3302f2b2013-01-16 23:08:36 +00008009 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008010}
8011
8012static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008013vec_ste(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008014{
David Blaikie3302f2b2013-01-16 23:08:36 +00008015 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008016}
8017
8018static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008019vec_ste(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008020{
David Blaikie3302f2b2013-01-16 23:08:36 +00008021 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008022}
8023
8024static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008025vec_ste(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008026{
David Blaikie3302f2b2013-01-16 23:08:36 +00008027 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008028}
8029
8030static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008031vec_ste(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008032{
David Blaikie3302f2b2013-01-16 23:08:36 +00008033 __builtin_altivec_stvehx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008034}
8035
8036static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008037vec_ste(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008038{
David Blaikie3302f2b2013-01-16 23:08:36 +00008039 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008040}
8041
8042static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008043vec_ste(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008044{
David Blaikie3302f2b2013-01-16 23:08:36 +00008045 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008046}
8047
8048static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008049vec_ste(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008050{
David Blaikie3302f2b2013-01-16 23:08:36 +00008051 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008052}
8053
8054static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008055vec_ste(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008056{
David Blaikie3302f2b2013-01-16 23:08:36 +00008057 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008058}
8059
8060static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008061vec_ste(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008062{
David Blaikie3302f2b2013-01-16 23:08:36 +00008063 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008064}
8065
8066static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008067vec_ste(vector int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008068{
David Blaikie3302f2b2013-01-16 23:08:36 +00008069 __builtin_altivec_stvewx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008070}
8071
8072static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008073vec_ste(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008074{
David Blaikie3302f2b2013-01-16 23:08:36 +00008075 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008076}
8077
8078static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008079vec_ste(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008080{
David Blaikie3302f2b2013-01-16 23:08:36 +00008081 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008082}
8083
8084static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008085vec_ste(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008086{
David Blaikie3302f2b2013-01-16 23:08:36 +00008087 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008088}
8089
8090static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008091vec_ste(vector float __a, int __b, float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008092{
David Blaikie3302f2b2013-01-16 23:08:36 +00008093 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008094}
8095
8096/* vec_stvebx */
8097
8098static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008099vec_stvebx(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008100{
David Blaikie3302f2b2013-01-16 23:08:36 +00008101 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008102}
8103
8104static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008105vec_stvebx(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008106{
David Blaikie3302f2b2013-01-16 23:08:36 +00008107 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008108}
8109
Anton Yartsevfc83c602010-08-19 03:21:36 +00008110static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008111vec_stvebx(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008112{
David Blaikie3302f2b2013-01-16 23:08:36 +00008113 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008114}
8115
8116static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008117vec_stvebx(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008118{
David Blaikie3302f2b2013-01-16 23:08:36 +00008119 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008120}
8121
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008122/* vec_stvehx */
8123
8124static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008125vec_stvehx(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008126{
David Blaikie3302f2b2013-01-16 23:08:36 +00008127 __builtin_altivec_stvehx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008128}
8129
8130static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008131vec_stvehx(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008132{
David Blaikie3302f2b2013-01-16 23:08:36 +00008133 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008134}
8135
Anton Yartsevfc83c602010-08-19 03:21:36 +00008136static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008137vec_stvehx(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008138{
David Blaikie3302f2b2013-01-16 23:08:36 +00008139 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008140}
8141
8142static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008143vec_stvehx(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008144{
David Blaikie3302f2b2013-01-16 23:08:36 +00008145 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008146}
8147
8148static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008149vec_stvehx(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008150{
David Blaikie3302f2b2013-01-16 23:08:36 +00008151 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008152}
8153
8154static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008155vec_stvehx(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008156{
David Blaikie3302f2b2013-01-16 23:08:36 +00008157 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008158}
8159
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008160/* vec_stvewx */
8161
8162static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008163vec_stvewx(vector int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008164{
David Blaikie3302f2b2013-01-16 23:08:36 +00008165 __builtin_altivec_stvewx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008166}
8167
8168static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008169vec_stvewx(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008170{
David Blaikie3302f2b2013-01-16 23:08:36 +00008171 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008172}
8173
8174static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008175vec_stvewx(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008176{
David Blaikie3302f2b2013-01-16 23:08:36 +00008177 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008178}
8179
8180static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008181vec_stvewx(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008182{
David Blaikie3302f2b2013-01-16 23:08:36 +00008183 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008184}
8185
8186static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008187vec_stvewx(vector float __a, int __b, float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008188{
David Blaikie3302f2b2013-01-16 23:08:36 +00008189 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008190}
8191
8192/* vec_stl */
8193
8194static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008195vec_stl(vector signed char __a, int __b, vector signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008196{
David Blaikie3302f2b2013-01-16 23:08:36 +00008197 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008198}
8199
8200static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008201vec_stl(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008202{
David Blaikie3302f2b2013-01-16 23:08:36 +00008203 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008204}
8205
8206static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008207vec_stl(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008208{
David Blaikie3302f2b2013-01-16 23:08:36 +00008209 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008210}
8211
8212static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008213vec_stl(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008214{
David Blaikie3302f2b2013-01-16 23:08:36 +00008215 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008216}
8217
8218static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008219vec_stl(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008220{
David Blaikie3302f2b2013-01-16 23:08:36 +00008221 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008222}
8223
8224static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008225vec_stl(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008226{
David Blaikie3302f2b2013-01-16 23:08:36 +00008227 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008228}
8229
8230static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008231vec_stl(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008232{
David Blaikie3302f2b2013-01-16 23:08:36 +00008233 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008234}
8235
8236static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008237vec_stl(vector short __a, int __b, vector short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008238{
David Blaikie3302f2b2013-01-16 23:08:36 +00008239 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008240}
8241
8242static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008243vec_stl(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008244{
David Blaikie3302f2b2013-01-16 23:08:36 +00008245 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008246}
8247
8248static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008249vec_stl(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008250{
David Blaikie3302f2b2013-01-16 23:08:36 +00008251 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008252}
8253
8254static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008255vec_stl(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008256{
David Blaikie3302f2b2013-01-16 23:08:36 +00008257 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008258}
8259
8260static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008261vec_stl(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008262{
David Blaikie3302f2b2013-01-16 23:08:36 +00008263 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008264}
8265
8266static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008267vec_stl(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008268{
David Blaikie3302f2b2013-01-16 23:08:36 +00008269 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008270}
8271
8272static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008273vec_stl(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008274{
David Blaikie3302f2b2013-01-16 23:08:36 +00008275 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008276}
8277
8278static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008279vec_stl(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008280{
David Blaikie3302f2b2013-01-16 23:08:36 +00008281 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008282}
8283
8284static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008285vec_stl(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008286{
David Blaikie3302f2b2013-01-16 23:08:36 +00008287 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008288}
8289
8290static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008291vec_stl(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008292{
David Blaikie3302f2b2013-01-16 23:08:36 +00008293 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008294}
8295
8296static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008297vec_stl(vector int __a, int __b, vector int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008298{
David Blaikie3302f2b2013-01-16 23:08:36 +00008299 __builtin_altivec_stvxl(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008300}
8301
8302static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008303vec_stl(vector int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008304{
David Blaikie3302f2b2013-01-16 23:08:36 +00008305 __builtin_altivec_stvxl(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008306}
8307
8308static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008309vec_stl(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008310{
David Blaikie3302f2b2013-01-16 23:08:36 +00008311 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008312}
8313
8314static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008315vec_stl(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008316{
David Blaikie3302f2b2013-01-16 23:08:36 +00008317 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008318}
8319
8320static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008321vec_stl(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008322{
David Blaikie3302f2b2013-01-16 23:08:36 +00008323 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008324}
8325
8326static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008327vec_stl(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008328{
David Blaikie3302f2b2013-01-16 23:08:36 +00008329 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008330}
8331
8332static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008333vec_stl(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008334{
David Blaikie3302f2b2013-01-16 23:08:36 +00008335 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008336}
8337
8338static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008339vec_stl(vector float __a, int __b, vector float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008340{
David Blaikie3302f2b2013-01-16 23:08:36 +00008341 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008342}
8343
8344static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008345vec_stl(vector float __a, int __b, float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008346{
David Blaikie3302f2b2013-01-16 23:08:36 +00008347 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008348}
8349
8350/* vec_stvxl */
8351
8352static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008353vec_stvxl(vector signed char __a, int __b, vector signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008354{
David Blaikie3302f2b2013-01-16 23:08:36 +00008355 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008356}
8357
8358static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008359vec_stvxl(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008360{
David Blaikie3302f2b2013-01-16 23:08:36 +00008361 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008362}
8363
8364static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008365vec_stvxl(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008366{
David Blaikie3302f2b2013-01-16 23:08:36 +00008367 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008368}
8369
8370static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008371vec_stvxl(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008372{
David Blaikie3302f2b2013-01-16 23:08:36 +00008373 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008374}
8375
8376static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008377vec_stvxl(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008378{
David Blaikie3302f2b2013-01-16 23:08:36 +00008379 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008380}
8381
8382static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008383vec_stvxl(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008384{
David Blaikie3302f2b2013-01-16 23:08:36 +00008385 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008386}
8387
8388static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008389vec_stvxl(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008390{
David Blaikie3302f2b2013-01-16 23:08:36 +00008391 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008392}
8393
8394static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008395vec_stvxl(vector short __a, int __b, vector short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008396{
David Blaikie3302f2b2013-01-16 23:08:36 +00008397 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008398}
8399
8400static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008401vec_stvxl(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008402{
David Blaikie3302f2b2013-01-16 23:08:36 +00008403 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008404}
8405
8406static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008407vec_stvxl(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008408{
David Blaikie3302f2b2013-01-16 23:08:36 +00008409 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008410}
8411
8412static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008413vec_stvxl(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008414{
David Blaikie3302f2b2013-01-16 23:08:36 +00008415 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008416}
8417
8418static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008419vec_stvxl(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008420{
David Blaikie3302f2b2013-01-16 23:08:36 +00008421 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008422}
8423
8424static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008425vec_stvxl(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008426{
David Blaikie3302f2b2013-01-16 23:08:36 +00008427 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008428}
8429
8430static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008431vec_stvxl(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008432{
David Blaikie3302f2b2013-01-16 23:08:36 +00008433 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008434}
8435
8436static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008437vec_stvxl(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008438{
David Blaikie3302f2b2013-01-16 23:08:36 +00008439 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008440}
8441
8442static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008443vec_stvxl(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008444{
David Blaikie3302f2b2013-01-16 23:08:36 +00008445 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008446}
8447
8448static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008449vec_stvxl(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008450{
David Blaikie3302f2b2013-01-16 23:08:36 +00008451 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008452}
8453
8454static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008455vec_stvxl(vector int __a, int __b, vector int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008456{
David Blaikie3302f2b2013-01-16 23:08:36 +00008457 __builtin_altivec_stvxl(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008458}
8459
8460static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008461vec_stvxl(vector int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008462{
David Blaikie3302f2b2013-01-16 23:08:36 +00008463 __builtin_altivec_stvxl(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008464}
8465
8466static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008467vec_stvxl(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008468{
David Blaikie3302f2b2013-01-16 23:08:36 +00008469 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008470}
8471
8472static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008473vec_stvxl(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008474{
David Blaikie3302f2b2013-01-16 23:08:36 +00008475 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008476}
8477
8478static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008479vec_stvxl(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008480{
David Blaikie3302f2b2013-01-16 23:08:36 +00008481 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008482}
8483
8484static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008485vec_stvxl(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008486{
David Blaikie3302f2b2013-01-16 23:08:36 +00008487 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008488}
8489
8490static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008491vec_stvxl(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008492{
David Blaikie3302f2b2013-01-16 23:08:36 +00008493 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008494}
8495
8496static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008497vec_stvxl(vector float __a, int __b, vector float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008498{
David Blaikie3302f2b2013-01-16 23:08:36 +00008499 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008500}
8501
8502static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008503vec_stvxl(vector float __a, int __b, float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008504{
David Blaikie3302f2b2013-01-16 23:08:36 +00008505 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008506}
8507
8508/* vec_sub */
8509
8510static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008511vec_sub(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008512{
David Blaikie3302f2b2013-01-16 23:08:36 +00008513 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008514}
8515
Anton Yartsevfc83c602010-08-19 03:21:36 +00008516static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008517vec_sub(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008518{
David Blaikie3302f2b2013-01-16 23:08:36 +00008519 return (vector signed char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008520}
8521
8522static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008523vec_sub(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008524{
David Blaikie3302f2b2013-01-16 23:08:36 +00008525 return __a - (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008526}
8527
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008528static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008529vec_sub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008530{
David Blaikie3302f2b2013-01-16 23:08:36 +00008531 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008532}
8533
Anton Yartsevfc83c602010-08-19 03:21:36 +00008534static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008535vec_sub(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008536{
David Blaikie3302f2b2013-01-16 23:08:36 +00008537 return (vector unsigned char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008538}
8539
8540static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008541vec_sub(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008542{
David Blaikie3302f2b2013-01-16 23:08:36 +00008543 return __a - (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008544}
8545
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008546static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008547vec_sub(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008548{
David Blaikie3302f2b2013-01-16 23:08:36 +00008549 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008550}
8551
Anton Yartsevfc83c602010-08-19 03:21:36 +00008552static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008553vec_sub(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008554{
David Blaikie3302f2b2013-01-16 23:08:36 +00008555 return (vector short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008556}
8557
8558static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008559vec_sub(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008560{
David Blaikie3302f2b2013-01-16 23:08:36 +00008561 return __a - (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008562}
8563
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008564static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008565vec_sub(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008566{
David Blaikie3302f2b2013-01-16 23:08:36 +00008567 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008568}
8569
Anton Yartsevfc83c602010-08-19 03:21:36 +00008570static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008571vec_sub(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008572{
David Blaikie3302f2b2013-01-16 23:08:36 +00008573 return (vector unsigned short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008574}
8575
8576static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008577vec_sub(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008578{
David Blaikie3302f2b2013-01-16 23:08:36 +00008579 return __a - (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008580}
8581
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008582static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008583vec_sub(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008584{
David Blaikie3302f2b2013-01-16 23:08:36 +00008585 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008586}
8587
Anton Yartsevfc83c602010-08-19 03:21:36 +00008588static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008589vec_sub(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008590{
David Blaikie3302f2b2013-01-16 23:08:36 +00008591 return (vector int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008592}
8593
8594static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008595vec_sub(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008596{
David Blaikie3302f2b2013-01-16 23:08:36 +00008597 return __a - (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008598}
8599
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008600static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008601vec_sub(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008602{
David Blaikie3302f2b2013-01-16 23:08:36 +00008603 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008604}
8605
Anton Yartsevfc83c602010-08-19 03:21:36 +00008606static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008607vec_sub(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008608{
David Blaikie3302f2b2013-01-16 23:08:36 +00008609 return (vector unsigned int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008610}
8611
8612static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008613vec_sub(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008614{
David Blaikie3302f2b2013-01-16 23:08:36 +00008615 return __a - (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008616}
8617
Kit Barton5944ee212015-05-25 15:52:45 +00008618#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
8619static vector signed __int128 __ATTRS_o_ai
8620vec_sub(vector signed __int128 __a, vector signed __int128 __b)
8621{
8622 return __a - __b;
8623}
8624
8625static vector unsigned __int128 __ATTRS_o_ai
8626vec_sub(vector unsigned __int128 __a, vector unsigned __int128 __b)
8627{
8628 return __a - __b;
8629}
8630#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
8631
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008632static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008633vec_sub(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008634{
David Blaikie3302f2b2013-01-16 23:08:36 +00008635 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008636}
8637
8638/* vec_vsububm */
8639
8640#define __builtin_altivec_vsububm vec_vsububm
8641
8642static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008643vec_vsububm(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008644{
David Blaikie3302f2b2013-01-16 23:08:36 +00008645 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008646}
8647
Anton Yartsevfc83c602010-08-19 03:21:36 +00008648static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008649vec_vsububm(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008650{
David Blaikie3302f2b2013-01-16 23:08:36 +00008651 return (vector signed char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008652}
8653
8654static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008655vec_vsububm(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008656{
David Blaikie3302f2b2013-01-16 23:08:36 +00008657 return __a - (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008658}
8659
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008660static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008661vec_vsububm(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008662{
David Blaikie3302f2b2013-01-16 23:08:36 +00008663 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008664}
8665
Anton Yartsevfc83c602010-08-19 03:21:36 +00008666static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008667vec_vsububm(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008668{
David Blaikie3302f2b2013-01-16 23:08:36 +00008669 return (vector unsigned char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008670}
8671
8672static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008673vec_vsububm(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008674{
David Blaikie3302f2b2013-01-16 23:08:36 +00008675 return __a - (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008676}
8677
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008678/* vec_vsubuhm */
8679
8680#define __builtin_altivec_vsubuhm vec_vsubuhm
8681
8682static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008683vec_vsubuhm(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008684{
David Blaikie3302f2b2013-01-16 23:08:36 +00008685 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008686}
8687
Anton Yartsevfc83c602010-08-19 03:21:36 +00008688static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008689vec_vsubuhm(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008690{
David Blaikie3302f2b2013-01-16 23:08:36 +00008691 return (vector short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008692}
8693
8694static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008695vec_vsubuhm(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008696{
David Blaikie3302f2b2013-01-16 23:08:36 +00008697 return __a - (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008698}
8699
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008700static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008701vec_vsubuhm(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008702{
David Blaikie3302f2b2013-01-16 23:08:36 +00008703 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008704}
8705
Anton Yartsevfc83c602010-08-19 03:21:36 +00008706static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008707vec_vsubuhm(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008708{
David Blaikie3302f2b2013-01-16 23:08:36 +00008709 return (vector unsigned short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008710}
8711
8712static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008713vec_vsubuhm(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008714{
David Blaikie3302f2b2013-01-16 23:08:36 +00008715 return __a - (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008716}
8717
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008718/* vec_vsubuwm */
8719
8720#define __builtin_altivec_vsubuwm vec_vsubuwm
8721
8722static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008723vec_vsubuwm(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008724{
David Blaikie3302f2b2013-01-16 23:08:36 +00008725 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008726}
8727
Anton Yartsevfc83c602010-08-19 03:21:36 +00008728static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008729vec_vsubuwm(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008730{
David Blaikie3302f2b2013-01-16 23:08:36 +00008731 return (vector int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008732}
8733
8734static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008735vec_vsubuwm(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008736{
David Blaikie3302f2b2013-01-16 23:08:36 +00008737 return __a - (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008738}
8739
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008740static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008741vec_vsubuwm(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008742{
David Blaikie3302f2b2013-01-16 23:08:36 +00008743 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008744}
8745
Anton Yartsevfc83c602010-08-19 03:21:36 +00008746static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008747vec_vsubuwm(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008748{
David Blaikie3302f2b2013-01-16 23:08:36 +00008749 return (vector unsigned int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008750}
8751
8752static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008753vec_vsubuwm(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008754{
David Blaikie3302f2b2013-01-16 23:08:36 +00008755 return __a - (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008756}
8757
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008758/* vec_vsubfp */
8759
8760#define __builtin_altivec_vsubfp vec_vsubfp
8761
8762static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008763vec_vsubfp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008764{
David Blaikie3302f2b2013-01-16 23:08:36 +00008765 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008766}
8767
8768/* vec_subc */
8769
Kit Barton5944ee212015-05-25 15:52:45 +00008770static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008771vec_subc(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008772{
David Blaikie3302f2b2013-01-16 23:08:36 +00008773 return __builtin_altivec_vsubcuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008774}
8775
Kit Barton5944ee212015-05-25 15:52:45 +00008776#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
8777static vector unsigned __int128 __ATTRS_o_ai
8778vec_subc(vector unsigned __int128 __a, vector unsigned __int128 __b)
8779{
8780 return __builtin_altivec_vsubcuq(__a, __b);
8781}
8782
8783static vector signed __int128 __ATTRS_o_ai
8784vec_subc(vector signed __int128 __a, vector signed __int128 __b)
8785{
8786 return __builtin_altivec_vsubcuq(__a, __b);
8787}
8788#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
8789
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008790/* vec_vsubcuw */
8791
8792static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008793vec_vsubcuw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008794{
David Blaikie3302f2b2013-01-16 23:08:36 +00008795 return __builtin_altivec_vsubcuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008796}
8797
8798/* vec_subs */
8799
8800static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008801vec_subs(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008802{
David Blaikie3302f2b2013-01-16 23:08:36 +00008803 return __builtin_altivec_vsubsbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008804}
8805
Anton Yartsevfc83c602010-08-19 03:21:36 +00008806static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008807vec_subs(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008808{
David Blaikie3302f2b2013-01-16 23:08:36 +00008809 return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008810}
8811
8812static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008813vec_subs(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008814{
David Blaikie3302f2b2013-01-16 23:08:36 +00008815 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008816}
8817
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008818static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008819vec_subs(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008820{
David Blaikie3302f2b2013-01-16 23:08:36 +00008821 return __builtin_altivec_vsububs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008822}
8823
Anton Yartsevfc83c602010-08-19 03:21:36 +00008824static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008825vec_subs(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008826{
David Blaikie3302f2b2013-01-16 23:08:36 +00008827 return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008828}
8829
8830static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008831vec_subs(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008832{
David Blaikie3302f2b2013-01-16 23:08:36 +00008833 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008834}
8835
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008836static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008837vec_subs(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008838{
David Blaikie3302f2b2013-01-16 23:08:36 +00008839 return __builtin_altivec_vsubshs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008840}
8841
Anton Yartsevfc83c602010-08-19 03:21:36 +00008842static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008843vec_subs(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008844{
David Blaikie3302f2b2013-01-16 23:08:36 +00008845 return __builtin_altivec_vsubshs((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008846}
8847
8848static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008849vec_subs(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008850{
David Blaikie3302f2b2013-01-16 23:08:36 +00008851 return __builtin_altivec_vsubshs(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008852}
8853
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008854static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008855vec_subs(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008856{
David Blaikie3302f2b2013-01-16 23:08:36 +00008857 return __builtin_altivec_vsubuhs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008858}
8859
Anton Yartsevfc83c602010-08-19 03:21:36 +00008860static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008861vec_subs(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008862{
David Blaikie3302f2b2013-01-16 23:08:36 +00008863 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008864}
8865
8866static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008867vec_subs(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008868{
David Blaikie3302f2b2013-01-16 23:08:36 +00008869 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008870}
8871
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008872static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008873vec_subs(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008874{
David Blaikie3302f2b2013-01-16 23:08:36 +00008875 return __builtin_altivec_vsubsws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008876}
8877
Anton Yartsevfc83c602010-08-19 03:21:36 +00008878static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008879vec_subs(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008880{
David Blaikie3302f2b2013-01-16 23:08:36 +00008881 return __builtin_altivec_vsubsws((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008882}
8883
8884static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008885vec_subs(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008886{
David Blaikie3302f2b2013-01-16 23:08:36 +00008887 return __builtin_altivec_vsubsws(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008888}
8889
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008890static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008891vec_subs(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008892{
David Blaikie3302f2b2013-01-16 23:08:36 +00008893 return __builtin_altivec_vsubuws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008894}
8895
Anton Yartsevfc83c602010-08-19 03:21:36 +00008896static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008897vec_subs(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008898{
David Blaikie3302f2b2013-01-16 23:08:36 +00008899 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008900}
8901
8902static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008903vec_subs(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008904{
David Blaikie3302f2b2013-01-16 23:08:36 +00008905 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008906}
8907
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008908/* vec_vsubsbs */
8909
Anton Yartsevfc83c602010-08-19 03:21:36 +00008910static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008911vec_vsubsbs(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008912{
David Blaikie3302f2b2013-01-16 23:08:36 +00008913 return __builtin_altivec_vsubsbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008914}
8915
Anton Yartsevfc83c602010-08-19 03:21:36 +00008916static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008917vec_vsubsbs(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008918{
David Blaikie3302f2b2013-01-16 23:08:36 +00008919 return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008920}
8921
8922static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008923vec_vsubsbs(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008924{
David Blaikie3302f2b2013-01-16 23:08:36 +00008925 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008926}
8927
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008928/* vec_vsububs */
8929
Anton Yartsevfc83c602010-08-19 03:21:36 +00008930static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008931vec_vsububs(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008932{
David Blaikie3302f2b2013-01-16 23:08:36 +00008933 return __builtin_altivec_vsububs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008934}
8935
Anton Yartsevfc83c602010-08-19 03:21:36 +00008936static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008937vec_vsububs(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008938{
David Blaikie3302f2b2013-01-16 23:08:36 +00008939 return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008940}
8941
8942static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008943vec_vsububs(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008944{
David Blaikie3302f2b2013-01-16 23:08:36 +00008945 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008946}
8947
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008948/* vec_vsubshs */
8949
Anton Yartsevfc83c602010-08-19 03:21:36 +00008950static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008951vec_vsubshs(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008952{
David Blaikie3302f2b2013-01-16 23:08:36 +00008953 return __builtin_altivec_vsubshs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008954}
8955
Anton Yartsevfc83c602010-08-19 03:21:36 +00008956static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008957vec_vsubshs(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008958{
David Blaikie3302f2b2013-01-16 23:08:36 +00008959 return __builtin_altivec_vsubshs((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008960}
8961
8962static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008963vec_vsubshs(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008964{
David Blaikie3302f2b2013-01-16 23:08:36 +00008965 return __builtin_altivec_vsubshs(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008966}
8967
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008968/* vec_vsubuhs */
8969
Anton Yartsevfc83c602010-08-19 03:21:36 +00008970static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008971vec_vsubuhs(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008972{
David Blaikie3302f2b2013-01-16 23:08:36 +00008973 return __builtin_altivec_vsubuhs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008974}
8975
Anton Yartsevfc83c602010-08-19 03:21:36 +00008976static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008977vec_vsubuhs(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008978{
David Blaikie3302f2b2013-01-16 23:08:36 +00008979 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008980}
8981
8982static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008983vec_vsubuhs(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008984{
David Blaikie3302f2b2013-01-16 23:08:36 +00008985 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008986}
8987
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008988/* vec_vsubsws */
8989
Anton Yartsevfc83c602010-08-19 03:21:36 +00008990static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008991vec_vsubsws(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008992{
David Blaikie3302f2b2013-01-16 23:08:36 +00008993 return __builtin_altivec_vsubsws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008994}
8995
Anton Yartsevfc83c602010-08-19 03:21:36 +00008996static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008997vec_vsubsws(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008998{
David Blaikie3302f2b2013-01-16 23:08:36 +00008999 return __builtin_altivec_vsubsws((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00009000}
9001
9002static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009003vec_vsubsws(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009004{
David Blaikie3302f2b2013-01-16 23:08:36 +00009005 return __builtin_altivec_vsubsws(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00009006}
9007
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009008/* vec_vsubuws */
9009
Anton Yartsevfc83c602010-08-19 03:21:36 +00009010static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009011vec_vsubuws(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009012{
David Blaikie3302f2b2013-01-16 23:08:36 +00009013 return __builtin_altivec_vsubuws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009014}
9015
Anton Yartsevfc83c602010-08-19 03:21:36 +00009016static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009017vec_vsubuws(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009018{
David Blaikie3302f2b2013-01-16 23:08:36 +00009019 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00009020}
9021
9022static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009023vec_vsubuws(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009024{
David Blaikie3302f2b2013-01-16 23:08:36 +00009025 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00009026}
9027
Kit Barton5944ee212015-05-25 15:52:45 +00009028#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
9029/* vec_vsubuqm */
9030
9031static vector signed __int128 __ATTRS_o_ai
9032vec_vsubuqm(vector signed __int128 __a, vector signed __int128 __b)
9033{
9034 return __a - __b;
9035}
9036
9037static vector unsigned __int128 __ATTRS_o_ai
9038vec_vsubuqm(vector unsigned __int128 __a, vector unsigned __int128 __b)
9039{
9040 return __a - __b;
9041}
9042
9043/* vec_vsubeuqm */
9044
9045static vector signed __int128 __ATTRS_o_ai
9046vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b,
9047 vector signed __int128 __c)
9048{
9049 return __builtin_altivec_vsubeuqm(__a, __b, __c);
9050}
9051
9052static vector unsigned __int128 __ATTRS_o_ai
9053vec_vsubeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
9054 vector unsigned __int128 __c)
9055{
9056 return __builtin_altivec_vsubeuqm(__a, __b, __c);
9057}
9058
9059/* vec_vsubcuq */
9060
9061static vector signed __int128 __ATTRS_o_ai
9062vec_vsubcuq(vector signed __int128 __a, vector signed __int128 __b)
9063{
9064 return __builtin_altivec_vsubcuq(__a, __b);
9065}
9066
9067static vector unsigned __int128 __ATTRS_o_ai
9068vec_vsubcuq(vector unsigned __int128 __a, vector unsigned __int128 __b)
9069{
9070 return __builtin_altivec_vsubcuq(__a, __b);
9071}
9072
9073/* vec_vsubecuq */
9074
9075static vector signed __int128 __ATTRS_o_ai
9076vec_vsubecuq(vector signed __int128 __a, vector signed __int128 __b,
9077 vector signed __int128 __c)
9078{
9079 return __builtin_altivec_vsubecuq(__a, __b, __c);
9080}
9081
9082static vector unsigned __int128 __ATTRS_o_ai
9083vec_vsubecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
9084 vector unsigned __int128 __c)
9085{
9086 return __builtin_altivec_vsubecuq(__a, __b, __c);
9087}
9088#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
9089
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009090/* vec_sum4s */
9091
9092static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009093vec_sum4s(vector signed char __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009094{
David Blaikie3302f2b2013-01-16 23:08:36 +00009095 return __builtin_altivec_vsum4sbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009096}
9097
9098static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009099vec_sum4s(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009100{
David Blaikie3302f2b2013-01-16 23:08:36 +00009101 return __builtin_altivec_vsum4ubs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009102}
9103
9104static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009105vec_sum4s(vector signed short __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009106{
David Blaikie3302f2b2013-01-16 23:08:36 +00009107 return __builtin_altivec_vsum4shs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009108}
9109
9110/* vec_vsum4sbs */
9111
9112static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00009113vec_vsum4sbs(vector signed char __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009114{
David Blaikie3302f2b2013-01-16 23:08:36 +00009115 return __builtin_altivec_vsum4sbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009116}
9117
9118/* vec_vsum4ubs */
9119
9120static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00009121vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009122{
David Blaikie3302f2b2013-01-16 23:08:36 +00009123 return __builtin_altivec_vsum4ubs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009124}
9125
9126/* vec_vsum4shs */
9127
9128static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00009129vec_vsum4shs(vector signed short __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009130{
David Blaikie3302f2b2013-01-16 23:08:36 +00009131 return __builtin_altivec_vsum4shs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009132}
9133
9134/* vec_sum2s */
9135
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00009136/* The vsum2sws instruction has a big-endian bias, so that the second
9137 input vector and the result always reference big-endian elements
9138 1 and 3 (little-endian element 0 and 2). For ease of porting the
9139 programmer wants elements 1 and 3 in both cases, so for little
9140 endian we must perform some permutes. */
9141
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009142static vector signed int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00009143vec_sum2s(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009144{
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00009145#ifdef __LITTLE_ENDIAN__
9146 vector int __c = (vector signed int)
9147 vec_perm(__b, __b, (vector unsigned char)
Eric Christopherc67e1b62014-12-10 00:57:43 +00009148 (4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11));
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00009149 __c = __builtin_altivec_vsum2sws(__a, __c);
9150 return (vector signed int)
9151 vec_perm(__c, __c, (vector unsigned char)
Eric Christopherc67e1b62014-12-10 00:57:43 +00009152 (4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11));
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00009153#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009154 return __builtin_altivec_vsum2sws(__a, __b);
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00009155#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009156}
9157
9158/* vec_vsum2sws */
9159
9160static vector signed int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00009161vec_vsum2sws(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009162{
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00009163#ifdef __LITTLE_ENDIAN__
9164 vector int __c = (vector signed int)
9165 vec_perm(__b, __b, (vector unsigned char)
Eric Christopherc67e1b62014-12-10 00:57:43 +00009166 (4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11));
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00009167 __c = __builtin_altivec_vsum2sws(__a, __c);
9168 return (vector signed int)
9169 vec_perm(__c, __c, (vector unsigned char)
Eric Christopherc67e1b62014-12-10 00:57:43 +00009170 (4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11));
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00009171#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009172 return __builtin_altivec_vsum2sws(__a, __b);
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00009173#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009174}
9175
9176/* vec_sums */
9177
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00009178/* The vsumsws instruction has a big-endian bias, so that the second
9179 input vector and the result always reference big-endian element 3
9180 (little-endian element 0). For ease of porting the programmer
9181 wants element 3 in both cases, so for little endian we must perform
9182 some permutes. */
9183
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009184static vector signed int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00009185vec_sums(vector signed int __a, vector signed int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009186{
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00009187#ifdef __LITTLE_ENDIAN__
Bill Schmidtccbe0a82014-08-04 23:21:26 +00009188 __b = (vector signed int)vec_splat(__b, 3);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00009189 __b = __builtin_altivec_vsumsws(__a, __b);
Bill Schmidtccbe0a82014-08-04 23:21:26 +00009190 return (vector signed int)(0, 0, 0, __b[0]);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00009191#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009192 return __builtin_altivec_vsumsws(__a, __b);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00009193#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009194}
9195
9196/* vec_vsumsws */
9197
9198static vector signed int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00009199vec_vsumsws(vector signed int __a, vector signed int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009200{
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00009201#ifdef __LITTLE_ENDIAN__
Bill Schmidtccbe0a82014-08-04 23:21:26 +00009202 __b = (vector signed int)vec_splat(__b, 3);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00009203 __b = __builtin_altivec_vsumsws(__a, __b);
Bill Schmidtccbe0a82014-08-04 23:21:26 +00009204 return (vector signed int)(0, 0, 0, __b[0]);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00009205#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009206 return __builtin_altivec_vsumsws(__a, __b);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00009207#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009208}
9209
9210/* vec_trunc */
9211
9212static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00009213vec_trunc(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009214{
David Blaikie3302f2b2013-01-16 23:08:36 +00009215 return __builtin_altivec_vrfiz(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009216}
9217
9218/* vec_vrfiz */
9219
9220static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00009221vec_vrfiz(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009222{
David Blaikie3302f2b2013-01-16 23:08:36 +00009223 return __builtin_altivec_vrfiz(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009224}
9225
9226/* vec_unpackh */
9227
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009228/* The vector unpack instructions all have a big-endian bias, so for
9229 little endian we must reverse the meanings of "high" and "low." */
9230
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009231static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009232vec_unpackh(vector signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009233{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009234#ifdef __LITTLE_ENDIAN__
9235 return __builtin_altivec_vupklsb((vector char)__a);
9236#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009237 return __builtin_altivec_vupkhsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009238#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009239}
9240
Anton Yartsevfc83c602010-08-19 03:21:36 +00009241static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009242vec_unpackh(vector bool char __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009243{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009244#ifdef __LITTLE_ENDIAN__
9245 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
9246#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009247 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009248#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00009249}
9250
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009251static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009252vec_unpackh(vector short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009253{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009254#ifdef __LITTLE_ENDIAN__
9255 return __builtin_altivec_vupklsh(__a);
9256#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009257 return __builtin_altivec_vupkhsh(__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009258#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009259}
9260
Anton Yartsevfc83c602010-08-19 03:21:36 +00009261static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009262vec_unpackh(vector bool short __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009263{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009264#ifdef __LITTLE_ENDIAN__
9265 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
9266#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009267 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009268#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00009269}
9270
9271static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009272vec_unpackh(vector pixel __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009273{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009274#ifdef __LITTLE_ENDIAN__
9275 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
9276#else
9277 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
9278#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00009279}
9280
Bill Schmidt41e14c42015-05-16 01:02:25 +00009281#ifdef __POWER8_VECTOR__
9282static vector long long __ATTRS_o_ai
9283vec_unpackh(vector int __a)
9284{
9285#ifdef __LITTLE_ENDIAN__
9286 return __builtin_altivec_vupklsw(__a);
9287#else
9288 return __builtin_altivec_vupkhsw(__a);
9289#endif
9290}
9291
9292static vector bool long long __ATTRS_o_ai
9293vec_unpackh(vector bool int __a)
9294{
9295#ifdef __LITTLE_ENDIAN__
9296 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
9297#else
9298 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
9299#endif
9300}
9301#endif
9302
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009303/* vec_vupkhsb */
9304
Anton Yartsevfc83c602010-08-19 03:21:36 +00009305static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009306vec_vupkhsb(vector signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009307{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009308#ifdef __LITTLE_ENDIAN__
9309 return __builtin_altivec_vupklsb((vector char)__a);
9310#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009311 return __builtin_altivec_vupkhsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009312#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009313}
9314
Anton Yartsevfc83c602010-08-19 03:21:36 +00009315static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009316vec_vupkhsb(vector bool char __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009317{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009318#ifdef __LITTLE_ENDIAN__
9319 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
9320#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009321 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009322#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00009323}
9324
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009325/* vec_vupkhsh */
9326
Anton Yartsevfc83c602010-08-19 03:21:36 +00009327static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009328vec_vupkhsh(vector short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009329{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009330#ifdef __LITTLE_ENDIAN__
9331 return __builtin_altivec_vupklsh(__a);
9332#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009333 return __builtin_altivec_vupkhsh(__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009334#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009335}
9336
Anton Yartsevfc83c602010-08-19 03:21:36 +00009337static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009338vec_vupkhsh(vector bool short __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009339{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009340#ifdef __LITTLE_ENDIAN__
9341 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
9342#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009343 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009344#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00009345}
9346
9347static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009348vec_vupkhsh(vector pixel __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009349{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009350#ifdef __LITTLE_ENDIAN__
9351 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
9352#else
9353 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
9354#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00009355}
9356
Bill Schmidt41e14c42015-05-16 01:02:25 +00009357/* vec_vupkhsw */
9358
9359#ifdef __POWER8_VECTOR__
9360static vector long long __ATTRS_o_ai
9361vec_vupkhsw(vector int __a)
9362{
9363#ifdef __LITTLE_ENDIAN__
9364 return __builtin_altivec_vupklsw(__a);
9365#else
9366 return __builtin_altivec_vupkhsw(__a);
9367#endif
9368}
9369
9370static vector bool long long __ATTRS_o_ai
9371vec_vupkhsw(vector bool int __a)
9372{
9373#ifdef __LITTLE_ENDIAN__
9374 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
9375#else
9376 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
9377#endif
9378}
9379#endif
9380
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009381/* vec_unpackl */
9382
9383static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009384vec_unpackl(vector signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009385{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009386#ifdef __LITTLE_ENDIAN__
9387 return __builtin_altivec_vupkhsb((vector char)__a);
9388#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009389 return __builtin_altivec_vupklsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009390#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009391}
9392
Anton Yartsevfc83c602010-08-19 03:21:36 +00009393static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009394vec_unpackl(vector bool char __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009395{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009396#ifdef __LITTLE_ENDIAN__
9397 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
9398#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009399 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009400#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00009401}
9402
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009403static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009404vec_unpackl(vector short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009405{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009406#ifdef __LITTLE_ENDIAN__
9407 return __builtin_altivec_vupkhsh(__a);
9408#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009409 return __builtin_altivec_vupklsh(__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009410#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009411}
9412
Anton Yartsevfc83c602010-08-19 03:21:36 +00009413static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009414vec_unpackl(vector bool short __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009415{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009416#ifdef __LITTLE_ENDIAN__
9417 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
9418#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009419 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009420#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00009421}
9422
9423static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009424vec_unpackl(vector pixel __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009425{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009426#ifdef __LITTLE_ENDIAN__
9427 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
9428#else
9429 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
9430#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00009431}
9432
Bill Schmidt41e14c42015-05-16 01:02:25 +00009433#ifdef __POWER8_VECTOR__
9434static vector long long __ATTRS_o_ai
9435vec_unpackl(vector int __a)
9436{
9437#ifdef __LITTLE_ENDIAN__
9438 return __builtin_altivec_vupkhsw(__a);
9439#else
9440 return __builtin_altivec_vupklsw(__a);
9441#endif
9442}
9443
9444static vector bool long long __ATTRS_o_ai
9445vec_unpackl(vector bool int __a)
9446{
9447#ifdef __LITTLE_ENDIAN__
9448 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
9449#else
9450 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
9451#endif
9452}
9453#endif
9454
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009455/* vec_vupklsb */
9456
Anton Yartsevfc83c602010-08-19 03:21:36 +00009457static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009458vec_vupklsb(vector signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009459{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009460#ifdef __LITTLE_ENDIAN__
9461 return __builtin_altivec_vupkhsb((vector char)__a);
9462#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009463 return __builtin_altivec_vupklsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009464#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009465}
9466
Anton Yartsevfc83c602010-08-19 03:21:36 +00009467static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009468vec_vupklsb(vector bool char __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009469{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009470#ifdef __LITTLE_ENDIAN__
9471 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
9472#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009473 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009474#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00009475}
9476
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009477/* vec_vupklsh */
9478
Anton Yartsevfc83c602010-08-19 03:21:36 +00009479static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009480vec_vupklsh(vector short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009481{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009482#ifdef __LITTLE_ENDIAN__
9483 return __builtin_altivec_vupkhsh(__a);
9484#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009485 return __builtin_altivec_vupklsh(__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009486#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009487}
9488
Anton Yartsevfc83c602010-08-19 03:21:36 +00009489static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009490vec_vupklsh(vector bool short __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009491{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009492#ifdef __LITTLE_ENDIAN__
9493 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
9494#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009495 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009496#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00009497}
9498
9499static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009500vec_vupklsh(vector pixel __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009501{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009502#ifdef __LITTLE_ENDIAN__
9503 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
9504#else
9505 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
9506#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00009507}
9508
Bill Schmidt41e14c42015-05-16 01:02:25 +00009509/* vec_vupklsw */
9510
9511#ifdef __POWER8_VECTOR__
9512static vector long long __ATTRS_o_ai
9513vec_vupklsw(vector int __a)
9514{
9515#ifdef __LITTLE_ENDIAN__
9516 return __builtin_altivec_vupkhsw(__a);
9517#else
9518 return __builtin_altivec_vupklsw(__a);
9519#endif
9520}
9521
9522static vector bool long long __ATTRS_o_ai
9523vec_vupklsw(vector bool int __a)
9524{
9525#ifdef __LITTLE_ENDIAN__
9526 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
9527#else
9528 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
9529#endif
9530}
9531#endif
9532
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00009533/* vec_vsx_ld */
9534
9535#ifdef __VSX__
9536
9537static vector signed int __ATTRS_o_ai
9538vec_vsx_ld(int __a, const vector signed int *__b)
9539{
9540 return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
9541}
9542
9543static vector unsigned int __ATTRS_o_ai
9544vec_vsx_ld(int __a, const vector unsigned int *__b)
9545{
9546 return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
9547}
9548
9549static vector float __ATTRS_o_ai
9550vec_vsx_ld(int __a, const vector float *__b)
9551{
9552 return (vector float)__builtin_vsx_lxvw4x(__a, __b);
9553}
9554
9555static vector signed long long __ATTRS_o_ai
9556vec_vsx_ld(int __a, const vector signed long long *__b)
9557{
9558 return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b);
9559}
9560
9561static vector unsigned long long __ATTRS_o_ai
9562vec_vsx_ld(int __a, const vector unsigned long long *__b)
9563{
9564 return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b);
9565}
9566
9567static vector double __ATTRS_o_ai
9568vec_vsx_ld(int __a, const vector double *__b)
9569{
9570 return (vector double)__builtin_vsx_lxvd2x(__a, __b);
9571}
9572
9573#endif
9574
9575/* vec_vsx_st */
9576
9577#ifdef __VSX__
9578
9579static void __ATTRS_o_ai
9580vec_vsx_st(vector signed int __a, int __b, vector signed int *__c)
9581{
9582 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
9583}
9584
9585static void __ATTRS_o_ai
9586vec_vsx_st(vector unsigned int __a, int __b, vector unsigned int *__c)
9587{
9588 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
9589}
9590
9591static void __ATTRS_o_ai
9592vec_vsx_st(vector float __a, int __b, vector float *__c)
9593{
9594 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
9595}
9596
9597static void __ATTRS_o_ai
9598vec_vsx_st(vector signed long long __a, int __b, vector signed long long *__c)
9599{
9600 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
9601}
9602
9603static void __ATTRS_o_ai
9604vec_vsx_st(vector unsigned long long __a, int __b,
9605 vector unsigned long long *__c)
9606{
9607 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
9608}
9609
9610static void __ATTRS_o_ai
9611vec_vsx_st(vector double __a, int __b, vector double *__c)
9612{
9613 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
9614}
9615
9616#endif
9617
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009618/* vec_xor */
9619
9620#define __builtin_altivec_vxor vec_xor
9621
9622static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009623vec_xor(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009624{
David Blaikie3302f2b2013-01-16 23:08:36 +00009625 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009626}
9627
Anton Yartsevfc83c602010-08-19 03:21:36 +00009628static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009629vec_xor(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009630{
David Blaikie3302f2b2013-01-16 23:08:36 +00009631 return (vector signed char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009632}
9633
9634static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009635vec_xor(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009636{
David Blaikie3302f2b2013-01-16 23:08:36 +00009637 return __a ^ (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009638}
9639
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009640static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009641vec_xor(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009642{
David Blaikie3302f2b2013-01-16 23:08:36 +00009643 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009644}
9645
Anton Yartsevfc83c602010-08-19 03:21:36 +00009646static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009647vec_xor(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009648{
David Blaikie3302f2b2013-01-16 23:08:36 +00009649 return (vector unsigned char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009650}
9651
9652static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009653vec_xor(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009654{
David Blaikie3302f2b2013-01-16 23:08:36 +00009655 return __a ^ (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009656}
9657
9658static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009659vec_xor(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009660{
David Blaikie3302f2b2013-01-16 23:08:36 +00009661 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009662}
9663
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009664static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009665vec_xor(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009666{
David Blaikie3302f2b2013-01-16 23:08:36 +00009667 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009668}
9669
Anton Yartsevfc83c602010-08-19 03:21:36 +00009670static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009671vec_xor(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009672{
David Blaikie3302f2b2013-01-16 23:08:36 +00009673 return (vector short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009674}
9675
9676static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009677vec_xor(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009678{
David Blaikie3302f2b2013-01-16 23:08:36 +00009679 return __a ^ (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009680}
9681
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009682static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009683vec_xor(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009684{
David Blaikie3302f2b2013-01-16 23:08:36 +00009685 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009686}
9687
Anton Yartsevfc83c602010-08-19 03:21:36 +00009688static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009689vec_xor(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009690{
David Blaikie3302f2b2013-01-16 23:08:36 +00009691 return (vector unsigned short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009692}
9693
9694static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009695vec_xor(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009696{
David Blaikie3302f2b2013-01-16 23:08:36 +00009697 return __a ^ (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009698}
9699
9700static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009701vec_xor(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009702{
David Blaikie3302f2b2013-01-16 23:08:36 +00009703 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009704}
9705
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009706static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009707vec_xor(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009708{
David Blaikie3302f2b2013-01-16 23:08:36 +00009709 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009710}
9711
Anton Yartsevfc83c602010-08-19 03:21:36 +00009712static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009713vec_xor(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009714{
David Blaikie3302f2b2013-01-16 23:08:36 +00009715 return (vector int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009716}
9717
9718static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009719vec_xor(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009720{
David Blaikie3302f2b2013-01-16 23:08:36 +00009721 return __a ^ (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009722}
9723
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009724static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009725vec_xor(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009726{
David Blaikie3302f2b2013-01-16 23:08:36 +00009727 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009728}
9729
Anton Yartsevfc83c602010-08-19 03:21:36 +00009730static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009731vec_xor(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009732{
David Blaikie3302f2b2013-01-16 23:08:36 +00009733 return (vector unsigned int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009734}
9735
9736static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009737vec_xor(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009738{
David Blaikie3302f2b2013-01-16 23:08:36 +00009739 return __a ^ (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009740}
9741
9742static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009743vec_xor(vector bool int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009744{
David Blaikie3302f2b2013-01-16 23:08:36 +00009745 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009746}
9747
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009748static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009749vec_xor(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009750{
David Blaikie3302f2b2013-01-16 23:08:36 +00009751 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
9752 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009753}
9754
Anton Yartsevfc83c602010-08-19 03:21:36 +00009755static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009756vec_xor(vector bool int __a, vector float __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009757{
David Blaikie3302f2b2013-01-16 23:08:36 +00009758 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
9759 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009760}
9761
9762static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009763vec_xor(vector float __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009764{
David Blaikie3302f2b2013-01-16 23:08:36 +00009765 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
9766 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009767}
9768
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009769/* vec_vxor */
9770
9771static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009772vec_vxor(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009773{
David Blaikie3302f2b2013-01-16 23:08:36 +00009774 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009775}
9776
Anton Yartsevfc83c602010-08-19 03:21:36 +00009777static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009778vec_vxor(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009779{
David Blaikie3302f2b2013-01-16 23:08:36 +00009780 return (vector signed char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009781}
9782
9783static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009784vec_vxor(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009785{
David Blaikie3302f2b2013-01-16 23:08:36 +00009786 return __a ^ (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009787}
9788
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009789static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009790vec_vxor(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009791{
David Blaikie3302f2b2013-01-16 23:08:36 +00009792 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009793}
9794
Anton Yartsevfc83c602010-08-19 03:21:36 +00009795static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009796vec_vxor(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009797{
David Blaikie3302f2b2013-01-16 23:08:36 +00009798 return (vector unsigned char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009799}
9800
9801static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009802vec_vxor(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009803{
David Blaikie3302f2b2013-01-16 23:08:36 +00009804 return __a ^ (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009805}
9806
9807static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009808vec_vxor(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009809{
David Blaikie3302f2b2013-01-16 23:08:36 +00009810 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009811}
9812
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009813static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009814vec_vxor(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009815{
David Blaikie3302f2b2013-01-16 23:08:36 +00009816 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009817}
9818
Anton Yartsevfc83c602010-08-19 03:21:36 +00009819static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009820vec_vxor(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009821{
David Blaikie3302f2b2013-01-16 23:08:36 +00009822 return (vector short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009823}
9824
9825static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009826vec_vxor(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009827{
David Blaikie3302f2b2013-01-16 23:08:36 +00009828 return __a ^ (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009829}
9830
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009831static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009832vec_vxor(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009833{
David Blaikie3302f2b2013-01-16 23:08:36 +00009834 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009835}
9836
Anton Yartsevfc83c602010-08-19 03:21:36 +00009837static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009838vec_vxor(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009839{
David Blaikie3302f2b2013-01-16 23:08:36 +00009840 return (vector unsigned short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009841}
9842
9843static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009844vec_vxor(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009845{
David Blaikie3302f2b2013-01-16 23:08:36 +00009846 return __a ^ (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009847}
9848
9849static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009850vec_vxor(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009851{
David Blaikie3302f2b2013-01-16 23:08:36 +00009852 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009853}
9854
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009855static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009856vec_vxor(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009857{
David Blaikie3302f2b2013-01-16 23:08:36 +00009858 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009859}
9860
Anton Yartsevfc83c602010-08-19 03:21:36 +00009861static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009862vec_vxor(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009863{
David Blaikie3302f2b2013-01-16 23:08:36 +00009864 return (vector int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009865}
9866
9867static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009868vec_vxor(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009869{
David Blaikie3302f2b2013-01-16 23:08:36 +00009870 return __a ^ (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009871}
9872
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009873static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009874vec_vxor(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009875{
David Blaikie3302f2b2013-01-16 23:08:36 +00009876 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009877}
9878
Anton Yartsevfc83c602010-08-19 03:21:36 +00009879static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009880vec_vxor(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009881{
David Blaikie3302f2b2013-01-16 23:08:36 +00009882 return (vector unsigned int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009883}
9884
9885static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009886vec_vxor(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009887{
David Blaikie3302f2b2013-01-16 23:08:36 +00009888 return __a ^ (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009889}
9890
9891static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009892vec_vxor(vector bool int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009893{
David Blaikie3302f2b2013-01-16 23:08:36 +00009894 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009895}
9896
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009897static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009898vec_vxor(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009899{
David Blaikie3302f2b2013-01-16 23:08:36 +00009900 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
9901 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009902}
Chris Lattnerdad40622010-04-14 03:54:58 +00009903
Anton Yartsevfc83c602010-08-19 03:21:36 +00009904static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009905vec_vxor(vector bool int __a, vector float __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009906{
David Blaikie3302f2b2013-01-16 23:08:36 +00009907 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
9908 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009909}
9910
9911static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009912vec_vxor(vector float __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009913{
David Blaikie3302f2b2013-01-16 23:08:36 +00009914 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
9915 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009916}
9917
Anton Yartsev79d6af32010-09-18 00:39:16 +00009918/* ------------------------ extensions for CBEA ----------------------------- */
Anton Yartsev73d40232010-10-14 14:37:46 +00009919
9920/* vec_extract */
9921
9922static signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009923vec_extract(vector signed char __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009924{
David Blaikie3302f2b2013-01-16 23:08:36 +00009925 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009926}
9927
9928static unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009929vec_extract(vector unsigned char __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009930{
David Blaikie3302f2b2013-01-16 23:08:36 +00009931 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009932}
9933
9934static short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009935vec_extract(vector short __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009936{
David Blaikie3302f2b2013-01-16 23:08:36 +00009937 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009938}
9939
9940static unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009941vec_extract(vector unsigned short __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009942{
David Blaikie3302f2b2013-01-16 23:08:36 +00009943 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009944}
9945
9946static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009947vec_extract(vector int __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009948{
David Blaikie3302f2b2013-01-16 23:08:36 +00009949 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009950}
9951
9952static unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009953vec_extract(vector unsigned int __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009954{
David Blaikie3302f2b2013-01-16 23:08:36 +00009955 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009956}
9957
9958static float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009959vec_extract(vector float __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009960{
David Blaikie3302f2b2013-01-16 23:08:36 +00009961 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009962}
9963
9964/* vec_insert */
9965
9966static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009967vec_insert(signed char __a, vector signed char __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009968{
David Blaikie3302f2b2013-01-16 23:08:36 +00009969 __b[__c] = __a;
9970 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009971}
9972
9973static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009974vec_insert(unsigned char __a, vector unsigned char __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009975{
David Blaikie3302f2b2013-01-16 23:08:36 +00009976 __b[__c] = __a;
9977 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009978}
9979
9980static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009981vec_insert(short __a, vector short __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009982{
David Blaikie3302f2b2013-01-16 23:08:36 +00009983 __b[__c] = __a;
9984 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009985}
9986
9987static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009988vec_insert(unsigned short __a, vector unsigned short __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009989{
David Blaikie3302f2b2013-01-16 23:08:36 +00009990 __b[__c] = __a;
9991 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009992}
9993
9994static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009995vec_insert(int __a, vector int __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009996{
David Blaikie3302f2b2013-01-16 23:08:36 +00009997 __b[__c] = __a;
9998 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009999}
10000
10001static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010002vec_insert(unsigned int __a, vector unsigned int __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010003{
David Blaikie3302f2b2013-01-16 23:08:36 +000010004 __b[__c] = __a;
10005 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +000010006}
10007
10008static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010009vec_insert(float __a, vector float __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010010{
David Blaikie3302f2b2013-01-16 23:08:36 +000010011 __b[__c] = __a;
10012 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +000010013}
10014
10015/* vec_lvlx */
10016
10017static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010018vec_lvlx(int __a, const signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010019{
David Blaikie3302f2b2013-01-16 23:08:36 +000010020 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010021 (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010022 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010023}
10024
10025static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010026vec_lvlx(int __a, const vector signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010027{
David Blaikie3302f2b2013-01-16 23:08:36 +000010028 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010029 (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010030 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010031}
10032
10033static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010034vec_lvlx(int __a, const unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010035{
David Blaikie3302f2b2013-01-16 23:08:36 +000010036 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010037 (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010038 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010039}
10040
10041static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010042vec_lvlx(int __a, const vector unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010043{
David Blaikie3302f2b2013-01-16 23:08:36 +000010044 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010045 (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010046 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010047}
10048
10049static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010050vec_lvlx(int __a, const vector bool char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010051{
David Blaikie3302f2b2013-01-16 23:08:36 +000010052 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010053 (vector bool char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010054 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010055}
10056
10057static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010058vec_lvlx(int __a, const short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010059{
David Blaikie3302f2b2013-01-16 23:08:36 +000010060 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010061 (vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010062 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010063}
10064
10065static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010066vec_lvlx(int __a, const vector short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010067{
David Blaikie3302f2b2013-01-16 23:08:36 +000010068 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010069 (vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010070 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010071}
10072
10073static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010074vec_lvlx(int __a, const unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010075{
David Blaikie3302f2b2013-01-16 23:08:36 +000010076 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010077 (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010078 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010079}
10080
10081static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010082vec_lvlx(int __a, const vector unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010083{
David Blaikie3302f2b2013-01-16 23:08:36 +000010084 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010085 (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010086 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010087}
10088
10089static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010090vec_lvlx(int __a, const vector bool short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010091{
David Blaikie3302f2b2013-01-16 23:08:36 +000010092 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010093 (vector bool short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010094 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010095}
10096
10097static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010098vec_lvlx(int __a, const vector pixel *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010099{
David Blaikie3302f2b2013-01-16 23:08:36 +000010100 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010101 (vector pixel)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010102 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010103}
10104
10105static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010106vec_lvlx(int __a, const int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010107{
David Blaikie3302f2b2013-01-16 23:08:36 +000010108 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010109 (vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010110 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010111}
10112
10113static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010114vec_lvlx(int __a, const vector int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010115{
David Blaikie3302f2b2013-01-16 23:08:36 +000010116 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010117 (vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010118 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010119}
10120
10121static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010122vec_lvlx(int __a, const unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010123{
David Blaikie3302f2b2013-01-16 23:08:36 +000010124 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010125 (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010126 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010127}
10128
10129static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010130vec_lvlx(int __a, const vector unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010131{
David Blaikie3302f2b2013-01-16 23:08:36 +000010132 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010133 (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010134 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010135}
10136
10137static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010138vec_lvlx(int __a, const vector bool int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010139{
David Blaikie3302f2b2013-01-16 23:08:36 +000010140 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010141 (vector bool int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010142 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010143}
10144
10145static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010146vec_lvlx(int __a, const float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010147{
David Blaikie3302f2b2013-01-16 23:08:36 +000010148 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010149 (vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010150 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010151}
10152
10153static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010154vec_lvlx(int __a, const vector float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010155{
David Blaikie3302f2b2013-01-16 23:08:36 +000010156 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010157 (vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010158 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010159}
10160
10161/* vec_lvlxl */
10162
10163static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010164vec_lvlxl(int __a, const signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010165{
David Blaikie3302f2b2013-01-16 23:08:36 +000010166 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010167 (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010168 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010169}
10170
10171static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010172vec_lvlxl(int __a, const vector signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010173{
David Blaikie3302f2b2013-01-16 23:08:36 +000010174 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010175 (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010176 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010177}
10178
10179static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010180vec_lvlxl(int __a, const unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010181{
David Blaikie3302f2b2013-01-16 23:08:36 +000010182 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010183 (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010184 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010185}
10186
10187static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010188vec_lvlxl(int __a, const vector unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010189{
David Blaikie3302f2b2013-01-16 23:08:36 +000010190 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010191 (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010192 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010193}
10194
10195static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010196vec_lvlxl(int __a, const vector bool char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010197{
David Blaikie3302f2b2013-01-16 23:08:36 +000010198 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010199 (vector bool char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010200 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010201}
10202
10203static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010204vec_lvlxl(int __a, const short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010205{
David Blaikie3302f2b2013-01-16 23:08:36 +000010206 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010207 (vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010208 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010209}
10210
10211static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010212vec_lvlxl(int __a, const vector short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010213{
David Blaikie3302f2b2013-01-16 23:08:36 +000010214 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010215 (vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010216 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010217}
10218
10219static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010220vec_lvlxl(int __a, const unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010221{
David Blaikie3302f2b2013-01-16 23:08:36 +000010222 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010223 (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010224 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010225}
10226
10227static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010228vec_lvlxl(int __a, const vector unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010229{
David Blaikie3302f2b2013-01-16 23:08:36 +000010230 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010231 (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010232 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010233}
10234
10235static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010236vec_lvlxl(int __a, const vector bool short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010237{
David Blaikie3302f2b2013-01-16 23:08:36 +000010238 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010239 (vector bool short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010240 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010241}
10242
10243static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010244vec_lvlxl(int __a, const vector pixel *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010245{
David Blaikie3302f2b2013-01-16 23:08:36 +000010246 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010247 (vector pixel)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010248 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010249}
10250
10251static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010252vec_lvlxl(int __a, const int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010253{
David Blaikie3302f2b2013-01-16 23:08:36 +000010254 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010255 (vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010256 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010257}
10258
10259static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010260vec_lvlxl(int __a, const vector int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010261{
David Blaikie3302f2b2013-01-16 23:08:36 +000010262 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010263 (vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010264 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010265}
10266
10267static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010268vec_lvlxl(int __a, const unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010269{
David Blaikie3302f2b2013-01-16 23:08:36 +000010270 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010271 (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010272 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010273}
10274
10275static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010276vec_lvlxl(int __a, const vector unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010277{
David Blaikie3302f2b2013-01-16 23:08:36 +000010278 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010279 (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010280 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010281}
10282
10283static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010284vec_lvlxl(int __a, const vector bool int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010285{
David Blaikie3302f2b2013-01-16 23:08:36 +000010286 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010287 (vector bool int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010288 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010289}
10290
10291static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010292vec_lvlxl(int __a, const float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010293{
David Blaikie3302f2b2013-01-16 23:08:36 +000010294 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010295 (vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010296 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010297}
10298
10299static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010300vec_lvlxl(int __a, vector float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010301{
David Blaikie3302f2b2013-01-16 23:08:36 +000010302 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010303 (vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010304 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010305}
10306
10307/* vec_lvrx */
10308
10309static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010310vec_lvrx(int __a, const signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010311{
10312 return vec_perm((vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010313 vec_ld(__a, __b),
10314 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010315}
10316
10317static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010318vec_lvrx(int __a, const vector signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010319{
10320 return vec_perm((vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010321 vec_ld(__a, __b),
10322 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010323}
10324
10325static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010326vec_lvrx(int __a, const unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010327{
10328 return vec_perm((vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010329 vec_ld(__a, __b),
10330 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010331}
10332
10333static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010334vec_lvrx(int __a, const vector unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010335{
10336 return vec_perm((vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010337 vec_ld(__a, __b),
10338 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010339}
10340
10341static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010342vec_lvrx(int __a, const vector bool char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010343{
10344 return vec_perm((vector bool char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010345 vec_ld(__a, __b),
10346 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010347}
10348
10349static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010350vec_lvrx(int __a, const short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010351{
10352 return vec_perm((vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010353 vec_ld(__a, __b),
10354 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010355}
10356
10357static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010358vec_lvrx(int __a, const vector short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010359{
10360 return vec_perm((vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010361 vec_ld(__a, __b),
10362 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010363}
10364
10365static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010366vec_lvrx(int __a, const unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010367{
10368 return vec_perm((vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010369 vec_ld(__a, __b),
10370 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010371}
10372
10373static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010374vec_lvrx(int __a, const vector unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010375{
10376 return vec_perm((vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010377 vec_ld(__a, __b),
10378 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010379}
10380
10381static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010382vec_lvrx(int __a, const vector bool short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010383{
10384 return vec_perm((vector bool short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010385 vec_ld(__a, __b),
10386 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010387}
10388
10389static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010390vec_lvrx(int __a, const vector pixel *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010391{
10392 return vec_perm((vector pixel)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010393 vec_ld(__a, __b),
10394 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010395}
10396
10397static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010398vec_lvrx(int __a, const int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010399{
10400 return vec_perm((vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010401 vec_ld(__a, __b),
10402 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010403}
10404
10405static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010406vec_lvrx(int __a, const vector int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010407{
10408 return vec_perm((vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010409 vec_ld(__a, __b),
10410 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010411}
10412
10413static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010414vec_lvrx(int __a, const unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010415{
10416 return vec_perm((vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010417 vec_ld(__a, __b),
10418 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010419}
10420
10421static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010422vec_lvrx(int __a, const vector unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010423{
10424 return vec_perm((vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010425 vec_ld(__a, __b),
10426 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010427}
10428
10429static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010430vec_lvrx(int __a, const vector bool int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010431{
10432 return vec_perm((vector bool int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010433 vec_ld(__a, __b),
10434 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010435}
10436
10437static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010438vec_lvrx(int __a, const float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010439{
10440 return vec_perm((vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010441 vec_ld(__a, __b),
10442 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010443}
10444
10445static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010446vec_lvrx(int __a, const vector float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010447{
10448 return vec_perm((vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010449 vec_ld(__a, __b),
10450 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010451}
10452
10453/* vec_lvrxl */
10454
10455static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010456vec_lvrxl(int __a, const signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010457{
10458 return vec_perm((vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010459 vec_ldl(__a, __b),
10460 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010461}
10462
10463static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010464vec_lvrxl(int __a, const vector signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010465{
10466 return vec_perm((vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010467 vec_ldl(__a, __b),
10468 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010469}
10470
10471static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010472vec_lvrxl(int __a, const unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010473{
10474 return vec_perm((vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010475 vec_ldl(__a, __b),
10476 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010477}
10478
10479static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010480vec_lvrxl(int __a, const vector unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010481{
10482 return vec_perm((vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010483 vec_ldl(__a, __b),
10484 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010485}
10486
10487static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010488vec_lvrxl(int __a, const vector bool char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010489{
10490 return vec_perm((vector bool char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010491 vec_ldl(__a, __b),
10492 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010493}
10494
10495static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010496vec_lvrxl(int __a, const short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010497{
10498 return vec_perm((vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010499 vec_ldl(__a, __b),
10500 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010501}
10502
10503static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010504vec_lvrxl(int __a, const vector short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010505{
10506 return vec_perm((vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010507 vec_ldl(__a, __b),
10508 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010509}
10510
10511static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010512vec_lvrxl(int __a, const unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010513{
10514 return vec_perm((vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010515 vec_ldl(__a, __b),
10516 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010517}
10518
10519static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010520vec_lvrxl(int __a, const vector unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010521{
10522 return vec_perm((vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010523 vec_ldl(__a, __b),
10524 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010525}
10526
10527static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010528vec_lvrxl(int __a, const vector bool short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010529{
10530 return vec_perm((vector bool short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010531 vec_ldl(__a, __b),
10532 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010533}
10534
10535static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010536vec_lvrxl(int __a, const vector pixel *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010537{
10538 return vec_perm((vector pixel)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010539 vec_ldl(__a, __b),
10540 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010541}
10542
10543static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010544vec_lvrxl(int __a, const int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010545{
10546 return vec_perm((vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010547 vec_ldl(__a, __b),
10548 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010549}
10550
10551static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010552vec_lvrxl(int __a, const vector int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010553{
10554 return vec_perm((vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010555 vec_ldl(__a, __b),
10556 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010557}
10558
10559static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010560vec_lvrxl(int __a, const unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010561{
10562 return vec_perm((vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010563 vec_ldl(__a, __b),
10564 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010565}
10566
10567static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010568vec_lvrxl(int __a, const vector unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010569{
10570 return vec_perm((vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010571 vec_ldl(__a, __b),
10572 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010573}
10574
10575static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010576vec_lvrxl(int __a, const vector bool int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010577{
10578 return vec_perm((vector bool int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010579 vec_ldl(__a, __b),
10580 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010581}
10582
10583static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010584vec_lvrxl(int __a, const float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010585{
10586 return vec_perm((vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010587 vec_ldl(__a, __b),
10588 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010589}
10590
10591static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010592vec_lvrxl(int __a, const vector float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010593{
10594 return vec_perm((vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010595 vec_ldl(__a, __b),
10596 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010597}
10598
10599/* vec_stvlx */
10600
10601static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010602vec_stvlx(vector signed char __a, int __b, signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010603{
David Blaikie3302f2b2013-01-16 23:08:36 +000010604 return vec_st(vec_perm(vec_lvrx(__b, __c),
10605 __a,
10606 vec_lvsr(__b, __c)),
10607 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010608}
10609
10610static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010611vec_stvlx(vector signed char __a, int __b, vector signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010612{
David Blaikie3302f2b2013-01-16 23:08:36 +000010613 return vec_st(vec_perm(vec_lvrx(__b, __c),
10614 __a,
10615 vec_lvsr(__b, (unsigned char *)__c)),
10616 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010617}
10618
10619static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010620vec_stvlx(vector unsigned char __a, int __b, unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010621{
David Blaikie3302f2b2013-01-16 23:08:36 +000010622 return vec_st(vec_perm(vec_lvrx(__b, __c),
10623 __a,
10624 vec_lvsr(__b, __c)),
10625 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010626}
10627
10628static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010629vec_stvlx(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010630{
David Blaikie3302f2b2013-01-16 23:08:36 +000010631 return vec_st(vec_perm(vec_lvrx(__b, __c),
10632 __a,
10633 vec_lvsr(__b, (unsigned char *)__c)),
10634 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010635}
10636
10637static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010638vec_stvlx(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010639{
David Blaikie3302f2b2013-01-16 23:08:36 +000010640 return vec_st(vec_perm(vec_lvrx(__b, __c),
10641 __a,
10642 vec_lvsr(__b, (unsigned char *)__c)),
10643 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010644}
10645
10646static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010647vec_stvlx(vector short __a, int __b, short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010648{
David Blaikie3302f2b2013-01-16 23:08:36 +000010649 return vec_st(vec_perm(vec_lvrx(__b, __c),
10650 __a,
10651 vec_lvsr(__b, __c)),
10652 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010653}
10654
10655static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010656vec_stvlx(vector short __a, int __b, vector short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010657{
David Blaikie3302f2b2013-01-16 23:08:36 +000010658 return vec_st(vec_perm(vec_lvrx(__b, __c),
10659 __a,
10660 vec_lvsr(__b, (unsigned char *)__c)),
10661 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010662}
10663
10664static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010665vec_stvlx(vector unsigned short __a, int __b, unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010666{
David Blaikie3302f2b2013-01-16 23:08:36 +000010667 return vec_st(vec_perm(vec_lvrx(__b, __c),
10668 __a,
10669 vec_lvsr(__b, __c)),
10670 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010671}
10672
10673static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010674vec_stvlx(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010675{
David Blaikie3302f2b2013-01-16 23:08:36 +000010676 return vec_st(vec_perm(vec_lvrx(__b, __c),
10677 __a,
10678 vec_lvsr(__b, (unsigned char *)__c)),
10679 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010680}
10681
10682static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010683vec_stvlx(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010684{
David Blaikie3302f2b2013-01-16 23:08:36 +000010685 return vec_st(vec_perm(vec_lvrx(__b, __c),
10686 __a,
10687 vec_lvsr(__b, (unsigned char *)__c)),
10688 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010689}
10690
10691static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010692vec_stvlx(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010693{
David Blaikie3302f2b2013-01-16 23:08:36 +000010694 return vec_st(vec_perm(vec_lvrx(__b, __c),
10695 __a,
10696 vec_lvsr(__b, (unsigned char *)__c)),
10697 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010698}
10699
10700static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010701vec_stvlx(vector int __a, int __b, int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010702{
David Blaikie3302f2b2013-01-16 23:08:36 +000010703 return vec_st(vec_perm(vec_lvrx(__b, __c),
10704 __a,
10705 vec_lvsr(__b, __c)),
10706 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010707}
10708
10709static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010710vec_stvlx(vector int __a, int __b, vector int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010711{
David Blaikie3302f2b2013-01-16 23:08:36 +000010712 return vec_st(vec_perm(vec_lvrx(__b, __c),
10713 __a,
10714 vec_lvsr(__b, (unsigned char *)__c)),
10715 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010716}
10717
10718static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010719vec_stvlx(vector unsigned int __a, int __b, unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010720{
David Blaikie3302f2b2013-01-16 23:08:36 +000010721 return vec_st(vec_perm(vec_lvrx(__b, __c),
10722 __a,
10723 vec_lvsr(__b, __c)),
10724 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010725}
10726
10727static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010728vec_stvlx(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010729{
David Blaikie3302f2b2013-01-16 23:08:36 +000010730 return vec_st(vec_perm(vec_lvrx(__b, __c),
10731 __a,
10732 vec_lvsr(__b, (unsigned char *)__c)),
10733 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010734}
10735
10736static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010737vec_stvlx(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010738{
David Blaikie3302f2b2013-01-16 23:08:36 +000010739 return vec_st(vec_perm(vec_lvrx(__b, __c),
10740 __a,
10741 vec_lvsr(__b, (unsigned char *)__c)),
10742 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010743}
10744
10745static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010746vec_stvlx(vector float __a, int __b, vector float *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010747{
David Blaikie3302f2b2013-01-16 23:08:36 +000010748 return vec_st(vec_perm(vec_lvrx(__b, __c),
10749 __a,
10750 vec_lvsr(__b, (unsigned char *)__c)),
10751 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010752}
10753
10754/* vec_stvlxl */
10755
10756static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010757vec_stvlxl(vector signed char __a, int __b, signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010758{
David Blaikie3302f2b2013-01-16 23:08:36 +000010759 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10760 __a,
10761 vec_lvsr(__b, __c)),
10762 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010763}
10764
10765static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010766vec_stvlxl(vector signed char __a, int __b, vector signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010767{
David Blaikie3302f2b2013-01-16 23:08:36 +000010768 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10769 __a,
10770 vec_lvsr(__b, (unsigned char *)__c)),
10771 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010772}
10773
10774static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010775vec_stvlxl(vector unsigned char __a, int __b, unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010776{
David Blaikie3302f2b2013-01-16 23:08:36 +000010777 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10778 __a,
10779 vec_lvsr(__b, __c)),
10780 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010781}
10782
10783static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010784vec_stvlxl(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010785{
David Blaikie3302f2b2013-01-16 23:08:36 +000010786 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10787 __a,
10788 vec_lvsr(__b, (unsigned char *)__c)),
10789 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010790}
10791
10792static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010793vec_stvlxl(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010794{
David Blaikie3302f2b2013-01-16 23:08:36 +000010795 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10796 __a,
10797 vec_lvsr(__b, (unsigned char *)__c)),
10798 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010799}
10800
10801static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010802vec_stvlxl(vector short __a, int __b, short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010803{
David Blaikie3302f2b2013-01-16 23:08:36 +000010804 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10805 __a,
10806 vec_lvsr(__b, __c)),
10807 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010808}
10809
10810static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010811vec_stvlxl(vector short __a, int __b, vector short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010812{
David Blaikie3302f2b2013-01-16 23:08:36 +000010813 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10814 __a,
10815 vec_lvsr(__b, (unsigned char *)__c)),
10816 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010817}
10818
10819static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010820vec_stvlxl(vector unsigned short __a, int __b, unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010821{
David Blaikie3302f2b2013-01-16 23:08:36 +000010822 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10823 __a,
10824 vec_lvsr(__b, __c)),
10825 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010826}
10827
10828static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010829vec_stvlxl(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010830{
David Blaikie3302f2b2013-01-16 23:08:36 +000010831 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10832 __a,
10833 vec_lvsr(__b, (unsigned char *)__c)),
10834 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010835}
10836
10837static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010838vec_stvlxl(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010839{
David Blaikie3302f2b2013-01-16 23:08:36 +000010840 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10841 __a,
10842 vec_lvsr(__b, (unsigned char *)__c)),
10843 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010844}
10845
10846static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010847vec_stvlxl(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010848{
David Blaikie3302f2b2013-01-16 23:08:36 +000010849 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10850 __a,
10851 vec_lvsr(__b, (unsigned char *)__c)),
10852 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010853}
10854
10855static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010856vec_stvlxl(vector int __a, int __b, int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010857{
David Blaikie3302f2b2013-01-16 23:08:36 +000010858 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10859 __a,
10860 vec_lvsr(__b, __c)),
10861 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010862}
10863
10864static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010865vec_stvlxl(vector int __a, int __b, vector int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010866{
David Blaikie3302f2b2013-01-16 23:08:36 +000010867 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10868 __a,
10869 vec_lvsr(__b, (unsigned char *)__c)),
10870 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010871}
10872
10873static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010874vec_stvlxl(vector unsigned int __a, int __b, unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010875{
David Blaikie3302f2b2013-01-16 23:08:36 +000010876 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10877 __a,
10878 vec_lvsr(__b, __c)),
10879 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010880}
10881
10882static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010883vec_stvlxl(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010884{
David Blaikie3302f2b2013-01-16 23:08:36 +000010885 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10886 __a,
10887 vec_lvsr(__b, (unsigned char *)__c)),
10888 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010889}
10890
10891static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010892vec_stvlxl(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010893{
David Blaikie3302f2b2013-01-16 23:08:36 +000010894 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10895 __a,
10896 vec_lvsr(__b, (unsigned char *)__c)),
10897 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010898}
10899
10900static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010901vec_stvlxl(vector float __a, int __b, vector float *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010902{
David Blaikie3302f2b2013-01-16 23:08:36 +000010903 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10904 __a,
10905 vec_lvsr(__b, (unsigned char *)__c)),
10906 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010907}
10908
10909/* vec_stvrx */
10910
10911static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010912vec_stvrx(vector signed char __a, int __b, signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010913{
David Blaikie3302f2b2013-01-16 23:08:36 +000010914 return vec_st(vec_perm(__a,
10915 vec_lvlx(__b, __c),
10916 vec_lvsr(__b, __c)),
10917 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010918}
10919
10920static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010921vec_stvrx(vector signed char __a, int __b, vector signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010922{
David Blaikie3302f2b2013-01-16 23:08:36 +000010923 return vec_st(vec_perm(__a,
10924 vec_lvlx(__b, __c),
10925 vec_lvsr(__b, (unsigned char *)__c)),
10926 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010927}
10928
10929static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010930vec_stvrx(vector unsigned char __a, int __b, unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010931{
David Blaikie3302f2b2013-01-16 23:08:36 +000010932 return vec_st(vec_perm(__a,
10933 vec_lvlx(__b, __c),
10934 vec_lvsr(__b, __c)),
10935 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010936}
10937
10938static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010939vec_stvrx(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010940{
David Blaikie3302f2b2013-01-16 23:08:36 +000010941 return vec_st(vec_perm(__a,
10942 vec_lvlx(__b, __c),
10943 vec_lvsr(__b, (unsigned char *)__c)),
10944 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010945}
10946
10947static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010948vec_stvrx(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010949{
David Blaikie3302f2b2013-01-16 23:08:36 +000010950 return vec_st(vec_perm(__a,
10951 vec_lvlx(__b, __c),
10952 vec_lvsr(__b, (unsigned char *)__c)),
10953 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010954}
10955
10956static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010957vec_stvrx(vector short __a, int __b, short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010958{
David Blaikie3302f2b2013-01-16 23:08:36 +000010959 return vec_st(vec_perm(__a,
10960 vec_lvlx(__b, __c),
10961 vec_lvsr(__b, __c)),
10962 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010963}
10964
10965static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010966vec_stvrx(vector short __a, int __b, vector short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010967{
David Blaikie3302f2b2013-01-16 23:08:36 +000010968 return vec_st(vec_perm(__a,
10969 vec_lvlx(__b, __c),
10970 vec_lvsr(__b, (unsigned char *)__c)),
10971 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010972}
10973
10974static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010975vec_stvrx(vector unsigned short __a, int __b, unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010976{
David Blaikie3302f2b2013-01-16 23:08:36 +000010977 return vec_st(vec_perm(__a,
10978 vec_lvlx(__b, __c),
10979 vec_lvsr(__b, __c)),
10980 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010981}
10982
10983static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010984vec_stvrx(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010985{
David Blaikie3302f2b2013-01-16 23:08:36 +000010986 return vec_st(vec_perm(__a,
10987 vec_lvlx(__b, __c),
10988 vec_lvsr(__b, (unsigned char *)__c)),
10989 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010990}
10991
10992static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010993vec_stvrx(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010994{
David Blaikie3302f2b2013-01-16 23:08:36 +000010995 return vec_st(vec_perm(__a,
10996 vec_lvlx(__b, __c),
10997 vec_lvsr(__b, (unsigned char *)__c)),
10998 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010999}
11000
11001static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011002vec_stvrx(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000011003{
David Blaikie3302f2b2013-01-16 23:08:36 +000011004 return vec_st(vec_perm(__a,
11005 vec_lvlx(__b, __c),
11006 vec_lvsr(__b, (unsigned char *)__c)),
11007 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000011008}
11009
11010static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011011vec_stvrx(vector int __a, int __b, int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000011012{
David Blaikie3302f2b2013-01-16 23:08:36 +000011013 return vec_st(vec_perm(__a,
11014 vec_lvlx(__b, __c),
11015 vec_lvsr(__b, __c)),
11016 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000011017}
11018
11019static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011020vec_stvrx(vector int __a, int __b, vector int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000011021{
David Blaikie3302f2b2013-01-16 23:08:36 +000011022 return vec_st(vec_perm(__a,
11023 vec_lvlx(__b, __c),
11024 vec_lvsr(__b, (unsigned char *)__c)),
11025 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000011026}
11027
11028static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011029vec_stvrx(vector unsigned int __a, int __b, unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000011030{
David Blaikie3302f2b2013-01-16 23:08:36 +000011031 return vec_st(vec_perm(__a,
11032 vec_lvlx(__b, __c),
11033 vec_lvsr(__b, __c)),
11034 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000011035}
11036
11037static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011038vec_stvrx(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000011039{
David Blaikie3302f2b2013-01-16 23:08:36 +000011040 return vec_st(vec_perm(__a,
11041 vec_lvlx(__b, __c),
11042 vec_lvsr(__b, (unsigned char *)__c)),
11043 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000011044}
11045
11046static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011047vec_stvrx(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000011048{
David Blaikie3302f2b2013-01-16 23:08:36 +000011049 return vec_st(vec_perm(__a,
11050 vec_lvlx(__b, __c),
11051 vec_lvsr(__b, (unsigned char *)__c)),
11052 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000011053}
11054
11055static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011056vec_stvrx(vector float __a, int __b, vector float *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000011057{
David Blaikie3302f2b2013-01-16 23:08:36 +000011058 return vec_st(vec_perm(__a,
11059 vec_lvlx(__b, __c),
11060 vec_lvsr(__b, (unsigned char *)__c)),
11061 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000011062}
11063
11064/* vec_stvrxl */
11065
11066static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011067vec_stvrxl(vector signed char __a, int __b, signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000011068{
David Blaikie3302f2b2013-01-16 23:08:36 +000011069 return vec_stl(vec_perm(__a,
11070 vec_lvlx(__b, __c),
11071 vec_lvsr(__b, __c)),
11072 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000011073}
11074
11075static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011076vec_stvrxl(vector signed char __a, int __b, vector signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000011077{
David Blaikie3302f2b2013-01-16 23:08:36 +000011078 return vec_stl(vec_perm(__a,
11079 vec_lvlx(__b, __c),
11080 vec_lvsr(__b, (unsigned char *)__c)),
11081 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000011082}
11083
11084static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011085vec_stvrxl(vector unsigned char __a, int __b, unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000011086{
David Blaikie3302f2b2013-01-16 23:08:36 +000011087 return vec_stl(vec_perm(__a,
11088 vec_lvlx(__b, __c),
11089 vec_lvsr(__b, __c)),
11090 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000011091}
11092
11093static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011094vec_stvrxl(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000011095{
David Blaikie3302f2b2013-01-16 23:08:36 +000011096 return vec_stl(vec_perm(__a,
11097 vec_lvlx(__b, __c),
11098 vec_lvsr(__b, (unsigned char *)__c)),
11099 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000011100}
11101
11102static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011103vec_stvrxl(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000011104{
David Blaikie3302f2b2013-01-16 23:08:36 +000011105 return vec_stl(vec_perm(__a,
11106 vec_lvlx(__b, __c),
11107 vec_lvsr(__b, (unsigned char *)__c)),
11108 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000011109}
11110
11111static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011112vec_stvrxl(vector short __a, int __b, short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000011113{
David Blaikie3302f2b2013-01-16 23:08:36 +000011114 return vec_stl(vec_perm(__a,
11115 vec_lvlx(__b, __c),
11116 vec_lvsr(__b, __c)),
11117 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000011118}
11119
11120static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011121vec_stvrxl(vector short __a, int __b, vector short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000011122{
David Blaikie3302f2b2013-01-16 23:08:36 +000011123 return vec_stl(vec_perm(__a,
11124 vec_lvlx(__b, __c),
11125 vec_lvsr(__b, (unsigned char *)__c)),
11126 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000011127}
11128
11129static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011130vec_stvrxl(vector unsigned short __a, int __b, unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000011131{
David Blaikie3302f2b2013-01-16 23:08:36 +000011132 return vec_stl(vec_perm(__a,
11133 vec_lvlx(__b, __c),
11134 vec_lvsr(__b, __c)),
11135 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000011136}
11137
11138static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011139vec_stvrxl(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000011140{
David Blaikie3302f2b2013-01-16 23:08:36 +000011141 return vec_stl(vec_perm(__a,
11142 vec_lvlx(__b, __c),
11143 vec_lvsr(__b, (unsigned char *)__c)),
11144 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000011145}
11146
11147static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011148vec_stvrxl(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000011149{
David Blaikie3302f2b2013-01-16 23:08:36 +000011150 return vec_stl(vec_perm(__a,
11151 vec_lvlx(__b, __c),
11152 vec_lvsr(__b, (unsigned char *)__c)),
11153 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000011154}
11155
11156static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011157vec_stvrxl(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000011158{
David Blaikie3302f2b2013-01-16 23:08:36 +000011159 return vec_stl(vec_perm(__a,
11160 vec_lvlx(__b, __c),
11161 vec_lvsr(__b, (unsigned char *)__c)),
11162 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000011163}
11164
11165static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011166vec_stvrxl(vector int __a, int __b, int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000011167{
David Blaikie3302f2b2013-01-16 23:08:36 +000011168 return vec_stl(vec_perm(__a,
11169 vec_lvlx(__b, __c),
11170 vec_lvsr(__b, __c)),
11171 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000011172}
11173
11174static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011175vec_stvrxl(vector int __a, int __b, vector int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000011176{
David Blaikie3302f2b2013-01-16 23:08:36 +000011177 return vec_stl(vec_perm(__a,
11178 vec_lvlx(__b, __c),
11179 vec_lvsr(__b, (unsigned char *)__c)),
11180 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000011181}
11182
11183static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011184vec_stvrxl(vector unsigned int __a, int __b, unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000011185{
David Blaikie3302f2b2013-01-16 23:08:36 +000011186 return vec_stl(vec_perm(__a,
11187 vec_lvlx(__b, __c),
11188 vec_lvsr(__b, __c)),
11189 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000011190}
11191
11192static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011193vec_stvrxl(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000011194{
David Blaikie3302f2b2013-01-16 23:08:36 +000011195 return vec_stl(vec_perm(__a,
11196 vec_lvlx(__b, __c),
11197 vec_lvsr(__b, (unsigned char *)__c)),
11198 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000011199}
11200
11201static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011202vec_stvrxl(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000011203{
David Blaikie3302f2b2013-01-16 23:08:36 +000011204 return vec_stl(vec_perm(__a,
11205 vec_lvlx(__b, __c),
11206 vec_lvsr(__b, (unsigned char *)__c)),
11207 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000011208}
11209
11210static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011211vec_stvrxl(vector float __a, int __b, vector float *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000011212{
David Blaikie3302f2b2013-01-16 23:08:36 +000011213 return vec_stl(vec_perm(__a,
11214 vec_lvlx(__b, __c),
11215 vec_lvsr(__b, (unsigned char *)__c)),
11216 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000011217}
11218
11219/* vec_promote */
11220
11221static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011222vec_promote(signed char __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000011223{
David Blaikie3302f2b2013-01-16 23:08:36 +000011224 vector signed char __res = (vector signed char)(0);
11225 __res[__b] = __a;
11226 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000011227}
11228
11229static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011230vec_promote(unsigned char __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000011231{
David Blaikie3302f2b2013-01-16 23:08:36 +000011232 vector unsigned char __res = (vector unsigned char)(0);
11233 __res[__b] = __a;
11234 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000011235}
11236
11237static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011238vec_promote(short __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000011239{
David Blaikie3302f2b2013-01-16 23:08:36 +000011240 vector short __res = (vector short)(0);
11241 __res[__b] = __a;
11242 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000011243}
11244
11245static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011246vec_promote(unsigned short __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000011247{
David Blaikie3302f2b2013-01-16 23:08:36 +000011248 vector unsigned short __res = (vector unsigned short)(0);
11249 __res[__b] = __a;
11250 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000011251}
11252
11253static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011254vec_promote(int __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000011255{
David Blaikie3302f2b2013-01-16 23:08:36 +000011256 vector int __res = (vector int)(0);
11257 __res[__b] = __a;
11258 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000011259}
11260
11261static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011262vec_promote(unsigned int __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000011263{
David Blaikie3302f2b2013-01-16 23:08:36 +000011264 vector unsigned int __res = (vector unsigned int)(0);
11265 __res[__b] = __a;
11266 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000011267}
11268
11269static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011270vec_promote(float __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000011271{
David Blaikie3302f2b2013-01-16 23:08:36 +000011272 vector float __res = (vector float)(0);
11273 __res[__b] = __a;
11274 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000011275}
11276
11277/* vec_splats */
11278
11279static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011280vec_splats(signed char __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000011281{
David Blaikie3302f2b2013-01-16 23:08:36 +000011282 return (vector signed char)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000011283}
11284
11285static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011286vec_splats(unsigned char __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000011287{
David Blaikie3302f2b2013-01-16 23:08:36 +000011288 return (vector unsigned char)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000011289}
11290
11291static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011292vec_splats(short __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000011293{
David Blaikie3302f2b2013-01-16 23:08:36 +000011294 return (vector short)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000011295}
11296
11297static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011298vec_splats(unsigned short __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000011299{
David Blaikie3302f2b2013-01-16 23:08:36 +000011300 return (vector unsigned short)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000011301}
11302
11303static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011304vec_splats(int __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000011305{
David Blaikie3302f2b2013-01-16 23:08:36 +000011306 return (vector int)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000011307}
11308
11309static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011310vec_splats(unsigned int __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000011311{
David Blaikie3302f2b2013-01-16 23:08:36 +000011312 return (vector unsigned int)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000011313}
11314
11315static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011316vec_splats(float __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000011317{
David Blaikie3302f2b2013-01-16 23:08:36 +000011318 return (vector float)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000011319}
11320
Anton Yartsev79d6af32010-09-18 00:39:16 +000011321/* ----------------------------- predicates --------------------------------- */
Chris Lattnerdad40622010-04-14 03:54:58 +000011322
Chris Lattnerdad40622010-04-14 03:54:58 +000011323/* vec_all_eq */
11324
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011325static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011326vec_all_eq(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011327{
David Blaikie3302f2b2013-01-16 23:08:36 +000011328 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011329}
11330
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011331static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011332vec_all_eq(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011333{
David Blaikie3302f2b2013-01-16 23:08:36 +000011334 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011335}
11336
11337static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011338vec_all_eq(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011339{
David Blaikie3302f2b2013-01-16 23:08:36 +000011340 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011341}
11342
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011343static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011344vec_all_eq(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011345{
David Blaikie3302f2b2013-01-16 23:08:36 +000011346 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011347}
11348
11349static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011350vec_all_eq(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011351{
David Blaikie3302f2b2013-01-16 23:08:36 +000011352 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011353}
11354
11355static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011356vec_all_eq(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011357{
David Blaikie3302f2b2013-01-16 23:08:36 +000011358 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011359}
11360
11361static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011362vec_all_eq(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011363{
David Blaikie3302f2b2013-01-16 23:08:36 +000011364 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011365}
11366
11367static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011368vec_all_eq(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011369{
David Blaikie3302f2b2013-01-16 23:08:36 +000011370 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011371}
11372
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011373static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011374vec_all_eq(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011375{
David Blaikie3302f2b2013-01-16 23:08:36 +000011376 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011377}
11378
11379static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011380vec_all_eq(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011381{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011382 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011383 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011384}
11385
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011386static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011387vec_all_eq(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011388{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011389 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011390 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011391}
11392
11393static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011394vec_all_eq(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011395{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011396 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011397 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011398}
11399
11400static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011401vec_all_eq(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011402{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011403 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011404 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011405}
11406
11407static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011408vec_all_eq(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011409{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011410 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011411 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011412}
11413
11414static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011415vec_all_eq(vector pixel __a, vector pixel __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011416{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011417 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011418 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011419}
11420
11421static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011422vec_all_eq(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011423{
David Blaikie3302f2b2013-01-16 23:08:36 +000011424 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011425}
11426
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011427static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011428vec_all_eq(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011429{
David Blaikie3302f2b2013-01-16 23:08:36 +000011430 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011431}
11432
11433static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011434vec_all_eq(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011435{
David Blaikie3302f2b2013-01-16 23:08:36 +000011436 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011437}
11438
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011439static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011440vec_all_eq(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011441{
David Blaikie3302f2b2013-01-16 23:08:36 +000011442 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011443}
11444
11445static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011446vec_all_eq(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011447{
David Blaikie3302f2b2013-01-16 23:08:36 +000011448 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011449}
11450
11451static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011452vec_all_eq(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011453{
David Blaikie3302f2b2013-01-16 23:08:36 +000011454 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011455}
11456
11457static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011458vec_all_eq(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011459{
David Blaikie3302f2b2013-01-16 23:08:36 +000011460 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011461}
11462
Kit Barton8553bec2015-03-11 15:57:19 +000011463#ifdef __POWER8_VECTOR__
11464static int __ATTRS_o_ai
11465vec_all_eq(vector signed long long __a, vector signed long long __b)
11466{
11467 return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, __b);
11468}
11469
11470static int __ATTRS_o_ai
11471vec_all_eq(vector long long __a, vector bool long long __b)
11472{
11473 return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, (vector long long)__b);
11474}
11475
11476static int __ATTRS_o_ai
11477vec_all_eq(vector unsigned long long __a, vector unsigned long long __b)
11478{
11479 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
11480 (vector long long)__b);
11481}
11482
11483static int __ATTRS_o_ai
11484vec_all_eq(vector unsigned long long __a, vector bool long long __b)
11485{
11486 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
11487 (vector long long)__b);
11488}
11489
11490static int __ATTRS_o_ai
11491vec_all_eq(vector bool long long __a, vector long long __b)
11492{
11493 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
11494 (vector long long)__b);
11495}
11496
11497static int __ATTRS_o_ai
11498vec_all_eq(vector bool long long __a, vector unsigned long long __b)
11499{
11500 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
11501 (vector long long)__b);
11502}
11503
11504static int __ATTRS_o_ai
11505vec_all_eq(vector bool long long __a, vector bool long long __b)
11506{
11507 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
11508 (vector long long)__b);
11509}
11510#endif
11511
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011512static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011513vec_all_eq(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011514{
David Blaikie3302f2b2013-01-16 23:08:36 +000011515 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011516}
11517
11518/* vec_all_ge */
11519
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011520static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011521vec_all_ge(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011522{
David Blaikie3302f2b2013-01-16 23:08:36 +000011523 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011524}
11525
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011526static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011527vec_all_ge(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011528{
David Blaikie3302f2b2013-01-16 23:08:36 +000011529 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011530}
11531
11532static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011533vec_all_ge(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011534{
David Blaikie3302f2b2013-01-16 23:08:36 +000011535 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011536}
11537
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011538static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011539vec_all_ge(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011540{
David Blaikie3302f2b2013-01-16 23:08:36 +000011541 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011542}
11543
11544static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011545vec_all_ge(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011546{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011547 return __builtin_altivec_vcmpgtub_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011548 (vector unsigned char)__b,
11549 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011550}
11551
11552static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011553vec_all_ge(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011554{
David Blaikie3302f2b2013-01-16 23:08:36 +000011555 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011556}
11557
11558static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011559vec_all_ge(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011560{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011561 return __builtin_altivec_vcmpgtub_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011562 (vector unsigned char)__b,
11563 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011564}
11565
11566static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011567vec_all_ge(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011568{
David Blaikie3302f2b2013-01-16 23:08:36 +000011569 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011570}
11571
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011572static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011573vec_all_ge(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011574{
David Blaikie3302f2b2013-01-16 23:08:36 +000011575 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011576}
11577
11578static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011579vec_all_ge(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011580{
David Blaikie3302f2b2013-01-16 23:08:36 +000011581 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011582}
11583
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011584static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011585vec_all_ge(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011586{
David Blaikie3302f2b2013-01-16 23:08:36 +000011587 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011588}
11589
11590static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011591vec_all_ge(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011592{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011593 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011594 (vector unsigned short)__b,
11595 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011596}
11597
11598static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011599vec_all_ge(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011600{
David Blaikie3302f2b2013-01-16 23:08:36 +000011601 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011602}
11603
11604static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011605vec_all_ge(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011606{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011607 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011608 (vector unsigned short)__b,
11609 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011610}
11611
11612static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011613vec_all_ge(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011614{
David Blaikie3302f2b2013-01-16 23:08:36 +000011615 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011616}
11617
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011618static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011619vec_all_ge(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011620{
David Blaikie3302f2b2013-01-16 23:08:36 +000011621 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011622}
11623
11624static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011625vec_all_ge(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011626{
David Blaikie3302f2b2013-01-16 23:08:36 +000011627 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011628}
11629
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011630static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011631vec_all_ge(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011632{
David Blaikie3302f2b2013-01-16 23:08:36 +000011633 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011634}
11635
11636static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011637vec_all_ge(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011638{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011639 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011640 (vector unsigned int)__b,
11641 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011642}
11643
11644static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011645vec_all_ge(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011646{
David Blaikie3302f2b2013-01-16 23:08:36 +000011647 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011648}
11649
11650static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011651vec_all_ge(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011652{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011653 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011654 (vector unsigned int)__b,
11655 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011656}
11657
Kit Barton8553bec2015-03-11 15:57:19 +000011658#ifdef __POWER8_VECTOR__
11659static int __ATTRS_o_ai
11660vec_all_ge(vector signed long long __a, vector signed long long __b)
11661{
11662 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, __a);
11663}
11664static int __ATTRS_o_ai
11665vec_all_ge(vector signed long long __a, vector bool long long __b)
11666{
11667 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__b,
11668 __a);
11669}
11670
11671static int __ATTRS_o_ai
11672vec_all_ge(vector unsigned long long __a, vector unsigned long long __b)
11673{
11674 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, __a);
11675}
11676
11677static int __ATTRS_o_ai
11678vec_all_ge(vector unsigned long long __a, vector bool long long __b)
11679{
11680 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
11681 __a);
11682}
11683
11684static int __ATTRS_o_ai
11685vec_all_ge(vector bool long long __a, vector signed long long __b)
11686{
11687 return __builtin_altivec_vcmpgtud_p(__CR6_EQ,
11688 (vector unsigned long long)__b,
11689 (vector unsigned long long)__a);
11690}
11691
11692static int __ATTRS_o_ai
11693vec_all_ge(vector bool long long __a, vector unsigned long long __b)
11694{
11695 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b,
11696 (vector unsigned long long)__a);
11697}
11698
11699static int __ATTRS_o_ai
11700vec_all_ge(vector bool long long __a, vector bool long long __b)
11701{
11702 return __builtin_altivec_vcmpgtud_p(__CR6_EQ,
11703 (vector unsigned long long)__b,
11704 (vector unsigned long long)__a);
11705}
11706#endif
11707
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011708static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011709vec_all_ge(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011710{
David Blaikie3302f2b2013-01-16 23:08:36 +000011711 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011712}
11713
11714/* vec_all_gt */
11715
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011716static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011717vec_all_gt(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011718{
David Blaikie3302f2b2013-01-16 23:08:36 +000011719 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011720}
11721
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011722static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011723vec_all_gt(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011724{
David Blaikie3302f2b2013-01-16 23:08:36 +000011725 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011726}
11727
11728static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011729vec_all_gt(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011730{
David Blaikie3302f2b2013-01-16 23:08:36 +000011731 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011732}
11733
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011734static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011735vec_all_gt(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011736{
David Blaikie3302f2b2013-01-16 23:08:36 +000011737 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011738}
11739
11740static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011741vec_all_gt(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011742{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011743 return __builtin_altivec_vcmpgtub_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011744 (vector unsigned char)__a,
11745 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011746}
11747
11748static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011749vec_all_gt(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011750{
David Blaikie3302f2b2013-01-16 23:08:36 +000011751 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011752}
11753
11754static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011755vec_all_gt(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011756{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011757 return __builtin_altivec_vcmpgtub_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011758 (vector unsigned char)__a,
11759 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011760}
11761
11762static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011763vec_all_gt(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011764{
David Blaikie3302f2b2013-01-16 23:08:36 +000011765 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011766}
11767
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011768static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011769vec_all_gt(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011770{
David Blaikie3302f2b2013-01-16 23:08:36 +000011771 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011772}
11773
11774static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011775vec_all_gt(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011776{
David Blaikie3302f2b2013-01-16 23:08:36 +000011777 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011778}
11779
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011780static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011781vec_all_gt(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011782{
David Blaikie3302f2b2013-01-16 23:08:36 +000011783 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011784}
11785
11786static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011787vec_all_gt(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011788{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011789 return __builtin_altivec_vcmpgtuh_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011790 (vector unsigned short)__a,
11791 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011792}
11793
11794static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011795vec_all_gt(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011796{
David Blaikie3302f2b2013-01-16 23:08:36 +000011797 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011798}
11799
11800static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011801vec_all_gt(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011802{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011803 return __builtin_altivec_vcmpgtuh_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011804 (vector unsigned short)__a,
11805 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011806}
11807
11808static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011809vec_all_gt(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011810{
David Blaikie3302f2b2013-01-16 23:08:36 +000011811 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011812}
11813
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011814static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011815vec_all_gt(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011816{
David Blaikie3302f2b2013-01-16 23:08:36 +000011817 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011818}
11819
11820static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011821vec_all_gt(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011822{
David Blaikie3302f2b2013-01-16 23:08:36 +000011823 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011824}
11825
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011826static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011827vec_all_gt(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011828{
David Blaikie3302f2b2013-01-16 23:08:36 +000011829 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011830}
11831
11832static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011833vec_all_gt(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011834{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011835 return __builtin_altivec_vcmpgtuw_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011836 (vector unsigned int)__a,
11837 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011838}
11839
11840static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011841vec_all_gt(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011842{
David Blaikie3302f2b2013-01-16 23:08:36 +000011843 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011844}
11845
11846static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011847vec_all_gt(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011848{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011849 return __builtin_altivec_vcmpgtuw_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011850 (vector unsigned int)__a,
11851 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011852}
11853
Kit Barton8553bec2015-03-11 15:57:19 +000011854#ifdef __POWER8_VECTOR__
11855static int __ATTRS_o_ai
11856vec_all_gt(vector signed long long __a, vector signed long long __b)
11857{
11858 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, __b);
11859}
11860static int __ATTRS_o_ai
11861vec_all_gt(vector signed long long __a, vector bool long long __b)
11862{
11863 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a,
11864 (vector signed long long)__b);
11865}
11866
11867static int __ATTRS_o_ai
11868vec_all_gt(vector unsigned long long __a, vector unsigned long long __b)
11869{
11870 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, __b);
11871}
11872
11873static int __ATTRS_o_ai
11874vec_all_gt(vector unsigned long long __a, vector bool long long __b)
11875{
11876 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a,
11877 (vector unsigned long long)__b);
11878}
11879
11880static int __ATTRS_o_ai
11881vec_all_gt(vector bool long long __a, vector signed long long __b)
11882{
11883 return __builtin_altivec_vcmpgtud_p(__CR6_LT,
11884 (vector unsigned long long)__a,
11885 (vector unsigned long long)__b);
11886}
11887
11888static int __ATTRS_o_ai
11889vec_all_gt(vector bool long long __a, vector unsigned long long __b)
11890{
11891 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
11892 __b);
11893}
11894
11895static int __ATTRS_o_ai
11896vec_all_gt(vector bool long long __a, vector bool long long __b)
11897{
11898 return __builtin_altivec_vcmpgtud_p(__CR6_LT,
11899 (vector unsigned long long)__a,
11900 (vector unsigned long long)__b);
11901}
11902#endif
11903
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011904static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011905vec_all_gt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011906{
David Blaikie3302f2b2013-01-16 23:08:36 +000011907 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011908}
11909
11910/* vec_all_in */
11911
11912static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000011913vec_all_in(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011914{
David Blaikie3302f2b2013-01-16 23:08:36 +000011915 return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011916}
11917
11918/* vec_all_le */
11919
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011920static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011921vec_all_le(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011922{
David Blaikie3302f2b2013-01-16 23:08:36 +000011923 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011924}
11925
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011926static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011927vec_all_le(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011928{
David Blaikie3302f2b2013-01-16 23:08:36 +000011929 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011930}
11931
11932static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011933vec_all_le(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011934{
David Blaikie3302f2b2013-01-16 23:08:36 +000011935 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011936}
11937
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011938static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011939vec_all_le(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011940{
David Blaikie3302f2b2013-01-16 23:08:36 +000011941 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011942}
11943
11944static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011945vec_all_le(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011946{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011947 return __builtin_altivec_vcmpgtub_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011948 (vector unsigned char)__a,
11949 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011950}
11951
11952static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011953vec_all_le(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011954{
David Blaikie3302f2b2013-01-16 23:08:36 +000011955 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011956}
11957
11958static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011959vec_all_le(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011960{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011961 return __builtin_altivec_vcmpgtub_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011962 (vector unsigned char)__a,
11963 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011964}
11965
11966static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011967vec_all_le(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011968{
David Blaikie3302f2b2013-01-16 23:08:36 +000011969 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011970}
11971
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011972static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011973vec_all_le(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011974{
David Blaikie3302f2b2013-01-16 23:08:36 +000011975 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011976}
11977
11978static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011979vec_all_le(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011980{
David Blaikie3302f2b2013-01-16 23:08:36 +000011981 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011982}
11983
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011984static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011985vec_all_le(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011986{
David Blaikie3302f2b2013-01-16 23:08:36 +000011987 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011988}
11989
11990static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011991vec_all_le(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011992{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011993 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011994 (vector unsigned short)__a,
11995 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011996}
11997
11998static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011999vec_all_le(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012000{
David Blaikie3302f2b2013-01-16 23:08:36 +000012001 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012002}
12003
12004static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012005vec_all_le(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012006{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012007 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000012008 (vector unsigned short)__a,
12009 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012010}
12011
12012static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012013vec_all_le(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012014{
David Blaikie3302f2b2013-01-16 23:08:36 +000012015 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012016}
12017
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012018static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012019vec_all_le(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012020{
David Blaikie3302f2b2013-01-16 23:08:36 +000012021 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012022}
12023
12024static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012025vec_all_le(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012026{
David Blaikie3302f2b2013-01-16 23:08:36 +000012027 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012028}
12029
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012030static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012031vec_all_le(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012032{
David Blaikie3302f2b2013-01-16 23:08:36 +000012033 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012034}
12035
12036static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012037vec_all_le(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012038{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012039 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000012040 (vector unsigned int)__a,
12041 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012042}
12043
12044static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012045vec_all_le(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012046{
David Blaikie3302f2b2013-01-16 23:08:36 +000012047 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012048}
12049
12050static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012051vec_all_le(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012052{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012053 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000012054 (vector unsigned int)__a,
12055 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012056}
12057
Kit Barton8553bec2015-03-11 15:57:19 +000012058#ifdef __POWER8_VECTOR__
12059static int __ATTRS_o_ai
12060vec_all_le(vector signed long long __a, vector signed long long __b)
12061{
12062 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, __b);
12063}
12064
12065static int __ATTRS_o_ai
12066vec_all_le(vector unsigned long long __a, vector unsigned long long __b)
12067{
12068 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, __b);
12069}
12070
12071static int __ATTRS_o_ai
12072vec_all_le(vector signed long long __a, vector bool long long __b)
12073{
12074 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a,
12075 (vector signed long long)__b);
12076}
12077
12078static int __ATTRS_o_ai
12079vec_all_le(vector unsigned long long __a, vector bool long long __b)
12080{
12081 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a,
12082 (vector unsigned long long)__b);
12083}
12084
12085static int __ATTRS_o_ai
12086vec_all_le(vector bool long long __a, vector signed long long __b)
12087{
12088 return __builtin_altivec_vcmpgtud_p(__CR6_EQ,
12089 (vector unsigned long long)__a,
12090 (vector unsigned long long)__b);
12091}
12092
12093static int __ATTRS_o_ai
12094vec_all_le(vector bool long long __a, vector unsigned long long __b)
12095{
12096 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
12097 __b);
12098}
12099
12100static int __ATTRS_o_ai
12101vec_all_le(vector bool long long __a, vector bool long long __b)
12102{
12103 return __builtin_altivec_vcmpgtud_p(__CR6_EQ,
12104 (vector unsigned long long)__a,
12105 (vector unsigned long long)__b);
12106}
12107#endif
12108
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012109static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012110vec_all_le(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012111{
David Blaikie3302f2b2013-01-16 23:08:36 +000012112 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012113}
12114
12115/* vec_all_lt */
12116
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012117static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012118vec_all_lt(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012119{
David Blaikie3302f2b2013-01-16 23:08:36 +000012120 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012121}
12122
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012123static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012124vec_all_lt(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012125{
David Blaikie3302f2b2013-01-16 23:08:36 +000012126 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012127}
12128
12129static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012130vec_all_lt(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012131{
David Blaikie3302f2b2013-01-16 23:08:36 +000012132 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012133}
12134
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012135static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012136vec_all_lt(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012137{
David Blaikie3302f2b2013-01-16 23:08:36 +000012138 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012139}
12140
12141static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012142vec_all_lt(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012143{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012144 return __builtin_altivec_vcmpgtub_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000012145 (vector unsigned char)__b,
12146 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012147}
12148
12149static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012150vec_all_lt(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012151{
David Blaikie3302f2b2013-01-16 23:08:36 +000012152 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012153}
12154
12155static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012156vec_all_lt(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012157{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012158 return __builtin_altivec_vcmpgtub_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000012159 (vector unsigned char)__b,
12160 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012161}
12162
12163static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012164vec_all_lt(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012165{
David Blaikie3302f2b2013-01-16 23:08:36 +000012166 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012167}
12168
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012169static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012170vec_all_lt(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012171{
David Blaikie3302f2b2013-01-16 23:08:36 +000012172 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012173}
12174
12175static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012176vec_all_lt(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012177{
David Blaikie3302f2b2013-01-16 23:08:36 +000012178 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012179}
12180
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012181static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012182vec_all_lt(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012183{
David Blaikie3302f2b2013-01-16 23:08:36 +000012184 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012185}
12186
12187static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012188vec_all_lt(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012189{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012190 return __builtin_altivec_vcmpgtuh_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000012191 (vector unsigned short)__b,
12192 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012193}
12194
12195static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012196vec_all_lt(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012197{
David Blaikie3302f2b2013-01-16 23:08:36 +000012198 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012199}
12200
12201static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012202vec_all_lt(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012203{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012204 return __builtin_altivec_vcmpgtuh_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000012205 (vector unsigned short)__b,
12206 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012207}
12208
12209static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012210vec_all_lt(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012211{
David Blaikie3302f2b2013-01-16 23:08:36 +000012212 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012213}
12214
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012215static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012216vec_all_lt(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012217{
David Blaikie3302f2b2013-01-16 23:08:36 +000012218 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012219}
12220
12221static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012222vec_all_lt(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012223{
David Blaikie3302f2b2013-01-16 23:08:36 +000012224 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012225}
12226
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012227static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012228vec_all_lt(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012229{
David Blaikie3302f2b2013-01-16 23:08:36 +000012230 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012231}
12232
12233static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012234vec_all_lt(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012235{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012236 return __builtin_altivec_vcmpgtuw_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000012237 (vector unsigned int)__b,
12238 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012239}
12240
12241static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012242vec_all_lt(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012243{
David Blaikie3302f2b2013-01-16 23:08:36 +000012244 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012245}
12246
12247static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012248vec_all_lt(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012249{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012250 return __builtin_altivec_vcmpgtuw_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000012251 (vector unsigned int)__b,
12252 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012253}
12254
Kit Barton8553bec2015-03-11 15:57:19 +000012255#ifdef __POWER8_VECTOR__
12256static int __ATTRS_o_ai
12257vec_all_lt(vector signed long long __a, vector signed long long __b)
12258{
12259 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, __a);
12260}
12261
12262static int __ATTRS_o_ai
12263vec_all_lt(vector unsigned long long __a, vector unsigned long long __b)
12264{
12265 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, __a);
12266}
12267
12268static int __ATTRS_o_ai
12269vec_all_lt(vector signed long long __a, vector bool long long __b)
12270{
12271 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__b,
12272 __a);
12273}
12274
12275static int __ATTRS_o_ai
12276vec_all_lt(vector unsigned long long __a, vector bool long long __b)
12277{
12278 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
12279 __a);
12280}
12281
12282static int __ATTRS_o_ai
12283vec_all_lt(vector bool long long __a, vector signed long long __b)
12284{
12285 return __builtin_altivec_vcmpgtud_p(__CR6_LT,
12286 (vector unsigned long long)__b,
12287 (vector unsigned long long)__a);
12288}
12289
12290static int __ATTRS_o_ai
12291vec_all_lt(vector bool long long __a, vector unsigned long long __b)
12292{
12293 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b,
12294 (vector unsigned long long)__a);
12295}
12296
12297static int __ATTRS_o_ai
12298vec_all_lt(vector bool long long __a, vector bool long long __b)
12299{
12300 return __builtin_altivec_vcmpgtud_p(__CR6_LT,
12301 (vector unsigned long long)__b,
12302 (vector unsigned long long)__a);
12303}
12304#endif
12305
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012306static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012307vec_all_lt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012308{
David Blaikie3302f2b2013-01-16 23:08:36 +000012309 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012310}
12311
12312/* vec_all_nan */
12313
12314static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012315vec_all_nan(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +000012316{
David Blaikie3302f2b2013-01-16 23:08:36 +000012317 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012318}
12319
12320/* vec_all_ne */
12321
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012322static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012323vec_all_ne(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012324{
David Blaikie3302f2b2013-01-16 23:08:36 +000012325 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012326}
12327
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012328static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012329vec_all_ne(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012330{
David Blaikie3302f2b2013-01-16 23:08:36 +000012331 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012332}
12333
12334static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012335vec_all_ne(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012336{
David Blaikie3302f2b2013-01-16 23:08:36 +000012337 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012338}
12339
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012340static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012341vec_all_ne(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012342{
David Blaikie3302f2b2013-01-16 23:08:36 +000012343 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012344}
12345
12346static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012347vec_all_ne(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012348{
David Blaikie3302f2b2013-01-16 23:08:36 +000012349 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012350}
12351
12352static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012353vec_all_ne(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012354{
David Blaikie3302f2b2013-01-16 23:08:36 +000012355 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012356}
12357
12358static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012359vec_all_ne(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012360{
David Blaikie3302f2b2013-01-16 23:08:36 +000012361 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012362}
12363
12364static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012365vec_all_ne(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012366{
David Blaikie3302f2b2013-01-16 23:08:36 +000012367 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012368}
12369
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012370static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012371vec_all_ne(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012372{
David Blaikie3302f2b2013-01-16 23:08:36 +000012373 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012374}
12375
12376static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012377vec_all_ne(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012378{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012379 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012380 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012381}
12382
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012383static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012384vec_all_ne(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012385{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012386 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012387 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012388}
12389
12390static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012391vec_all_ne(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012392{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012393 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012394 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012395}
12396
12397static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012398vec_all_ne(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012399{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012400 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012401 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012402}
12403
12404static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012405vec_all_ne(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012406{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012407 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012408 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012409}
12410
12411static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012412vec_all_ne(vector pixel __a, vector pixel __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012413{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012414 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012415 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012416}
12417
12418static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012419vec_all_ne(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012420{
David Blaikie3302f2b2013-01-16 23:08:36 +000012421 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012422}
12423
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012424static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012425vec_all_ne(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012426{
David Blaikie3302f2b2013-01-16 23:08:36 +000012427 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012428}
12429
12430static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012431vec_all_ne(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012432{
David Blaikie3302f2b2013-01-16 23:08:36 +000012433 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012434}
12435
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012436static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012437vec_all_ne(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012438{
David Blaikie3302f2b2013-01-16 23:08:36 +000012439 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012440}
12441
12442static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012443vec_all_ne(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012444{
David Blaikie3302f2b2013-01-16 23:08:36 +000012445 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012446}
12447
12448static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012449vec_all_ne(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012450{
David Blaikie3302f2b2013-01-16 23:08:36 +000012451 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012452}
12453
12454static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012455vec_all_ne(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012456{
David Blaikie3302f2b2013-01-16 23:08:36 +000012457 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012458}
12459
Kit Barton8553bec2015-03-11 15:57:19 +000012460#ifdef __POWER8_VECTOR__
12461static int __ATTRS_o_ai
12462vec_all_ne(vector signed long long __a, vector signed long long __b)
12463{
12464 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, __b);
12465}
12466
12467static int __ATTRS_o_ai
12468vec_all_ne(vector unsigned long long __a, vector unsigned long long __b)
12469{
12470 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector long long)__a,
12471 (vector long long)__b);
12472}
12473
12474static int __ATTRS_o_ai
12475vec_all_ne(vector signed long long __a, vector bool long long __b)
12476{
12477 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a,
12478 (vector signed long long)__b);
12479}
12480
12481static int __ATTRS_o_ai
12482vec_all_ne(vector unsigned long long __a, vector bool long long __b)
12483{
12484 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
12485 (vector signed long long)__b);
12486}
12487
12488static int __ATTRS_o_ai
12489vec_all_ne(vector bool long long __a, vector signed long long __b)
12490{
12491 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
12492 (vector signed long long)__b);
12493}
12494
12495static int __ATTRS_o_ai
12496vec_all_ne(vector bool long long __a, vector unsigned long long __b)
12497{
12498 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
12499 (vector signed long long)__b);
12500}
12501
12502static int __ATTRS_o_ai
12503vec_all_ne(vector bool long long __a, vector bool long long __b)
12504{
12505 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
12506 (vector signed long long)__b);
12507}
12508#endif
12509
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012510static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012511vec_all_ne(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012512{
David Blaikie3302f2b2013-01-16 23:08:36 +000012513 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012514}
12515
12516/* vec_all_nge */
12517
12518static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012519vec_all_nge(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012520{
David Blaikie3302f2b2013-01-16 23:08:36 +000012521 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012522}
12523
12524/* vec_all_ngt */
12525
12526static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012527vec_all_ngt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012528{
David Blaikie3302f2b2013-01-16 23:08:36 +000012529 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012530}
12531
12532/* vec_all_nle */
12533
12534static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012535vec_all_nle(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012536{
David Blaikie3302f2b2013-01-16 23:08:36 +000012537 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012538}
12539
12540/* vec_all_nlt */
12541
12542static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012543vec_all_nlt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012544{
David Blaikie3302f2b2013-01-16 23:08:36 +000012545 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012546}
12547
12548/* vec_all_numeric */
12549
12550static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012551vec_all_numeric(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +000012552{
David Blaikie3302f2b2013-01-16 23:08:36 +000012553 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012554}
12555
12556/* vec_any_eq */
12557
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012558static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012559vec_any_eq(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012560{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012561 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012562 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012563}
12564
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012565static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012566vec_any_eq(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012567{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012568 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012569 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012570}
12571
12572static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012573vec_any_eq(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012574{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012575 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012576 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012577}
12578
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012579static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012580vec_any_eq(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012581{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012582 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012583 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012584}
12585
12586static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012587vec_any_eq(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012588{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012589 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012590 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012591}
12592
12593static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012594vec_any_eq(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012595{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012596 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012597 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012598}
12599
12600static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012601vec_any_eq(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012602{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012603 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012604 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012605}
12606
12607static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012608vec_any_eq(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012609{
David Blaikie3302f2b2013-01-16 23:08:36 +000012610 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012611}
12612
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012613static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012614vec_any_eq(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012615{
David Blaikie3302f2b2013-01-16 23:08:36 +000012616 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012617}
12618
12619static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012620vec_any_eq(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012621{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012622 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012623 (vector short)__a,
12624 (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012625}
12626
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012627static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012628vec_any_eq(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012629{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012630 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012631 (vector short)__a,
12632 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012633}
12634
12635static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012636vec_any_eq(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012637{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012638 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012639 (vector short)__a,
12640 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012641}
12642
12643static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012644vec_any_eq(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012645{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012646 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012647 (vector short)__a,
12648 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012649}
12650
12651static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012652vec_any_eq(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012653{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012654 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012655 (vector short)__a,
12656 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012657}
12658
12659static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012660vec_any_eq(vector pixel __a, vector pixel __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012661{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012662 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012663 (vector short)__a,
12664 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012665}
12666
12667static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012668vec_any_eq(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012669{
David Blaikie3302f2b2013-01-16 23:08:36 +000012670 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012671}
12672
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012673static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012674vec_any_eq(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012675{
David Blaikie3302f2b2013-01-16 23:08:36 +000012676 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012677}
12678
12679static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012680vec_any_eq(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012681{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012682 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012683 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012684}
12685
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012686static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012687vec_any_eq(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012688{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012689 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012690 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012691}
12692
12693static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012694vec_any_eq(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012695{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012696 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012697 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012698}
12699
12700static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012701vec_any_eq(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012702{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012703 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012704 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012705}
12706
12707static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012708vec_any_eq(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012709{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012710 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012711 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012712}
12713
Kit Barton8553bec2015-03-11 15:57:19 +000012714#ifdef __POWER8_VECTOR__
12715static int __ATTRS_o_ai
12716vec_any_eq(vector signed long long __a, vector signed long long __b)
12717{
12718 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, __b);
12719}
12720
12721static int __ATTRS_o_ai
12722vec_any_eq(vector unsigned long long __a, vector unsigned long long __b)
12723{
12724 return
12725 __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector long long)__a,
12726 (vector long long)__b);
12727}
12728
12729static int __ATTRS_o_ai
12730vec_any_eq(vector signed long long __a, vector bool long long __b)
12731{
12732 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a,
12733 (vector signed long long)__b);
12734}
12735
12736static int __ATTRS_o_ai
12737vec_any_eq(vector unsigned long long __a, vector bool long long __b)
12738{
12739 return
12740 __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector signed long long)__a,
12741 (vector signed long long)__b);
12742}
12743
12744static int __ATTRS_o_ai
12745vec_any_eq(vector bool long long __a, vector signed long long __b)
12746{
12747 return
12748 __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector signed long long)__a,
12749 (vector signed long long)__b);
12750}
12751
12752static int __ATTRS_o_ai
12753vec_any_eq(vector bool long long __a, vector unsigned long long __b)
12754{
12755 return
12756 __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector signed long long)__a,
12757 (vector signed long long)__b);
12758}
12759
12760static int __ATTRS_o_ai
12761vec_any_eq(vector bool long long __a, vector bool long long __b)
12762{
12763 return
12764 __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector signed long long)__a,
12765 (vector signed long long)__b);
12766}
12767#endif
12768
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012769static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012770vec_any_eq(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012771{
David Blaikie3302f2b2013-01-16 23:08:36 +000012772 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012773}
12774
12775/* vec_any_ge */
12776
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012777static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012778vec_any_ge(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012779{
David Blaikie3302f2b2013-01-16 23:08:36 +000012780 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012781}
12782
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012783static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012784vec_any_ge(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012785{
David Blaikie3302f2b2013-01-16 23:08:36 +000012786 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012787}
12788
12789static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012790vec_any_ge(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012791{
David Blaikie3302f2b2013-01-16 23:08:36 +000012792 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012793}
12794
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012795static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012796vec_any_ge(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012797{
David Blaikie3302f2b2013-01-16 23:08:36 +000012798 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012799}
12800
12801static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012802vec_any_ge(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012803{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012804 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012805 (vector unsigned char)__b,
12806 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012807}
12808
12809static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012810vec_any_ge(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012811{
David Blaikie3302f2b2013-01-16 23:08:36 +000012812 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012813}
12814
12815static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012816vec_any_ge(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012817{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012818 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012819 (vector unsigned char)__b,
12820 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012821}
12822
12823static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012824vec_any_ge(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012825{
David Blaikie3302f2b2013-01-16 23:08:36 +000012826 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012827}
12828
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012829static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012830vec_any_ge(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012831{
David Blaikie3302f2b2013-01-16 23:08:36 +000012832 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012833}
12834
12835static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012836vec_any_ge(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012837{
David Blaikie3302f2b2013-01-16 23:08:36 +000012838 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012839}
12840
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012841static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012842vec_any_ge(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012843{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012844 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012845 __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012846}
12847
12848static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012849vec_any_ge(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012850{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012851 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012852 (vector unsigned short)__b,
12853 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012854}
12855
12856static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012857vec_any_ge(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012858{
12859 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012860 __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012861}
12862
12863static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012864vec_any_ge(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012865{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012866 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012867 (vector unsigned short)__b,
12868 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012869}
12870
12871static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012872vec_any_ge(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012873{
David Blaikie3302f2b2013-01-16 23:08:36 +000012874 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012875}
12876
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012877static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012878vec_any_ge(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012879{
David Blaikie3302f2b2013-01-16 23:08:36 +000012880 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012881}
12882
12883static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012884vec_any_ge(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012885{
David Blaikie3302f2b2013-01-16 23:08:36 +000012886 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012887}
12888
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012889static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012890vec_any_ge(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012891{
David Blaikie3302f2b2013-01-16 23:08:36 +000012892 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012893}
12894
12895static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012896vec_any_ge(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012897{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012898 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012899 (vector unsigned int)__b,
12900 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012901}
12902
12903static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012904vec_any_ge(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012905{
David Blaikie3302f2b2013-01-16 23:08:36 +000012906 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012907}
12908
12909static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012910vec_any_ge(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012911{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012912 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012913 (vector unsigned int)__b,
12914 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012915}
12916
Kit Barton8553bec2015-03-11 15:57:19 +000012917#ifdef __POWER8_VECTOR__
12918static int __ATTRS_o_ai
12919vec_any_ge(vector signed long long __a, vector signed long long __b)
12920{
12921 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, __a);
12922}
12923
12924static int __ATTRS_o_ai
12925vec_any_ge(vector unsigned long long __a, vector unsigned long long __b)
12926{
12927 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, __a);
12928}
12929
12930static int __ATTRS_o_ai
12931vec_any_ge(vector signed long long __a, vector bool long long __b)
12932{
12933 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV,
12934 (vector signed long long)__b, __a);
12935}
12936
12937static int __ATTRS_o_ai
12938vec_any_ge(vector unsigned long long __a, vector bool long long __b)
12939{
12940 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
12941 (vector unsigned long long)__b, __a);
12942}
12943
12944static int __ATTRS_o_ai
12945vec_any_ge(vector bool long long __a, vector signed long long __b)
12946{
12947 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
12948 (vector unsigned long long)__b,
12949 (vector unsigned long long)__a);
12950}
12951
12952static int __ATTRS_o_ai
12953vec_any_ge(vector bool long long __a, vector unsigned long long __b)
12954{
12955 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b,
12956 (vector unsigned long long)__a);
12957}
12958
12959static int __ATTRS_o_ai
12960vec_any_ge(vector bool long long __a, vector bool long long __b)
12961{
12962 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
12963 (vector unsigned long long)__b,
12964 (vector unsigned long long)__a);
12965}
12966#endif
12967
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012968static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012969vec_any_ge(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012970{
David Blaikie3302f2b2013-01-16 23:08:36 +000012971 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012972}
12973
12974/* vec_any_gt */
12975
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012976static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012977vec_any_gt(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012978{
David Blaikie3302f2b2013-01-16 23:08:36 +000012979 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012980}
12981
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012982static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012983vec_any_gt(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012984{
David Blaikie3302f2b2013-01-16 23:08:36 +000012985 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012986}
12987
12988static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012989vec_any_gt(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012990{
David Blaikie3302f2b2013-01-16 23:08:36 +000012991 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012992}
12993
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012994static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012995vec_any_gt(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012996{
12997 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012998 __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012999}
13000
13001static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013002vec_any_gt(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013003{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013004 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013005 (vector unsigned char)__a,
13006 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013007}
13008
13009static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013010vec_any_gt(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013011{
13012 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013013 __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013014}
13015
13016static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013017vec_any_gt(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013018{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013019 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013020 (vector unsigned char)__a,
13021 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013022}
13023
13024static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013025vec_any_gt(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013026{
David Blaikie3302f2b2013-01-16 23:08:36 +000013027 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013028}
13029
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013030static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013031vec_any_gt(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013032{
David Blaikie3302f2b2013-01-16 23:08:36 +000013033 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013034}
13035
13036static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013037vec_any_gt(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013038{
David Blaikie3302f2b2013-01-16 23:08:36 +000013039 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013040}
13041
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013042static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013043vec_any_gt(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013044{
13045 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013046 __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013047}
13048
13049static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013050vec_any_gt(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013051{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013052 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013053 (vector unsigned short)__a,
13054 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013055}
13056
13057static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013058vec_any_gt(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013059{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013060 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013061 __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013062}
13063
13064static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013065vec_any_gt(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013066{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013067 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013068 (vector unsigned short)__a,
13069 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013070}
13071
13072static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013073vec_any_gt(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013074{
David Blaikie3302f2b2013-01-16 23:08:36 +000013075 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013076}
13077
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013078static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013079vec_any_gt(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013080{
David Blaikie3302f2b2013-01-16 23:08:36 +000013081 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013082}
13083
13084static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013085vec_any_gt(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013086{
David Blaikie3302f2b2013-01-16 23:08:36 +000013087 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013088}
13089
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013090static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013091vec_any_gt(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013092{
David Blaikie3302f2b2013-01-16 23:08:36 +000013093 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013094}
13095
13096static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013097vec_any_gt(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013098{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013099 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013100 (vector unsigned int)__a,
13101 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013102}
13103
13104static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013105vec_any_gt(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013106{
David Blaikie3302f2b2013-01-16 23:08:36 +000013107 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013108}
13109
13110static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013111vec_any_gt(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013112{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013113 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013114 (vector unsigned int)__a,
13115 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013116}
13117
Kit Barton8553bec2015-03-11 15:57:19 +000013118#ifdef __POWER8_VECTOR__
13119static int __ATTRS_o_ai
13120vec_any_gt(vector signed long long __a, vector signed long long __b)
13121{
13122 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, __b);
13123}
13124
13125static int __ATTRS_o_ai
13126vec_any_gt(vector unsigned long long __a, vector unsigned long long __b)
13127{
13128 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, __b);
13129}
13130
13131static int __ATTRS_o_ai
13132vec_any_gt(vector signed long long __a, vector bool long long __b)
13133{
13134 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a,
13135 (vector signed long long)__b);
13136}
13137
13138
13139static int __ATTRS_o_ai
13140vec_any_gt(vector unsigned long long __a, vector bool long long __b)
13141{
13142 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a,
13143 (vector unsigned long long)__b);
13144}
13145
13146static int __ATTRS_o_ai
13147vec_any_gt(vector bool long long __a, vector signed long long __b)
13148{
13149 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
13150 (vector unsigned long long)__a,
13151 (vector unsigned long long)__b);
13152}
13153
13154static int __ATTRS_o_ai
13155vec_any_gt(vector bool long long __a, vector unsigned long long __b)
13156{
13157 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
13158 (vector unsigned long long)__a, __b);
13159}
13160
13161static int __ATTRS_o_ai
13162vec_any_gt(vector bool long long __a, vector bool long long __b)
13163{
13164 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
13165 (vector unsigned long long)__a,
13166 (vector unsigned long long)__b);
13167}
13168#endif
13169
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013170static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013171vec_any_gt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013172{
David Blaikie3302f2b2013-01-16 23:08:36 +000013173 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013174}
13175
13176/* vec_any_le */
13177
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013178static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013179vec_any_le(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013180{
David Blaikie3302f2b2013-01-16 23:08:36 +000013181 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013182}
13183
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013184static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013185vec_any_le(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013186{
David Blaikie3302f2b2013-01-16 23:08:36 +000013187 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013188}
13189
13190static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013191vec_any_le(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013192{
David Blaikie3302f2b2013-01-16 23:08:36 +000013193 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013194}
13195
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013196static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013197vec_any_le(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013198{
13199 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013200 __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013201}
13202
13203static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013204vec_any_le(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013205{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013206 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013207 (vector unsigned char)__a,
13208 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013209}
13210
13211static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013212vec_any_le(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013213{
13214 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013215 __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013216}
13217
13218static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013219vec_any_le(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013220{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013221 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013222 (vector unsigned char)__a,
13223 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013224}
13225
13226static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013227vec_any_le(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013228{
David Blaikie3302f2b2013-01-16 23:08:36 +000013229 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013230}
13231
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013232static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013233vec_any_le(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013234{
David Blaikie3302f2b2013-01-16 23:08:36 +000013235 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013236}
13237
13238static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013239vec_any_le(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013240{
David Blaikie3302f2b2013-01-16 23:08:36 +000013241 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013242}
13243
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013244static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013245vec_any_le(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013246{
13247 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013248 __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013249}
13250
13251static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013252vec_any_le(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013253{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013254 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013255 (vector unsigned short)__a,
13256 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013257}
13258
13259static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013260vec_any_le(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013261{
13262 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013263 __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013264}
13265
13266static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013267vec_any_le(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013268{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013269 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013270 (vector unsigned short)__a,
13271 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013272}
13273
13274static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013275vec_any_le(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013276{
David Blaikie3302f2b2013-01-16 23:08:36 +000013277 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013278}
13279
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013280static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013281vec_any_le(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013282{
David Blaikie3302f2b2013-01-16 23:08:36 +000013283 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013284}
13285
13286static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013287vec_any_le(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013288{
David Blaikie3302f2b2013-01-16 23:08:36 +000013289 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013290}
13291
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013292static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013293vec_any_le(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013294{
David Blaikie3302f2b2013-01-16 23:08:36 +000013295 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013296}
13297
13298static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013299vec_any_le(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013300{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013301 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013302 (vector unsigned int)__a,
13303 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013304}
13305
13306static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013307vec_any_le(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013308{
David Blaikie3302f2b2013-01-16 23:08:36 +000013309 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013310}
13311
13312static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013313vec_any_le(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013314{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013315 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013316 (vector unsigned int)__a,
13317 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013318}
13319
Kit Barton8553bec2015-03-11 15:57:19 +000013320#ifdef __POWER8_VECTOR__
13321static int __ATTRS_o_ai
13322vec_any_le(vector signed long long __a, vector signed long long __b)
13323{
13324 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, __b);
13325}
13326
13327static int __ATTRS_o_ai
13328vec_any_le(vector unsigned long long __a, vector unsigned long long __b)
13329{
13330 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, __b);
13331}
13332
13333static int __ATTRS_o_ai
13334vec_any_le(vector signed long long __a, vector bool long long __b)
13335{
13336 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a,
13337 (vector signed long long)__b);
13338}
13339
13340static int __ATTRS_o_ai
13341vec_any_le(vector unsigned long long __a, vector bool long long __b)
13342{
13343 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a,
13344 (vector unsigned long long)__b);
13345}
13346
13347static int __ATTRS_o_ai
13348vec_any_le(vector bool long long __a, vector signed long long __b)
13349{
13350 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
13351 (vector unsigned long long)__a,
13352 (vector unsigned long long)__b);
13353}
13354
13355static int __ATTRS_o_ai
13356vec_any_le(vector bool long long __a, vector unsigned long long __b)
13357{
13358 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
13359 (vector unsigned long long)__a, __b);
13360}
13361
13362static int __ATTRS_o_ai
13363vec_any_le(vector bool long long __a, vector bool long long __b)
13364{
13365 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
13366 (vector unsigned long long)__a,
13367 (vector unsigned long long)__b);
13368}
13369#endif
13370
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013371static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013372vec_any_le(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013373{
David Blaikie3302f2b2013-01-16 23:08:36 +000013374 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000013375}
13376
13377/* vec_any_lt */
13378
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013379static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013380vec_any_lt(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013381{
David Blaikie3302f2b2013-01-16 23:08:36 +000013382 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000013383}
13384
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013385static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013386vec_any_lt(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013387{
David Blaikie3302f2b2013-01-16 23:08:36 +000013388 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013389}
13390
13391static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013392vec_any_lt(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013393{
David Blaikie3302f2b2013-01-16 23:08:36 +000013394 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000013395}
13396
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013397static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013398vec_any_lt(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013399{
13400 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013401 __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013402}
13403
13404static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013405vec_any_lt(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013406{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013407 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013408 (vector unsigned char)__b,
13409 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013410}
13411
13412static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013413vec_any_lt(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013414{
13415 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013416 __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013417}
13418
13419static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013420vec_any_lt(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013421{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013422 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013423 (vector unsigned char)__b,
13424 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013425}
13426
13427static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013428vec_any_lt(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013429{
David Blaikie3302f2b2013-01-16 23:08:36 +000013430 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000013431}
13432
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013433static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013434vec_any_lt(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013435{
David Blaikie3302f2b2013-01-16 23:08:36 +000013436 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013437}
13438
13439static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013440vec_any_lt(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013441{
David Blaikie3302f2b2013-01-16 23:08:36 +000013442 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000013443}
13444
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013445static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013446vec_any_lt(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013447{
13448 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013449 __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013450}
13451
13452static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013453vec_any_lt(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013454{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013455 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013456 (vector unsigned short)__b,
13457 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013458}
13459
13460static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013461vec_any_lt(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013462{
13463 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013464 __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013465}
13466
13467static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013468vec_any_lt(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013469{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013470 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013471 (vector unsigned short)__b,
13472 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013473}
13474
13475static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013476vec_any_lt(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013477{
David Blaikie3302f2b2013-01-16 23:08:36 +000013478 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000013479}
13480
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013481static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013482vec_any_lt(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013483{
David Blaikie3302f2b2013-01-16 23:08:36 +000013484 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013485}
13486
13487static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013488vec_any_lt(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013489{
David Blaikie3302f2b2013-01-16 23:08:36 +000013490 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000013491}
13492
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013493static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013494vec_any_lt(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013495{
David Blaikie3302f2b2013-01-16 23:08:36 +000013496 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013497}
13498
13499static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013500vec_any_lt(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013501{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013502 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013503 (vector unsigned int)__b,
13504 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013505}
13506
13507static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013508vec_any_lt(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013509{
David Blaikie3302f2b2013-01-16 23:08:36 +000013510 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013511}
13512
13513static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013514vec_any_lt(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013515{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013516 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013517 (vector unsigned int)__b,
13518 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013519}
13520
Kit Barton8553bec2015-03-11 15:57:19 +000013521#ifdef __POWER8_VECTOR__
13522static int __ATTRS_o_ai
13523vec_any_lt(vector signed long long __a, vector signed long long __b)
13524{
13525 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, __a);
13526}
13527
13528static int __ATTRS_o_ai
13529vec_any_lt(vector unsigned long long __a, vector unsigned long long __b)
13530{
13531 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, __a);
13532}
13533
13534static int __ATTRS_o_ai
13535vec_any_lt(vector signed long long __a, vector bool long long __b)
13536{
13537 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV,
13538 (vector signed long long)__b, __a);
13539}
13540
13541static int __ATTRS_o_ai
13542vec_any_lt(vector unsigned long long __a, vector bool long long __b)
13543{
13544 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
13545 (vector unsigned long long)__b, __a);
13546}
13547
13548static int __ATTRS_o_ai
13549vec_any_lt(vector bool long long __a, vector signed long long __b)
13550{
13551 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
13552 (vector unsigned long long)__b,
13553 (vector unsigned long long)__a);
13554}
13555
13556static int __ATTRS_o_ai
13557vec_any_lt(vector bool long long __a, vector unsigned long long __b)
13558{
13559 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b,
13560 (vector unsigned long long)__a);
13561}
13562
13563static int __ATTRS_o_ai
13564vec_any_lt(vector bool long long __a, vector bool long long __b)
13565{
13566 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
13567 (vector unsigned long long)__b,
13568 (vector unsigned long long)__a);
13569}
13570#endif
13571
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013572static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013573vec_any_lt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013574{
David Blaikie3302f2b2013-01-16 23:08:36 +000013575 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000013576}
13577
13578/* vec_any_nan */
13579
13580static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000013581vec_any_nan(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +000013582{
David Blaikie3302f2b2013-01-16 23:08:36 +000013583 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000013584}
13585
13586/* vec_any_ne */
13587
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013588static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013589vec_any_ne(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013590{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013591 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013592 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013593}
13594
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013595static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013596vec_any_ne(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013597{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013598 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013599 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013600}
13601
13602static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013603vec_any_ne(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013604{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013605 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013606 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013607}
13608
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013609static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013610vec_any_ne(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013611{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013612 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013613 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013614}
13615
13616static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013617vec_any_ne(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013618{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013619 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013620 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013621}
13622
13623static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013624vec_any_ne(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013625{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013626 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013627 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013628}
13629
13630static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013631vec_any_ne(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013632{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013633 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013634 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013635}
13636
13637static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013638vec_any_ne(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013639{
David Blaikie3302f2b2013-01-16 23:08:36 +000013640 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013641}
13642
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013643static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013644vec_any_ne(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013645{
David Blaikie3302f2b2013-01-16 23:08:36 +000013646 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013647}
13648
13649static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013650vec_any_ne(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013651{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013652 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013653 (vector short)__a,
13654 (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013655}
13656
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013657static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013658vec_any_ne(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013659{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013660 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013661 (vector short)__a,
13662 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013663}
13664
13665static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013666vec_any_ne(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013667{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013668 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013669 (vector short)__a,
13670 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013671}
13672
13673static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013674vec_any_ne(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013675{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013676 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013677 (vector short)__a,
13678 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013679}
13680
13681static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013682vec_any_ne(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013683{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013684 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013685 (vector short)__a,
13686 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013687}
13688
13689static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013690vec_any_ne(vector pixel __a, vector pixel __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013691{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013692 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013693 (vector short)__a,
13694 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013695}
13696
13697static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013698vec_any_ne(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013699{
David Blaikie3302f2b2013-01-16 23:08:36 +000013700 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013701}
13702
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013703static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013704vec_any_ne(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013705{
David Blaikie3302f2b2013-01-16 23:08:36 +000013706 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013707}
13708
13709static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013710vec_any_ne(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013711{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013712 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013713 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013714}
13715
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013716static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013717vec_any_ne(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013718{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013719 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013720 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013721}
13722
13723static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013724vec_any_ne(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013725{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013726 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013727 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013728}
13729
13730static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013731vec_any_ne(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013732{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013733 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013734 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013735}
13736
13737static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013738vec_any_ne(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013739{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013740 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013741 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013742}
13743
Kit Barton8553bec2015-03-11 15:57:19 +000013744#ifdef __POWER8_VECTOR__
13745static int __ATTRS_o_ai
13746vec_any_ne(vector signed long long __a, vector signed long long __b)
13747{
13748 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, __b);
13749}
13750
13751static int __ATTRS_o_ai
13752vec_any_ne(vector unsigned long long __a, vector unsigned long long __b)
13753{
13754 return
13755 __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector long long)__a,
13756 (vector long long)__b);
13757}
13758
13759static int __ATTRS_o_ai
13760vec_any_ne(vector signed long long __a, vector bool long long __b)
13761{
13762 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a,
13763 (vector signed long long)__b);
13764}
13765
13766static int __ATTRS_o_ai
13767vec_any_ne(vector unsigned long long __a, vector bool long long __b)
13768{
13769 return
13770 __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector signed long long)__a,
13771 (vector signed long long)__b);
13772}
13773
13774static int __ATTRS_o_ai
13775vec_any_ne(vector bool long long __a, vector signed long long __b)
13776{
13777 return
13778 __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector signed long long)__a,
13779 (vector signed long long)__b);
13780}
13781
13782static int __ATTRS_o_ai
13783vec_any_ne(vector bool long long __a, vector unsigned long long __b)
13784{
13785 return
13786 __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector signed long long)__a,
13787 (vector signed long long)__b);
13788}
13789
13790static int __ATTRS_o_ai
13791vec_any_ne(vector bool long long __a, vector bool long long __b)
13792{
13793 return
13794 __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector signed long long)__a,
13795 (vector signed long long)__b);
13796}
13797#endif
13798
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013799static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013800vec_any_ne(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013801{
David Blaikie3302f2b2013-01-16 23:08:36 +000013802 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013803}
13804
13805/* vec_any_nge */
13806
13807static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000013808vec_any_nge(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013809{
David Blaikie3302f2b2013-01-16 23:08:36 +000013810 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013811}
13812
13813/* vec_any_ngt */
13814
13815static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000013816vec_any_ngt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013817{
David Blaikie3302f2b2013-01-16 23:08:36 +000013818 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013819}
13820
13821/* vec_any_nle */
13822
13823static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000013824vec_any_nle(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013825{
David Blaikie3302f2b2013-01-16 23:08:36 +000013826 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000013827}
13828
13829/* vec_any_nlt */
13830
13831static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000013832vec_any_nlt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013833{
David Blaikie3302f2b2013-01-16 23:08:36 +000013834 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000013835}
13836
13837/* vec_any_numeric */
13838
13839static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000013840vec_any_numeric(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +000013841{
David Blaikie3302f2b2013-01-16 23:08:36 +000013842 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000013843}
13844
13845/* vec_any_out */
13846
13847static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000013848vec_any_out(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013849{
David Blaikie3302f2b2013-01-16 23:08:36 +000013850 return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013851}
13852
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000013853/* Power 8 Crypto functions
13854Note: We diverge from the current GCC implementation with regard
13855to cryptography and related functions as follows:
13856- Only the SHA and AES instructions and builtins are disabled by -mno-crypto
13857- The remaining ones are only available on Power8 and up so
13858 require -mpower8-vector
13859The justification for this is that export requirements require that
13860Category:Vector.Crypto is optional (i.e. compliant hardware may not provide
13861support). As a result, we need to be able to turn off support for those.
13862The remaining ones (currently controlled by -mcrypto for GCC) still
13863need to be provided on compliant hardware even if Vector.Crypto is not
13864provided.
13865FIXME: the naming convention for the builtins will be adjusted due
13866to the inconsistency (__builtin_crypto_ prefix on builtins that cannot be
13867removed with -mno-crypto). This is under development.
13868*/
13869#ifdef __CRYPTO__
13870static vector unsigned long long __attribute__((__always_inline__))
13871__builtin_crypto_vsbox (vector unsigned long long __a)
13872{
13873 return __builtin_altivec_crypto_vsbox(__a);
13874}
13875
13876static vector unsigned long long __attribute__((__always_inline__))
13877__builtin_crypto_vcipher (vector unsigned long long __a,
13878 vector unsigned long long __b)
13879{
13880 return __builtin_altivec_crypto_vcipher(__a, __b);
13881}
13882
13883static vector unsigned long long __attribute__((__always_inline__))
13884__builtin_crypto_vcipherlast (vector unsigned long long __a,
13885 vector unsigned long long __b)
13886{
13887 return __builtin_altivec_crypto_vcipherlast(__a, __b);
13888}
13889
13890static vector unsigned long long __attribute__((__always_inline__))
13891__builtin_crypto_vncipher (vector unsigned long long __a,
13892 vector unsigned long long __b)
13893{
13894 return __builtin_altivec_crypto_vncipher(__a, __b);
13895}
13896
13897static vector unsigned long long __attribute__((__always_inline__))
13898__builtin_crypto_vncipherlast (vector unsigned long long __a,
13899 vector unsigned long long __b)
13900{
13901 return __builtin_altivec_crypto_vncipherlast(__a, __b);
13902}
13903
13904
13905#define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad
13906#define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw
13907#endif
13908
13909#ifdef __POWER8_VECTOR__
13910static vector unsigned char __ATTRS_o_ai
13911__builtin_crypto_vpermxor (vector unsigned char __a,
13912 vector unsigned char __b,
13913 vector unsigned char __c)
13914{
13915 return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
13916}
13917
13918static vector unsigned short __ATTRS_o_ai
13919__builtin_crypto_vpermxor (vector unsigned short __a,
13920 vector unsigned short __b,
13921 vector unsigned short __c)
13922{
13923 return (vector unsigned short)
13924 __builtin_altivec_crypto_vpermxor((vector unsigned char) __a,
13925 (vector unsigned char) __b,
13926 (vector unsigned char) __c);
13927}
13928
13929static vector unsigned int __ATTRS_o_ai
13930__builtin_crypto_vpermxor (vector unsigned int __a,
13931 vector unsigned int __b,
13932 vector unsigned int __c)
13933{
13934 return (vector unsigned int)
13935 __builtin_altivec_crypto_vpermxor((vector unsigned char) __a,
13936 (vector unsigned char) __b,
13937 (vector unsigned char) __c);
13938}
13939
13940static vector unsigned long long __ATTRS_o_ai
13941__builtin_crypto_vpermxor (vector unsigned long long __a,
13942 vector unsigned long long __b,
13943 vector unsigned long long __c)
13944{
13945 return (vector unsigned long long)
13946 __builtin_altivec_crypto_vpermxor((vector unsigned char) __a,
13947 (vector unsigned char) __b,
13948 (vector unsigned char) __c);
13949}
13950
13951static vector unsigned char __ATTRS_o_ai
13952__builtin_crypto_vpmsumb (vector unsigned char __a,
13953 vector unsigned char __b)
13954{
13955 return __builtin_altivec_crypto_vpmsumb(__a, __b);
13956}
13957
13958static vector unsigned short __ATTRS_o_ai
13959__builtin_crypto_vpmsumb (vector unsigned short __a,
13960 vector unsigned short __b)
13961{
13962 return __builtin_altivec_crypto_vpmsumh(__a, __b);
13963}
13964
13965static vector unsigned int __ATTRS_o_ai
13966__builtin_crypto_vpmsumb (vector unsigned int __a,
13967 vector unsigned int __b)
13968{
13969 return __builtin_altivec_crypto_vpmsumw(__a, __b);
13970}
13971
13972static vector unsigned long long __ATTRS_o_ai
13973__builtin_crypto_vpmsumb (vector unsigned long long __a,
13974 vector unsigned long long __b)
13975{
13976 return __builtin_altivec_crypto_vpmsumd(__a, __b);
13977}
13978#endif
13979
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013980#undef __ATTRS_o_ai
Chris Lattnerdad40622010-04-14 03:54:58 +000013981
13982#endif /* __ALTIVEC_H */