blob: 2bce9e765326908043ac1ba4b9b6247f0b4f89d1 [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
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000260static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000261vec_add(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000262{
David Blaikie3302f2b2013-01-16 23:08:36 +0000263 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000264}
265
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000266/* vec_vaddubm */
267
268#define __builtin_altivec_vaddubm vec_vaddubm
269
270static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000271vec_vaddubm(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000272{
David Blaikie3302f2b2013-01-16 23:08:36 +0000273 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000274}
275
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000276static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000277vec_vaddubm(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000278{
David Blaikie3302f2b2013-01-16 23:08:36 +0000279 return (vector signed char)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000280}
281
282static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000283vec_vaddubm(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000284{
David Blaikie3302f2b2013-01-16 23:08:36 +0000285 return __a + (vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000286}
287
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000288static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000289vec_vaddubm(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000290{
David Blaikie3302f2b2013-01-16 23:08:36 +0000291 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000292}
293
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000294static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000295vec_vaddubm(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000296{
David Blaikie3302f2b2013-01-16 23:08:36 +0000297 return (vector unsigned char)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000298}
299
300static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000301vec_vaddubm(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000302{
David Blaikie3302f2b2013-01-16 23:08:36 +0000303 return __a + (vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000304}
305
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000306/* vec_vadduhm */
307
308#define __builtin_altivec_vadduhm vec_vadduhm
309
310static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000311vec_vadduhm(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000312{
David Blaikie3302f2b2013-01-16 23:08:36 +0000313 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000314}
315
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000316static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000317vec_vadduhm(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000318{
David Blaikie3302f2b2013-01-16 23:08:36 +0000319 return (vector short)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000320}
321
322static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000323vec_vadduhm(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000324{
David Blaikie3302f2b2013-01-16 23:08:36 +0000325 return __a + (vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000326}
327
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000328static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000329vec_vadduhm(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000330{
David Blaikie3302f2b2013-01-16 23:08:36 +0000331 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000332}
333
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000334static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000335vec_vadduhm(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000336{
David Blaikie3302f2b2013-01-16 23:08:36 +0000337 return (vector unsigned short)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000338}
339
340static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000341vec_vadduhm(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000342{
David Blaikie3302f2b2013-01-16 23:08:36 +0000343 return __a + (vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000344}
345
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000346/* vec_vadduwm */
347
348#define __builtin_altivec_vadduwm vec_vadduwm
349
350static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000351vec_vadduwm(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000352{
David Blaikie3302f2b2013-01-16 23:08:36 +0000353 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000354}
355
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000356static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000357vec_vadduwm(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000358{
David Blaikie3302f2b2013-01-16 23:08:36 +0000359 return (vector int)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000360}
361
362static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000363vec_vadduwm(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000364{
David Blaikie3302f2b2013-01-16 23:08:36 +0000365 return __a + (vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000366}
367
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000368static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000369vec_vadduwm(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000370{
David Blaikie3302f2b2013-01-16 23:08:36 +0000371 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000372}
373
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000374static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000375vec_vadduwm(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000376{
David Blaikie3302f2b2013-01-16 23:08:36 +0000377 return (vector unsigned int)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000378}
379
380static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000381vec_vadduwm(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000382{
David Blaikie3302f2b2013-01-16 23:08:36 +0000383 return __a + (vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000384}
385
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000386/* vec_vaddfp */
387
388#define __builtin_altivec_vaddfp vec_vaddfp
389
390static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +0000391vec_vaddfp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000392{
David Blaikie3302f2b2013-01-16 23:08:36 +0000393 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000394}
395
Chris Lattnerdad40622010-04-14 03:54:58 +0000396/* vec_addc */
397
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000398static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +0000399vec_addc(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000400{
David Blaikie3302f2b2013-01-16 23:08:36 +0000401 return __builtin_altivec_vaddcuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000402}
403
404/* vec_vaddcuw */
405
406static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +0000407vec_vaddcuw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000408{
David Blaikie3302f2b2013-01-16 23:08:36 +0000409 return __builtin_altivec_vaddcuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000410}
Chris Lattnerdad40622010-04-14 03:54:58 +0000411
412/* vec_adds */
413
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000414static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000415vec_adds(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000416{
David Blaikie3302f2b2013-01-16 23:08:36 +0000417 return __builtin_altivec_vaddsbs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000418}
419
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000420static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000421vec_adds(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000422{
David Blaikie3302f2b2013-01-16 23:08:36 +0000423 return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000424}
425
426static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000427vec_adds(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000428{
David Blaikie3302f2b2013-01-16 23:08:36 +0000429 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000430}
431
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000432static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000433vec_adds(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000434{
David Blaikie3302f2b2013-01-16 23:08:36 +0000435 return __builtin_altivec_vaddubs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000436}
437
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000438static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000439vec_adds(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000440{
David Blaikie3302f2b2013-01-16 23:08:36 +0000441 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000442}
443
444static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000445vec_adds(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000446{
David Blaikie3302f2b2013-01-16 23:08:36 +0000447 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000448}
449
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000450static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000451vec_adds(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000452{
David Blaikie3302f2b2013-01-16 23:08:36 +0000453 return __builtin_altivec_vaddshs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000454}
455
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000456static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000457vec_adds(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000458{
David Blaikie3302f2b2013-01-16 23:08:36 +0000459 return __builtin_altivec_vaddshs((vector short)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000460}
461
462static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000463vec_adds(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000464{
David Blaikie3302f2b2013-01-16 23:08:36 +0000465 return __builtin_altivec_vaddshs(__a, (vector short)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000466}
467
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000468static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000469vec_adds(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000470{
David Blaikie3302f2b2013-01-16 23:08:36 +0000471 return __builtin_altivec_vadduhs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000472}
473
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000474static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000475vec_adds(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000476{
David Blaikie3302f2b2013-01-16 23:08:36 +0000477 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000478}
479
480static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000481vec_adds(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000482{
David Blaikie3302f2b2013-01-16 23:08:36 +0000483 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000484}
485
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000486static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000487vec_adds(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000488{
David Blaikie3302f2b2013-01-16 23:08:36 +0000489 return __builtin_altivec_vaddsws(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000490}
491
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000492static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000493vec_adds(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000494{
David Blaikie3302f2b2013-01-16 23:08:36 +0000495 return __builtin_altivec_vaddsws((vector int)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000496}
497
498static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000499vec_adds(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000500{
David Blaikie3302f2b2013-01-16 23:08:36 +0000501 return __builtin_altivec_vaddsws(__a, (vector int)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000502}
503
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000504static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000505vec_adds(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000506{
David Blaikie3302f2b2013-01-16 23:08:36 +0000507 return __builtin_altivec_vadduws(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000508}
509
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000510static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000511vec_adds(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000512{
David Blaikie3302f2b2013-01-16 23:08:36 +0000513 return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000514}
515
516static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000517vec_adds(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000518{
David Blaikie3302f2b2013-01-16 23:08:36 +0000519 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000520}
521
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000522/* vec_vaddsbs */
Chris Lattnerdad40622010-04-14 03:54:58 +0000523
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000524static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000525vec_vaddsbs(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000526{
David Blaikie3302f2b2013-01-16 23:08:36 +0000527 return __builtin_altivec_vaddsbs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000528}
529
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000530static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000531vec_vaddsbs(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000532{
David Blaikie3302f2b2013-01-16 23:08:36 +0000533 return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000534}
535
536static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000537vec_vaddsbs(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000538{
David Blaikie3302f2b2013-01-16 23:08:36 +0000539 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000540}
541
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000542/* vec_vaddubs */
543
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000544static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000545vec_vaddubs(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000546{
David Blaikie3302f2b2013-01-16 23:08:36 +0000547 return __builtin_altivec_vaddubs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000548}
549
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000550static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000551vec_vaddubs(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000552{
David Blaikie3302f2b2013-01-16 23:08:36 +0000553 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000554}
555
556static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000557vec_vaddubs(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000558{
David Blaikie3302f2b2013-01-16 23:08:36 +0000559 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000560}
561
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000562/* vec_vaddshs */
563
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000564static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000565vec_vaddshs(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000566{
David Blaikie3302f2b2013-01-16 23:08:36 +0000567 return __builtin_altivec_vaddshs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000568}
569
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000570static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000571vec_vaddshs(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000572{
David Blaikie3302f2b2013-01-16 23:08:36 +0000573 return __builtin_altivec_vaddshs((vector short)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000574}
575
576static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000577vec_vaddshs(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000578{
David Blaikie3302f2b2013-01-16 23:08:36 +0000579 return __builtin_altivec_vaddshs(__a, (vector short)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000580}
581
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000582/* vec_vadduhs */
583
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000584static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000585vec_vadduhs(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000586{
David Blaikie3302f2b2013-01-16 23:08:36 +0000587 return __builtin_altivec_vadduhs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000588}
589
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000590static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000591vec_vadduhs(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000592{
David Blaikie3302f2b2013-01-16 23:08:36 +0000593 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000594}
595
596static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000597vec_vadduhs(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000598{
David Blaikie3302f2b2013-01-16 23:08:36 +0000599 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000600}
601
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000602/* vec_vaddsws */
603
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000604static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000605vec_vaddsws(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000606{
David Blaikie3302f2b2013-01-16 23:08:36 +0000607 return __builtin_altivec_vaddsws(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000608}
609
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000610static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000611vec_vaddsws(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000612{
David Blaikie3302f2b2013-01-16 23:08:36 +0000613 return __builtin_altivec_vaddsws((vector int)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000614}
615
616static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000617vec_vaddsws(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000618{
David Blaikie3302f2b2013-01-16 23:08:36 +0000619 return __builtin_altivec_vaddsws(__a, (vector int)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000620}
621
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000622/* vec_vadduws */
623
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000624static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000625vec_vadduws(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000626{
David Blaikie3302f2b2013-01-16 23:08:36 +0000627 return __builtin_altivec_vadduws(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000628}
629
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000630static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000631vec_vadduws(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000632{
David Blaikie3302f2b2013-01-16 23:08:36 +0000633 return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000634}
635
636static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000637vec_vadduws(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000638{
David Blaikie3302f2b2013-01-16 23:08:36 +0000639 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000640}
641
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000642/* vec_and */
643
644#define __builtin_altivec_vand vec_and
645
646static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000647vec_and(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000648{
David Blaikie3302f2b2013-01-16 23:08:36 +0000649 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000650}
651
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000652static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000653vec_and(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000654{
David Blaikie3302f2b2013-01-16 23:08:36 +0000655 return (vector signed char)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000656}
657
658static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000659vec_and(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000660{
David Blaikie3302f2b2013-01-16 23:08:36 +0000661 return __a & (vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000662}
663
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000664static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000665vec_and(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000666{
David Blaikie3302f2b2013-01-16 23:08:36 +0000667 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000668}
669
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000670static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000671vec_and(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000672{
David Blaikie3302f2b2013-01-16 23:08:36 +0000673 return (vector unsigned char)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000674}
675
676static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000677vec_and(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000678{
David Blaikie3302f2b2013-01-16 23:08:36 +0000679 return __a & (vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000680}
681
682static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000683vec_and(vector bool char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000684{
David Blaikie3302f2b2013-01-16 23:08:36 +0000685 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000686}
687
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000688static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000689vec_and(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000690{
David Blaikie3302f2b2013-01-16 23:08:36 +0000691 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000692}
693
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000694static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000695vec_and(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000696{
David Blaikie3302f2b2013-01-16 23:08:36 +0000697 return (vector short)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000698}
699
700static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000701vec_and(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000702{
David Blaikie3302f2b2013-01-16 23:08:36 +0000703 return __a & (vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000704}
705
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000706static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000707vec_and(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000708{
David Blaikie3302f2b2013-01-16 23:08:36 +0000709 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000710}
711
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000712static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000713vec_and(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000714{
David Blaikie3302f2b2013-01-16 23:08:36 +0000715 return (vector unsigned short)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000716}
717
718static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000719vec_and(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000720{
David Blaikie3302f2b2013-01-16 23:08:36 +0000721 return __a & (vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000722}
723
724static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000725vec_and(vector bool short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000726{
David Blaikie3302f2b2013-01-16 23:08:36 +0000727 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000728}
729
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000730static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000731vec_and(vector int __a, vector int __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 int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000737vec_and(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000738{
David Blaikie3302f2b2013-01-16 23:08:36 +0000739 return (vector int)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000740}
741
742static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000743vec_and(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000744{
David Blaikie3302f2b2013-01-16 23:08:36 +0000745 return __a & (vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000746}
747
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000748static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000749vec_and(vector unsigned int __a, vector unsigned int __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 int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000755vec_and(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000756{
David Blaikie3302f2b2013-01-16 23:08:36 +0000757 return (vector unsigned int)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000758}
759
760static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000761vec_and(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000762{
David Blaikie3302f2b2013-01-16 23:08:36 +0000763 return __a & (vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000764}
765
766static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000767vec_and(vector bool int __a, vector bool int __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 float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000773vec_and(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000774{
David Blaikie3302f2b2013-01-16 23:08:36 +0000775 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
776 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000777}
778
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000779static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000780vec_and(vector bool int __a, vector float __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000781{
David Blaikie3302f2b2013-01-16 23:08:36 +0000782 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
783 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000784}
785
786static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000787vec_and(vector float __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000788{
David Blaikie3302f2b2013-01-16 23:08:36 +0000789 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
790 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000791}
792
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000793/* vec_vand */
794
795static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000796vec_vand(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000797{
David Blaikie3302f2b2013-01-16 23:08:36 +0000798 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000799}
800
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000801static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000802vec_vand(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000803{
David Blaikie3302f2b2013-01-16 23:08:36 +0000804 return (vector signed char)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000805}
806
807static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000808vec_vand(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000809{
David Blaikie3302f2b2013-01-16 23:08:36 +0000810 return __a & (vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000811}
812
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000813static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000814vec_vand(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000815{
David Blaikie3302f2b2013-01-16 23:08:36 +0000816 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000817}
818
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000819static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000820vec_vand(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000821{
David Blaikie3302f2b2013-01-16 23:08:36 +0000822 return (vector unsigned char)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000823}
824
825static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000826vec_vand(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000827{
David Blaikie3302f2b2013-01-16 23:08:36 +0000828 return __a & (vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000829}
830
831static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000832vec_vand(vector bool char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000833{
David Blaikie3302f2b2013-01-16 23:08:36 +0000834 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000835}
836
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000837static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000838vec_vand(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000839{
David Blaikie3302f2b2013-01-16 23:08:36 +0000840 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000841}
842
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000843static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000844vec_vand(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000845{
David Blaikie3302f2b2013-01-16 23:08:36 +0000846 return (vector short)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000847}
848
849static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000850vec_vand(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000851{
David Blaikie3302f2b2013-01-16 23:08:36 +0000852 return __a & (vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000853}
854
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000855static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000856vec_vand(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000857{
David Blaikie3302f2b2013-01-16 23:08:36 +0000858 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000859}
860
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000861static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000862vec_vand(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000863{
David Blaikie3302f2b2013-01-16 23:08:36 +0000864 return (vector unsigned short)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000865}
866
867static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000868vec_vand(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000869{
David Blaikie3302f2b2013-01-16 23:08:36 +0000870 return __a & (vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000871}
872
873static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000874vec_vand(vector bool short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000875{
David Blaikie3302f2b2013-01-16 23:08:36 +0000876 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000877}
878
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000879static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000880vec_vand(vector int __a, vector int __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 int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000886vec_vand(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000887{
David Blaikie3302f2b2013-01-16 23:08:36 +0000888 return (vector int)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000889}
890
891static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000892vec_vand(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000893{
David Blaikie3302f2b2013-01-16 23:08:36 +0000894 return __a & (vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000895}
896
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000897static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000898vec_vand(vector unsigned int __a, vector unsigned int __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 int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000904vec_vand(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000905{
David Blaikie3302f2b2013-01-16 23:08:36 +0000906 return (vector unsigned int)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000907}
908
909static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000910vec_vand(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000911{
David Blaikie3302f2b2013-01-16 23:08:36 +0000912 return __a & (vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000913}
914
915static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000916vec_vand(vector bool int __a, vector bool int __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 float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000922vec_vand(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000923{
David Blaikie3302f2b2013-01-16 23:08:36 +0000924 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
925 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000926}
927
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000928static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000929vec_vand(vector bool int __a, vector float __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000930{
David Blaikie3302f2b2013-01-16 23:08:36 +0000931 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
932 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000933}
934
935static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000936vec_vand(vector float __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000937{
David Blaikie3302f2b2013-01-16 23:08:36 +0000938 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
939 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000940}
941
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000942/* vec_andc */
943
944#define __builtin_altivec_vandc vec_andc
945
946static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000947vec_andc(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000948{
David Blaikie3302f2b2013-01-16 23:08:36 +0000949 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000950}
951
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000952static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000953vec_andc(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000954{
David Blaikie3302f2b2013-01-16 23:08:36 +0000955 return (vector signed char)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000956}
957
958static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000959vec_andc(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000960{
David Blaikie3302f2b2013-01-16 23:08:36 +0000961 return __a & ~(vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000962}
963
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000964static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000965vec_andc(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000966{
David Blaikie3302f2b2013-01-16 23:08:36 +0000967 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000968}
969
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000970static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000971vec_andc(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000972{
David Blaikie3302f2b2013-01-16 23:08:36 +0000973 return (vector unsigned char)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000974}
975
976static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000977vec_andc(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000978{
David Blaikie3302f2b2013-01-16 23:08:36 +0000979 return __a & ~(vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000980}
981
982static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000983vec_andc(vector bool char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000984{
David Blaikie3302f2b2013-01-16 23:08:36 +0000985 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000986}
987
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000988static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000989vec_andc(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000990{
David Blaikie3302f2b2013-01-16 23:08:36 +0000991 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000992}
993
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000994static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000995vec_andc(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000996{
David Blaikie3302f2b2013-01-16 23:08:36 +0000997 return (vector short)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000998}
999
1000static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001001vec_andc(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001002{
David Blaikie3302f2b2013-01-16 23:08:36 +00001003 return __a & ~(vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001004}
1005
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001006static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001007vec_andc(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001008{
David Blaikie3302f2b2013-01-16 23:08:36 +00001009 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001010}
1011
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001012static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001013vec_andc(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001014{
David Blaikie3302f2b2013-01-16 23:08:36 +00001015 return (vector unsigned short)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001016}
1017
1018static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001019vec_andc(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001020{
David Blaikie3302f2b2013-01-16 23:08:36 +00001021 return __a & ~(vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001022}
1023
1024static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001025vec_andc(vector bool short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001026{
David Blaikie3302f2b2013-01-16 23:08:36 +00001027 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001028}
1029
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001030static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001031vec_andc(vector int __a, vector int __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 int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001037vec_andc(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001038{
David Blaikie3302f2b2013-01-16 23:08:36 +00001039 return (vector int)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001040}
1041
1042static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001043vec_andc(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001044{
David Blaikie3302f2b2013-01-16 23:08:36 +00001045 return __a & ~(vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001046}
1047
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001048static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001049vec_andc(vector unsigned int __a, vector unsigned int __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 int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001055vec_andc(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001056{
David Blaikie3302f2b2013-01-16 23:08:36 +00001057 return (vector unsigned int)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001058}
1059
1060static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001061vec_andc(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001062{
David Blaikie3302f2b2013-01-16 23:08:36 +00001063 return __a & ~(vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001064}
1065
1066static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001067vec_andc(vector bool int __a, vector bool int __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 float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001073vec_andc(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001074{
David Blaikie3302f2b2013-01-16 23:08:36 +00001075 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1076 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001077}
1078
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001079static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001080vec_andc(vector bool int __a, vector float __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001081{
David Blaikie3302f2b2013-01-16 23:08:36 +00001082 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1083 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001084}
1085
1086static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001087vec_andc(vector float __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001088{
David Blaikie3302f2b2013-01-16 23:08:36 +00001089 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1090 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001091}
1092
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001093/* vec_vandc */
1094
1095static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001096vec_vandc(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001097{
David Blaikie3302f2b2013-01-16 23:08:36 +00001098 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001099}
1100
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001101static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001102vec_vandc(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001103{
David Blaikie3302f2b2013-01-16 23:08:36 +00001104 return (vector signed char)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001105}
1106
1107static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001108vec_vandc(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001109{
David Blaikie3302f2b2013-01-16 23:08:36 +00001110 return __a & ~(vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001111}
1112
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001113static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001114vec_vandc(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001115{
David Blaikie3302f2b2013-01-16 23:08:36 +00001116 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001117}
1118
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001119static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001120vec_vandc(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001121{
David Blaikie3302f2b2013-01-16 23:08:36 +00001122 return (vector unsigned char)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001123}
1124
1125static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001126vec_vandc(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001127{
David Blaikie3302f2b2013-01-16 23:08:36 +00001128 return __a & ~(vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001129}
1130
1131static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001132vec_vandc(vector bool char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001133{
David Blaikie3302f2b2013-01-16 23:08:36 +00001134 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001135}
1136
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001137static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001138vec_vandc(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001139{
David Blaikie3302f2b2013-01-16 23:08:36 +00001140 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001141}
1142
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001143static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001144vec_vandc(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001145{
David Blaikie3302f2b2013-01-16 23:08:36 +00001146 return (vector short)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001147}
1148
1149static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001150vec_vandc(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001151{
David Blaikie3302f2b2013-01-16 23:08:36 +00001152 return __a & ~(vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001153}
1154
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001155static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001156vec_vandc(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001157{
David Blaikie3302f2b2013-01-16 23:08:36 +00001158 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001159}
1160
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001161static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001162vec_vandc(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001163{
David Blaikie3302f2b2013-01-16 23:08:36 +00001164 return (vector unsigned short)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001165}
1166
1167static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001168vec_vandc(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001169{
David Blaikie3302f2b2013-01-16 23:08:36 +00001170 return __a & ~(vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001171}
1172
1173static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001174vec_vandc(vector bool short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001175{
David Blaikie3302f2b2013-01-16 23:08:36 +00001176 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001177}
1178
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001179static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001180vec_vandc(vector int __a, vector int __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 int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001186vec_vandc(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001187{
David Blaikie3302f2b2013-01-16 23:08:36 +00001188 return (vector int)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001189}
1190
1191static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001192vec_vandc(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001193{
David Blaikie3302f2b2013-01-16 23:08:36 +00001194 return __a & ~(vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001195}
1196
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001197static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001198vec_vandc(vector unsigned int __a, vector unsigned int __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 int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001204vec_vandc(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001205{
David Blaikie3302f2b2013-01-16 23:08:36 +00001206 return (vector unsigned int)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001207}
1208
1209static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001210vec_vandc(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001211{
David Blaikie3302f2b2013-01-16 23:08:36 +00001212 return __a & ~(vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001213}
1214
1215static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001216vec_vandc(vector bool int __a, vector bool int __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 float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001222vec_vandc(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001223{
David Blaikie3302f2b2013-01-16 23:08:36 +00001224 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1225 return (vector float)__res;
Chris Lattnerdad40622010-04-14 03:54:58 +00001226}
1227
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001228static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001229vec_vandc(vector bool int __a, vector float __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001230{
David Blaikie3302f2b2013-01-16 23:08:36 +00001231 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1232 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001233}
1234
1235static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001236vec_vandc(vector float __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001237{
David Blaikie3302f2b2013-01-16 23:08:36 +00001238 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1239 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001240}
1241
Chris Lattnerdad40622010-04-14 03:54:58 +00001242/* vec_avg */
1243
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001244static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001245vec_avg(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001246{
David Blaikie3302f2b2013-01-16 23:08:36 +00001247 return __builtin_altivec_vavgsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001248}
1249
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001250static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001251vec_avg(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001252{
David Blaikie3302f2b2013-01-16 23:08:36 +00001253 return __builtin_altivec_vavgub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001254}
1255
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001256static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001257vec_avg(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001258{
David Blaikie3302f2b2013-01-16 23:08:36 +00001259 return __builtin_altivec_vavgsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001260}
1261
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001262static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001263vec_avg(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001264{
David Blaikie3302f2b2013-01-16 23:08:36 +00001265 return __builtin_altivec_vavguh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001266}
1267
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001268static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001269vec_avg(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001270{
David Blaikie3302f2b2013-01-16 23:08:36 +00001271 return __builtin_altivec_vavgsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001272}
1273
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001274static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001275vec_avg(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001276{
David Blaikie3302f2b2013-01-16 23:08:36 +00001277 return __builtin_altivec_vavguw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001278}
1279
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001280/* vec_vavgsb */
Chris Lattnerdad40622010-04-14 03:54:58 +00001281
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001282static vector signed char __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001283vec_vavgsb(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001284{
David Blaikie3302f2b2013-01-16 23:08:36 +00001285 return __builtin_altivec_vavgsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001286}
1287
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001288/* vec_vavgub */
1289
1290static vector unsigned char __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001291vec_vavgub(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001292{
David Blaikie3302f2b2013-01-16 23:08:36 +00001293 return __builtin_altivec_vavgub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001294}
1295
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001296/* vec_vavgsh */
1297
1298static vector short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001299vec_vavgsh(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001300{
David Blaikie3302f2b2013-01-16 23:08:36 +00001301 return __builtin_altivec_vavgsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001302}
1303
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001304/* vec_vavguh */
1305
1306static vector unsigned short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001307vec_vavguh(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001308{
David Blaikie3302f2b2013-01-16 23:08:36 +00001309 return __builtin_altivec_vavguh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001310}
1311
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001312/* vec_vavgsw */
1313
1314static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001315vec_vavgsw(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001316{
David Blaikie3302f2b2013-01-16 23:08:36 +00001317 return __builtin_altivec_vavgsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001318}
1319
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001320/* vec_vavguw */
1321
1322static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001323vec_vavguw(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001324{
David Blaikie3302f2b2013-01-16 23:08:36 +00001325 return __builtin_altivec_vavguw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001326}
1327
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001328/* vec_ceil */
1329
1330static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001331vec_ceil(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +00001332{
David Blaikie3302f2b2013-01-16 23:08:36 +00001333 return __builtin_altivec_vrfip(__a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001334}
1335
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001336/* vec_vrfip */
Chris Lattnerdad40622010-04-14 03:54:58 +00001337
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001338static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001339vec_vrfip(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +00001340{
David Blaikie3302f2b2013-01-16 23:08:36 +00001341 return __builtin_altivec_vrfip(__a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001342}
1343
1344/* vec_cmpb */
1345
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001346static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001347vec_cmpb(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001348{
David Blaikie3302f2b2013-01-16 23:08:36 +00001349 return __builtin_altivec_vcmpbfp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001350}
1351
1352/* vec_vcmpbfp */
1353
1354static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001355vec_vcmpbfp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001356{
David Blaikie3302f2b2013-01-16 23:08:36 +00001357 return __builtin_altivec_vcmpbfp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001358}
Chris Lattnerdad40622010-04-14 03:54:58 +00001359
1360/* vec_cmpeq */
1361
Anton Yartsevfc83c602010-08-19 03:21:36 +00001362static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001363vec_cmpeq(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001364{
Anton Yartsevfc83c602010-08-19 03:21:36 +00001365 return (vector bool char)
David Blaikie3302f2b2013-01-16 23:08:36 +00001366 __builtin_altivec_vcmpequb((vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001367}
1368
Anton Yartsevfc83c602010-08-19 03:21:36 +00001369static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001370vec_cmpeq(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001371{
Anton Yartsevfc83c602010-08-19 03:21:36 +00001372 return (vector bool char)
David Blaikie3302f2b2013-01-16 23:08:36 +00001373 __builtin_altivec_vcmpequb((vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001374}
1375
Anton Yartsevfc83c602010-08-19 03:21:36 +00001376static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001377vec_cmpeq(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001378{
David Blaikie3302f2b2013-01-16 23:08:36 +00001379 return (vector bool short)__builtin_altivec_vcmpequh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001380}
1381
Anton Yartsevfc83c602010-08-19 03:21:36 +00001382static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001383vec_cmpeq(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001384{
Anton Yartsevfc83c602010-08-19 03:21:36 +00001385 return (vector bool short)
David Blaikie3302f2b2013-01-16 23:08:36 +00001386 __builtin_altivec_vcmpequh((vector short)__a, (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001387}
1388
Anton Yartsevfc83c602010-08-19 03:21:36 +00001389static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001390vec_cmpeq(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001391{
David Blaikie3302f2b2013-01-16 23:08:36 +00001392 return (vector bool int)__builtin_altivec_vcmpequw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001393}
1394
Anton Yartsevfc83c602010-08-19 03:21:36 +00001395static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001396vec_cmpeq(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001397{
Anton Yartsevfc83c602010-08-19 03:21:36 +00001398 return (vector bool int)
David Blaikie3302f2b2013-01-16 23:08:36 +00001399 __builtin_altivec_vcmpequw((vector int)__a, (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001400}
1401
Kit Barton8553bec2015-03-11 15:57:19 +00001402#ifdef __POWER8_VECTOR__
1403static vector bool long long __ATTRS_o_ai
1404vec_cmpeq(vector signed long long __a, vector signed long long __b)
1405{
1406 return (vector bool long long) __builtin_altivec_vcmpequd(__a, __b);
1407}
1408
1409static vector bool long long __ATTRS_o_ai
1410vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b)
1411{
1412 return (vector bool long long)
1413 __builtin_altivec_vcmpequd((vector long long)__a, (vector long long) __b);
1414}
1415#endif
1416
Anton Yartsevfc83c602010-08-19 03:21:36 +00001417static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001418vec_cmpeq(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001419{
David Blaikie3302f2b2013-01-16 23:08:36 +00001420 return (vector bool int)__builtin_altivec_vcmpeqfp(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001421}
1422
1423/* vec_cmpge */
1424
Anton Yartsevfc83c602010-08-19 03:21:36 +00001425static vector bool int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001426vec_cmpge(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001427{
David Blaikie3302f2b2013-01-16 23:08:36 +00001428 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001429}
1430
1431/* vec_vcmpgefp */
1432
Anton Yartsevfc83c602010-08-19 03:21:36 +00001433static vector bool int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001434vec_vcmpgefp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001435{
David Blaikie3302f2b2013-01-16 23:08:36 +00001436 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001437}
Chris Lattnerdad40622010-04-14 03:54:58 +00001438
1439/* vec_cmpgt */
1440
Anton Yartsevfc83c602010-08-19 03:21:36 +00001441static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001442vec_cmpgt(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001443{
David Blaikie3302f2b2013-01-16 23:08:36 +00001444 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001445}
1446
Anton Yartsevfc83c602010-08-19 03:21:36 +00001447static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001448vec_cmpgt(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001449{
David Blaikie3302f2b2013-01-16 23:08:36 +00001450 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001451}
1452
Anton Yartsevfc83c602010-08-19 03:21:36 +00001453static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001454vec_cmpgt(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001455{
David Blaikie3302f2b2013-01-16 23:08:36 +00001456 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001457}
1458
Anton Yartsevfc83c602010-08-19 03:21:36 +00001459static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001460vec_cmpgt(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001461{
David Blaikie3302f2b2013-01-16 23:08:36 +00001462 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001463}
1464
Anton Yartsevfc83c602010-08-19 03:21:36 +00001465static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001466vec_cmpgt(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001467{
David Blaikie3302f2b2013-01-16 23:08:36 +00001468 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001469}
1470
Anton Yartsevfc83c602010-08-19 03:21:36 +00001471static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001472vec_cmpgt(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001473{
David Blaikie3302f2b2013-01-16 23:08:36 +00001474 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001475}
1476
Kit Barton8553bec2015-03-11 15:57:19 +00001477#ifdef __POWER8_VECTOR__
1478static vector bool long long __ATTRS_o_ai
1479vec_cmpgt(vector signed long long __a, vector signed long long __b)
1480{
1481 return (vector bool long long)__builtin_altivec_vcmpgtsd(__a, __b);
1482}
1483
1484static vector bool long long __ATTRS_o_ai
1485vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b)
1486{
1487 return (vector bool long long)__builtin_altivec_vcmpgtud(__a, __b);
1488}
1489#endif
1490
Anton Yartsevfc83c602010-08-19 03:21:36 +00001491static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001492vec_cmpgt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001493{
David Blaikie3302f2b2013-01-16 23:08:36 +00001494 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001495}
1496
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001497/* vec_vcmpgtsb */
Chris Lattnerdad40622010-04-14 03:54:58 +00001498
Anton Yartsevfc83c602010-08-19 03:21:36 +00001499static vector bool char __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001500vec_vcmpgtsb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001501{
David Blaikie3302f2b2013-01-16 23:08:36 +00001502 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001503}
1504
1505/* vec_vcmpgtub */
1506
Anton Yartsevfc83c602010-08-19 03:21:36 +00001507static vector bool char __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001508vec_vcmpgtub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001509{
David Blaikie3302f2b2013-01-16 23:08:36 +00001510 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001511}
1512
1513/* vec_vcmpgtsh */
1514
Anton Yartsevfc83c602010-08-19 03:21:36 +00001515static vector bool short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001516vec_vcmpgtsh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001517{
David Blaikie3302f2b2013-01-16 23:08:36 +00001518 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001519}
1520
1521/* vec_vcmpgtuh */
1522
Anton Yartsevfc83c602010-08-19 03:21:36 +00001523static vector bool short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001524vec_vcmpgtuh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001525{
David Blaikie3302f2b2013-01-16 23:08:36 +00001526 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001527}
1528
1529/* vec_vcmpgtsw */
1530
Anton Yartsevfc83c602010-08-19 03:21:36 +00001531static vector bool int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001532vec_vcmpgtsw(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001533{
David Blaikie3302f2b2013-01-16 23:08:36 +00001534 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001535}
1536
1537/* vec_vcmpgtuw */
1538
Anton Yartsevfc83c602010-08-19 03:21:36 +00001539static vector bool int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001540vec_vcmpgtuw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001541{
David Blaikie3302f2b2013-01-16 23:08:36 +00001542 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001543}
1544
1545/* vec_vcmpgtfp */
1546
Anton Yartsevfc83c602010-08-19 03:21:36 +00001547static vector bool int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001548vec_vcmpgtfp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001549{
David Blaikie3302f2b2013-01-16 23:08:36 +00001550 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001551}
1552
1553/* vec_cmple */
Chris Lattnerdad40622010-04-14 03:54:58 +00001554
Anton Yartsevfc83c602010-08-19 03:21:36 +00001555static vector bool int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001556vec_cmple(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001557{
David Blaikie3302f2b2013-01-16 23:08:36 +00001558 return (vector bool int)__builtin_altivec_vcmpgefp(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001559}
1560
1561/* vec_cmplt */
1562
Anton Yartsevfc83c602010-08-19 03:21:36 +00001563static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001564vec_cmplt(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001565{
David Blaikie3302f2b2013-01-16 23:08:36 +00001566 return (vector bool char)__builtin_altivec_vcmpgtsb(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001567}
1568
Anton Yartsevfc83c602010-08-19 03:21:36 +00001569static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001570vec_cmplt(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001571{
David Blaikie3302f2b2013-01-16 23:08:36 +00001572 return (vector bool char)__builtin_altivec_vcmpgtub(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001573}
1574
Anton Yartsevfc83c602010-08-19 03:21:36 +00001575static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001576vec_cmplt(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001577{
David Blaikie3302f2b2013-01-16 23:08:36 +00001578 return (vector bool short)__builtin_altivec_vcmpgtsh(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001579}
1580
Anton Yartsevfc83c602010-08-19 03:21:36 +00001581static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001582vec_cmplt(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001583{
David Blaikie3302f2b2013-01-16 23:08:36 +00001584 return (vector bool short)__builtin_altivec_vcmpgtuh(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001585}
1586
Anton Yartsevfc83c602010-08-19 03:21:36 +00001587static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001588vec_cmplt(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001589{
David Blaikie3302f2b2013-01-16 23:08:36 +00001590 return (vector bool int)__builtin_altivec_vcmpgtsw(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001591}
1592
Anton Yartsevfc83c602010-08-19 03:21:36 +00001593static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001594vec_cmplt(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001595{
David Blaikie3302f2b2013-01-16 23:08:36 +00001596 return (vector bool int)__builtin_altivec_vcmpgtuw(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001597}
1598
Anton Yartsevfc83c602010-08-19 03:21:36 +00001599static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001600vec_cmplt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001601{
David Blaikie3302f2b2013-01-16 23:08:36 +00001602 return (vector bool int)__builtin_altivec_vcmpgtfp(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001603}
1604
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001605/* vec_ctf */
1606
1607static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001608vec_ctf(vector int __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001609{
David Blaikie3302f2b2013-01-16 23:08:36 +00001610 return __builtin_altivec_vcfsx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001611}
1612
1613static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001614vec_ctf(vector unsigned int __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001615{
David Blaikie3302f2b2013-01-16 23:08:36 +00001616 return __builtin_altivec_vcfux((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001617}
1618
1619/* vec_vcfsx */
1620
1621static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001622vec_vcfsx(vector int __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001623{
David Blaikie3302f2b2013-01-16 23:08:36 +00001624 return __builtin_altivec_vcfsx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001625}
1626
1627/* vec_vcfux */
1628
1629static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001630vec_vcfux(vector unsigned int __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001631{
David Blaikie3302f2b2013-01-16 23:08:36 +00001632 return __builtin_altivec_vcfux((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001633}
1634
1635/* vec_cts */
1636
1637static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001638vec_cts(vector float __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001639{
David Blaikie3302f2b2013-01-16 23:08:36 +00001640 return __builtin_altivec_vctsxs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001641}
1642
1643/* vec_vctsxs */
1644
1645static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001646vec_vctsxs(vector float __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001647{
David Blaikie3302f2b2013-01-16 23:08:36 +00001648 return __builtin_altivec_vctsxs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001649}
1650
1651/* vec_ctu */
1652
1653static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001654vec_ctu(vector float __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001655{
David Blaikie3302f2b2013-01-16 23:08:36 +00001656 return __builtin_altivec_vctuxs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001657}
1658
1659/* vec_vctuxs */
1660
1661static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001662vec_vctuxs(vector float __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001663{
David Blaikie3302f2b2013-01-16 23:08:36 +00001664 return __builtin_altivec_vctuxs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001665}
1666
Bill Schmidtcee13a22014-11-14 12:10:51 +00001667/* vec_div */
1668#ifdef __VSX__
1669static vector float __ATTRS_o_ai
1670vec_div(vector float __a, vector float __b)
1671{
1672 return __builtin_vsx_xvdivsp(__a, __b);
1673}
1674
1675static vector double __ATTRS_o_ai
1676vec_div(vector double __a, vector double __b)
1677{
1678 return __builtin_vsx_xvdivdp(__a, __b);
1679}
1680#endif
1681
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001682/* vec_dss */
1683
1684static void __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001685vec_dss(int __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001686{
David Blaikie3302f2b2013-01-16 23:08:36 +00001687 __builtin_altivec_dss(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001688}
1689
1690/* vec_dssall */
1691
1692static void __attribute__((__always_inline__))
1693vec_dssall(void)
1694{
1695 __builtin_altivec_dssall();
1696}
1697
1698/* vec_dst */
1699
1700static void __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001701vec_dst(const void *__a, int __b, int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001702{
David Blaikie3302f2b2013-01-16 23:08:36 +00001703 __builtin_altivec_dst(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001704}
1705
1706/* vec_dstst */
1707
1708static void __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001709vec_dstst(const void *__a, int __b, int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001710{
David Blaikie3302f2b2013-01-16 23:08:36 +00001711 __builtin_altivec_dstst(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001712}
1713
1714/* vec_dststt */
1715
1716static void __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001717vec_dststt(const void *__a, int __b, int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001718{
David Blaikie3302f2b2013-01-16 23:08:36 +00001719 __builtin_altivec_dststt(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001720}
1721
1722/* vec_dstt */
1723
1724static void __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001725vec_dstt(const void *__a, int __b, int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001726{
David Blaikie3302f2b2013-01-16 23:08:36 +00001727 __builtin_altivec_dstt(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001728}
1729
1730/* vec_expte */
1731
1732static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001733vec_expte(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001734{
David Blaikie3302f2b2013-01-16 23:08:36 +00001735 return __builtin_altivec_vexptefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001736}
1737
1738/* vec_vexptefp */
1739
1740static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001741vec_vexptefp(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001742{
David Blaikie3302f2b2013-01-16 23:08:36 +00001743 return __builtin_altivec_vexptefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001744}
1745
1746/* vec_floor */
1747
1748static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001749vec_floor(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001750{
David Blaikie3302f2b2013-01-16 23:08:36 +00001751 return __builtin_altivec_vrfim(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001752}
1753
1754/* vec_vrfim */
1755
1756static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001757vec_vrfim(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001758{
David Blaikie3302f2b2013-01-16 23:08:36 +00001759 return __builtin_altivec_vrfim(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001760}
1761
1762/* vec_ld */
1763
1764static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001765vec_ld(int __a, const vector signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001766{
David Blaikie3302f2b2013-01-16 23:08:36 +00001767 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001768}
1769
1770static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001771vec_ld(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001772{
David Blaikie3302f2b2013-01-16 23:08:36 +00001773 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001774}
1775
1776static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001777vec_ld(int __a, const vector unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001778{
David Blaikie3302f2b2013-01-16 23:08:36 +00001779 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001780}
1781
1782static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001783vec_ld(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001784{
David Blaikie3302f2b2013-01-16 23:08:36 +00001785 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001786}
1787
Anton Yartsevfc83c602010-08-19 03:21:36 +00001788static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001789vec_ld(int __a, const vector bool char *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001790{
David Blaikie3302f2b2013-01-16 23:08:36 +00001791 return (vector bool char)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001792}
1793
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001794static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001795vec_ld(int __a, const vector short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001796{
David Blaikie3302f2b2013-01-16 23:08:36 +00001797 return (vector short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001798}
1799
1800static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001801vec_ld(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001802{
David Blaikie3302f2b2013-01-16 23:08:36 +00001803 return (vector short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001804}
1805
1806static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001807vec_ld(int __a, const vector unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001808{
David Blaikie3302f2b2013-01-16 23:08:36 +00001809 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001810}
1811
1812static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001813vec_ld(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001814{
David Blaikie3302f2b2013-01-16 23:08:36 +00001815 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001816}
1817
Anton Yartsevfc83c602010-08-19 03:21:36 +00001818static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001819vec_ld(int __a, const vector bool short *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001820{
David Blaikie3302f2b2013-01-16 23:08:36 +00001821 return (vector bool short)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001822}
1823
1824static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001825vec_ld(int __a, const vector pixel *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001826{
David Blaikie3302f2b2013-01-16 23:08:36 +00001827 return (vector pixel)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001828}
1829
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001830static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001831vec_ld(int __a, const vector int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001832{
David Blaikie3302f2b2013-01-16 23:08:36 +00001833 return (vector int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001834}
1835
1836static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001837vec_ld(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001838{
David Blaikie3302f2b2013-01-16 23:08:36 +00001839 return (vector int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001840}
1841
1842static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001843vec_ld(int __a, const vector unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001844{
David Blaikie3302f2b2013-01-16 23:08:36 +00001845 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001846}
1847
1848static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001849vec_ld(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001850{
David Blaikie3302f2b2013-01-16 23:08:36 +00001851 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001852}
1853
Anton Yartsevfc83c602010-08-19 03:21:36 +00001854static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001855vec_ld(int __a, const vector bool int *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001856{
David Blaikie3302f2b2013-01-16 23:08:36 +00001857 return (vector bool int)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001858}
1859
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001860static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001861vec_ld(int __a, const vector float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001862{
David Blaikie3302f2b2013-01-16 23:08:36 +00001863 return (vector float)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001864}
1865
1866static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001867vec_ld(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001868{
David Blaikie3302f2b2013-01-16 23:08:36 +00001869 return (vector float)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001870}
1871
1872/* vec_lvx */
1873
1874static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001875vec_lvx(int __a, const vector signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001876{
David Blaikie3302f2b2013-01-16 23:08:36 +00001877 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001878}
1879
1880static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001881vec_lvx(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001882{
David Blaikie3302f2b2013-01-16 23:08:36 +00001883 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001884}
1885
1886static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001887vec_lvx(int __a, const vector unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001888{
David Blaikie3302f2b2013-01-16 23:08:36 +00001889 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001890}
1891
1892static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001893vec_lvx(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001894{
David Blaikie3302f2b2013-01-16 23:08:36 +00001895 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001896}
1897
Anton Yartsevfc83c602010-08-19 03:21:36 +00001898static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001899vec_lvx(int __a, const vector bool char *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001900{
David Blaikie3302f2b2013-01-16 23:08:36 +00001901 return (vector bool char)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001902}
1903
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001904static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001905vec_lvx(int __a, const vector short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001906{
David Blaikie3302f2b2013-01-16 23:08:36 +00001907 return (vector short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001908}
1909
1910static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001911vec_lvx(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001912{
David Blaikie3302f2b2013-01-16 23:08:36 +00001913 return (vector short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001914}
1915
1916static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001917vec_lvx(int __a, const vector unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001918{
David Blaikie3302f2b2013-01-16 23:08:36 +00001919 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001920}
1921
1922static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001923vec_lvx(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001924{
David Blaikie3302f2b2013-01-16 23:08:36 +00001925 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001926}
1927
Anton Yartsevfc83c602010-08-19 03:21:36 +00001928static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001929vec_lvx(int __a, const vector bool short *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001930{
David Blaikie3302f2b2013-01-16 23:08:36 +00001931 return (vector bool short)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001932}
1933
1934static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001935vec_lvx(int __a, const vector pixel *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001936{
David Blaikie3302f2b2013-01-16 23:08:36 +00001937 return (vector pixel)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001938}
1939
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001940static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001941vec_lvx(int __a, const vector int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001942{
David Blaikie3302f2b2013-01-16 23:08:36 +00001943 return (vector int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001944}
1945
1946static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001947vec_lvx(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001948{
David Blaikie3302f2b2013-01-16 23:08:36 +00001949 return (vector int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001950}
1951
1952static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001953vec_lvx(int __a, const vector unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001954{
David Blaikie3302f2b2013-01-16 23:08:36 +00001955 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001956}
1957
1958static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001959vec_lvx(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001960{
David Blaikie3302f2b2013-01-16 23:08:36 +00001961 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001962}
1963
Anton Yartsevfc83c602010-08-19 03:21:36 +00001964static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001965vec_lvx(int __a, const vector bool int *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001966{
David Blaikie3302f2b2013-01-16 23:08:36 +00001967 return (vector bool int)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001968}
1969
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001970static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001971vec_lvx(int __a, const vector float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001972{
David Blaikie3302f2b2013-01-16 23:08:36 +00001973 return (vector float)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001974}
1975
1976static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001977vec_lvx(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001978{
David Blaikie3302f2b2013-01-16 23:08:36 +00001979 return (vector float)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001980}
1981
1982/* vec_lde */
1983
1984static vector signed char __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001985vec_lde(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001986{
David Blaikie3302f2b2013-01-16 23:08:36 +00001987 return (vector signed char)__builtin_altivec_lvebx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001988}
1989
1990static vector unsigned char __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001991vec_lde(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001992{
David Blaikie3302f2b2013-01-16 23:08:36 +00001993 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001994}
1995
1996static vector short __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001997vec_lde(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001998{
David Blaikie3302f2b2013-01-16 23:08:36 +00001999 return (vector short)__builtin_altivec_lvehx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002000}
2001
2002static vector unsigned short __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002003vec_lde(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002004{
David Blaikie3302f2b2013-01-16 23:08:36 +00002005 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002006}
2007
2008static vector int __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002009vec_lde(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002010{
David Blaikie3302f2b2013-01-16 23:08:36 +00002011 return (vector int)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002012}
2013
2014static vector unsigned int __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002015vec_lde(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002016{
David Blaikie3302f2b2013-01-16 23:08:36 +00002017 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002018}
2019
2020static vector float __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002021vec_lde(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002022{
David Blaikie3302f2b2013-01-16 23:08:36 +00002023 return (vector float)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002024}
2025
2026/* vec_lvebx */
2027
2028static vector signed char __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002029vec_lvebx(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002030{
David Blaikie3302f2b2013-01-16 23:08:36 +00002031 return (vector signed char)__builtin_altivec_lvebx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002032}
2033
2034static vector unsigned char __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002035vec_lvebx(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002036{
David Blaikie3302f2b2013-01-16 23:08:36 +00002037 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002038}
2039
2040/* vec_lvehx */
2041
2042static vector short __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002043vec_lvehx(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002044{
David Blaikie3302f2b2013-01-16 23:08:36 +00002045 return (vector short)__builtin_altivec_lvehx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002046}
2047
2048static vector unsigned short __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002049vec_lvehx(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002050{
David Blaikie3302f2b2013-01-16 23:08:36 +00002051 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002052}
2053
2054/* vec_lvewx */
2055
2056static vector int __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002057vec_lvewx(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002058{
David Blaikie3302f2b2013-01-16 23:08:36 +00002059 return (vector int)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002060}
2061
2062static vector unsigned int __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002063vec_lvewx(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002064{
David Blaikie3302f2b2013-01-16 23:08:36 +00002065 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002066}
2067
2068static vector float __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002069vec_lvewx(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002070{
David Blaikie3302f2b2013-01-16 23:08:36 +00002071 return (vector float)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002072}
2073
2074/* vec_ldl */
2075
2076static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002077vec_ldl(int __a, const vector signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002078{
David Blaikie3302f2b2013-01-16 23:08:36 +00002079 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002080}
2081
2082static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002083vec_ldl(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002084{
David Blaikie3302f2b2013-01-16 23:08:36 +00002085 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002086}
2087
2088static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002089vec_ldl(int __a, const vector unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002090{
David Blaikie3302f2b2013-01-16 23:08:36 +00002091 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002092}
2093
2094static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002095vec_ldl(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002096{
David Blaikie3302f2b2013-01-16 23:08:36 +00002097 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002098}
2099
Anton Yartsevfc83c602010-08-19 03:21:36 +00002100static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002101vec_ldl(int __a, const vector bool char *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002102{
David Blaikie3302f2b2013-01-16 23:08:36 +00002103 return (vector bool char)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002104}
2105
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002106static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002107vec_ldl(int __a, const vector short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002108{
David Blaikie3302f2b2013-01-16 23:08:36 +00002109 return (vector short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002110}
2111
2112static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002113vec_ldl(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002114{
David Blaikie3302f2b2013-01-16 23:08:36 +00002115 return (vector short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002116}
2117
2118static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002119vec_ldl(int __a, const vector unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002120{
David Blaikie3302f2b2013-01-16 23:08:36 +00002121 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002122}
2123
2124static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002125vec_ldl(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002126{
David Blaikie3302f2b2013-01-16 23:08:36 +00002127 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002128}
2129
Anton Yartsevfc83c602010-08-19 03:21:36 +00002130static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002131vec_ldl(int __a, const vector bool short *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002132{
David Blaikie3302f2b2013-01-16 23:08:36 +00002133 return (vector bool short)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002134}
2135
2136static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002137vec_ldl(int __a, const vector pixel *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002138{
David Blaikie3302f2b2013-01-16 23:08:36 +00002139 return (vector pixel short)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002140}
2141
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002142static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002143vec_ldl(int __a, const vector int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002144{
David Blaikie3302f2b2013-01-16 23:08:36 +00002145 return (vector int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002146}
2147
2148static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002149vec_ldl(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002150{
David Blaikie3302f2b2013-01-16 23:08:36 +00002151 return (vector int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002152}
2153
2154static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002155vec_ldl(int __a, const vector unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002156{
David Blaikie3302f2b2013-01-16 23:08:36 +00002157 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002158}
2159
2160static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002161vec_ldl(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002162{
David Blaikie3302f2b2013-01-16 23:08:36 +00002163 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002164}
2165
Anton Yartsevfc83c602010-08-19 03:21:36 +00002166static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002167vec_ldl(int __a, const vector bool int *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002168{
David Blaikie3302f2b2013-01-16 23:08:36 +00002169 return (vector bool int)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002170}
2171
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002172static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002173vec_ldl(int __a, const vector float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002174{
David Blaikie3302f2b2013-01-16 23:08:36 +00002175 return (vector float)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002176}
2177
2178static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002179vec_ldl(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002180{
David Blaikie3302f2b2013-01-16 23:08:36 +00002181 return (vector float)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002182}
2183
2184/* vec_lvxl */
2185
2186static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002187vec_lvxl(int __a, const vector signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002188{
David Blaikie3302f2b2013-01-16 23:08:36 +00002189 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002190}
2191
2192static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002193vec_lvxl(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002194{
David Blaikie3302f2b2013-01-16 23:08:36 +00002195 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002196}
2197
2198static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002199vec_lvxl(int __a, const vector unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002200{
David Blaikie3302f2b2013-01-16 23:08:36 +00002201 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002202}
2203
2204static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002205vec_lvxl(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002206{
David Blaikie3302f2b2013-01-16 23:08:36 +00002207 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002208}
2209
Anton Yartsevfc83c602010-08-19 03:21:36 +00002210static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002211vec_lvxl(int __a, const vector bool char *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002212{
David Blaikie3302f2b2013-01-16 23:08:36 +00002213 return (vector bool char)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002214}
2215
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002216static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002217vec_lvxl(int __a, const vector short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002218{
David Blaikie3302f2b2013-01-16 23:08:36 +00002219 return (vector short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002220}
2221
2222static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002223vec_lvxl(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002224{
David Blaikie3302f2b2013-01-16 23:08:36 +00002225 return (vector short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002226}
2227
2228static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002229vec_lvxl(int __a, const vector unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002230{
David Blaikie3302f2b2013-01-16 23:08:36 +00002231 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002232}
2233
2234static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002235vec_lvxl(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002236{
David Blaikie3302f2b2013-01-16 23:08:36 +00002237 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002238}
2239
Anton Yartsevfc83c602010-08-19 03:21:36 +00002240static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002241vec_lvxl(int __a, const vector bool short *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002242{
David Blaikie3302f2b2013-01-16 23:08:36 +00002243 return (vector bool short)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002244}
2245
2246static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002247vec_lvxl(int __a, const vector pixel *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002248{
David Blaikie3302f2b2013-01-16 23:08:36 +00002249 return (vector pixel)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002250}
2251
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002252static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002253vec_lvxl(int __a, const vector int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002254{
David Blaikie3302f2b2013-01-16 23:08:36 +00002255 return (vector int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002256}
2257
2258static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002259vec_lvxl(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002260{
David Blaikie3302f2b2013-01-16 23:08:36 +00002261 return (vector int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002262}
2263
2264static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002265vec_lvxl(int __a, const vector unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002266{
David Blaikie3302f2b2013-01-16 23:08:36 +00002267 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002268}
2269
2270static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002271vec_lvxl(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002272{
David Blaikie3302f2b2013-01-16 23:08:36 +00002273 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002274}
2275
Anton Yartsevfc83c602010-08-19 03:21:36 +00002276static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002277vec_lvxl(int __a, const vector bool int *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002278{
David Blaikie3302f2b2013-01-16 23:08:36 +00002279 return (vector bool int)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002280}
2281
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002282static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002283vec_lvxl(int __a, const vector float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002284{
David Blaikie3302f2b2013-01-16 23:08:36 +00002285 return (vector float)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002286}
2287
2288static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002289vec_lvxl(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002290{
David Blaikie3302f2b2013-01-16 23:08:36 +00002291 return (vector float)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002292}
2293
2294/* vec_loge */
2295
2296static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002297vec_loge(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002298{
David Blaikie3302f2b2013-01-16 23:08:36 +00002299 return __builtin_altivec_vlogefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002300}
2301
2302/* vec_vlogefp */
2303
2304static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002305vec_vlogefp(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002306{
David Blaikie3302f2b2013-01-16 23:08:36 +00002307 return __builtin_altivec_vlogefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002308}
2309
2310/* vec_lvsl */
2311
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002312#ifdef __LITTLE_ENDIAN__
2313static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002314__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002315loads/stores")))
2316vec_lvsl(int __a, const signed char *__b)
2317{
2318 vector unsigned char mask =
2319 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2320 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2321 return vec_perm(mask, mask, reverse);
2322}
2323#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002324static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002325vec_lvsl(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002326{
David Blaikie3302f2b2013-01-16 23:08:36 +00002327 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002328}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002329#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002330
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002331#ifdef __LITTLE_ENDIAN__
2332static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002333__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002334loads/stores")))
2335vec_lvsl(int __a, const unsigned char *__b)
2336{
2337 vector unsigned char mask =
2338 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2339 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2340 return vec_perm(mask, mask, reverse);
2341}
2342#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002343static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002344vec_lvsl(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002345{
David Blaikie3302f2b2013-01-16 23:08:36 +00002346 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002347}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002348#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002349
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002350#ifdef __LITTLE_ENDIAN__
2351static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002352__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002353loads/stores")))
2354vec_lvsl(int __a, const short *__b)
2355{
2356 vector unsigned char mask =
2357 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2358 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2359 return vec_perm(mask, mask, reverse);
2360}
2361#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002362static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002363vec_lvsl(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002364{
David Blaikie3302f2b2013-01-16 23:08:36 +00002365 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002366}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002367#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002368
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002369#ifdef __LITTLE_ENDIAN__
2370static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002371__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002372loads/stores")))
2373vec_lvsl(int __a, const unsigned short *__b)
2374{
2375 vector unsigned char mask =
2376 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2377 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2378 return vec_perm(mask, mask, reverse);
2379}
2380#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002381static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002382vec_lvsl(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002383{
David Blaikie3302f2b2013-01-16 23:08:36 +00002384 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002385}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002386#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002387
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002388#ifdef __LITTLE_ENDIAN__
2389static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002390__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002391loads/stores")))
2392vec_lvsl(int __a, const int *__b)
2393{
2394 vector unsigned char mask =
2395 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2396 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2397 return vec_perm(mask, mask, reverse);
2398}
2399#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002400static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002401vec_lvsl(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002402{
David Blaikie3302f2b2013-01-16 23:08:36 +00002403 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002404}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002405#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002406
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002407#ifdef __LITTLE_ENDIAN__
2408static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002409__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002410loads/stores")))
2411vec_lvsl(int __a, const unsigned int *__b)
2412{
2413 vector unsigned char mask =
2414 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2415 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2416 return vec_perm(mask, mask, reverse);
2417}
2418#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002419static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002420vec_lvsl(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002421{
David Blaikie3302f2b2013-01-16 23:08:36 +00002422 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002423}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002424#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002425
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002426#ifdef __LITTLE_ENDIAN__
2427static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002428__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002429loads/stores")))
2430vec_lvsl(int __a, const float *__b)
2431{
2432 vector unsigned char mask =
2433 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2434 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2435 return vec_perm(mask, mask, reverse);
2436}
2437#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002438static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002439vec_lvsl(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002440{
David Blaikie3302f2b2013-01-16 23:08:36 +00002441 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002442}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002443#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002444
2445/* vec_lvsr */
2446
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002447#ifdef __LITTLE_ENDIAN__
2448static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002449__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002450loads/stores")))
2451vec_lvsr(int __a, const signed char *__b)
2452{
2453 vector unsigned char mask =
2454 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2455 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2456 return vec_perm(mask, mask, reverse);
2457}
2458#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002459static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002460vec_lvsr(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002461{
David Blaikie3302f2b2013-01-16 23:08:36 +00002462 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002463}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002464#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002465
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002466#ifdef __LITTLE_ENDIAN__
2467static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002468__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002469loads/stores")))
2470vec_lvsr(int __a, const unsigned char *__b)
2471{
2472 vector unsigned char mask =
2473 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2474 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2475 return vec_perm(mask, mask, reverse);
2476}
2477#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002478static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002479vec_lvsr(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002480{
David Blaikie3302f2b2013-01-16 23:08:36 +00002481 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002482}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002483#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002484
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002485#ifdef __LITTLE_ENDIAN__
2486static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002487__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002488loads/stores")))
2489vec_lvsr(int __a, const short *__b)
2490{
2491 vector unsigned char mask =
2492 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2493 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2494 return vec_perm(mask, mask, reverse);
2495}
2496#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002497static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002498vec_lvsr(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002499{
David Blaikie3302f2b2013-01-16 23:08:36 +00002500 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002501}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002502#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002503
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002504#ifdef __LITTLE_ENDIAN__
2505static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002506__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002507loads/stores")))
2508vec_lvsr(int __a, const unsigned short *__b)
2509{
2510 vector unsigned char mask =
2511 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2512 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2513 return vec_perm(mask, mask, reverse);
2514}
2515#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002516static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002517vec_lvsr(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002518{
David Blaikie3302f2b2013-01-16 23:08:36 +00002519 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002520}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002521#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002522
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002523#ifdef __LITTLE_ENDIAN__
2524static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002525__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002526loads/stores")))
2527vec_lvsr(int __a, const int *__b)
2528{
2529 vector unsigned char mask =
2530 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2531 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2532 return vec_perm(mask, mask, reverse);
2533}
2534#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002535static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002536vec_lvsr(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002537{
David Blaikie3302f2b2013-01-16 23:08:36 +00002538 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002539}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002540#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002541
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002542#ifdef __LITTLE_ENDIAN__
2543static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002544__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002545loads/stores")))
2546vec_lvsr(int __a, const unsigned int *__b)
2547{
2548 vector unsigned char mask =
2549 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2550 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2551 return vec_perm(mask, mask, reverse);
2552}
2553#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002554static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002555vec_lvsr(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002556{
David Blaikie3302f2b2013-01-16 23:08:36 +00002557 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002558}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002559#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002560
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002561#ifdef __LITTLE_ENDIAN__
2562static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002563__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002564loads/stores")))
2565vec_lvsr(int __a, const float *__b)
2566{
2567 vector unsigned char mask =
2568 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2569 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2570 return vec_perm(mask, mask, reverse);
2571}
2572#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002573static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002574vec_lvsr(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002575{
David Blaikie3302f2b2013-01-16 23:08:36 +00002576 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002577}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002578#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002579
2580/* vec_madd */
2581
2582static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002583vec_madd(vector float __a, vector float __b, vector float __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002584{
David Blaikie3302f2b2013-01-16 23:08:36 +00002585 return __builtin_altivec_vmaddfp(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002586}
2587
2588/* vec_vmaddfp */
2589
2590static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002591vec_vmaddfp(vector float __a, vector float __b, vector float __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002592{
David Blaikie3302f2b2013-01-16 23:08:36 +00002593 return __builtin_altivec_vmaddfp(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002594}
2595
2596/* vec_madds */
2597
2598static vector signed short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002599vec_madds(vector signed short __a, vector signed short __b, vector signed short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002600{
David Blaikie3302f2b2013-01-16 23:08:36 +00002601 return __builtin_altivec_vmhaddshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002602}
2603
2604/* vec_vmhaddshs */
2605static vector signed short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002606vec_vmhaddshs(vector signed short __a,
2607 vector signed short __b,
2608 vector signed short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002609{
David Blaikie3302f2b2013-01-16 23:08:36 +00002610 return __builtin_altivec_vmhaddshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002611}
2612
Chris Lattnerdad40622010-04-14 03:54:58 +00002613/* vec_max */
2614
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002615static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002616vec_max(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002617{
David Blaikie3302f2b2013-01-16 23:08:36 +00002618 return __builtin_altivec_vmaxsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002619}
2620
Anton Yartsevfc83c602010-08-19 03:21:36 +00002621static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002622vec_max(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002623{
David Blaikie3302f2b2013-01-16 23:08:36 +00002624 return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002625}
2626
2627static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002628vec_max(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002629{
David Blaikie3302f2b2013-01-16 23:08:36 +00002630 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002631}
2632
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002633static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002634vec_max(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002635{
David Blaikie3302f2b2013-01-16 23:08:36 +00002636 return __builtin_altivec_vmaxub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002637}
2638
Anton Yartsevfc83c602010-08-19 03:21:36 +00002639static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002640vec_max(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002641{
David Blaikie3302f2b2013-01-16 23:08:36 +00002642 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002643}
2644
2645static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002646vec_max(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002647{
David Blaikie3302f2b2013-01-16 23:08:36 +00002648 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002649}
2650
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002651static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002652vec_max(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002653{
David Blaikie3302f2b2013-01-16 23:08:36 +00002654 return __builtin_altivec_vmaxsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002655}
2656
Anton Yartsevfc83c602010-08-19 03:21:36 +00002657static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002658vec_max(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002659{
David Blaikie3302f2b2013-01-16 23:08:36 +00002660 return __builtin_altivec_vmaxsh((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002661}
2662
2663static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002664vec_max(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002665{
David Blaikie3302f2b2013-01-16 23:08:36 +00002666 return __builtin_altivec_vmaxsh(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002667}
2668
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002669static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002670vec_max(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002671{
David Blaikie3302f2b2013-01-16 23:08:36 +00002672 return __builtin_altivec_vmaxuh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002673}
2674
Anton Yartsevfc83c602010-08-19 03:21:36 +00002675static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002676vec_max(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002677{
David Blaikie3302f2b2013-01-16 23:08:36 +00002678 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002679}
2680
2681static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002682vec_max(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002683{
David Blaikie3302f2b2013-01-16 23:08:36 +00002684 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002685}
2686
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002687static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002688vec_max(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002689{
David Blaikie3302f2b2013-01-16 23:08:36 +00002690 return __builtin_altivec_vmaxsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002691}
2692
Anton Yartsevfc83c602010-08-19 03:21:36 +00002693static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002694vec_max(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002695{
David Blaikie3302f2b2013-01-16 23:08:36 +00002696 return __builtin_altivec_vmaxsw((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002697}
2698
2699static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002700vec_max(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002701{
David Blaikie3302f2b2013-01-16 23:08:36 +00002702 return __builtin_altivec_vmaxsw(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002703}
2704
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002705static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002706vec_max(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002707{
David Blaikie3302f2b2013-01-16 23:08:36 +00002708 return __builtin_altivec_vmaxuw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002709}
2710
Anton Yartsevfc83c602010-08-19 03:21:36 +00002711static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002712vec_max(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002713{
David Blaikie3302f2b2013-01-16 23:08:36 +00002714 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002715}
2716
2717static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002718vec_max(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002719{
David Blaikie3302f2b2013-01-16 23:08:36 +00002720 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002721}
2722
Kit Barton8553bec2015-03-11 15:57:19 +00002723#ifdef __POWER8_VECTOR__
2724static vector signed long long __ATTRS_o_ai
2725vec_max(vector signed long long __a, vector signed long long __b)
2726{
2727 return __builtin_altivec_vmaxsd(__a, __b);
2728}
2729
2730static vector unsigned long long __ATTRS_o_ai
2731vec_max(vector unsigned long long __a, vector unsigned long long __b)
2732{
2733 return __builtin_altivec_vmaxud(__a, __b);
2734}
2735#endif
2736
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002737static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002738vec_max(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002739{
Bill Schmidt691e01d2014-10-31 19:19:24 +00002740#ifdef __VSX__
2741 return __builtin_vsx_xvmaxsp(__a, __b);
2742#else
David Blaikie3302f2b2013-01-16 23:08:36 +00002743 return __builtin_altivec_vmaxfp(__a, __b);
Bill Schmidt691e01d2014-10-31 19:19:24 +00002744#endif
Chris Lattnerdad40622010-04-14 03:54:58 +00002745}
2746
Bill Schmidt691e01d2014-10-31 19:19:24 +00002747#ifdef __VSX__
2748static vector double __ATTRS_o_ai
2749vec_max(vector double __a, vector double __b)
2750{
2751 return __builtin_vsx_xvmaxdp(__a, __b);
2752}
2753#endif
2754
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002755/* vec_vmaxsb */
2756
Anton Yartsevfc83c602010-08-19 03:21:36 +00002757static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002758vec_vmaxsb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002759{
David Blaikie3302f2b2013-01-16 23:08:36 +00002760 return __builtin_altivec_vmaxsb(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002761}
2762
Anton Yartsevfc83c602010-08-19 03:21:36 +00002763static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002764vec_vmaxsb(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002765{
David Blaikie3302f2b2013-01-16 23:08:36 +00002766 return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002767}
2768
2769static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002770vec_vmaxsb(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002771{
David Blaikie3302f2b2013-01-16 23:08:36 +00002772 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002773}
2774
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002775/* vec_vmaxub */
2776
Anton Yartsevfc83c602010-08-19 03:21:36 +00002777static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002778vec_vmaxub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002779{
David Blaikie3302f2b2013-01-16 23:08:36 +00002780 return __builtin_altivec_vmaxub(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002781}
2782
Anton Yartsevfc83c602010-08-19 03:21:36 +00002783static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002784vec_vmaxub(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002785{
David Blaikie3302f2b2013-01-16 23:08:36 +00002786 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002787}
2788
2789static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002790vec_vmaxub(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002791{
David Blaikie3302f2b2013-01-16 23:08:36 +00002792 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002793}
2794
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002795/* vec_vmaxsh */
2796
Anton Yartsevfc83c602010-08-19 03:21:36 +00002797static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002798vec_vmaxsh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002799{
David Blaikie3302f2b2013-01-16 23:08:36 +00002800 return __builtin_altivec_vmaxsh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002801}
2802
Anton Yartsevfc83c602010-08-19 03:21:36 +00002803static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002804vec_vmaxsh(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002805{
David Blaikie3302f2b2013-01-16 23:08:36 +00002806 return __builtin_altivec_vmaxsh((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002807}
2808
2809static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002810vec_vmaxsh(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002811{
David Blaikie3302f2b2013-01-16 23:08:36 +00002812 return __builtin_altivec_vmaxsh(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002813}
2814
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002815/* vec_vmaxuh */
2816
Anton Yartsevfc83c602010-08-19 03:21:36 +00002817static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002818vec_vmaxuh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002819{
David Blaikie3302f2b2013-01-16 23:08:36 +00002820 return __builtin_altivec_vmaxuh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002821}
2822
Anton Yartsevfc83c602010-08-19 03:21:36 +00002823static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002824vec_vmaxuh(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002825{
David Blaikie3302f2b2013-01-16 23:08:36 +00002826 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002827}
2828
2829static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002830vec_vmaxuh(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002831{
David Blaikie3302f2b2013-01-16 23:08:36 +00002832 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002833}
2834
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002835/* vec_vmaxsw */
2836
Anton Yartsevfc83c602010-08-19 03:21:36 +00002837static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002838vec_vmaxsw(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002839{
David Blaikie3302f2b2013-01-16 23:08:36 +00002840 return __builtin_altivec_vmaxsw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002841}
2842
Anton Yartsevfc83c602010-08-19 03:21:36 +00002843static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002844vec_vmaxsw(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002845{
David Blaikie3302f2b2013-01-16 23:08:36 +00002846 return __builtin_altivec_vmaxsw((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002847}
2848
2849static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002850vec_vmaxsw(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002851{
David Blaikie3302f2b2013-01-16 23:08:36 +00002852 return __builtin_altivec_vmaxsw(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002853}
2854
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002855/* vec_vmaxuw */
2856
Anton Yartsevfc83c602010-08-19 03:21:36 +00002857static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002858vec_vmaxuw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002859{
David Blaikie3302f2b2013-01-16 23:08:36 +00002860 return __builtin_altivec_vmaxuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002861}
2862
Anton Yartsevfc83c602010-08-19 03:21:36 +00002863static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002864vec_vmaxuw(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002865{
David Blaikie3302f2b2013-01-16 23:08:36 +00002866 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002867}
2868
2869static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002870vec_vmaxuw(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002871{
David Blaikie3302f2b2013-01-16 23:08:36 +00002872 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002873}
2874
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002875/* vec_vmaxfp */
2876
2877static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002878vec_vmaxfp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002879{
Bill Schmidt691e01d2014-10-31 19:19:24 +00002880#ifdef __VSX__
2881 return __builtin_vsx_xvmaxsp(__a, __b);
2882#else
David Blaikie3302f2b2013-01-16 23:08:36 +00002883 return __builtin_altivec_vmaxfp(__a, __b);
Bill Schmidt691e01d2014-10-31 19:19:24 +00002884#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002885}
2886
2887/* vec_mergeh */
2888
2889static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002890vec_mergeh(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002891{
David Blaikie3302f2b2013-01-16 23:08:36 +00002892 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002893 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2894 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2895}
2896
2897static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002898vec_mergeh(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002899{
David Blaikie3302f2b2013-01-16 23:08:36 +00002900 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002901 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2902 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2903}
2904
Anton Yartsev9e968982010-08-19 03:00:09 +00002905static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002906vec_mergeh(vector bool char __a, vector bool char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002907{
David Blaikie3302f2b2013-01-16 23:08:36 +00002908 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002909 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2910 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2911}
2912
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002913static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002914vec_mergeh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002915{
David Blaikie3302f2b2013-01-16 23:08:36 +00002916 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002917 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2918 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2919}
2920
2921static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002922vec_mergeh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002923{
David Blaikie3302f2b2013-01-16 23:08:36 +00002924 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002925 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2926 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2927}
2928
Anton Yartsev9e968982010-08-19 03:00:09 +00002929static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002930vec_mergeh(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002931{
David Blaikie3302f2b2013-01-16 23:08:36 +00002932 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002933 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2934 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2935}
2936
2937static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002938vec_mergeh(vector pixel __a, vector pixel __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002939{
David Blaikie3302f2b2013-01-16 23:08:36 +00002940 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002941 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2942 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2943}
2944
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002945static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002946vec_mergeh(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002947{
David Blaikie3302f2b2013-01-16 23:08:36 +00002948 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002949 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2950 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2951}
2952
2953static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002954vec_mergeh(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002955{
David Blaikie3302f2b2013-01-16 23:08:36 +00002956 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002957 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2958 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2959}
2960
Anton Yartsev9e968982010-08-19 03:00:09 +00002961static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002962vec_mergeh(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002963{
David Blaikie3302f2b2013-01-16 23:08:36 +00002964 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002965 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2966 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2967}
2968
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002969static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002970vec_mergeh(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002971{
David Blaikie3302f2b2013-01-16 23:08:36 +00002972 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002973 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2974 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2975}
2976
2977/* vec_vmrghb */
2978
2979#define __builtin_altivec_vmrghb vec_vmrghb
2980
2981static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002982vec_vmrghb(vector signed char __a, vector signed 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
2989static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002990vec_vmrghb(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002991{
David Blaikie3302f2b2013-01-16 23:08:36 +00002992 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002993 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2994 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2995}
2996
Anton Yartsev9e968982010-08-19 03:00:09 +00002997static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002998vec_vmrghb(vector bool char __a, vector bool char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002999{
David Blaikie3302f2b2013-01-16 23:08:36 +00003000 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003001 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
3002 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
3003}
3004
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003005/* vec_vmrghh */
3006
3007#define __builtin_altivec_vmrghh vec_vmrghh
3008
3009static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003010vec_vmrghh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003011{
David Blaikie3302f2b2013-01-16 23:08:36 +00003012 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003013 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
3014 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
3015}
3016
3017static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003018vec_vmrghh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003019{
David Blaikie3302f2b2013-01-16 23:08:36 +00003020 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003021 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
3022 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
3023}
3024
Anton Yartsev9e968982010-08-19 03:00:09 +00003025static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003026vec_vmrghh(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003027{
David Blaikie3302f2b2013-01-16 23:08:36 +00003028 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003029 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
3030 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
3031}
3032
3033static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003034vec_vmrghh(vector pixel __a, vector pixel __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003035{
David Blaikie3302f2b2013-01-16 23:08:36 +00003036 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003037 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
3038 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
3039}
3040
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003041/* vec_vmrghw */
3042
3043#define __builtin_altivec_vmrghw vec_vmrghw
3044
3045static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003046vec_vmrghw(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003047{
David Blaikie3302f2b2013-01-16 23:08:36 +00003048 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003049 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
3050 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
3051}
3052
3053static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003054vec_vmrghw(vector unsigned int __a, vector unsigned int __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
Anton Yartsev9e968982010-08-19 03:00:09 +00003061static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003062vec_vmrghw(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003063{
David Blaikie3302f2b2013-01-16 23:08:36 +00003064 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003065 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
3066 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
3067}
3068
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003069static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003070vec_vmrghw(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003071{
David Blaikie3302f2b2013-01-16 23:08:36 +00003072 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003073 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
3074 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
3075}
3076
3077/* vec_mergel */
3078
3079static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003080vec_mergel(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003081{
David Blaikie3302f2b2013-01-16 23:08:36 +00003082 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003083 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
3084 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
3085}
3086
3087static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003088vec_mergel(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003089{
David Blaikie3302f2b2013-01-16 23:08:36 +00003090 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003091 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
3092 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
3093}
3094
Anton Yartsev9e968982010-08-19 03:00:09 +00003095static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003096vec_mergel(vector bool char __a, vector bool char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003097{
David Blaikie3302f2b2013-01-16 23:08:36 +00003098 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003099 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
3100 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
3101}
3102
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003103static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003104vec_mergel(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003105{
David Blaikie3302f2b2013-01-16 23:08:36 +00003106 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003107 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3108 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3109}
3110
3111static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003112vec_mergel(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003113{
David Blaikie3302f2b2013-01-16 23:08:36 +00003114 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003115 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3116 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3117}
3118
Anton Yartsev9e968982010-08-19 03:00:09 +00003119static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003120vec_mergel(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003121{
David Blaikie3302f2b2013-01-16 23:08:36 +00003122 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003123 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3124 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3125}
3126
3127static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003128vec_mergel(vector pixel __a, vector pixel __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003129{
David Blaikie3302f2b2013-01-16 23:08:36 +00003130 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003131 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3132 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3133}
3134
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003135static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003136vec_mergel(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003137{
David Blaikie3302f2b2013-01-16 23:08:36 +00003138 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003139 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3140 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3141}
3142
3143static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003144vec_mergel(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003145{
David Blaikie3302f2b2013-01-16 23:08:36 +00003146 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003147 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3148 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3149}
3150
Anton Yartsev9e968982010-08-19 03:00:09 +00003151static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003152vec_mergel(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003153{
David Blaikie3302f2b2013-01-16 23:08:36 +00003154 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003155 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3156 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3157}
3158
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003159static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003160vec_mergel(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003161{
David Blaikie3302f2b2013-01-16 23:08:36 +00003162 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003163 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3164 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3165}
3166
3167/* vec_vmrglb */
3168
3169#define __builtin_altivec_vmrglb vec_vmrglb
3170
3171static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003172vec_vmrglb(vector signed char __a, vector signed 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
3179static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003180vec_vmrglb(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003181{
David Blaikie3302f2b2013-01-16 23:08:36 +00003182 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003183 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
3184 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
3185}
3186
Anton Yartsev9e968982010-08-19 03:00:09 +00003187static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003188vec_vmrglb(vector bool char __a, vector bool char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003189{
David Blaikie3302f2b2013-01-16 23:08:36 +00003190 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003191 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
3192 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
3193}
3194
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003195/* vec_vmrglh */
3196
3197#define __builtin_altivec_vmrglh vec_vmrglh
3198
3199static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003200vec_vmrglh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003201{
David Blaikie3302f2b2013-01-16 23:08:36 +00003202 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003203 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3204 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3205}
3206
3207static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003208vec_vmrglh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003209{
David Blaikie3302f2b2013-01-16 23:08:36 +00003210 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003211 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3212 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3213}
3214
Anton Yartsev9e968982010-08-19 03:00:09 +00003215static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003216vec_vmrglh(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003217{
David Blaikie3302f2b2013-01-16 23:08:36 +00003218 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003219 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3220 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3221}
3222
3223static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003224vec_vmrglh(vector pixel __a, vector pixel __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003225{
David Blaikie3302f2b2013-01-16 23:08:36 +00003226 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003227 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3228 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3229}
3230
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003231/* vec_vmrglw */
3232
3233#define __builtin_altivec_vmrglw vec_vmrglw
3234
3235static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003236vec_vmrglw(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003237{
David Blaikie3302f2b2013-01-16 23:08:36 +00003238 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003239 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3240 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3241}
3242
3243static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003244vec_vmrglw(vector unsigned int __a, vector unsigned int __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
Anton Yartsev9e968982010-08-19 03:00:09 +00003251static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003252vec_vmrglw(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003253{
David Blaikie3302f2b2013-01-16 23:08:36 +00003254 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003255 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3256 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3257}
3258
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003259static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003260vec_vmrglw(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003261{
David Blaikie3302f2b2013-01-16 23:08:36 +00003262 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003263 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3264 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3265}
3266
Chris Lattnerdad40622010-04-14 03:54:58 +00003267/* vec_mfvscr */
3268
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003269static vector unsigned short __attribute__((__always_inline__))
3270vec_mfvscr(void)
3271{
3272 return __builtin_altivec_mfvscr();
3273}
Chris Lattnerdad40622010-04-14 03:54:58 +00003274
3275/* vec_min */
3276
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003277static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003278vec_min(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003279{
David Blaikie3302f2b2013-01-16 23:08:36 +00003280 return __builtin_altivec_vminsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003281}
3282
Anton Yartsevfc83c602010-08-19 03:21:36 +00003283static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003284vec_min(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003285{
David Blaikie3302f2b2013-01-16 23:08:36 +00003286 return __builtin_altivec_vminsb((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003287}
3288
3289static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003290vec_min(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003291{
David Blaikie3302f2b2013-01-16 23:08:36 +00003292 return __builtin_altivec_vminsb(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003293}
3294
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003295static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003296vec_min(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003297{
David Blaikie3302f2b2013-01-16 23:08:36 +00003298 return __builtin_altivec_vminub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003299}
3300
Anton Yartsevfc83c602010-08-19 03:21:36 +00003301static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003302vec_min(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003303{
David Blaikie3302f2b2013-01-16 23:08:36 +00003304 return __builtin_altivec_vminub((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003305}
3306
3307static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003308vec_min(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003309{
David Blaikie3302f2b2013-01-16 23:08:36 +00003310 return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003311}
3312
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003313static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003314vec_min(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003315{
David Blaikie3302f2b2013-01-16 23:08:36 +00003316 return __builtin_altivec_vminsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003317}
3318
Anton Yartsevfc83c602010-08-19 03:21:36 +00003319static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003320vec_min(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003321{
David Blaikie3302f2b2013-01-16 23:08:36 +00003322 return __builtin_altivec_vminsh((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003323}
3324
3325static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003326vec_min(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003327{
David Blaikie3302f2b2013-01-16 23:08:36 +00003328 return __builtin_altivec_vminsh(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003329}
3330
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003331static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003332vec_min(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003333{
David Blaikie3302f2b2013-01-16 23:08:36 +00003334 return __builtin_altivec_vminuh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003335}
3336
Anton Yartsevfc83c602010-08-19 03:21:36 +00003337static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003338vec_min(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003339{
David Blaikie3302f2b2013-01-16 23:08:36 +00003340 return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003341}
3342
3343static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003344vec_min(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003345{
David Blaikie3302f2b2013-01-16 23:08:36 +00003346 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003347}
3348
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003349static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003350vec_min(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003351{
David Blaikie3302f2b2013-01-16 23:08:36 +00003352 return __builtin_altivec_vminsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003353}
3354
Anton Yartsevfc83c602010-08-19 03:21:36 +00003355static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003356vec_min(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003357{
David Blaikie3302f2b2013-01-16 23:08:36 +00003358 return __builtin_altivec_vminsw((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003359}
3360
3361static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003362vec_min(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003363{
David Blaikie3302f2b2013-01-16 23:08:36 +00003364 return __builtin_altivec_vminsw(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003365}
3366
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003367static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003368vec_min(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003369{
David Blaikie3302f2b2013-01-16 23:08:36 +00003370 return __builtin_altivec_vminuw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003371}
3372
Anton Yartsevfc83c602010-08-19 03:21:36 +00003373static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003374vec_min(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003375{
David Blaikie3302f2b2013-01-16 23:08:36 +00003376 return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003377}
3378
3379static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003380vec_min(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003381{
David Blaikie3302f2b2013-01-16 23:08:36 +00003382 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003383}
3384
Kit Barton8553bec2015-03-11 15:57:19 +00003385#ifdef __POWER8_VECTOR__
3386static vector signed long long __ATTRS_o_ai
3387vec_min(vector signed long long __a, vector signed long long __b)
3388{
3389 return __builtin_altivec_vminsd(__a, __b);
3390}
3391
3392static vector unsigned long long __ATTRS_o_ai
3393vec_min(vector unsigned long long __a, vector unsigned long long __b)
3394{
3395 return __builtin_altivec_vminud(__a, __b);
3396}
3397#endif
3398
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003399static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003400vec_min(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003401{
Bill Schmidt691e01d2014-10-31 19:19:24 +00003402#ifdef __VSX__
3403 return __builtin_vsx_xvminsp(__a, __b);
3404#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003405 return __builtin_altivec_vminfp(__a, __b);
Bill Schmidt691e01d2014-10-31 19:19:24 +00003406#endif
Chris Lattnerdad40622010-04-14 03:54:58 +00003407}
3408
Bill Schmidt691e01d2014-10-31 19:19:24 +00003409#ifdef __VSX__
3410static vector double __ATTRS_o_ai
3411vec_min(vector double __a, vector double __b)
3412{
3413 return __builtin_vsx_xvmindp(__a, __b);
3414}
3415#endif
3416
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003417/* vec_vminsb */
3418
Anton Yartsevfc83c602010-08-19 03:21:36 +00003419static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003420vec_vminsb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003421{
David Blaikie3302f2b2013-01-16 23:08:36 +00003422 return __builtin_altivec_vminsb(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003423}
3424
Anton Yartsevfc83c602010-08-19 03:21:36 +00003425static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003426vec_vminsb(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003427{
David Blaikie3302f2b2013-01-16 23:08:36 +00003428 return __builtin_altivec_vminsb((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003429}
3430
3431static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003432vec_vminsb(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003433{
David Blaikie3302f2b2013-01-16 23:08:36 +00003434 return __builtin_altivec_vminsb(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003435}
3436
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003437/* vec_vminub */
3438
Anton Yartsevfc83c602010-08-19 03:21:36 +00003439static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003440vec_vminub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003441{
David Blaikie3302f2b2013-01-16 23:08:36 +00003442 return __builtin_altivec_vminub(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003443}
3444
Anton Yartsevfc83c602010-08-19 03:21:36 +00003445static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003446vec_vminub(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003447{
David Blaikie3302f2b2013-01-16 23:08:36 +00003448 return __builtin_altivec_vminub((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003449}
3450
3451static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003452vec_vminub(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003453{
David Blaikie3302f2b2013-01-16 23:08:36 +00003454 return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003455}
3456
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003457/* vec_vminsh */
3458
Anton Yartsevfc83c602010-08-19 03:21:36 +00003459static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003460vec_vminsh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003461{
David Blaikie3302f2b2013-01-16 23:08:36 +00003462 return __builtin_altivec_vminsh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003463}
3464
Anton Yartsevfc83c602010-08-19 03:21:36 +00003465static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003466vec_vminsh(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003467{
David Blaikie3302f2b2013-01-16 23:08:36 +00003468 return __builtin_altivec_vminsh((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003469}
3470
3471static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003472vec_vminsh(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003473{
David Blaikie3302f2b2013-01-16 23:08:36 +00003474 return __builtin_altivec_vminsh(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003475}
3476
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003477/* vec_vminuh */
3478
Anton Yartsevfc83c602010-08-19 03:21:36 +00003479static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003480vec_vminuh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003481{
David Blaikie3302f2b2013-01-16 23:08:36 +00003482 return __builtin_altivec_vminuh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003483}
3484
Anton Yartsevfc83c602010-08-19 03:21:36 +00003485static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003486vec_vminuh(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003487{
David Blaikie3302f2b2013-01-16 23:08:36 +00003488 return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003489}
3490
3491static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003492vec_vminuh(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003493{
David Blaikie3302f2b2013-01-16 23:08:36 +00003494 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003495}
3496
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003497/* vec_vminsw */
3498
Anton Yartsevfc83c602010-08-19 03:21:36 +00003499static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003500vec_vminsw(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003501{
David Blaikie3302f2b2013-01-16 23:08:36 +00003502 return __builtin_altivec_vminsw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003503}
3504
Anton Yartsevfc83c602010-08-19 03:21:36 +00003505static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003506vec_vminsw(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003507{
David Blaikie3302f2b2013-01-16 23:08:36 +00003508 return __builtin_altivec_vminsw((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003509}
3510
3511static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003512vec_vminsw(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003513{
David Blaikie3302f2b2013-01-16 23:08:36 +00003514 return __builtin_altivec_vminsw(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003515}
3516
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003517/* vec_vminuw */
3518
Anton Yartsevfc83c602010-08-19 03:21:36 +00003519static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003520vec_vminuw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003521{
David Blaikie3302f2b2013-01-16 23:08:36 +00003522 return __builtin_altivec_vminuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003523}
3524
Anton Yartsevfc83c602010-08-19 03:21:36 +00003525static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003526vec_vminuw(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003527{
David Blaikie3302f2b2013-01-16 23:08:36 +00003528 return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003529}
3530
3531static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003532vec_vminuw(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003533{
David Blaikie3302f2b2013-01-16 23:08:36 +00003534 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003535}
3536
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003537/* vec_vminfp */
3538
3539static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003540vec_vminfp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003541{
Bill Schmidt691e01d2014-10-31 19:19:24 +00003542#ifdef __VSX__
3543 return __builtin_vsx_xvminsp(__a, __b);
3544#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003545 return __builtin_altivec_vminfp(__a, __b);
Bill Schmidt691e01d2014-10-31 19:19:24 +00003546#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003547}
3548
3549/* vec_mladd */
3550
3551#define __builtin_altivec_vmladduhm vec_mladd
3552
3553static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003554vec_mladd(vector short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003555{
David Blaikie3302f2b2013-01-16 23:08:36 +00003556 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003557}
3558
3559static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003560vec_mladd(vector short __a, vector unsigned short __b, vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003561{
David Blaikie3302f2b2013-01-16 23:08:36 +00003562 return __a * (vector short)__b + (vector short)__c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003563}
3564
3565static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003566vec_mladd(vector unsigned short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003567{
David Blaikie3302f2b2013-01-16 23:08:36 +00003568 return (vector short)__a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003569}
3570
3571static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003572vec_mladd(vector unsigned short __a,
3573 vector unsigned short __b,
3574 vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003575{
David Blaikie3302f2b2013-01-16 23:08:36 +00003576 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003577}
3578
3579/* vec_vmladduhm */
3580
3581static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003582vec_vmladduhm(vector short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003583{
David Blaikie3302f2b2013-01-16 23:08:36 +00003584 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003585}
3586
3587static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003588vec_vmladduhm(vector short __a, vector unsigned short __b, vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003589{
David Blaikie3302f2b2013-01-16 23:08:36 +00003590 return __a * (vector short)__b + (vector short)__c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003591}
3592
3593static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003594vec_vmladduhm(vector unsigned short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003595{
David Blaikie3302f2b2013-01-16 23:08:36 +00003596 return (vector short)__a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003597}
3598
3599static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003600vec_vmladduhm(vector unsigned short __a,
3601 vector unsigned short __b,
3602 vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003603{
David Blaikie3302f2b2013-01-16 23:08:36 +00003604 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003605}
3606
3607/* vec_mradds */
3608
3609static vector short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003610vec_mradds(vector short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003611{
David Blaikie3302f2b2013-01-16 23:08:36 +00003612 return __builtin_altivec_vmhraddshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003613}
3614
3615/* vec_vmhraddshs */
3616
3617static vector short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003618vec_vmhraddshs(vector short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003619{
David Blaikie3302f2b2013-01-16 23:08:36 +00003620 return __builtin_altivec_vmhraddshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003621}
3622
3623/* vec_msum */
3624
3625static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003626vec_msum(vector signed char __a, vector unsigned char __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003627{
David Blaikie3302f2b2013-01-16 23:08:36 +00003628 return __builtin_altivec_vmsummbm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003629}
3630
3631static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003632vec_msum(vector unsigned char __a, vector unsigned char __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003633{
David Blaikie3302f2b2013-01-16 23:08:36 +00003634 return __builtin_altivec_vmsumubm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003635}
3636
3637static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003638vec_msum(vector short __a, vector short __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003639{
David Blaikie3302f2b2013-01-16 23:08:36 +00003640 return __builtin_altivec_vmsumshm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003641}
3642
3643static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003644vec_msum(vector unsigned short __a,
3645 vector unsigned short __b,
3646 vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003647{
David Blaikie3302f2b2013-01-16 23:08:36 +00003648 return __builtin_altivec_vmsumuhm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003649}
3650
3651/* vec_vmsummbm */
3652
3653static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003654vec_vmsummbm(vector signed char __a, vector unsigned char __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003655{
David Blaikie3302f2b2013-01-16 23:08:36 +00003656 return __builtin_altivec_vmsummbm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003657}
3658
3659/* vec_vmsumubm */
3660
3661static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003662vec_vmsumubm(vector unsigned char __a,
3663 vector unsigned char __b,
3664 vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003665{
David Blaikie3302f2b2013-01-16 23:08:36 +00003666 return __builtin_altivec_vmsumubm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003667}
3668
3669/* vec_vmsumshm */
3670
3671static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003672vec_vmsumshm(vector short __a, vector short __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003673{
David Blaikie3302f2b2013-01-16 23:08:36 +00003674 return __builtin_altivec_vmsumshm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003675}
3676
3677/* vec_vmsumuhm */
3678
3679static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003680vec_vmsumuhm(vector unsigned short __a,
3681 vector unsigned short __b,
3682 vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003683{
David Blaikie3302f2b2013-01-16 23:08:36 +00003684 return __builtin_altivec_vmsumuhm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003685}
3686
3687/* vec_msums */
3688
3689static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003690vec_msums(vector short __a, vector short __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003691{
David Blaikie3302f2b2013-01-16 23:08:36 +00003692 return __builtin_altivec_vmsumshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003693}
3694
3695static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003696vec_msums(vector unsigned short __a,
3697 vector unsigned short __b,
3698 vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003699{
David Blaikie3302f2b2013-01-16 23:08:36 +00003700 return __builtin_altivec_vmsumuhs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003701}
3702
3703/* vec_vmsumshs */
3704
3705static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003706vec_vmsumshs(vector short __a, vector short __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003707{
David Blaikie3302f2b2013-01-16 23:08:36 +00003708 return __builtin_altivec_vmsumshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003709}
3710
3711/* vec_vmsumuhs */
3712
3713static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003714vec_vmsumuhs(vector unsigned short __a,
3715 vector unsigned short __b,
3716 vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003717{
David Blaikie3302f2b2013-01-16 23:08:36 +00003718 return __builtin_altivec_vmsumuhs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003719}
3720
Chris Lattnerdad40622010-04-14 03:54:58 +00003721/* vec_mtvscr */
3722
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003723static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003724vec_mtvscr(vector signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003725{
David Blaikie3302f2b2013-01-16 23:08:36 +00003726 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003727}
3728
3729static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003730vec_mtvscr(vector unsigned char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003731{
David Blaikie3302f2b2013-01-16 23:08:36 +00003732 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003733}
3734
3735static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003736vec_mtvscr(vector bool char __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003737{
David Blaikie3302f2b2013-01-16 23:08:36 +00003738 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003739}
3740
3741static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003742vec_mtvscr(vector short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003743{
David Blaikie3302f2b2013-01-16 23:08:36 +00003744 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003745}
3746
3747static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003748vec_mtvscr(vector unsigned short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003749{
David Blaikie3302f2b2013-01-16 23:08:36 +00003750 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003751}
3752
3753static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003754vec_mtvscr(vector bool short __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003755{
David Blaikie3302f2b2013-01-16 23:08:36 +00003756 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003757}
3758
3759static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003760vec_mtvscr(vector pixel __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003761{
David Blaikie3302f2b2013-01-16 23:08:36 +00003762 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003763}
3764
3765static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003766vec_mtvscr(vector int __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003767{
David Blaikie3302f2b2013-01-16 23:08:36 +00003768 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003769}
3770
3771static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003772vec_mtvscr(vector unsigned int __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003773{
David Blaikie3302f2b2013-01-16 23:08:36 +00003774 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003775}
3776
3777static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003778vec_mtvscr(vector bool int __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003779{
David Blaikie3302f2b2013-01-16 23:08:36 +00003780 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003781}
3782
3783static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003784vec_mtvscr(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003785{
David Blaikie3302f2b2013-01-16 23:08:36 +00003786 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003787}
3788
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003789/* The vmulos* and vmules* instructions have a big endian bias, so
3790 we must reverse the meaning of "even" and "odd" for little endian. */
3791
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003792/* vec_mule */
3793
3794static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003795vec_mule(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003796{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003797#ifdef __LITTLE_ENDIAN__
3798 return __builtin_altivec_vmulosb(__a, __b);
3799#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003800 return __builtin_altivec_vmulesb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003801#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003802}
3803
3804static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003805vec_mule(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003806{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003807#ifdef __LITTLE_ENDIAN__
3808 return __builtin_altivec_vmuloub(__a, __b);
3809#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003810 return __builtin_altivec_vmuleub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003811#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003812}
3813
3814static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003815vec_mule(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003816{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003817#ifdef __LITTLE_ENDIAN__
3818 return __builtin_altivec_vmulosh(__a, __b);
3819#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003820 return __builtin_altivec_vmulesh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003821#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003822}
3823
3824static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003825vec_mule(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003826{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003827#ifdef __LITTLE_ENDIAN__
3828 return __builtin_altivec_vmulouh(__a, __b);
3829#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003830 return __builtin_altivec_vmuleuh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003831#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003832}
3833
Kit Barton8553bec2015-03-11 15:57:19 +00003834#ifdef __POWER8_VECTOR__
3835static vector signed long long __ATTRS_o_ai
3836vec_mule(vector signed int __a, vector signed int __b)
3837{
3838#ifdef __LITTLE_ENDIAN__
3839 return __builtin_altivec_vmulosw(__a, __b);
3840#else
3841 return __builtin_altivec_vmulesw(__a, __b);
3842#endif
3843}
3844
3845static vector unsigned long long __ATTRS_o_ai
3846vec_mule(vector unsigned int __a, vector unsigned int __b)
3847{
3848#ifdef __LITTLE_ENDIAN__
3849 return __builtin_altivec_vmulouw(__a, __b);
3850#else
3851 return __builtin_altivec_vmuleuw(__a, __b);
3852#endif
3853}
3854#endif
3855
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003856/* vec_vmulesb */
3857
3858static vector short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003859vec_vmulesb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003860{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003861#ifdef __LITTLE_ENDIAN__
3862 return __builtin_altivec_vmulosb(__a, __b);
3863#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003864 return __builtin_altivec_vmulesb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003865#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003866}
3867
3868/* vec_vmuleub */
3869
3870static vector unsigned short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003871vec_vmuleub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003872{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003873#ifdef __LITTLE_ENDIAN__
3874 return __builtin_altivec_vmuloub(__a, __b);
3875#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003876 return __builtin_altivec_vmuleub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003877#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003878}
3879
3880/* vec_vmulesh */
3881
3882static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003883vec_vmulesh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003884{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003885#ifdef __LITTLE_ENDIAN__
3886 return __builtin_altivec_vmulosh(__a, __b);
3887#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003888 return __builtin_altivec_vmulesh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003889#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003890}
3891
3892/* vec_vmuleuh */
3893
3894static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003895vec_vmuleuh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003896{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003897#ifdef __LITTLE_ENDIAN__
3898 return __builtin_altivec_vmulouh(__a, __b);
3899#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003900 return __builtin_altivec_vmuleuh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003901#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003902}
3903
3904/* vec_mulo */
3905
3906static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003907vec_mulo(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003908{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003909#ifdef __LITTLE_ENDIAN__
3910 return __builtin_altivec_vmulesb(__a, __b);
3911#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003912 return __builtin_altivec_vmulosb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003913#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003914}
3915
3916static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003917vec_mulo(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003918{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003919#ifdef __LITTLE_ENDIAN__
3920 return __builtin_altivec_vmuleub(__a, __b);
3921#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003922 return __builtin_altivec_vmuloub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003923#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003924}
3925
3926static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003927vec_mulo(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003928{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003929#ifdef __LITTLE_ENDIAN__
3930 return __builtin_altivec_vmulesh(__a, __b);
3931#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003932 return __builtin_altivec_vmulosh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003933#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003934}
3935
3936static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003937vec_mulo(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003938{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003939#ifdef __LITTLE_ENDIAN__
3940 return __builtin_altivec_vmuleuh(__a, __b);
3941#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003942 return __builtin_altivec_vmulouh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003943#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003944}
3945
Kit Barton8553bec2015-03-11 15:57:19 +00003946#ifdef __POWER8_VECTOR__
3947static vector signed long long __ATTRS_o_ai
3948vec_mulo(vector signed int __a, vector signed int __b)
3949{
3950#ifdef __LITTLE_ENDIAN__
3951 return __builtin_altivec_vmulesw(__a, __b);
3952#else
3953 return __builtin_altivec_vmulosw(__a, __b);
3954#endif
3955}
3956
3957static vector unsigned long long __ATTRS_o_ai
3958vec_mulo(vector unsigned int __a, vector unsigned int __b)
3959{
3960#ifdef __LITTLE_ENDIAN__
3961 return __builtin_altivec_vmuleuw(__a, __b);
3962#else
3963 return __builtin_altivec_vmulouw(__a, __b);
3964#endif
3965}
3966#endif
3967
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003968/* vec_vmulosb */
3969
3970static vector short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003971vec_vmulosb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003972{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003973#ifdef __LITTLE_ENDIAN__
3974 return __builtin_altivec_vmulesb(__a, __b);
3975#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003976 return __builtin_altivec_vmulosb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003977#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003978}
3979
3980/* vec_vmuloub */
3981
3982static vector unsigned short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003983vec_vmuloub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003984{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003985#ifdef __LITTLE_ENDIAN__
3986 return __builtin_altivec_vmuleub(__a, __b);
3987#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003988 return __builtin_altivec_vmuloub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003989#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003990}
3991
3992/* vec_vmulosh */
3993
3994static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003995vec_vmulosh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003996{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003997#ifdef __LITTLE_ENDIAN__
3998 return __builtin_altivec_vmulesh(__a, __b);
3999#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004000 return __builtin_altivec_vmulosh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00004001#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004002}
4003
4004/* vec_vmulouh */
4005
4006static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004007vec_vmulouh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004008{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00004009#ifdef __LITTLE_ENDIAN__
4010 return __builtin_altivec_vmuleuh(__a, __b);
4011#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004012 return __builtin_altivec_vmulouh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00004013#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004014}
4015
4016/* vec_nmsub */
4017
4018static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004019vec_nmsub(vector float __a, vector float __b, vector float __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004020{
David Blaikie3302f2b2013-01-16 23:08:36 +00004021 return __builtin_altivec_vnmsubfp(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004022}
4023
4024/* vec_vnmsubfp */
4025
4026static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004027vec_vnmsubfp(vector float __a, vector float __b, vector float __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004028{
David Blaikie3302f2b2013-01-16 23:08:36 +00004029 return __builtin_altivec_vnmsubfp(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004030}
4031
4032/* vec_nor */
4033
4034#define __builtin_altivec_vnor vec_nor
4035
4036static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004037vec_nor(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004038{
David Blaikie3302f2b2013-01-16 23:08:36 +00004039 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004040}
4041
4042static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004043vec_nor(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004044{
David Blaikie3302f2b2013-01-16 23:08:36 +00004045 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004046}
4047
Anton Yartsevfc83c602010-08-19 03:21:36 +00004048static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004049vec_nor(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004050{
David Blaikie3302f2b2013-01-16 23:08:36 +00004051 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00004052}
4053
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004054static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004055vec_nor(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004056{
David Blaikie3302f2b2013-01-16 23:08:36 +00004057 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004058}
4059
4060static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004061vec_nor(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004062{
David Blaikie3302f2b2013-01-16 23:08:36 +00004063 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004064}
4065
Anton Yartsevfc83c602010-08-19 03:21:36 +00004066static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004067vec_nor(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004068{
David Blaikie3302f2b2013-01-16 23:08:36 +00004069 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00004070}
4071
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004072static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004073vec_nor(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004074{
David Blaikie3302f2b2013-01-16 23:08:36 +00004075 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004076}
4077
4078static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004079vec_nor(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004080{
David Blaikie3302f2b2013-01-16 23:08:36 +00004081 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004082}
4083
Anton Yartsevfc83c602010-08-19 03:21:36 +00004084static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004085vec_nor(vector bool int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004086{
David Blaikie3302f2b2013-01-16 23:08:36 +00004087 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00004088}
4089
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004090static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004091vec_nor(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004092{
David Blaikie3302f2b2013-01-16 23:08:36 +00004093 vector unsigned int __res = ~((vector unsigned int)__a | (vector unsigned int)__b);
4094 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004095}
4096
4097/* vec_vnor */
4098
4099static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004100vec_vnor(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004101{
David Blaikie3302f2b2013-01-16 23:08:36 +00004102 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004103}
4104
4105static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004106vec_vnor(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004107{
David Blaikie3302f2b2013-01-16 23:08:36 +00004108 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004109}
4110
Anton Yartsevfc83c602010-08-19 03:21:36 +00004111static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004112vec_vnor(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004113{
David Blaikie3302f2b2013-01-16 23:08:36 +00004114 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00004115}
4116
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004117static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004118vec_vnor(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004119{
David Blaikie3302f2b2013-01-16 23:08:36 +00004120 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004121}
4122
4123static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004124vec_vnor(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004125{
David Blaikie3302f2b2013-01-16 23:08:36 +00004126 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004127}
4128
Anton Yartsevfc83c602010-08-19 03:21:36 +00004129static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004130vec_vnor(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004131{
David Blaikie3302f2b2013-01-16 23:08:36 +00004132 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00004133}
4134
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004135static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004136vec_vnor(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004137{
David Blaikie3302f2b2013-01-16 23:08:36 +00004138 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004139}
4140
4141static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004142vec_vnor(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004143{
David Blaikie3302f2b2013-01-16 23:08:36 +00004144 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004145}
4146
Anton Yartsevfc83c602010-08-19 03:21:36 +00004147static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004148vec_vnor(vector bool int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004149{
David Blaikie3302f2b2013-01-16 23:08:36 +00004150 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00004151}
4152
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004153static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004154vec_vnor(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004155{
David Blaikie3302f2b2013-01-16 23:08:36 +00004156 vector unsigned int __res = ~((vector unsigned int)__a | (vector unsigned int)__b);
4157 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004158}
4159
4160/* vec_or */
4161
4162#define __builtin_altivec_vor vec_or
4163
4164static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004165vec_or(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004166{
David Blaikie3302f2b2013-01-16 23:08:36 +00004167 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004168}
4169
Anton Yartsevfc83c602010-08-19 03:21:36 +00004170static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004171vec_or(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004172{
David Blaikie3302f2b2013-01-16 23:08:36 +00004173 return (vector signed char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004174}
4175
4176static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004177vec_or(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004178{
David Blaikie3302f2b2013-01-16 23:08:36 +00004179 return __a | (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004180}
4181
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004182static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004183vec_or(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004184{
David Blaikie3302f2b2013-01-16 23:08:36 +00004185 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004186}
4187
Anton Yartsevfc83c602010-08-19 03:21:36 +00004188static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004189vec_or(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004190{
David Blaikie3302f2b2013-01-16 23:08:36 +00004191 return (vector unsigned char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004192}
4193
4194static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004195vec_or(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004196{
David Blaikie3302f2b2013-01-16 23:08:36 +00004197 return __a | (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004198}
4199
4200static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004201vec_or(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004202{
David Blaikie3302f2b2013-01-16 23:08:36 +00004203 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004204}
4205
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004206static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004207vec_or(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004208{
David Blaikie3302f2b2013-01-16 23:08:36 +00004209 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004210}
4211
Anton Yartsevfc83c602010-08-19 03:21:36 +00004212static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004213vec_or(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004214{
David Blaikie3302f2b2013-01-16 23:08:36 +00004215 return (vector short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004216}
4217
4218static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004219vec_or(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004220{
David Blaikie3302f2b2013-01-16 23:08:36 +00004221 return __a | (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004222}
4223
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004224static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004225vec_or(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004226{
David Blaikie3302f2b2013-01-16 23:08:36 +00004227 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004228}
4229
Anton Yartsevfc83c602010-08-19 03:21:36 +00004230static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004231vec_or(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004232{
David Blaikie3302f2b2013-01-16 23:08:36 +00004233 return (vector unsigned short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004234}
4235
4236static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004237vec_or(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004238{
David Blaikie3302f2b2013-01-16 23:08:36 +00004239 return __a | (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004240}
4241
4242static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004243vec_or(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004244{
David Blaikie3302f2b2013-01-16 23:08:36 +00004245 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004246}
4247
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004248static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004249vec_or(vector int __a, vector int __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 int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004255vec_or(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004256{
David Blaikie3302f2b2013-01-16 23:08:36 +00004257 return (vector int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004258}
4259
4260static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004261vec_or(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004262{
David Blaikie3302f2b2013-01-16 23:08:36 +00004263 return __a | (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004264}
4265
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004266static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004267vec_or(vector unsigned int __a, vector unsigned int __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 int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004273vec_or(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004274{
David Blaikie3302f2b2013-01-16 23:08:36 +00004275 return (vector unsigned int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004276}
4277
4278static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004279vec_or(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004280{
David Blaikie3302f2b2013-01-16 23:08:36 +00004281 return __a | (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004282}
4283
4284static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004285vec_or(vector bool int __a, vector bool int __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 float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004291vec_or(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004292{
David Blaikie3302f2b2013-01-16 23:08:36 +00004293 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4294 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004295}
4296
Anton Yartsevfc83c602010-08-19 03:21:36 +00004297static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004298vec_or(vector bool int __a, vector float __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004299{
David Blaikie3302f2b2013-01-16 23:08:36 +00004300 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4301 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004302}
4303
4304static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004305vec_or(vector float __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004306{
David Blaikie3302f2b2013-01-16 23:08:36 +00004307 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4308 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004309}
4310
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004311/* vec_vor */
4312
4313static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004314vec_vor(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004315{
David Blaikie3302f2b2013-01-16 23:08:36 +00004316 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004317}
4318
Anton Yartsevfc83c602010-08-19 03:21:36 +00004319static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004320vec_vor(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004321{
David Blaikie3302f2b2013-01-16 23:08:36 +00004322 return (vector signed char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004323}
4324
4325static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004326vec_vor(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004327{
David Blaikie3302f2b2013-01-16 23:08:36 +00004328 return __a | (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004329}
4330
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004331static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004332vec_vor(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004333{
David Blaikie3302f2b2013-01-16 23:08:36 +00004334 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004335}
4336
Anton Yartsevfc83c602010-08-19 03:21:36 +00004337static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004338vec_vor(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004339{
David Blaikie3302f2b2013-01-16 23:08:36 +00004340 return (vector unsigned char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004341}
4342
4343static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004344vec_vor(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004345{
David Blaikie3302f2b2013-01-16 23:08:36 +00004346 return __a | (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004347}
4348
4349static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004350vec_vor(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004351{
David Blaikie3302f2b2013-01-16 23:08:36 +00004352 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004353}
4354
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004355static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004356vec_vor(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004357{
David Blaikie3302f2b2013-01-16 23:08:36 +00004358 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004359}
4360
Anton Yartsevfc83c602010-08-19 03:21:36 +00004361static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004362vec_vor(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004363{
David Blaikie3302f2b2013-01-16 23:08:36 +00004364 return (vector short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004365}
4366
4367static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004368vec_vor(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004369{
David Blaikie3302f2b2013-01-16 23:08:36 +00004370 return __a | (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004371}
4372
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004373static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004374vec_vor(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004375{
David Blaikie3302f2b2013-01-16 23:08:36 +00004376 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004377}
4378
Anton Yartsevfc83c602010-08-19 03:21:36 +00004379static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004380vec_vor(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004381{
David Blaikie3302f2b2013-01-16 23:08:36 +00004382 return (vector unsigned short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004383}
4384
4385static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004386vec_vor(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004387{
David Blaikie3302f2b2013-01-16 23:08:36 +00004388 return __a | (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004389}
4390
4391static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004392vec_vor(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004393{
David Blaikie3302f2b2013-01-16 23:08:36 +00004394 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004395}
4396
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004397static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004398vec_vor(vector int __a, vector int __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 int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004404vec_vor(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004405{
David Blaikie3302f2b2013-01-16 23:08:36 +00004406 return (vector int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004407}
4408
4409static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004410vec_vor(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004411{
David Blaikie3302f2b2013-01-16 23:08:36 +00004412 return __a | (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004413}
4414
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004415static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004416vec_vor(vector unsigned int __a, vector unsigned int __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 int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004422vec_vor(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004423{
David Blaikie3302f2b2013-01-16 23:08:36 +00004424 return (vector unsigned int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004425}
4426
4427static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004428vec_vor(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004429{
David Blaikie3302f2b2013-01-16 23:08:36 +00004430 return __a | (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004431}
4432
4433static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004434vec_vor(vector bool int __a, vector bool int __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 float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004440vec_vor(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004441{
David Blaikie3302f2b2013-01-16 23:08:36 +00004442 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4443 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004444}
4445
Anton Yartsevfc83c602010-08-19 03:21:36 +00004446static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004447vec_vor(vector bool int __a, vector float __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004448{
David Blaikie3302f2b2013-01-16 23:08:36 +00004449 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4450 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004451}
4452
4453static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004454vec_vor(vector float __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004455{
David Blaikie3302f2b2013-01-16 23:08:36 +00004456 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4457 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004458}
4459
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004460/* vec_pack */
4461
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004462/* The various vector pack instructions have a big-endian bias, so for
4463 little endian we must handle reversed element numbering. */
4464
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004465static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004466vec_pack(vector signed short __a, vector signed short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004467{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004468#ifdef __LITTLE_ENDIAN__
4469 return (vector signed char)vec_perm(__a, __b, (vector unsigned char)
4470 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4471 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4472#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004473 return (vector signed char)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004474 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4475 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004476#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004477}
4478
4479static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004480vec_pack(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004481{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004482#ifdef __LITTLE_ENDIAN__
4483 return (vector unsigned char)vec_perm(__a, __b, (vector unsigned char)
4484 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4485 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4486#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004487 return (vector unsigned char)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004488 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4489 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004490#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004491}
4492
Anton Yartsev9e968982010-08-19 03:00:09 +00004493static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004494vec_pack(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00004495{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004496#ifdef __LITTLE_ENDIAN__
4497 return (vector bool char)vec_perm(__a, __b, (vector unsigned char)
4498 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4499 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4500#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004501 return (vector bool char)vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00004502 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4503 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004504#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004505}
4506
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004507static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004508vec_pack(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004509{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004510#ifdef __LITTLE_ENDIAN__
4511 return (vector short)vec_perm(__a, __b, (vector unsigned char)
4512 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4513 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4514#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004515 return (vector short)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004516 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4517 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004518#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004519}
4520
4521static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004522vec_pack(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004523{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004524#ifdef __LITTLE_ENDIAN__
4525 return (vector unsigned short)vec_perm(__a, __b, (vector unsigned char)
4526 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4527 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4528#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004529 return (vector unsigned short)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004530 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4531 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004532#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004533}
4534
Anton Yartsev9e968982010-08-19 03:00:09 +00004535static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004536vec_pack(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00004537{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004538#ifdef __LITTLE_ENDIAN__
Bill Schmidt1cf7c642014-06-13 18:30:06 +00004539 return (vector bool short)vec_perm(__a, __b, (vector unsigned char)
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004540 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4541 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4542#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004543 return (vector bool short)vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00004544 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4545 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004546#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004547}
4548
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004549/* vec_vpkuhum */
4550
4551#define __builtin_altivec_vpkuhum vec_vpkuhum
4552
4553static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004554vec_vpkuhum(vector signed short __a, vector signed short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004555{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004556#ifdef __LITTLE_ENDIAN__
4557 return (vector signed char)vec_perm(__a, __b, (vector unsigned char)
4558 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4559 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4560#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004561 return (vector signed char)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004562 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4563 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004564#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004565}
4566
4567static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004568vec_vpkuhum(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004569{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004570#ifdef __LITTLE_ENDIAN__
4571 return (vector unsigned char)vec_perm(__a, __b, (vector unsigned char)
4572 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4573 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4574#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004575 return (vector unsigned char)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004576 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4577 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004578#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004579}
4580
Anton Yartsev9e968982010-08-19 03:00:09 +00004581static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004582vec_vpkuhum(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00004583{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004584#ifdef __LITTLE_ENDIAN__
4585 return (vector bool char)vec_perm(__a, __b, (vector unsigned char)
4586 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4587 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4588#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004589 return (vector bool char)vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00004590 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4591 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004592#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004593}
4594
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004595/* vec_vpkuwum */
4596
4597#define __builtin_altivec_vpkuwum vec_vpkuwum
4598
4599static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004600vec_vpkuwum(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004601{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004602#ifdef __LITTLE_ENDIAN__
4603 return (vector short)vec_perm(__a, __b, (vector unsigned char)
4604 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4605 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4606#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004607 return (vector short)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004608 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4609 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004610#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004611}
4612
4613static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004614vec_vpkuwum(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004615{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004616#ifdef __LITTLE_ENDIAN__
4617 return (vector unsigned short)vec_perm(__a, __b, (vector unsigned char)
4618 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4619 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4620#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004621 return (vector unsigned short)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004622 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4623 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004624#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004625}
4626
Anton Yartsev9e968982010-08-19 03:00:09 +00004627static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004628vec_vpkuwum(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00004629{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004630#ifdef __LITTLE_ENDIAN__
4631 return (vector bool short)vec_perm(__a, __b, (vector unsigned char)
4632 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4633 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4634#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004635 return (vector bool short)vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00004636 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4637 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004638#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004639}
4640
Bill Schmidt41e14c42015-05-16 01:02:25 +00004641/* vec_vpkudum */
4642
4643#ifdef __POWER8_VECTOR__
4644#define __builtin_altivec_vpkudum vec_vpkudum
4645
4646static vector int __ATTRS_o_ai
4647vec_vpkudum(vector long long __a, vector long long __b)
4648{
4649#ifdef __LITTLE_ENDIAN__
4650 return (vector int)vec_perm(__a, __b, (vector unsigned char)
4651 (0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
4652 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
4653#else
4654 return (vector int)vec_perm(__a, __b, (vector unsigned char)
4655 (0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
4656 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
4657#endif
4658}
4659
4660static vector unsigned int __ATTRS_o_ai
4661vec_vpkudum(vector unsigned long long __a, vector unsigned long long __b)
4662{
4663#ifdef __LITTLE_ENDIAN__
4664 return (vector unsigned int)vec_perm(__a, __b, (vector unsigned char)
4665 (0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
4666 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
4667#else
4668 return (vector unsigned int)vec_perm(__a, __b, (vector unsigned char)
4669 (0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
4670 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
4671#endif
4672}
4673
4674static vector bool int __ATTRS_o_ai
4675vec_vpkudum(vector bool long long __a, vector bool long long __b)
4676{
4677#ifdef __LITTLE_ENDIAN__
4678 return (vector bool int)vec_perm((vector long long)__a,
4679 (vector long long)__b,
4680 (vector unsigned char)
4681 (0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
4682 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
4683#else
4684 return (vector bool int)vec_perm((vector long long)__a,
4685 (vector long long)__b,
4686 (vector unsigned char)
4687 (0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
4688 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
4689#endif
4690}
4691#endif
4692
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004693/* vec_packpx */
4694
4695static vector pixel __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004696vec_packpx(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004697{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004698#ifdef __LITTLE_ENDIAN__
4699 return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
4700#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004701 return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004702#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004703}
4704
4705/* vec_vpkpx */
4706
4707static vector pixel __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004708vec_vpkpx(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004709{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004710#ifdef __LITTLE_ENDIAN__
4711 return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
4712#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004713 return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004714#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004715}
4716
4717/* vec_packs */
4718
4719static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004720vec_packs(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004721{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004722#ifdef __LITTLE_ENDIAN__
4723 return __builtin_altivec_vpkshss(__b, __a);
4724#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004725 return __builtin_altivec_vpkshss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004726#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004727}
4728
4729static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004730vec_packs(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004731{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004732#ifdef __LITTLE_ENDIAN__
4733 return __builtin_altivec_vpkuhus(__b, __a);
4734#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004735 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004736#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004737}
4738
4739static vector signed short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004740vec_packs(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004741{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004742#ifdef __LITTLE_ENDIAN__
4743 return __builtin_altivec_vpkswss(__b, __a);
4744#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004745 return __builtin_altivec_vpkswss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004746#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004747}
4748
4749static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004750vec_packs(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004751{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004752#ifdef __LITTLE_ENDIAN__
4753 return __builtin_altivec_vpkuwus(__b, __a);
4754#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004755 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004756#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004757}
4758
Bill Schmidt41e14c42015-05-16 01:02:25 +00004759#ifdef __POWER8_VECTOR__
4760static vector int __ATTRS_o_ai
4761vec_packs(vector long long __a, vector long long __b)
4762{
4763#ifdef __LITTLE_ENDIAN__
4764 return __builtin_altivec_vpksdss(__b, __a);
4765#else
4766 return __builtin_altivec_vpksdss(__a, __b);
4767#endif
4768}
4769
4770static vector unsigned int __ATTRS_o_ai
4771vec_packs(vector unsigned long long __a, vector unsigned long long __b)
4772{
4773#ifdef __LITTLE_ENDIAN__
4774 return __builtin_altivec_vpkudus(__b, __a);
4775#else
4776 return __builtin_altivec_vpkudus(__a, __b);
4777#endif
4778}
4779#endif
4780
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004781/* vec_vpkshss */
4782
4783static vector signed char __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004784vec_vpkshss(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004785{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004786#ifdef __LITTLE_ENDIAN__
4787 return __builtin_altivec_vpkshss(__b, __a);
4788#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004789 return __builtin_altivec_vpkshss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004790#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004791}
4792
Bill Schmidt41e14c42015-05-16 01:02:25 +00004793/* vec_vpksdss */
4794
4795#ifdef __POWER8_VECTOR__
4796static vector int __ATTRS_o_ai
4797vec_vpksdss(vector long long __a, vector long long __b)
4798{
4799#ifdef __LITTLE_ENDIAN__
4800 return __builtin_altivec_vpksdss(__b, __a);
4801#else
4802 return __builtin_altivec_vpksdss(__a, __b);
4803#endif
4804}
4805#endif
4806
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004807/* vec_vpkuhus */
4808
4809static vector unsigned char __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004810vec_vpkuhus(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004811{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004812#ifdef __LITTLE_ENDIAN__
4813 return __builtin_altivec_vpkuhus(__b, __a);
4814#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004815 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004816#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004817}
4818
Bill Schmidt41e14c42015-05-16 01:02:25 +00004819/* vec_vpkudus */
4820
4821#ifdef __POWER8_VECTOR__
4822static vector unsigned int __attribute__((__always_inline__))
4823vec_vpkudus(vector unsigned long long __a, vector unsigned long long __b)
4824{
4825#ifdef __LITTLE_ENDIAN__
4826 return __builtin_altivec_vpkudus(__b, __a);
4827#else
4828 return __builtin_altivec_vpkudus(__a, __b);
4829#endif
4830}
4831#endif
4832
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004833/* vec_vpkswss */
4834
4835static vector signed short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004836vec_vpkswss(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004837{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004838#ifdef __LITTLE_ENDIAN__
4839 return __builtin_altivec_vpkswss(__b, __a);
4840#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004841 return __builtin_altivec_vpkswss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004842#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004843}
4844
4845/* vec_vpkuwus */
4846
4847static vector unsigned short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004848vec_vpkuwus(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004849{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004850#ifdef __LITTLE_ENDIAN__
4851 return __builtin_altivec_vpkuwus(__b, __a);
4852#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004853 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004854#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004855}
4856
4857/* vec_packsu */
4858
4859static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004860vec_packsu(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004861{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004862#ifdef __LITTLE_ENDIAN__
4863 return __builtin_altivec_vpkshus(__b, __a);
4864#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004865 return __builtin_altivec_vpkshus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004866#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004867}
4868
4869static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004870vec_packsu(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004871{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004872#ifdef __LITTLE_ENDIAN__
4873 return __builtin_altivec_vpkuhus(__b, __a);
4874#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004875 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004876#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004877}
4878
4879static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004880vec_packsu(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004881{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004882#ifdef __LITTLE_ENDIAN__
4883 return __builtin_altivec_vpkswus(__b, __a);
4884#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004885 return __builtin_altivec_vpkswus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004886#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004887}
4888
4889static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004890vec_packsu(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004891{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004892#ifdef __LITTLE_ENDIAN__
4893 return __builtin_altivec_vpkuwus(__b, __a);
4894#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004895 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004896#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004897}
4898
Bill Schmidt41e14c42015-05-16 01:02:25 +00004899#ifdef __POWER8_VECTOR__
4900static vector unsigned int __ATTRS_o_ai
4901vec_packsu(vector long long __a, vector long long __b)
4902{
4903#ifdef __LITTLE_ENDIAN__
4904 return __builtin_altivec_vpksdus(__b, __a);
4905#else
4906 return __builtin_altivec_vpksdus(__a, __b);
4907#endif
4908}
4909
4910static vector unsigned int __ATTRS_o_ai
4911vec_packsu(vector unsigned long long __a, vector unsigned long long __b)
4912{
4913#ifdef __LITTLE_ENDIAN__
4914 return __builtin_altivec_vpkudus(__b, __a);
4915#else
4916 return __builtin_altivec_vpkudus(__a, __b);
4917#endif
4918}
4919#endif
4920
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004921/* vec_vpkshus */
4922
4923static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004924vec_vpkshus(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004925{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004926#ifdef __LITTLE_ENDIAN__
4927 return __builtin_altivec_vpkshus(__b, __a);
4928#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004929 return __builtin_altivec_vpkshus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004930#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004931}
4932
4933static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004934vec_vpkshus(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004935{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004936#ifdef __LITTLE_ENDIAN__
4937 return __builtin_altivec_vpkuhus(__b, __a);
4938#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004939 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004940#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004941}
4942
4943/* vec_vpkswus */
4944
4945static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004946vec_vpkswus(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004947{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004948#ifdef __LITTLE_ENDIAN__
4949 return __builtin_altivec_vpkswus(__b, __a);
4950#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004951 return __builtin_altivec_vpkswus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004952#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004953}
4954
4955static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004956vec_vpkswus(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004957{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004958#ifdef __LITTLE_ENDIAN__
4959 return __builtin_altivec_vpkuwus(__b, __a);
4960#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004961 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004962#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004963}
4964
Bill Schmidt41e14c42015-05-16 01:02:25 +00004965/* vec_vpksdus */
4966
4967#ifdef __POWER8_VECTOR__
4968static vector unsigned int __ATTRS_o_ai
4969vec_vpksdus(vector long long __a, vector long long __b)
4970{
4971#ifdef __LITTLE_ENDIAN__
4972 return __builtin_altivec_vpksdus(__b, __a);
4973#else
4974 return __builtin_altivec_vpksdus(__a, __b);
4975#endif
4976}
4977#endif
4978
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004979/* vec_perm */
4980
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004981// The vperm instruction is defined architecturally with a big-endian bias.
4982// For little endian, we swap the input operands and invert the permute
4983// control vector. Only the rightmost 5 bits matter, so we could use
4984// a vector of all 31s instead of all 255s to perform the inversion.
4985// However, when the PCV is not a constant, using 255 has an advantage
4986// in that the vec_xor can be recognized as a vec_nor (and for P8 and
4987// later, possibly a vec_nand).
4988
Eric Christopherc67e1b62014-12-10 00:57:43 +00004989static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004990vec_perm(vector signed char __a, vector signed char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004991{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004992#ifdef __LITTLE_ENDIAN__
4993 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4994 255,255,255,255,255,255,255,255};
4995 __d = vec_xor(__c, __d);
4996 return (vector signed char)
4997 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4998#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004999 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005000 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005001#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005002}
5003
Eric Christopherc67e1b62014-12-10 00:57:43 +00005004static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005005vec_perm(vector unsigned char __a,
5006 vector unsigned char __b,
5007 vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005008{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005009#ifdef __LITTLE_ENDIAN__
5010 vector unsigned char __d = {255,255,255,255,255,255,255,255,
5011 255,255,255,255,255,255,255,255};
5012 __d = vec_xor(__c, __d);
5013 return (vector unsigned char)
5014 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
5015#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00005016 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005017 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005018#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005019}
5020
Eric Christopherc67e1b62014-12-10 00:57:43 +00005021static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005022vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00005023{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005024#ifdef __LITTLE_ENDIAN__
5025 vector unsigned char __d = {255,255,255,255,255,255,255,255,
5026 255,255,255,255,255,255,255,255};
5027 __d = vec_xor(__c, __d);
5028 return (vector bool char)
5029 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
5030#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00005031 return (vector bool char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005032 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005033#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00005034}
5035
Eric Christopherc67e1b62014-12-10 00:57:43 +00005036static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005037vec_perm(vector short __a, vector short __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005038{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005039#ifdef __LITTLE_ENDIAN__
5040 vector unsigned char __d = {255,255,255,255,255,255,255,255,
5041 255,255,255,255,255,255,255,255};
5042 __d = vec_xor(__c, __d);
5043 return (vector short)
5044 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
5045#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00005046 return (vector short)
David Blaikie3302f2b2013-01-16 23:08:36 +00005047 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005048#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005049}
5050
Eric Christopherc67e1b62014-12-10 00:57:43 +00005051static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005052vec_perm(vector unsigned short __a,
5053 vector unsigned short __b,
5054 vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005055{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005056#ifdef __LITTLE_ENDIAN__
5057 vector unsigned char __d = {255,255,255,255,255,255,255,255,
5058 255,255,255,255,255,255,255,255};
5059 __d = vec_xor(__c, __d);
5060 return (vector unsigned short)
5061 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
5062#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00005063 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00005064 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005065#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005066}
5067
Eric Christopherc67e1b62014-12-10 00:57:43 +00005068static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005069vec_perm(vector bool short __a, vector bool short __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00005070{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005071#ifdef __LITTLE_ENDIAN__
5072 vector unsigned char __d = {255,255,255,255,255,255,255,255,
5073 255,255,255,255,255,255,255,255};
5074 __d = vec_xor(__c, __d);
5075 return (vector bool short)
5076 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
5077#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00005078 return (vector bool short)
David Blaikie3302f2b2013-01-16 23:08:36 +00005079 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005080#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00005081}
5082
Eric Christopherc67e1b62014-12-10 00:57:43 +00005083static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005084vec_perm(vector pixel __a, vector pixel __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00005085{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005086#ifdef __LITTLE_ENDIAN__
5087 vector unsigned char __d = {255,255,255,255,255,255,255,255,
5088 255,255,255,255,255,255,255,255};
5089 __d = vec_xor(__c, __d);
5090 return (vector pixel)
5091 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
5092#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00005093 return (vector pixel)
David Blaikie3302f2b2013-01-16 23:08:36 +00005094 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005095#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00005096}
5097
Eric Christopherc67e1b62014-12-10 00:57:43 +00005098static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005099vec_perm(vector int __a, vector int __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005100{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005101#ifdef __LITTLE_ENDIAN__
5102 vector unsigned char __d = {255,255,255,255,255,255,255,255,
5103 255,255,255,255,255,255,255,255};
5104 __d = vec_xor(__c, __d);
5105 return (vector int)__builtin_altivec_vperm_4si(__b, __a, __d);
5106#else
David Blaikie3302f2b2013-01-16 23:08:36 +00005107 return (vector int)__builtin_altivec_vperm_4si(__a, __b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005108#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005109}
5110
Eric Christopherc67e1b62014-12-10 00:57:43 +00005111static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005112vec_perm(vector unsigned int __a, vector unsigned int __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005113{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005114#ifdef __LITTLE_ENDIAN__
5115 vector unsigned char __d = {255,255,255,255,255,255,255,255,
5116 255,255,255,255,255,255,255,255};
5117 __d = vec_xor(__c, __d);
5118 return (vector unsigned int)
5119 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
5120#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00005121 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00005122 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005123#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005124}
5125
Eric Christopherc67e1b62014-12-10 00:57:43 +00005126static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005127vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00005128{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005129#ifdef __LITTLE_ENDIAN__
5130 vector unsigned char __d = {255,255,255,255,255,255,255,255,
5131 255,255,255,255,255,255,255,255};
5132 __d = vec_xor(__c, __d);
5133 return (vector bool int)
5134 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
5135#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00005136 return (vector bool int)
David Blaikie3302f2b2013-01-16 23:08:36 +00005137 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005138#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00005139}
5140
Eric Christopherc67e1b62014-12-10 00:57:43 +00005141static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005142vec_perm(vector float __a, vector float __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005143{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005144#ifdef __LITTLE_ENDIAN__
5145 vector unsigned char __d = {255,255,255,255,255,255,255,255,
5146 255,255,255,255,255,255,255,255};
5147 __d = vec_xor(__c, __d);
5148 return (vector float)
5149 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
5150#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00005151 return (vector float)
David Blaikie3302f2b2013-01-16 23:08:36 +00005152 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005153#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005154}
5155
Bill Schmidt8ff672d2014-11-14 13:10:13 +00005156#ifdef __VSX__
Eric Christopherc67e1b62014-12-10 00:57:43 +00005157static vector long long __ATTRS_o_ai
Bill Schmidt8ff672d2014-11-14 13:10:13 +00005158vec_perm(vector long long __a, vector long long __b, vector unsigned char __c)
5159{
5160#ifdef __LITTLE_ENDIAN__
5161 vector unsigned char __d = {255,255,255,255,255,255,255,255,
5162 255,255,255,255,255,255,255,255};
5163 __d = vec_xor(__c, __d);
5164 return (vector long long)__builtin_altivec_vperm_4si(__b, __a, __d);
5165#else
5166 return (vector long long)__builtin_altivec_vperm_4si(__a, __b, __c);
5167#endif
5168}
5169
Eric Christopherc67e1b62014-12-10 00:57:43 +00005170static vector unsigned long long __ATTRS_o_ai
Bill Schmidt8ff672d2014-11-14 13:10:13 +00005171vec_perm(vector unsigned long long __a, vector unsigned long long __b,
5172 vector unsigned char __c)
5173{
5174#ifdef __LITTLE_ENDIAN__
5175 vector unsigned char __d = {255,255,255,255,255,255,255,255,
5176 255,255,255,255,255,255,255,255};
5177 __d = vec_xor(__c, __d);
5178 return (vector unsigned long long)
5179 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
5180#else
5181 return (vector unsigned long long)
5182 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
5183#endif
5184}
5185
Eric Christopherc67e1b62014-12-10 00:57:43 +00005186static vector double __ATTRS_o_ai
Bill Schmidt8ff672d2014-11-14 13:10:13 +00005187vec_perm(vector double __a, vector double __b, vector unsigned char __c)
5188{
5189#ifdef __LITTLE_ENDIAN__
5190 vector unsigned char __d = {255,255,255,255,255,255,255,255,
5191 255,255,255,255,255,255,255,255};
5192 __d = vec_xor(__c, __d);
5193 return (vector double)
5194 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
5195#else
5196 return (vector double)
5197 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
5198#endif
5199}
5200#endif
5201
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005202/* vec_vperm */
5203
Ulrich Weigand9936f132012-10-31 18:17:07 +00005204static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005205vec_vperm(vector signed char __a, vector signed char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005206{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005207 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005208}
5209
Ulrich Weigand9936f132012-10-31 18:17:07 +00005210static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005211vec_vperm(vector unsigned char __a,
5212 vector unsigned char __b,
5213 vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005214{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005215 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005216}
5217
Ulrich Weigand9936f132012-10-31 18:17:07 +00005218static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005219vec_vperm(vector bool char __a, vector bool char __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00005220{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005221 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00005222}
5223
Ulrich Weigand9936f132012-10-31 18:17:07 +00005224static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005225vec_vperm(vector short __a, vector short __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005226{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005227 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005228}
5229
Ulrich Weigand9936f132012-10-31 18:17:07 +00005230static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005231vec_vperm(vector unsigned short __a,
5232 vector unsigned short __b,
5233 vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005234{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005235 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005236}
5237
Ulrich Weigand9936f132012-10-31 18:17:07 +00005238static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005239vec_vperm(vector bool short __a, vector bool short __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00005240{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005241 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00005242}
5243
Ulrich Weigand9936f132012-10-31 18:17:07 +00005244static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005245vec_vperm(vector pixel __a, vector pixel __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00005246{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005247 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00005248}
5249
Ulrich Weigand9936f132012-10-31 18:17:07 +00005250static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005251vec_vperm(vector int __a, vector int __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005252{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005253 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005254}
5255
Ulrich Weigand9936f132012-10-31 18:17:07 +00005256static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005257vec_vperm(vector unsigned int __a, vector unsigned int __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005258{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005259 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005260}
5261
Ulrich Weigand9936f132012-10-31 18:17:07 +00005262static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005263vec_vperm(vector bool int __a, vector bool int __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00005264{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005265 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00005266}
5267
Ulrich Weigand9936f132012-10-31 18:17:07 +00005268static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005269vec_vperm(vector float __a, vector float __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005270{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005271 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005272}
5273
Bill Schmidt8ff672d2014-11-14 13:10:13 +00005274#ifdef __VSX__
5275static vector long long __ATTRS_o_ai
5276vec_vperm(vector long long __a, vector long long __b, vector unsigned char __c)
5277{
5278 return vec_perm(__a, __b, __c);
5279}
5280
5281static vector unsigned long long __ATTRS_o_ai
5282vec_vperm(vector unsigned long long __a, vector unsigned long long __b,
5283 vector unsigned char __c)
5284{
5285 return vec_perm(__a, __b, __c);
5286}
5287
5288static vector double __ATTRS_o_ai
5289vec_vperm(vector double __a, vector double __b, vector unsigned char __c)
5290{
5291 return vec_perm(__a, __b, __c);
5292}
5293#endif
5294
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005295/* vec_re */
5296
Ulrich Weigand9936f132012-10-31 18:17:07 +00005297static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00005298vec_re(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005299{
David Blaikie3302f2b2013-01-16 23:08:36 +00005300 return __builtin_altivec_vrefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005301}
5302
5303/* vec_vrefp */
5304
Ulrich Weigand9936f132012-10-31 18:17:07 +00005305static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00005306vec_vrefp(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005307{
David Blaikie3302f2b2013-01-16 23:08:36 +00005308 return __builtin_altivec_vrefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005309}
5310
5311/* vec_rl */
5312
5313static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005314vec_rl(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005315{
David Blaikie3302f2b2013-01-16 23:08:36 +00005316 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005317}
5318
5319static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005320vec_rl(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005321{
David Blaikie3302f2b2013-01-16 23:08:36 +00005322 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005323}
5324
5325static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005326vec_rl(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005327{
David Blaikie3302f2b2013-01-16 23:08:36 +00005328 return __builtin_altivec_vrlh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005329}
5330
5331static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005332vec_rl(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005333{
David Blaikie3302f2b2013-01-16 23:08:36 +00005334 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005335}
5336
5337static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005338vec_rl(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005339{
David Blaikie3302f2b2013-01-16 23:08:36 +00005340 return __builtin_altivec_vrlw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005341}
5342
5343static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005344vec_rl(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005345{
David Blaikie3302f2b2013-01-16 23:08:36 +00005346 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005347}
5348
Kit Barton8553bec2015-03-11 15:57:19 +00005349#ifdef __POWER8_VECTOR__
5350static vector signed long long __ATTRS_o_ai
5351vec_rl(vector signed long long __a, vector unsigned long long __b)
5352{
5353 return __builtin_altivec_vrld(__a, __b);
5354}
5355
5356static vector unsigned long long __ATTRS_o_ai
5357vec_rl(vector unsigned long long __a, vector unsigned long long __b)
5358{
5359 return __builtin_altivec_vrld(__a, __b);
5360}
5361#endif
5362
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005363/* vec_vrlb */
5364
5365static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005366vec_vrlb(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005367{
David Blaikie3302f2b2013-01-16 23:08:36 +00005368 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005369}
5370
5371static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005372vec_vrlb(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005373{
David Blaikie3302f2b2013-01-16 23:08:36 +00005374 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005375}
5376
5377/* vec_vrlh */
5378
5379static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005380vec_vrlh(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005381{
David Blaikie3302f2b2013-01-16 23:08:36 +00005382 return __builtin_altivec_vrlh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005383}
5384
5385static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005386vec_vrlh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005387{
David Blaikie3302f2b2013-01-16 23:08:36 +00005388 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005389}
5390
5391/* vec_vrlw */
5392
5393static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005394vec_vrlw(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005395{
David Blaikie3302f2b2013-01-16 23:08:36 +00005396 return __builtin_altivec_vrlw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005397}
5398
5399static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005400vec_vrlw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005401{
David Blaikie3302f2b2013-01-16 23:08:36 +00005402 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005403}
5404
5405/* vec_round */
5406
5407static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00005408vec_round(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005409{
David Blaikie3302f2b2013-01-16 23:08:36 +00005410 return __builtin_altivec_vrfin(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005411}
5412
5413/* vec_vrfin */
5414
5415static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00005416vec_vrfin(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005417{
David Blaikie3302f2b2013-01-16 23:08:36 +00005418 return __builtin_altivec_vrfin(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005419}
5420
5421/* vec_rsqrte */
5422
5423static __vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00005424vec_rsqrte(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005425{
David Blaikie3302f2b2013-01-16 23:08:36 +00005426 return __builtin_altivec_vrsqrtefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005427}
5428
5429/* vec_vrsqrtefp */
5430
5431static __vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00005432vec_vrsqrtefp(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005433{
David Blaikie3302f2b2013-01-16 23:08:36 +00005434 return __builtin_altivec_vrsqrtefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005435}
5436
5437/* vec_sel */
5438
5439#define __builtin_altivec_vsel_4si vec_sel
5440
5441static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005442vec_sel(vector signed char __a, vector signed char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005443{
David Blaikie3302f2b2013-01-16 23:08:36 +00005444 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005445}
5446
Anton Yartsevfc83c602010-08-19 03:21:36 +00005447static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005448vec_sel(vector signed char __a, vector signed char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005449{
David Blaikie3302f2b2013-01-16 23:08:36 +00005450 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005451}
5452
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005453static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005454vec_sel(vector unsigned char __a, vector unsigned char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005455{
David Blaikie3302f2b2013-01-16 23:08:36 +00005456 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005457}
5458
Anton Yartsevfc83c602010-08-19 03:21:36 +00005459static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005460vec_sel(vector unsigned char __a, vector unsigned char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005461{
David Blaikie3302f2b2013-01-16 23:08:36 +00005462 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005463}
5464
5465static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005466vec_sel(vector bool char __a, vector bool char __b, vector unsigned char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005467{
David Blaikie3302f2b2013-01-16 23:08:36 +00005468 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005469}
5470
5471static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005472vec_sel(vector bool char __a, vector bool char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005473{
David Blaikie3302f2b2013-01-16 23:08:36 +00005474 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005475}
5476
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005477static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005478vec_sel(vector short __a, vector short __b, vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005479{
David Blaikie3302f2b2013-01-16 23:08:36 +00005480 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005481}
5482
Anton Yartsevfc83c602010-08-19 03:21:36 +00005483static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005484vec_sel(vector short __a, vector short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005485{
David Blaikie3302f2b2013-01-16 23:08:36 +00005486 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005487}
5488
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005489static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005490vec_sel(vector unsigned short __a,
5491 vector unsigned short __b,
5492 vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005493{
David Blaikie3302f2b2013-01-16 23:08:36 +00005494 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005495}
5496
Anton Yartsevfc83c602010-08-19 03:21:36 +00005497static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005498vec_sel(vector unsigned short __a, vector unsigned short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005499{
David Blaikie3302f2b2013-01-16 23:08:36 +00005500 return (__a & ~(vector unsigned short)__c) | (__b & (vector unsigned short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005501}
5502
5503static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005504vec_sel(vector bool short __a, vector bool short __b, vector unsigned short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005505{
David Blaikie3302f2b2013-01-16 23:08:36 +00005506 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005507}
5508
5509static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005510vec_sel(vector bool short __a, vector bool short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005511{
David Blaikie3302f2b2013-01-16 23:08:36 +00005512 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005513}
5514
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005515static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005516vec_sel(vector int __a, vector int __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005517{
David Blaikie3302f2b2013-01-16 23:08:36 +00005518 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005519}
5520
Anton Yartsevfc83c602010-08-19 03:21:36 +00005521static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005522vec_sel(vector int __a, vector int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005523{
David Blaikie3302f2b2013-01-16 23:08:36 +00005524 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005525}
5526
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005527static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005528vec_sel(vector unsigned int __a, vector unsigned int __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005529{
David Blaikie3302f2b2013-01-16 23:08:36 +00005530 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005531}
5532
Anton Yartsevfc83c602010-08-19 03:21:36 +00005533static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005534vec_sel(vector unsigned int __a, vector unsigned int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005535{
David Blaikie3302f2b2013-01-16 23:08:36 +00005536 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005537}
5538
5539static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005540vec_sel(vector bool int __a, vector bool int __b, vector unsigned int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005541{
David Blaikie3302f2b2013-01-16 23:08:36 +00005542 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005543}
5544
5545static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005546vec_sel(vector bool int __a, vector bool int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005547{
David Blaikie3302f2b2013-01-16 23:08:36 +00005548 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005549}
5550
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005551static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005552vec_sel(vector float __a, vector float __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005553{
David Blaikie3302f2b2013-01-16 23:08:36 +00005554 vector int __res = ((vector int)__a & ~(vector int)__c)
5555 | ((vector int)__b & (vector int)__c);
5556 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005557}
5558
Anton Yartsevfc83c602010-08-19 03:21:36 +00005559static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005560vec_sel(vector float __a, vector float __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005561{
David Blaikie3302f2b2013-01-16 23:08:36 +00005562 vector int __res = ((vector int)__a & ~(vector int)__c)
5563 | ((vector int)__b & (vector int)__c);
5564 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00005565}
5566
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005567/* vec_vsel */
5568
5569static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005570vec_vsel(vector signed char __a, vector signed char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005571{
David Blaikie3302f2b2013-01-16 23:08:36 +00005572 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005573}
5574
Anton Yartsevfc83c602010-08-19 03:21:36 +00005575static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005576vec_vsel(vector signed char __a, vector signed char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005577{
David Blaikie3302f2b2013-01-16 23:08:36 +00005578 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005579}
5580
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005581static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005582vec_vsel(vector unsigned char __a, vector unsigned char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005583{
David Blaikie3302f2b2013-01-16 23:08:36 +00005584 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005585}
5586
Anton Yartsevfc83c602010-08-19 03:21:36 +00005587static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005588vec_vsel(vector unsigned char __a, vector unsigned char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005589{
David Blaikie3302f2b2013-01-16 23:08:36 +00005590 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005591}
5592
5593static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005594vec_vsel(vector bool char __a, vector bool char __b, vector unsigned char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005595{
David Blaikie3302f2b2013-01-16 23:08:36 +00005596 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005597}
5598
5599static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005600vec_vsel(vector bool char __a, vector bool char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005601{
David Blaikie3302f2b2013-01-16 23:08:36 +00005602 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005603}
5604
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005605static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005606vec_vsel(vector short __a, vector short __b, vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005607{
David Blaikie3302f2b2013-01-16 23:08:36 +00005608 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005609}
5610
Anton Yartsevfc83c602010-08-19 03:21:36 +00005611static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005612vec_vsel(vector short __a, vector short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005613{
David Blaikie3302f2b2013-01-16 23:08:36 +00005614 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005615}
5616
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005617static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005618vec_vsel(vector unsigned short __a,
5619 vector unsigned short __b,
5620 vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005621{
David Blaikie3302f2b2013-01-16 23:08:36 +00005622 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005623}
5624
Anton Yartsevfc83c602010-08-19 03:21:36 +00005625static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005626vec_vsel(vector unsigned short __a, vector unsigned short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005627{
David Blaikie3302f2b2013-01-16 23:08:36 +00005628 return (__a & ~(vector unsigned short)__c) | (__b & (vector unsigned short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005629}
5630
5631static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005632vec_vsel(vector bool short __a, vector bool short __b, vector unsigned short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005633{
David Blaikie3302f2b2013-01-16 23:08:36 +00005634 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005635}
5636
5637static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005638vec_vsel(vector bool short __a, vector bool short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005639{
David Blaikie3302f2b2013-01-16 23:08:36 +00005640 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005641}
5642
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005643static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005644vec_vsel(vector int __a, vector int __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005645{
David Blaikie3302f2b2013-01-16 23:08:36 +00005646 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005647}
5648
Anton Yartsevfc83c602010-08-19 03:21:36 +00005649static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005650vec_vsel(vector int __a, vector int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005651{
David Blaikie3302f2b2013-01-16 23:08:36 +00005652 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005653}
5654
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005655static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005656vec_vsel(vector unsigned int __a, vector unsigned int __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005657{
David Blaikie3302f2b2013-01-16 23:08:36 +00005658 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005659}
5660
Anton Yartsevfc83c602010-08-19 03:21:36 +00005661static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005662vec_vsel(vector unsigned int __a, vector unsigned int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005663{
David Blaikie3302f2b2013-01-16 23:08:36 +00005664 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005665}
5666
5667static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005668vec_vsel(vector bool int __a, vector bool int __b, vector unsigned int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005669{
David Blaikie3302f2b2013-01-16 23:08:36 +00005670 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005671}
5672
5673static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005674vec_vsel(vector bool int __a, vector bool int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005675{
David Blaikie3302f2b2013-01-16 23:08:36 +00005676 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005677}
5678
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005679static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005680vec_vsel(vector float __a, vector float __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005681{
David Blaikie3302f2b2013-01-16 23:08:36 +00005682 vector int __res = ((vector int)__a & ~(vector int)__c)
5683 | ((vector int)__b & (vector int)__c);
5684 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005685}
5686
Anton Yartsevfc83c602010-08-19 03:21:36 +00005687static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005688vec_vsel(vector float __a, vector float __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005689{
David Blaikie3302f2b2013-01-16 23:08:36 +00005690 vector int __res = ((vector int)__a & ~(vector int)__c)
5691 | ((vector int)__b & (vector int)__c);
5692 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00005693}
5694
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005695/* vec_sl */
5696
5697static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005698vec_sl(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005699{
David Blaikie3302f2b2013-01-16 23:08:36 +00005700 return __a << (vector signed char)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005701}
5702
5703static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005704vec_sl(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005705{
David Blaikie3302f2b2013-01-16 23:08:36 +00005706 return __a << __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005707}
5708
5709static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005710vec_sl(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005711{
David Blaikie3302f2b2013-01-16 23:08:36 +00005712 return __a << (vector short)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005713}
5714
5715static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005716vec_sl(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005717{
David Blaikie3302f2b2013-01-16 23:08:36 +00005718 return __a << __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005719}
5720
5721static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005722vec_sl(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005723{
David Blaikie3302f2b2013-01-16 23:08:36 +00005724 return __a << (vector int)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005725}
5726
5727static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005728vec_sl(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005729{
David Blaikie3302f2b2013-01-16 23:08:36 +00005730 return __a << __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005731}
5732
Kit Barton8553bec2015-03-11 15:57:19 +00005733#ifdef __POWER8_VECTOR__
5734static vector signed long long __ATTRS_o_ai
5735vec_sl(vector signed long long __a, vector unsigned long long __b)
5736{
5737 return __a << (vector long long)__b;
5738}
5739
5740static vector unsigned long long __ATTRS_o_ai
5741vec_sl(vector unsigned long long __a, vector unsigned long long __b)
5742{
5743 return __a << __b;
5744}
5745#endif
5746
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005747/* vec_vslb */
5748
5749#define __builtin_altivec_vslb vec_vslb
5750
5751static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005752vec_vslb(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005753{
David Blaikie3302f2b2013-01-16 23:08:36 +00005754 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005755}
5756
5757static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005758vec_vslb(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005759{
David Blaikie3302f2b2013-01-16 23:08:36 +00005760 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005761}
5762
5763/* vec_vslh */
5764
5765#define __builtin_altivec_vslh vec_vslh
5766
5767static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005768vec_vslh(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005769{
David Blaikie3302f2b2013-01-16 23:08:36 +00005770 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005771}
5772
5773static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005774vec_vslh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005775{
David Blaikie3302f2b2013-01-16 23:08:36 +00005776 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005777}
5778
5779/* vec_vslw */
5780
5781#define __builtin_altivec_vslw vec_vslw
5782
5783static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005784vec_vslw(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005785{
David Blaikie3302f2b2013-01-16 23:08:36 +00005786 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005787}
5788
5789static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005790vec_vslw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005791{
David Blaikie3302f2b2013-01-16 23:08:36 +00005792 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005793}
5794
5795/* vec_sld */
5796
5797#define __builtin_altivec_vsldoi_4si vec_sld
5798
5799static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005800vec_sld(vector signed char __a, vector signed char __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005801{
David Blaikie3302f2b2013-01-16 23:08:36 +00005802 return vec_perm(__a, __b, (vector unsigned char)
5803 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5804 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005805}
5806
5807static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005808vec_sld(vector unsigned char __a, vector unsigned char __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005809{
David Blaikie3302f2b2013-01-16 23:08:36 +00005810 return vec_perm(__a, __b, (vector unsigned char)
5811 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5812 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005813}
5814
5815static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005816vec_sld(vector short __a, vector short __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005817{
David Blaikie3302f2b2013-01-16 23:08:36 +00005818 return vec_perm(__a, __b, (vector unsigned char)
5819 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5820 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005821}
5822
5823static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005824vec_sld(vector unsigned short __a, vector unsigned short __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005825{
David Blaikie3302f2b2013-01-16 23:08:36 +00005826 return vec_perm(__a, __b, (vector unsigned char)
5827 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5828 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Yartsev9e968982010-08-19 03:00:09 +00005829}
5830
5831static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005832vec_sld(vector pixel __a, vector pixel __b, unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00005833{
David Blaikie3302f2b2013-01-16 23:08:36 +00005834 return vec_perm(__a, __b, (vector unsigned char)
5835 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5836 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005837}
5838
5839static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005840vec_sld(vector int __a, vector int __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005841{
David Blaikie3302f2b2013-01-16 23:08:36 +00005842 return vec_perm(__a, __b, (vector unsigned char)
5843 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5844 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005845}
5846
5847static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005848vec_sld(vector unsigned int __a, vector unsigned int __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005849{
David Blaikie3302f2b2013-01-16 23:08:36 +00005850 return vec_perm(__a, __b, (vector unsigned char)
5851 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5852 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005853}
5854
5855static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005856vec_sld(vector float __a, vector float __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005857{
David Blaikie3302f2b2013-01-16 23:08:36 +00005858 return vec_perm(__a, __b, (vector unsigned char)
5859 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5860 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005861}
5862
5863/* vec_vsldoi */
5864
5865static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005866vec_vsldoi(vector signed char __a, vector signed char __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005867{
David Blaikie3302f2b2013-01-16 23:08:36 +00005868 return vec_perm(__a, __b, (vector unsigned char)
5869 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5870 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005871}
5872
5873static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005874vec_vsldoi(vector unsigned char __a, vector unsigned char __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005875{
David Blaikie3302f2b2013-01-16 23:08:36 +00005876 return vec_perm(__a, __b, (vector unsigned char)
5877 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5878 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005879}
5880
5881static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005882vec_vsldoi(vector short __a, vector short __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005883{
David Blaikie3302f2b2013-01-16 23:08:36 +00005884 return vec_perm(__a, __b, (vector unsigned char)
5885 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5886 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005887}
5888
5889static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005890vec_vsldoi(vector unsigned short __a, vector unsigned short __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005891{
David Blaikie3302f2b2013-01-16 23:08:36 +00005892 return vec_perm(__a, __b, (vector unsigned char)
5893 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5894 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Yartsev9e968982010-08-19 03:00:09 +00005895}
5896
5897static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005898vec_vsldoi(vector pixel __a, vector pixel __b, unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00005899{
David Blaikie3302f2b2013-01-16 23:08:36 +00005900 return vec_perm(__a, __b, (vector unsigned char)
5901 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5902 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005903}
5904
5905static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005906vec_vsldoi(vector int __a, vector int __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005907{
David Blaikie3302f2b2013-01-16 23:08:36 +00005908 return vec_perm(__a, __b, (vector unsigned char)
5909 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5910 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005911}
5912
5913static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005914vec_vsldoi(vector unsigned int __a, vector unsigned int __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005915{
David Blaikie3302f2b2013-01-16 23:08:36 +00005916 return vec_perm(__a, __b, (vector unsigned char)
5917 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5918 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005919}
5920
5921static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005922vec_vsldoi(vector float __a, vector float __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005923{
David Blaikie3302f2b2013-01-16 23:08:36 +00005924 return vec_perm(__a, __b, (vector unsigned char)
5925 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5926 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005927}
5928
5929/* vec_sll */
5930
5931static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005932vec_sll(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005933{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005934 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005935 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005936}
5937
5938static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005939vec_sll(vector signed char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005940{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005941 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005942 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005943}
5944
5945static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005946vec_sll(vector signed char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005947{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005948 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005949 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005950}
5951
5952static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005953vec_sll(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005954{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005955 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005956 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005957}
5958
5959static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005960vec_sll(vector unsigned char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005961{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005962 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005963 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005964}
5965
5966static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005967vec_sll(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005968{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005969 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005970 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005971}
5972
Anton Yartsevfc83c602010-08-19 03:21:36 +00005973static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005974vec_sll(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005975{
David Blaikie3302f2b2013-01-16 23:08:36 +00005976 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005977}
5978
5979static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005980vec_sll(vector bool char __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005981{
David Blaikie3302f2b2013-01-16 23:08:36 +00005982 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005983}
5984
5985static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005986vec_sll(vector bool char __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005987{
David Blaikie3302f2b2013-01-16 23:08:36 +00005988 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005989}
5990
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005991static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005992vec_sll(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005993{
David Blaikie3302f2b2013-01-16 23:08:36 +00005994 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005995}
5996
5997static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005998vec_sll(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005999{
David Blaikie3302f2b2013-01-16 23:08:36 +00006000 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006001}
6002
6003static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006004vec_sll(vector short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006005{
David Blaikie3302f2b2013-01-16 23:08:36 +00006006 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006007}
6008
6009static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006010vec_sll(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006011{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006012 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006013 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006014}
6015
6016static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006017vec_sll(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006018{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006019 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006020 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006021}
6022
6023static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006024vec_sll(vector unsigned short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006025{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006026 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006027 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006028}
6029
Anton Yartsevfc83c602010-08-19 03:21:36 +00006030static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006031vec_sll(vector bool short __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006032{
David Blaikie3302f2b2013-01-16 23:08:36 +00006033 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006034}
6035
6036static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006037vec_sll(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006038{
David Blaikie3302f2b2013-01-16 23:08:36 +00006039 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006040}
6041
6042static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006043vec_sll(vector bool short __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006044{
David Blaikie3302f2b2013-01-16 23:08:36 +00006045 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006046}
6047
6048static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006049vec_sll(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006050{
David Blaikie3302f2b2013-01-16 23:08:36 +00006051 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006052}
6053
6054static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006055vec_sll(vector pixel __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006056{
David Blaikie3302f2b2013-01-16 23:08:36 +00006057 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006058}
6059
6060static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006061vec_sll(vector pixel __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006062{
David Blaikie3302f2b2013-01-16 23:08:36 +00006063 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006064}
6065
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006066static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006067vec_sll(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006068{
David Blaikie3302f2b2013-01-16 23:08:36 +00006069 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006070}
6071
6072static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006073vec_sll(vector int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006074{
David Blaikie3302f2b2013-01-16 23:08:36 +00006075 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006076}
6077
6078static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006079vec_sll(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006080{
David Blaikie3302f2b2013-01-16 23:08:36 +00006081 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006082}
6083
6084static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006085vec_sll(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006086{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006087 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006088 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006089}
6090
6091static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006092vec_sll(vector unsigned int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006093{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006094 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006095 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006096}
6097
6098static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006099vec_sll(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006100{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006101 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006102 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006103}
6104
Anton Yartsevfc83c602010-08-19 03:21:36 +00006105static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006106vec_sll(vector bool int __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006107{
David Blaikie3302f2b2013-01-16 23:08:36 +00006108 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006109}
6110
6111static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006112vec_sll(vector bool int __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006113{
David Blaikie3302f2b2013-01-16 23:08:36 +00006114 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006115}
6116
6117static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006118vec_sll(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006119{
David Blaikie3302f2b2013-01-16 23:08:36 +00006120 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006121}
6122
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006123/* vec_vsl */
6124
6125static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006126vec_vsl(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006127{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006128 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006129 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006130}
6131
6132static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006133vec_vsl(vector signed char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006134{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006135 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006136 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006137}
6138
6139static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006140vec_vsl(vector signed char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006141{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006142 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006143 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006144}
6145
6146static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006147vec_vsl(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006148{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006149 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006150 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006151}
6152
6153static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006154vec_vsl(vector unsigned char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006155{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006156 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006157 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006158}
6159
6160static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006161vec_vsl(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006162{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006163 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006164 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006165}
6166
Anton Yartsevfc83c602010-08-19 03:21:36 +00006167static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006168vec_vsl(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006169{
David Blaikie3302f2b2013-01-16 23:08:36 +00006170 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006171}
6172
6173static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006174vec_vsl(vector bool char __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006175{
David Blaikie3302f2b2013-01-16 23:08:36 +00006176 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006177}
6178
6179static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006180vec_vsl(vector bool char __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006181{
David Blaikie3302f2b2013-01-16 23:08:36 +00006182 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006183}
6184
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006185static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006186vec_vsl(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006187{
David Blaikie3302f2b2013-01-16 23:08:36 +00006188 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006189}
6190
6191static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006192vec_vsl(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006193{
David Blaikie3302f2b2013-01-16 23:08:36 +00006194 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006195}
6196
6197static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006198vec_vsl(vector short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006199{
David Blaikie3302f2b2013-01-16 23:08:36 +00006200 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006201}
6202
6203static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006204vec_vsl(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006205{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006206 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006207 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006208}
6209
6210static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006211vec_vsl(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006212{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006213 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006214 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006215}
6216
6217static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006218vec_vsl(vector unsigned short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006219{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006220 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006221 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006222}
6223
Anton Yartsevfc83c602010-08-19 03:21:36 +00006224static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006225vec_vsl(vector bool short __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006226{
David Blaikie3302f2b2013-01-16 23:08:36 +00006227 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006228}
6229
6230static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006231vec_vsl(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006232{
David Blaikie3302f2b2013-01-16 23:08:36 +00006233 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006234}
6235
6236static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006237vec_vsl(vector bool short __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006238{
David Blaikie3302f2b2013-01-16 23:08:36 +00006239 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006240}
6241
6242static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006243vec_vsl(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006244{
David Blaikie3302f2b2013-01-16 23:08:36 +00006245 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006246}
6247
6248static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006249vec_vsl(vector pixel __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006250{
David Blaikie3302f2b2013-01-16 23:08:36 +00006251 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006252}
6253
6254static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006255vec_vsl(vector pixel __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006256{
David Blaikie3302f2b2013-01-16 23:08:36 +00006257 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006258}
6259
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006260static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006261vec_vsl(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006262{
David Blaikie3302f2b2013-01-16 23:08:36 +00006263 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006264}
6265
6266static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006267vec_vsl(vector int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006268{
David Blaikie3302f2b2013-01-16 23:08:36 +00006269 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006270}
6271
6272static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006273vec_vsl(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006274{
David Blaikie3302f2b2013-01-16 23:08:36 +00006275 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006276}
6277
6278static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006279vec_vsl(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006280{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006281 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006282 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006283}
6284
6285static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006286vec_vsl(vector unsigned int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006287{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006288 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006289 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006290}
6291
6292static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006293vec_vsl(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006294{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006295 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006296 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006297}
6298
Anton Yartsevfc83c602010-08-19 03:21:36 +00006299static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006300vec_vsl(vector bool int __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006301{
David Blaikie3302f2b2013-01-16 23:08:36 +00006302 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006303}
6304
6305static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006306vec_vsl(vector bool int __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006307{
David Blaikie3302f2b2013-01-16 23:08:36 +00006308 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006309}
6310
6311static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006312vec_vsl(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006313{
David Blaikie3302f2b2013-01-16 23:08:36 +00006314 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006315}
6316
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006317/* vec_slo */
6318
6319static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006320vec_slo(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006321{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006322 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006323 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006324}
6325
6326static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006327vec_slo(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006328{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006329 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006330 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006331}
6332
6333static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006334vec_slo(vector unsigned char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006335{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006336 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006337 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006338}
6339
6340static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006341vec_slo(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006342{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006343 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006344 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006345}
6346
6347static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006348vec_slo(vector short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006349{
David Blaikie3302f2b2013-01-16 23:08:36 +00006350 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006351}
6352
6353static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006354vec_slo(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006355{
David Blaikie3302f2b2013-01-16 23:08:36 +00006356 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006357}
6358
6359static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006360vec_slo(vector unsigned short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006361{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006362 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006363 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006364}
6365
6366static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006367vec_slo(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006368{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006369 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006370 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006371}
6372
Anton Yartsevfc83c602010-08-19 03:21:36 +00006373static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006374vec_slo(vector pixel __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006375{
David Blaikie3302f2b2013-01-16 23:08:36 +00006376 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006377}
6378
6379static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006380vec_slo(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006381{
David Blaikie3302f2b2013-01-16 23:08:36 +00006382 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006383}
6384
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006385static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006386vec_slo(vector int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006387{
David Blaikie3302f2b2013-01-16 23:08:36 +00006388 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006389}
6390
6391static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006392vec_slo(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006393{
David Blaikie3302f2b2013-01-16 23:08:36 +00006394 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006395}
6396
6397static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006398vec_slo(vector unsigned int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006399{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006400 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006401 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006402}
6403
6404static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006405vec_slo(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006406{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006407 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006408 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006409}
6410
6411static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006412vec_slo(vector float __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006413{
David Blaikie3302f2b2013-01-16 23:08:36 +00006414 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006415}
6416
6417static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006418vec_slo(vector float __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006419{
David Blaikie3302f2b2013-01-16 23:08:36 +00006420 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006421}
6422
6423/* vec_vslo */
6424
6425static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006426vec_vslo(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006427{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006428 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006429 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006430}
6431
6432static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006433vec_vslo(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006434{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006435 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006436 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006437}
6438
6439static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006440vec_vslo(vector unsigned char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006441{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006442 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006443 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006444}
6445
6446static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006447vec_vslo(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006448{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006449 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006450 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006451}
6452
6453static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006454vec_vslo(vector short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006455{
David Blaikie3302f2b2013-01-16 23:08:36 +00006456 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006457}
6458
6459static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006460vec_vslo(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006461{
David Blaikie3302f2b2013-01-16 23:08:36 +00006462 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006463}
6464
6465static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006466vec_vslo(vector unsigned short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006467{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006468 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006469 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006470}
6471
6472static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006473vec_vslo(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006474{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006475 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006476 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006477}
6478
Anton Yartsevfc83c602010-08-19 03:21:36 +00006479static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006480vec_vslo(vector pixel __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006481{
David Blaikie3302f2b2013-01-16 23:08:36 +00006482 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006483}
6484
6485static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006486vec_vslo(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006487{
David Blaikie3302f2b2013-01-16 23:08:36 +00006488 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006489}
6490
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006491static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006492vec_vslo(vector int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006493{
David Blaikie3302f2b2013-01-16 23:08:36 +00006494 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006495}
6496
6497static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006498vec_vslo(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006499{
David Blaikie3302f2b2013-01-16 23:08:36 +00006500 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006501}
6502
6503static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006504vec_vslo(vector unsigned int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006505{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006506 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006507 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006508}
6509
6510static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006511vec_vslo(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006512{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006513 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006514 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006515}
6516
6517static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006518vec_vslo(vector float __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006519{
David Blaikie3302f2b2013-01-16 23:08:36 +00006520 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006521}
6522
6523static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006524vec_vslo(vector float __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006525{
David Blaikie3302f2b2013-01-16 23:08:36 +00006526 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006527}
6528
6529/* vec_splat */
6530
6531static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006532vec_splat(vector signed char __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006533{
David Blaikie3302f2b2013-01-16 23:08:36 +00006534 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006535}
6536
6537static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006538vec_splat(vector unsigned char __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006539{
David Blaikie3302f2b2013-01-16 23:08:36 +00006540 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Yartsev9e968982010-08-19 03:00:09 +00006541}
6542
6543static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006544vec_splat(vector bool char __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006545{
David Blaikie3302f2b2013-01-16 23:08:36 +00006546 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006547}
6548
6549static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006550vec_splat(vector short __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006551{
David Blaikie3302f2b2013-01-16 23:08:36 +00006552 __b *= 2;
6553 unsigned char b1=__b+1;
6554 return vec_perm(__a, __a, (vector unsigned char)
6555 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006556}
6557
6558static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006559vec_splat(vector unsigned short __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006560{
David Blaikie3302f2b2013-01-16 23:08:36 +00006561 __b *= 2;
6562 unsigned char b1=__b+1;
6563 return vec_perm(__a, __a, (vector unsigned char)
6564 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00006565}
6566
6567static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006568vec_splat(vector bool short __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006569{
David Blaikie3302f2b2013-01-16 23:08:36 +00006570 __b *= 2;
6571 unsigned char b1=__b+1;
6572 return vec_perm(__a, __a, (vector unsigned char)
6573 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00006574}
6575
6576static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006577vec_splat(vector pixel __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006578{
David Blaikie3302f2b2013-01-16 23:08:36 +00006579 __b *= 2;
6580 unsigned char b1=__b+1;
6581 return vec_perm(__a, __a, (vector unsigned char)
6582 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006583}
6584
6585static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006586vec_splat(vector int __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006587{
David Blaikie3302f2b2013-01-16 23:08:36 +00006588 __b *= 4;
6589 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6590 return vec_perm(__a, __a, (vector unsigned char)
6591 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006592}
6593
6594static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006595vec_splat(vector unsigned int __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006596{
David Blaikie3302f2b2013-01-16 23:08:36 +00006597 __b *= 4;
6598 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6599 return vec_perm(__a, __a, (vector unsigned char)
6600 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Yartsev9e968982010-08-19 03:00:09 +00006601}
6602
6603static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006604vec_splat(vector bool int __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006605{
David Blaikie3302f2b2013-01-16 23:08:36 +00006606 __b *= 4;
6607 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6608 return vec_perm(__a, __a, (vector unsigned char)
6609 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006610}
6611
6612static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006613vec_splat(vector float __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006614{
David Blaikie3302f2b2013-01-16 23:08:36 +00006615 __b *= 4;
6616 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6617 return vec_perm(__a, __a, (vector unsigned char)
6618 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006619}
6620
6621/* vec_vspltb */
6622
6623#define __builtin_altivec_vspltb vec_vspltb
6624
6625static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006626vec_vspltb(vector signed char __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006627{
David Blaikie3302f2b2013-01-16 23:08:36 +00006628 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006629}
6630
6631static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006632vec_vspltb(vector unsigned char __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006633{
David Blaikie3302f2b2013-01-16 23:08:36 +00006634 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Yartsev9e968982010-08-19 03:00:09 +00006635}
6636
6637static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006638vec_vspltb(vector bool char __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006639{
David Blaikie3302f2b2013-01-16 23:08:36 +00006640 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006641}
6642
6643/* vec_vsplth */
6644
6645#define __builtin_altivec_vsplth vec_vsplth
6646
6647static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006648vec_vsplth(vector short __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006649{
David Blaikie3302f2b2013-01-16 23:08:36 +00006650 __b *= 2;
6651 unsigned char b1=__b+1;
6652 return vec_perm(__a, __a, (vector unsigned char)
6653 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006654}
6655
6656static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006657vec_vsplth(vector unsigned short __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006658{
David Blaikie3302f2b2013-01-16 23:08:36 +00006659 __b *= 2;
6660 unsigned char b1=__b+1;
6661 return vec_perm(__a, __a, (vector unsigned char)
6662 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00006663}
6664
6665static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006666vec_vsplth(vector bool short __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006667{
David Blaikie3302f2b2013-01-16 23:08:36 +00006668 __b *= 2;
6669 unsigned char b1=__b+1;
6670 return vec_perm(__a, __a, (vector unsigned char)
6671 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00006672}
6673
6674static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006675vec_vsplth(vector pixel __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006676{
David Blaikie3302f2b2013-01-16 23:08:36 +00006677 __b *= 2;
6678 unsigned char b1=__b+1;
6679 return vec_perm(__a, __a, (vector unsigned char)
6680 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006681}
6682
6683/* vec_vspltw */
6684
6685#define __builtin_altivec_vspltw vec_vspltw
6686
6687static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006688vec_vspltw(vector int __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +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 unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006697vec_vspltw(vector unsigned int __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 Yartsev9e968982010-08-19 03:00:09 +00006703}
6704
6705static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006706vec_vspltw(vector bool int __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006707{
David Blaikie3302f2b2013-01-16 23:08:36 +00006708 __b *= 4;
6709 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6710 return vec_perm(__a, __a, (vector unsigned char)
6711 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006712}
6713
6714static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006715vec_vspltw(vector float __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006716{
David Blaikie3302f2b2013-01-16 23:08:36 +00006717 __b *= 4;
6718 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6719 return vec_perm(__a, __a, (vector unsigned char)
6720 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006721}
6722
6723/* vec_splat_s8 */
6724
6725#define __builtin_altivec_vspltisb vec_splat_s8
6726
6727// FIXME: parameter should be treated as 5-bit signed literal
6728static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006729vec_splat_s8(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006730{
David Blaikie3302f2b2013-01-16 23:08:36 +00006731 return (vector signed char)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006732}
6733
6734/* vec_vspltisb */
6735
6736// FIXME: parameter should be treated as 5-bit signed literal
6737static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006738vec_vspltisb(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006739{
David Blaikie3302f2b2013-01-16 23:08:36 +00006740 return (vector signed char)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006741}
6742
6743/* vec_splat_s16 */
6744
6745#define __builtin_altivec_vspltish vec_splat_s16
6746
6747// FIXME: parameter should be treated as 5-bit signed literal
6748static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006749vec_splat_s16(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006750{
David Blaikie3302f2b2013-01-16 23:08:36 +00006751 return (vector short)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006752}
6753
6754/* vec_vspltish */
6755
6756// FIXME: parameter should be treated as 5-bit signed literal
6757static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006758vec_vspltish(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006759{
David Blaikie3302f2b2013-01-16 23:08:36 +00006760 return (vector short)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006761}
6762
6763/* vec_splat_s32 */
6764
6765#define __builtin_altivec_vspltisw vec_splat_s32
6766
6767// FIXME: parameter should be treated as 5-bit signed literal
6768static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006769vec_splat_s32(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006770{
David Blaikie3302f2b2013-01-16 23:08:36 +00006771 return (vector int)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006772}
6773
6774/* vec_vspltisw */
6775
6776// FIXME: parameter should be treated as 5-bit signed literal
6777static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006778vec_vspltisw(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006779{
David Blaikie3302f2b2013-01-16 23:08:36 +00006780 return (vector int)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006781}
6782
6783/* vec_splat_u8 */
6784
6785// FIXME: parameter should be treated as 5-bit signed literal
6786static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006787vec_splat_u8(unsigned char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006788{
David Blaikie3302f2b2013-01-16 23:08:36 +00006789 return (vector unsigned char)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006790}
6791
6792/* vec_splat_u16 */
6793
6794// FIXME: parameter should be treated as 5-bit signed literal
6795static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006796vec_splat_u16(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006797{
David Blaikie3302f2b2013-01-16 23:08:36 +00006798 return (vector unsigned short)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006799}
6800
6801/* vec_splat_u32 */
6802
6803// FIXME: parameter should be treated as 5-bit signed literal
6804static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006805vec_splat_u32(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006806{
David Blaikie3302f2b2013-01-16 23:08:36 +00006807 return (vector unsigned int)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006808}
6809
6810/* vec_sr */
6811
6812static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006813vec_sr(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006814{
David Blaikie3302f2b2013-01-16 23:08:36 +00006815 return __a >> (vector signed char)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006816}
6817
6818static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006819vec_sr(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006820{
David Blaikie3302f2b2013-01-16 23:08:36 +00006821 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006822}
6823
6824static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006825vec_sr(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006826{
David Blaikie3302f2b2013-01-16 23:08:36 +00006827 return __a >> (vector short)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006828}
6829
6830static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006831vec_sr(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006832{
David Blaikie3302f2b2013-01-16 23:08:36 +00006833 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006834}
6835
6836static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006837vec_sr(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006838{
David Blaikie3302f2b2013-01-16 23:08:36 +00006839 return __a >> (vector int)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006840}
6841
6842static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006843vec_sr(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006844{
David Blaikie3302f2b2013-01-16 23:08:36 +00006845 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006846}
6847
Kit Barton8553bec2015-03-11 15:57:19 +00006848#ifdef __POWER8_VECTOR__
6849static vector signed long long __ATTRS_o_ai
6850vec_sr(vector signed long long __a, vector unsigned long long __b)
6851{
6852 return __a >> (vector long long)__b;
6853}
6854
6855static vector unsigned long long __ATTRS_o_ai
6856vec_sr(vector unsigned long long __a, vector unsigned long long __b)
6857{
6858 return __a >> __b;
6859}
6860#endif
6861
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006862/* vec_vsrb */
6863
6864#define __builtin_altivec_vsrb vec_vsrb
6865
6866static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006867vec_vsrb(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006868{
David Blaikie3302f2b2013-01-16 23:08:36 +00006869 return __a >> (vector signed char)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006870}
6871
6872static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006873vec_vsrb(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006874{
David Blaikie3302f2b2013-01-16 23:08:36 +00006875 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006876}
6877
6878/* vec_vsrh */
6879
6880#define __builtin_altivec_vsrh vec_vsrh
6881
6882static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006883vec_vsrh(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006884{
David Blaikie3302f2b2013-01-16 23:08:36 +00006885 return __a >> (vector short)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006886}
6887
6888static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006889vec_vsrh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006890{
David Blaikie3302f2b2013-01-16 23:08:36 +00006891 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006892}
6893
6894/* vec_vsrw */
6895
6896#define __builtin_altivec_vsrw vec_vsrw
6897
6898static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006899vec_vsrw(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006900{
David Blaikie3302f2b2013-01-16 23:08:36 +00006901 return __a >> (vector int)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006902}
6903
6904static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006905vec_vsrw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006906{
David Blaikie3302f2b2013-01-16 23:08:36 +00006907 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006908}
6909
6910/* vec_sra */
6911
6912static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006913vec_sra(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006914{
David Blaikie3302f2b2013-01-16 23:08:36 +00006915 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006916}
6917
6918static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006919vec_sra(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006920{
David Blaikie3302f2b2013-01-16 23:08:36 +00006921 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006922}
6923
6924static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006925vec_sra(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006926{
David Blaikie3302f2b2013-01-16 23:08:36 +00006927 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006928}
6929
6930static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006931vec_sra(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006932{
David Blaikie3302f2b2013-01-16 23:08:36 +00006933 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006934}
6935
6936static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006937vec_sra(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006938{
David Blaikie3302f2b2013-01-16 23:08:36 +00006939 return __builtin_altivec_vsraw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006940}
6941
6942static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006943vec_sra(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006944{
David Blaikie3302f2b2013-01-16 23:08:36 +00006945 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006946}
6947
Kit Barton8553bec2015-03-11 15:57:19 +00006948#ifdef __POWER8_VECTOR__
6949static vector signed long long __ATTRS_o_ai
6950vec_sra(vector signed long long __a, vector unsigned long long __b)
6951{
6952 return __a >> __b;
6953}
6954
6955static vector unsigned long long __ATTRS_o_ai
6956vec_sra(vector unsigned long long __a, vector unsigned long long __b)
6957{
6958 return (vector unsigned long long) ( (vector signed long long) __a >> __b);
6959}
6960#endif
6961
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006962/* vec_vsrab */
6963
6964static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006965vec_vsrab(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006966{
David Blaikie3302f2b2013-01-16 23:08:36 +00006967 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006968}
6969
6970static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006971vec_vsrab(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006972{
David Blaikie3302f2b2013-01-16 23:08:36 +00006973 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006974}
6975
6976/* vec_vsrah */
6977
6978static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006979vec_vsrah(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006980{
David Blaikie3302f2b2013-01-16 23:08:36 +00006981 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006982}
6983
6984static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006985vec_vsrah(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006986{
David Blaikie3302f2b2013-01-16 23:08:36 +00006987 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006988}
6989
6990/* vec_vsraw */
6991
6992static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006993vec_vsraw(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006994{
David Blaikie3302f2b2013-01-16 23:08:36 +00006995 return __builtin_altivec_vsraw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006996}
6997
6998static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006999vec_vsraw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007000{
David Blaikie3302f2b2013-01-16 23:08:36 +00007001 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007002}
7003
7004/* vec_srl */
7005
7006static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007007vec_srl(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007008{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007009 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007010 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007011}
7012
7013static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007014vec_srl(vector signed char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007015{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007016 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007017 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007018}
7019
7020static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007021vec_srl(vector signed char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007022{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007023 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007024 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007025}
7026
7027static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007028vec_srl(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007029{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007030 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007031 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007032}
7033
7034static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007035vec_srl(vector unsigned char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007036{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007037 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007038 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007039}
7040
7041static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007042vec_srl(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007043{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007044 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007045 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007046}
7047
Anton Yartsevfc83c602010-08-19 03:21:36 +00007048static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007049vec_srl(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007050{
David Blaikie3302f2b2013-01-16 23:08:36 +00007051 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007052}
7053
7054static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007055vec_srl(vector bool char __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007056{
David Blaikie3302f2b2013-01-16 23:08:36 +00007057 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007058}
7059
7060static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007061vec_srl(vector bool char __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007062{
David Blaikie3302f2b2013-01-16 23:08:36 +00007063 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007064}
7065
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007066static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007067vec_srl(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007068{
David Blaikie3302f2b2013-01-16 23:08:36 +00007069 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007070}
7071
7072static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007073vec_srl(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007074{
David Blaikie3302f2b2013-01-16 23:08:36 +00007075 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007076}
7077
7078static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007079vec_srl(vector short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007080{
David Blaikie3302f2b2013-01-16 23:08:36 +00007081 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007082}
7083
7084static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007085vec_srl(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007086{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007087 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00007088 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007089}
7090
7091static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007092vec_srl(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007093{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007094 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00007095 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007096}
7097
7098static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007099vec_srl(vector unsigned short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007100{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007101 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00007102 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007103}
7104
Anton Yartsevfc83c602010-08-19 03:21:36 +00007105static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007106vec_srl(vector bool short __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007107{
David Blaikie3302f2b2013-01-16 23:08:36 +00007108 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007109}
7110
7111static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007112vec_srl(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007113{
David Blaikie3302f2b2013-01-16 23:08:36 +00007114 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007115}
7116
7117static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007118vec_srl(vector bool short __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007119{
David Blaikie3302f2b2013-01-16 23:08:36 +00007120 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007121}
7122
7123static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007124vec_srl(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007125{
David Blaikie3302f2b2013-01-16 23:08:36 +00007126 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007127}
7128
7129static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007130vec_srl(vector pixel __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007131{
David Blaikie3302f2b2013-01-16 23:08:36 +00007132 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007133}
7134
7135static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007136vec_srl(vector pixel __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007137{
David Blaikie3302f2b2013-01-16 23:08:36 +00007138 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007139}
7140
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007141static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007142vec_srl(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007143{
David Blaikie3302f2b2013-01-16 23:08:36 +00007144 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007145}
7146
7147static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007148vec_srl(vector int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007149{
David Blaikie3302f2b2013-01-16 23:08:36 +00007150 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007151}
7152
7153static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007154vec_srl(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007155{
David Blaikie3302f2b2013-01-16 23:08:36 +00007156 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007157}
7158
7159static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007160vec_srl(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007161{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007162 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007163 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007164}
7165
7166static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007167vec_srl(vector unsigned int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007168{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007169 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007170 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007171}
7172
7173static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007174vec_srl(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007175{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007176 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007177 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007178}
7179
Anton Yartsevfc83c602010-08-19 03:21:36 +00007180static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007181vec_srl(vector bool int __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007182{
David Blaikie3302f2b2013-01-16 23:08:36 +00007183 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007184}
7185
7186static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007187vec_srl(vector bool int __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007188{
David Blaikie3302f2b2013-01-16 23:08:36 +00007189 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007190}
7191
7192static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007193vec_srl(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007194{
David Blaikie3302f2b2013-01-16 23:08:36 +00007195 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007196}
7197
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007198/* vec_vsr */
7199
7200static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007201vec_vsr(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007202{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007203 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007204 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007205}
7206
7207static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007208vec_vsr(vector signed char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007209{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007210 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007211 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007212}
7213
7214static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007215vec_vsr(vector signed char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007216{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007217 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007218 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007219}
7220
7221static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007222vec_vsr(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007223{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007224 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007225 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007226}
7227
7228static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007229vec_vsr(vector unsigned char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007230{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007231 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007232 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007233}
7234
7235static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007236vec_vsr(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007237{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007238 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007239 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007240}
7241
Anton Yartsevfc83c602010-08-19 03:21:36 +00007242static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007243vec_vsr(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007244{
David Blaikie3302f2b2013-01-16 23:08:36 +00007245 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007246}
7247
7248static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007249vec_vsr(vector bool char __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007250{
David Blaikie3302f2b2013-01-16 23:08:36 +00007251 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007252}
7253
7254static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007255vec_vsr(vector bool char __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007256{
David Blaikie3302f2b2013-01-16 23:08:36 +00007257 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007258}
7259
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007260static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007261vec_vsr(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007262{
David Blaikie3302f2b2013-01-16 23:08:36 +00007263 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007264}
7265
7266static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007267vec_vsr(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007268{
David Blaikie3302f2b2013-01-16 23:08:36 +00007269 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007270}
7271
7272static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007273vec_vsr(vector short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007274{
David Blaikie3302f2b2013-01-16 23:08:36 +00007275 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007276}
7277
7278static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007279vec_vsr(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007280{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007281 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00007282 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007283}
7284
7285static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007286vec_vsr(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007287{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007288 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00007289 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007290}
7291
7292static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007293vec_vsr(vector unsigned short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007294{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007295 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00007296 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007297}
7298
Anton Yartsevfc83c602010-08-19 03:21:36 +00007299static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007300vec_vsr(vector bool short __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007301{
David Blaikie3302f2b2013-01-16 23:08:36 +00007302 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007303}
7304
7305static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007306vec_vsr(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007307{
David Blaikie3302f2b2013-01-16 23:08:36 +00007308 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007309}
7310
7311static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007312vec_vsr(vector bool short __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007313{
David Blaikie3302f2b2013-01-16 23:08:36 +00007314 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007315}
7316
7317static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007318vec_vsr(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007319{
David Blaikie3302f2b2013-01-16 23:08:36 +00007320 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007321}
7322
7323static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007324vec_vsr(vector pixel __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007325{
David Blaikie3302f2b2013-01-16 23:08:36 +00007326 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007327}
7328
7329static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007330vec_vsr(vector pixel __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007331{
David Blaikie3302f2b2013-01-16 23:08:36 +00007332 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007333}
7334
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007335static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007336vec_vsr(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007337{
David Blaikie3302f2b2013-01-16 23:08:36 +00007338 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007339}
7340
7341static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007342vec_vsr(vector int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007343{
David Blaikie3302f2b2013-01-16 23:08:36 +00007344 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007345}
7346
7347static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007348vec_vsr(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007349{
David Blaikie3302f2b2013-01-16 23:08:36 +00007350 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007351}
7352
7353static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007354vec_vsr(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007355{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007356 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007357 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007358}
7359
7360static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007361vec_vsr(vector unsigned int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007362{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007363 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007364 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007365}
7366
7367static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007368vec_vsr(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007369{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007370 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007371 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007372}
7373
Anton Yartsevfc83c602010-08-19 03:21:36 +00007374static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007375vec_vsr(vector bool int __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007376{
David Blaikie3302f2b2013-01-16 23:08:36 +00007377 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007378}
7379
7380static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007381vec_vsr(vector bool int __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007382{
David Blaikie3302f2b2013-01-16 23:08:36 +00007383 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007384}
7385
7386static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007387vec_vsr(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007388{
David Blaikie3302f2b2013-01-16 23:08:36 +00007389 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007390}
7391
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007392/* vec_sro */
7393
7394static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007395vec_sro(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007396{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007397 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007398 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007399}
7400
7401static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007402vec_sro(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007403{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007404 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007405 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007406}
7407
7408static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007409vec_sro(vector unsigned char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007410{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007411 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007412 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007413}
7414
7415static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007416vec_sro(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007417{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007418 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007419 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007420}
7421
7422static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007423vec_sro(vector short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007424{
David Blaikie3302f2b2013-01-16 23:08:36 +00007425 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007426}
7427
7428static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007429vec_sro(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007430{
David Blaikie3302f2b2013-01-16 23:08:36 +00007431 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007432}
7433
7434static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007435vec_sro(vector unsigned short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007436{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007437 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00007438 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007439}
7440
7441static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007442vec_sro(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007443{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007444 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00007445 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007446}
7447
Anton Yartsevfc83c602010-08-19 03:21:36 +00007448static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007449vec_sro(vector pixel __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007450{
David Blaikie3302f2b2013-01-16 23:08:36 +00007451 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007452}
7453
7454static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007455vec_sro(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007456{
David Blaikie3302f2b2013-01-16 23:08:36 +00007457 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007458}
7459
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007460static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007461vec_sro(vector int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007462{
David Blaikie3302f2b2013-01-16 23:08:36 +00007463 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007464}
7465
7466static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007467vec_sro(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007468{
David Blaikie3302f2b2013-01-16 23:08:36 +00007469 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007470}
7471
7472static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007473vec_sro(vector unsigned int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007474{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007475 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007476 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007477}
7478
7479static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007480vec_sro(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007481{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007482 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007483 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007484}
7485
7486static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007487vec_sro(vector float __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007488{
David Blaikie3302f2b2013-01-16 23:08:36 +00007489 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007490}
7491
7492static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007493vec_sro(vector float __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007494{
David Blaikie3302f2b2013-01-16 23:08:36 +00007495 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007496}
7497
7498/* vec_vsro */
7499
7500static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007501vec_vsro(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007502{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007503 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007504 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007505}
7506
7507static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007508vec_vsro(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007509{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007510 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007511 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007512}
7513
7514static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007515vec_vsro(vector unsigned char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007516{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007517 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007518 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007519}
7520
7521static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007522vec_vsro(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007523{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007524 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007525 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007526}
7527
7528static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007529vec_vsro(vector short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007530{
David Blaikie3302f2b2013-01-16 23:08:36 +00007531 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007532}
7533
7534static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007535vec_vsro(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007536{
David Blaikie3302f2b2013-01-16 23:08:36 +00007537 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007538}
7539
7540static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007541vec_vsro(vector unsigned short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007542{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007543 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00007544 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007545}
7546
7547static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007548vec_vsro(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007549{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007550 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00007551 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007552}
7553
Anton Yartsevfc83c602010-08-19 03:21:36 +00007554static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007555vec_vsro(vector pixel __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007556{
David Blaikie3302f2b2013-01-16 23:08:36 +00007557 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007558}
7559
7560static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007561vec_vsro(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007562{
David Blaikie3302f2b2013-01-16 23:08:36 +00007563 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007564}
7565
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007566static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007567vec_vsro(vector int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007568{
David Blaikie3302f2b2013-01-16 23:08:36 +00007569 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007570}
7571
7572static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007573vec_vsro(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007574{
David Blaikie3302f2b2013-01-16 23:08:36 +00007575 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007576}
7577
7578static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007579vec_vsro(vector unsigned int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007580{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007581 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007582 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007583}
7584
7585static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007586vec_vsro(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007587{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007588 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007589 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007590}
7591
7592static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007593vec_vsro(vector float __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007594{
David Blaikie3302f2b2013-01-16 23:08:36 +00007595 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007596}
7597
7598static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007599vec_vsro(vector float __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007600{
David Blaikie3302f2b2013-01-16 23:08:36 +00007601 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007602}
7603
7604/* vec_st */
7605
7606static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007607vec_st(vector signed char __a, int __b, vector signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007608{
David Blaikie3302f2b2013-01-16 23:08:36 +00007609 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007610}
7611
7612static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007613vec_st(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007614{
David Blaikie3302f2b2013-01-16 23:08:36 +00007615 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007616}
7617
7618static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007619vec_st(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007620{
David Blaikie3302f2b2013-01-16 23:08:36 +00007621 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007622}
7623
7624static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007625vec_st(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007626{
David Blaikie3302f2b2013-01-16 23:08:36 +00007627 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007628}
7629
7630static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007631vec_st(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007632{
David Blaikie3302f2b2013-01-16 23:08:36 +00007633 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007634}
7635
7636static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007637vec_st(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007638{
David Blaikie3302f2b2013-01-16 23:08:36 +00007639 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007640}
7641
7642static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007643vec_st(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007644{
David Blaikie3302f2b2013-01-16 23:08:36 +00007645 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007646}
7647
7648static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007649vec_st(vector short __a, int __b, vector short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007650{
David Blaikie3302f2b2013-01-16 23:08:36 +00007651 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007652}
7653
7654static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007655vec_st(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007656{
David Blaikie3302f2b2013-01-16 23:08:36 +00007657 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007658}
7659
7660static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007661vec_st(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007662{
David Blaikie3302f2b2013-01-16 23:08:36 +00007663 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007664}
7665
7666static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007667vec_st(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007668{
David Blaikie3302f2b2013-01-16 23:08:36 +00007669 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007670}
7671
7672static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007673vec_st(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007674{
David Blaikie3302f2b2013-01-16 23:08:36 +00007675 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007676}
7677
7678static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007679vec_st(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007680{
David Blaikie3302f2b2013-01-16 23:08:36 +00007681 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007682}
7683
7684static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007685vec_st(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007686{
David Blaikie3302f2b2013-01-16 23:08:36 +00007687 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007688}
7689
7690static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007691vec_st(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007692{
David Blaikie3302f2b2013-01-16 23:08:36 +00007693 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007694}
7695
7696static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007697vec_st(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007698{
David Blaikie3302f2b2013-01-16 23:08:36 +00007699 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007700}
7701
7702static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007703vec_st(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007704{
David Blaikie3302f2b2013-01-16 23:08:36 +00007705 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007706}
7707
7708static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007709vec_st(vector int __a, int __b, vector int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007710{
David Blaikie3302f2b2013-01-16 23:08:36 +00007711 __builtin_altivec_stvx(__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 int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007716{
David Blaikie3302f2b2013-01-16 23:08:36 +00007717 __builtin_altivec_stvx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007718}
7719
7720static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007721vec_st(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007722{
David Blaikie3302f2b2013-01-16 23:08:36 +00007723 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007724}
7725
7726static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007727vec_st(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007728{
David Blaikie3302f2b2013-01-16 23:08:36 +00007729 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007730}
7731
7732static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007733vec_st(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007734{
David Blaikie3302f2b2013-01-16 23:08:36 +00007735 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007736}
7737
7738static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007739vec_st(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007740{
David Blaikie3302f2b2013-01-16 23:08:36 +00007741 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007742}
7743
7744static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007745vec_st(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007746{
David Blaikie3302f2b2013-01-16 23:08:36 +00007747 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007748}
7749
7750static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007751vec_st(vector float __a, int __b, vector float *__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 float __a, int __b, float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007758{
David Blaikie3302f2b2013-01-16 23:08:36 +00007759 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007760}
7761
7762/* vec_stvx */
7763
7764static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007765vec_stvx(vector signed char __a, int __b, vector signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007766{
David Blaikie3302f2b2013-01-16 23:08:36 +00007767 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007768}
7769
7770static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007771vec_stvx(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007772{
David Blaikie3302f2b2013-01-16 23:08:36 +00007773 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007774}
7775
7776static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007777vec_stvx(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007778{
David Blaikie3302f2b2013-01-16 23:08:36 +00007779 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007780}
7781
7782static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007783vec_stvx(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007784{
David Blaikie3302f2b2013-01-16 23:08:36 +00007785 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007786}
7787
7788static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007789vec_stvx(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007790{
David Blaikie3302f2b2013-01-16 23:08:36 +00007791 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007792}
7793
7794static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007795vec_stvx(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007796{
David Blaikie3302f2b2013-01-16 23:08:36 +00007797 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007798}
7799
7800static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007801vec_stvx(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007802{
David Blaikie3302f2b2013-01-16 23:08:36 +00007803 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007804}
7805
7806static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007807vec_stvx(vector short __a, int __b, vector short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007808{
David Blaikie3302f2b2013-01-16 23:08:36 +00007809 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007810}
7811
7812static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007813vec_stvx(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007814{
David Blaikie3302f2b2013-01-16 23:08:36 +00007815 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007816}
7817
7818static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007819vec_stvx(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007820{
David Blaikie3302f2b2013-01-16 23:08:36 +00007821 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007822}
7823
7824static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007825vec_stvx(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007826{
David Blaikie3302f2b2013-01-16 23:08:36 +00007827 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007828}
7829
7830static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007831vec_stvx(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007832{
David Blaikie3302f2b2013-01-16 23:08:36 +00007833 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007834}
7835
7836static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007837vec_stvx(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007838{
David Blaikie3302f2b2013-01-16 23:08:36 +00007839 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007840}
7841
7842static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007843vec_stvx(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007844{
David Blaikie3302f2b2013-01-16 23:08:36 +00007845 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007846}
7847
7848static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007849vec_stvx(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007850{
David Blaikie3302f2b2013-01-16 23:08:36 +00007851 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007852}
7853
7854static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007855vec_stvx(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007856{
David Blaikie3302f2b2013-01-16 23:08:36 +00007857 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007858}
7859
7860static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007861vec_stvx(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007862{
David Blaikie3302f2b2013-01-16 23:08:36 +00007863 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007864}
7865
7866static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007867vec_stvx(vector int __a, int __b, vector int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007868{
David Blaikie3302f2b2013-01-16 23:08:36 +00007869 __builtin_altivec_stvx(__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 int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007874{
David Blaikie3302f2b2013-01-16 23:08:36 +00007875 __builtin_altivec_stvx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007876}
7877
7878static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007879vec_stvx(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007880{
David Blaikie3302f2b2013-01-16 23:08:36 +00007881 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007882}
7883
7884static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007885vec_stvx(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007886{
David Blaikie3302f2b2013-01-16 23:08:36 +00007887 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007888}
7889
7890static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007891vec_stvx(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007892{
David Blaikie3302f2b2013-01-16 23:08:36 +00007893 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007894}
7895
7896static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007897vec_stvx(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007898{
David Blaikie3302f2b2013-01-16 23:08:36 +00007899 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007900}
7901
7902static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007903vec_stvx(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007904{
David Blaikie3302f2b2013-01-16 23:08:36 +00007905 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007906}
7907
7908static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007909vec_stvx(vector float __a, int __b, vector float *__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 float __a, int __b, float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007916{
David Blaikie3302f2b2013-01-16 23:08:36 +00007917 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007918}
7919
7920/* vec_ste */
7921
7922static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007923vec_ste(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007924{
David Blaikie3302f2b2013-01-16 23:08:36 +00007925 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007926}
7927
7928static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007929vec_ste(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007930{
David Blaikie3302f2b2013-01-16 23:08:36 +00007931 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007932}
7933
7934static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007935vec_ste(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007936{
David Blaikie3302f2b2013-01-16 23:08:36 +00007937 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007938}
7939
7940static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007941vec_ste(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007942{
David Blaikie3302f2b2013-01-16 23:08:36 +00007943 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007944}
7945
7946static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007947vec_ste(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007948{
David Blaikie3302f2b2013-01-16 23:08:36 +00007949 __builtin_altivec_stvehx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007950}
7951
7952static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007953vec_ste(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007954{
David Blaikie3302f2b2013-01-16 23:08:36 +00007955 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007956}
7957
7958static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007959vec_ste(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007960{
David Blaikie3302f2b2013-01-16 23:08:36 +00007961 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007962}
7963
7964static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007965vec_ste(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007966{
David Blaikie3302f2b2013-01-16 23:08:36 +00007967 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007968}
7969
7970static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007971vec_ste(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007972{
David Blaikie3302f2b2013-01-16 23:08:36 +00007973 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007974}
7975
7976static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007977vec_ste(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007978{
David Blaikie3302f2b2013-01-16 23:08:36 +00007979 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007980}
7981
7982static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007983vec_ste(vector int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007984{
David Blaikie3302f2b2013-01-16 23:08:36 +00007985 __builtin_altivec_stvewx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007986}
7987
7988static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007989vec_ste(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007990{
David Blaikie3302f2b2013-01-16 23:08:36 +00007991 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007992}
7993
7994static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007995vec_ste(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007996{
David Blaikie3302f2b2013-01-16 23:08:36 +00007997 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007998}
7999
8000static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008001vec_ste(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008002{
David Blaikie3302f2b2013-01-16 23:08:36 +00008003 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008004}
8005
8006static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008007vec_ste(vector float __a, int __b, float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008008{
David Blaikie3302f2b2013-01-16 23:08:36 +00008009 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008010}
8011
8012/* vec_stvebx */
8013
8014static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008015vec_stvebx(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008016{
David Blaikie3302f2b2013-01-16 23:08:36 +00008017 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008018}
8019
8020static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008021vec_stvebx(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008022{
David Blaikie3302f2b2013-01-16 23:08:36 +00008023 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008024}
8025
Anton Yartsevfc83c602010-08-19 03:21:36 +00008026static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008027vec_stvebx(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008028{
David Blaikie3302f2b2013-01-16 23:08:36 +00008029 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008030}
8031
8032static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008033vec_stvebx(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008034{
David Blaikie3302f2b2013-01-16 23:08:36 +00008035 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008036}
8037
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008038/* vec_stvehx */
8039
8040static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008041vec_stvehx(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008042{
David Blaikie3302f2b2013-01-16 23:08:36 +00008043 __builtin_altivec_stvehx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008044}
8045
8046static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008047vec_stvehx(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008048{
David Blaikie3302f2b2013-01-16 23:08:36 +00008049 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008050}
8051
Anton Yartsevfc83c602010-08-19 03:21:36 +00008052static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008053vec_stvehx(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008054{
David Blaikie3302f2b2013-01-16 23:08:36 +00008055 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008056}
8057
8058static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008059vec_stvehx(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008060{
David Blaikie3302f2b2013-01-16 23:08:36 +00008061 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008062}
8063
8064static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008065vec_stvehx(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008066{
David Blaikie3302f2b2013-01-16 23:08:36 +00008067 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008068}
8069
8070static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008071vec_stvehx(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008072{
David Blaikie3302f2b2013-01-16 23:08:36 +00008073 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008074}
8075
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008076/* vec_stvewx */
8077
8078static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008079vec_stvewx(vector int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008080{
David Blaikie3302f2b2013-01-16 23:08:36 +00008081 __builtin_altivec_stvewx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008082}
8083
8084static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008085vec_stvewx(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008086{
David Blaikie3302f2b2013-01-16 23:08:36 +00008087 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008088}
8089
8090static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008091vec_stvewx(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008092{
David Blaikie3302f2b2013-01-16 23:08:36 +00008093 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008094}
8095
8096static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008097vec_stvewx(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008098{
David Blaikie3302f2b2013-01-16 23:08:36 +00008099 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008100}
8101
8102static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008103vec_stvewx(vector float __a, int __b, float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008104{
David Blaikie3302f2b2013-01-16 23:08:36 +00008105 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008106}
8107
8108/* vec_stl */
8109
8110static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008111vec_stl(vector signed char __a, int __b, vector signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008112{
David Blaikie3302f2b2013-01-16 23:08:36 +00008113 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008114}
8115
8116static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008117vec_stl(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008118{
David Blaikie3302f2b2013-01-16 23:08:36 +00008119 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008120}
8121
8122static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008123vec_stl(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008124{
David Blaikie3302f2b2013-01-16 23:08:36 +00008125 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008126}
8127
8128static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008129vec_stl(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008130{
David Blaikie3302f2b2013-01-16 23:08:36 +00008131 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008132}
8133
8134static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008135vec_stl(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008136{
David Blaikie3302f2b2013-01-16 23:08:36 +00008137 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008138}
8139
8140static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008141vec_stl(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008142{
David Blaikie3302f2b2013-01-16 23:08:36 +00008143 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008144}
8145
8146static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008147vec_stl(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008148{
David Blaikie3302f2b2013-01-16 23:08:36 +00008149 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008150}
8151
8152static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008153vec_stl(vector short __a, int __b, vector short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008154{
David Blaikie3302f2b2013-01-16 23:08:36 +00008155 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008156}
8157
8158static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008159vec_stl(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008160{
David Blaikie3302f2b2013-01-16 23:08:36 +00008161 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008162}
8163
8164static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008165vec_stl(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008166{
David Blaikie3302f2b2013-01-16 23:08:36 +00008167 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008168}
8169
8170static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008171vec_stl(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008172{
David Blaikie3302f2b2013-01-16 23:08:36 +00008173 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008174}
8175
8176static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008177vec_stl(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008178{
David Blaikie3302f2b2013-01-16 23:08:36 +00008179 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008180}
8181
8182static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008183vec_stl(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008184{
David Blaikie3302f2b2013-01-16 23:08:36 +00008185 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008186}
8187
8188static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008189vec_stl(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008190{
David Blaikie3302f2b2013-01-16 23:08:36 +00008191 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008192}
8193
8194static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008195vec_stl(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008196{
David Blaikie3302f2b2013-01-16 23:08:36 +00008197 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008198}
8199
8200static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008201vec_stl(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008202{
David Blaikie3302f2b2013-01-16 23:08:36 +00008203 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008204}
8205
8206static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008207vec_stl(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008208{
David Blaikie3302f2b2013-01-16 23:08:36 +00008209 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008210}
8211
8212static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008213vec_stl(vector int __a, int __b, vector int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008214{
David Blaikie3302f2b2013-01-16 23:08:36 +00008215 __builtin_altivec_stvxl(__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 int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008220{
David Blaikie3302f2b2013-01-16 23:08:36 +00008221 __builtin_altivec_stvxl(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008222}
8223
8224static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008225vec_stl(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008226{
David Blaikie3302f2b2013-01-16 23:08:36 +00008227 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008228}
8229
8230static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008231vec_stl(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008232{
David Blaikie3302f2b2013-01-16 23:08:36 +00008233 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008234}
8235
8236static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008237vec_stl(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008238{
David Blaikie3302f2b2013-01-16 23:08:36 +00008239 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008240}
8241
8242static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008243vec_stl(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008244{
David Blaikie3302f2b2013-01-16 23:08:36 +00008245 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008246}
8247
8248static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008249vec_stl(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008250{
David Blaikie3302f2b2013-01-16 23:08:36 +00008251 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008252}
8253
8254static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008255vec_stl(vector float __a, int __b, vector float *__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 float __a, int __b, float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008262{
David Blaikie3302f2b2013-01-16 23:08:36 +00008263 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008264}
8265
8266/* vec_stvxl */
8267
8268static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008269vec_stvxl(vector signed char __a, int __b, vector signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008270{
David Blaikie3302f2b2013-01-16 23:08:36 +00008271 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008272}
8273
8274static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008275vec_stvxl(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008276{
David Blaikie3302f2b2013-01-16 23:08:36 +00008277 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008278}
8279
8280static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008281vec_stvxl(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008282{
David Blaikie3302f2b2013-01-16 23:08:36 +00008283 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008284}
8285
8286static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008287vec_stvxl(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008288{
David Blaikie3302f2b2013-01-16 23:08:36 +00008289 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008290}
8291
8292static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008293vec_stvxl(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008294{
David Blaikie3302f2b2013-01-16 23:08:36 +00008295 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008296}
8297
8298static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008299vec_stvxl(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008300{
David Blaikie3302f2b2013-01-16 23:08:36 +00008301 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008302}
8303
8304static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008305vec_stvxl(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008306{
David Blaikie3302f2b2013-01-16 23:08:36 +00008307 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008308}
8309
8310static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008311vec_stvxl(vector short __a, int __b, vector short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008312{
David Blaikie3302f2b2013-01-16 23:08:36 +00008313 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008314}
8315
8316static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008317vec_stvxl(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008318{
David Blaikie3302f2b2013-01-16 23:08:36 +00008319 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008320}
8321
8322static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008323vec_stvxl(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008324{
David Blaikie3302f2b2013-01-16 23:08:36 +00008325 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008326}
8327
8328static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008329vec_stvxl(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008330{
David Blaikie3302f2b2013-01-16 23:08:36 +00008331 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008332}
8333
8334static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008335vec_stvxl(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008336{
David Blaikie3302f2b2013-01-16 23:08:36 +00008337 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008338}
8339
8340static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008341vec_stvxl(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008342{
David Blaikie3302f2b2013-01-16 23:08:36 +00008343 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008344}
8345
8346static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008347vec_stvxl(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008348{
David Blaikie3302f2b2013-01-16 23:08:36 +00008349 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008350}
8351
8352static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008353vec_stvxl(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008354{
David Blaikie3302f2b2013-01-16 23:08:36 +00008355 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008356}
8357
8358static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008359vec_stvxl(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008360{
David Blaikie3302f2b2013-01-16 23:08:36 +00008361 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008362}
8363
8364static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008365vec_stvxl(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008366{
David Blaikie3302f2b2013-01-16 23:08:36 +00008367 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008368}
8369
8370static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008371vec_stvxl(vector int __a, int __b, vector int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008372{
David Blaikie3302f2b2013-01-16 23:08:36 +00008373 __builtin_altivec_stvxl(__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 int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008378{
David Blaikie3302f2b2013-01-16 23:08:36 +00008379 __builtin_altivec_stvxl(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008380}
8381
8382static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008383vec_stvxl(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008384{
David Blaikie3302f2b2013-01-16 23:08:36 +00008385 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008386}
8387
8388static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008389vec_stvxl(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008390{
David Blaikie3302f2b2013-01-16 23:08:36 +00008391 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008392}
8393
8394static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008395vec_stvxl(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008396{
David Blaikie3302f2b2013-01-16 23:08:36 +00008397 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008398}
8399
8400static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008401vec_stvxl(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008402{
David Blaikie3302f2b2013-01-16 23:08:36 +00008403 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008404}
8405
8406static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008407vec_stvxl(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008408{
David Blaikie3302f2b2013-01-16 23:08:36 +00008409 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008410}
8411
8412static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008413vec_stvxl(vector float __a, int __b, vector float *__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 float __a, int __b, float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008420{
David Blaikie3302f2b2013-01-16 23:08:36 +00008421 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008422}
8423
8424/* vec_sub */
8425
8426static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008427vec_sub(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008428{
David Blaikie3302f2b2013-01-16 23:08:36 +00008429 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008430}
8431
Anton Yartsevfc83c602010-08-19 03:21:36 +00008432static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008433vec_sub(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008434{
David Blaikie3302f2b2013-01-16 23:08:36 +00008435 return (vector signed char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008436}
8437
8438static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008439vec_sub(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008440{
David Blaikie3302f2b2013-01-16 23:08:36 +00008441 return __a - (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008442}
8443
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008444static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008445vec_sub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008446{
David Blaikie3302f2b2013-01-16 23:08:36 +00008447 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008448}
8449
Anton Yartsevfc83c602010-08-19 03:21:36 +00008450static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008451vec_sub(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008452{
David Blaikie3302f2b2013-01-16 23:08:36 +00008453 return (vector unsigned char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008454}
8455
8456static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008457vec_sub(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008458{
David Blaikie3302f2b2013-01-16 23:08:36 +00008459 return __a - (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008460}
8461
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008462static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008463vec_sub(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008464{
David Blaikie3302f2b2013-01-16 23:08:36 +00008465 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008466}
8467
Anton Yartsevfc83c602010-08-19 03:21:36 +00008468static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008469vec_sub(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008470{
David Blaikie3302f2b2013-01-16 23:08:36 +00008471 return (vector short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008472}
8473
8474static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008475vec_sub(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008476{
David Blaikie3302f2b2013-01-16 23:08:36 +00008477 return __a - (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008478}
8479
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008480static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008481vec_sub(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008482{
David Blaikie3302f2b2013-01-16 23:08:36 +00008483 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008484}
8485
Anton Yartsevfc83c602010-08-19 03:21:36 +00008486static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008487vec_sub(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008488{
David Blaikie3302f2b2013-01-16 23:08:36 +00008489 return (vector unsigned short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008490}
8491
8492static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008493vec_sub(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008494{
David Blaikie3302f2b2013-01-16 23:08:36 +00008495 return __a - (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008496}
8497
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008498static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008499vec_sub(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008500{
David Blaikie3302f2b2013-01-16 23:08:36 +00008501 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008502}
8503
Anton Yartsevfc83c602010-08-19 03:21:36 +00008504static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008505vec_sub(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008506{
David Blaikie3302f2b2013-01-16 23:08:36 +00008507 return (vector int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008508}
8509
8510static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008511vec_sub(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008512{
David Blaikie3302f2b2013-01-16 23:08:36 +00008513 return __a - (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008514}
8515
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008516static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008517vec_sub(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008518{
David Blaikie3302f2b2013-01-16 23:08:36 +00008519 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008520}
8521
Anton Yartsevfc83c602010-08-19 03:21:36 +00008522static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008523vec_sub(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008524{
David Blaikie3302f2b2013-01-16 23:08:36 +00008525 return (vector unsigned int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008526}
8527
8528static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008529vec_sub(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008530{
David Blaikie3302f2b2013-01-16 23:08:36 +00008531 return __a - (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008532}
8533
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008534static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008535vec_sub(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008536{
David Blaikie3302f2b2013-01-16 23:08:36 +00008537 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008538}
8539
8540/* vec_vsububm */
8541
8542#define __builtin_altivec_vsububm vec_vsububm
8543
8544static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008545vec_vsububm(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008546{
David Blaikie3302f2b2013-01-16 23:08:36 +00008547 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008548}
8549
Anton Yartsevfc83c602010-08-19 03:21:36 +00008550static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008551vec_vsububm(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008552{
David Blaikie3302f2b2013-01-16 23:08:36 +00008553 return (vector signed char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008554}
8555
8556static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008557vec_vsububm(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008558{
David Blaikie3302f2b2013-01-16 23:08:36 +00008559 return __a - (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008560}
8561
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008562static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008563vec_vsububm(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008564{
David Blaikie3302f2b2013-01-16 23:08:36 +00008565 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008566}
8567
Anton Yartsevfc83c602010-08-19 03:21:36 +00008568static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008569vec_vsububm(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008570{
David Blaikie3302f2b2013-01-16 23:08:36 +00008571 return (vector unsigned char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008572}
8573
8574static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008575vec_vsububm(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008576{
David Blaikie3302f2b2013-01-16 23:08:36 +00008577 return __a - (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008578}
8579
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008580/* vec_vsubuhm */
8581
8582#define __builtin_altivec_vsubuhm vec_vsubuhm
8583
8584static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008585vec_vsubuhm(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008586{
David Blaikie3302f2b2013-01-16 23:08:36 +00008587 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008588}
8589
Anton Yartsevfc83c602010-08-19 03:21:36 +00008590static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008591vec_vsubuhm(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008592{
David Blaikie3302f2b2013-01-16 23:08:36 +00008593 return (vector short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008594}
8595
8596static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008597vec_vsubuhm(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008598{
David Blaikie3302f2b2013-01-16 23:08:36 +00008599 return __a - (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008600}
8601
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008602static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008603vec_vsubuhm(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008604{
David Blaikie3302f2b2013-01-16 23:08:36 +00008605 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008606}
8607
Anton Yartsevfc83c602010-08-19 03:21:36 +00008608static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008609vec_vsubuhm(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008610{
David Blaikie3302f2b2013-01-16 23:08:36 +00008611 return (vector unsigned short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008612}
8613
8614static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008615vec_vsubuhm(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008616{
David Blaikie3302f2b2013-01-16 23:08:36 +00008617 return __a - (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008618}
8619
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008620/* vec_vsubuwm */
8621
8622#define __builtin_altivec_vsubuwm vec_vsubuwm
8623
8624static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008625vec_vsubuwm(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008626{
David Blaikie3302f2b2013-01-16 23:08:36 +00008627 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008628}
8629
Anton Yartsevfc83c602010-08-19 03:21:36 +00008630static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008631vec_vsubuwm(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008632{
David Blaikie3302f2b2013-01-16 23:08:36 +00008633 return (vector int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008634}
8635
8636static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008637vec_vsubuwm(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008638{
David Blaikie3302f2b2013-01-16 23:08:36 +00008639 return __a - (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008640}
8641
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008642static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008643vec_vsubuwm(vector unsigned int __a, vector unsigned int __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 unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008649vec_vsubuwm(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008650{
David Blaikie3302f2b2013-01-16 23:08:36 +00008651 return (vector unsigned int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008652}
8653
8654static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008655vec_vsubuwm(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008656{
David Blaikie3302f2b2013-01-16 23:08:36 +00008657 return __a - (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008658}
8659
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008660/* vec_vsubfp */
8661
8662#define __builtin_altivec_vsubfp vec_vsubfp
8663
8664static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008665vec_vsubfp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008666{
David Blaikie3302f2b2013-01-16 23:08:36 +00008667 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008668}
8669
8670/* vec_subc */
8671
8672static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008673vec_subc(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008674{
David Blaikie3302f2b2013-01-16 23:08:36 +00008675 return __builtin_altivec_vsubcuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008676}
8677
8678/* vec_vsubcuw */
8679
8680static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008681vec_vsubcuw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008682{
David Blaikie3302f2b2013-01-16 23:08:36 +00008683 return __builtin_altivec_vsubcuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008684}
8685
8686/* vec_subs */
8687
8688static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008689vec_subs(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008690{
David Blaikie3302f2b2013-01-16 23:08:36 +00008691 return __builtin_altivec_vsubsbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008692}
8693
Anton Yartsevfc83c602010-08-19 03:21:36 +00008694static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008695vec_subs(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008696{
David Blaikie3302f2b2013-01-16 23:08:36 +00008697 return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008698}
8699
8700static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008701vec_subs(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008702{
David Blaikie3302f2b2013-01-16 23:08:36 +00008703 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008704}
8705
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008706static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008707vec_subs(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008708{
David Blaikie3302f2b2013-01-16 23:08:36 +00008709 return __builtin_altivec_vsububs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008710}
8711
Anton Yartsevfc83c602010-08-19 03:21:36 +00008712static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008713vec_subs(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008714{
David Blaikie3302f2b2013-01-16 23:08:36 +00008715 return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008716}
8717
8718static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008719vec_subs(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008720{
David Blaikie3302f2b2013-01-16 23:08:36 +00008721 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008722}
8723
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008724static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008725vec_subs(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008726{
David Blaikie3302f2b2013-01-16 23:08:36 +00008727 return __builtin_altivec_vsubshs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008728}
8729
Anton Yartsevfc83c602010-08-19 03:21:36 +00008730static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008731vec_subs(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008732{
David Blaikie3302f2b2013-01-16 23:08:36 +00008733 return __builtin_altivec_vsubshs((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008734}
8735
8736static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008737vec_subs(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008738{
David Blaikie3302f2b2013-01-16 23:08:36 +00008739 return __builtin_altivec_vsubshs(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008740}
8741
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008742static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008743vec_subs(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008744{
David Blaikie3302f2b2013-01-16 23:08:36 +00008745 return __builtin_altivec_vsubuhs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008746}
8747
Anton Yartsevfc83c602010-08-19 03:21:36 +00008748static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008749vec_subs(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008750{
David Blaikie3302f2b2013-01-16 23:08:36 +00008751 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008752}
8753
8754static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008755vec_subs(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008756{
David Blaikie3302f2b2013-01-16 23:08:36 +00008757 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008758}
8759
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008760static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008761vec_subs(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008762{
David Blaikie3302f2b2013-01-16 23:08:36 +00008763 return __builtin_altivec_vsubsws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008764}
8765
Anton Yartsevfc83c602010-08-19 03:21:36 +00008766static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008767vec_subs(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008768{
David Blaikie3302f2b2013-01-16 23:08:36 +00008769 return __builtin_altivec_vsubsws((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008770}
8771
8772static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008773vec_subs(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008774{
David Blaikie3302f2b2013-01-16 23:08:36 +00008775 return __builtin_altivec_vsubsws(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008776}
8777
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008778static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008779vec_subs(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008780{
David Blaikie3302f2b2013-01-16 23:08:36 +00008781 return __builtin_altivec_vsubuws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008782}
8783
Anton Yartsevfc83c602010-08-19 03:21:36 +00008784static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008785vec_subs(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008786{
David Blaikie3302f2b2013-01-16 23:08:36 +00008787 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008788}
8789
8790static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008791vec_subs(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008792{
David Blaikie3302f2b2013-01-16 23:08:36 +00008793 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008794}
8795
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008796/* vec_vsubsbs */
8797
Anton Yartsevfc83c602010-08-19 03:21:36 +00008798static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008799vec_vsubsbs(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008800{
David Blaikie3302f2b2013-01-16 23:08:36 +00008801 return __builtin_altivec_vsubsbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008802}
8803
Anton Yartsevfc83c602010-08-19 03:21:36 +00008804static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008805vec_vsubsbs(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008806{
David Blaikie3302f2b2013-01-16 23:08:36 +00008807 return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008808}
8809
8810static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008811vec_vsubsbs(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008812{
David Blaikie3302f2b2013-01-16 23:08:36 +00008813 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008814}
8815
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008816/* vec_vsububs */
8817
Anton Yartsevfc83c602010-08-19 03:21:36 +00008818static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008819vec_vsububs(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_vsububs(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_vsububs(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 +00008836/* vec_vsubshs */
8837
Anton Yartsevfc83c602010-08-19 03:21:36 +00008838static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008839vec_vsubshs(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008840{
David Blaikie3302f2b2013-01-16 23:08:36 +00008841 return __builtin_altivec_vsubshs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008842}
8843
Anton Yartsevfc83c602010-08-19 03:21:36 +00008844static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008845vec_vsubshs(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008846{
David Blaikie3302f2b2013-01-16 23:08:36 +00008847 return __builtin_altivec_vsubshs((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008848}
8849
8850static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008851vec_vsubshs(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008852{
David Blaikie3302f2b2013-01-16 23:08:36 +00008853 return __builtin_altivec_vsubshs(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008854}
8855
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008856/* vec_vsubuhs */
8857
Anton Yartsevfc83c602010-08-19 03:21:36 +00008858static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008859vec_vsubuhs(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008860{
David Blaikie3302f2b2013-01-16 23:08:36 +00008861 return __builtin_altivec_vsubuhs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008862}
8863
Anton Yartsevfc83c602010-08-19 03:21:36 +00008864static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008865vec_vsubuhs(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008866{
David Blaikie3302f2b2013-01-16 23:08:36 +00008867 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008868}
8869
8870static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008871vec_vsubuhs(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008872{
David Blaikie3302f2b2013-01-16 23:08:36 +00008873 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008874}
8875
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008876/* vec_vsubsws */
8877
Anton Yartsevfc83c602010-08-19 03:21:36 +00008878static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008879vec_vsubsws(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008880{
David Blaikie3302f2b2013-01-16 23:08:36 +00008881 return __builtin_altivec_vsubsws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008882}
8883
Anton Yartsevfc83c602010-08-19 03:21:36 +00008884static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008885vec_vsubsws(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008886{
David Blaikie3302f2b2013-01-16 23:08:36 +00008887 return __builtin_altivec_vsubsws((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008888}
8889
8890static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008891vec_vsubsws(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008892{
David Blaikie3302f2b2013-01-16 23:08:36 +00008893 return __builtin_altivec_vsubsws(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008894}
8895
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008896/* vec_vsubuws */
8897
Anton Yartsevfc83c602010-08-19 03:21:36 +00008898static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008899vec_vsubuws(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008900{
David Blaikie3302f2b2013-01-16 23:08:36 +00008901 return __builtin_altivec_vsubuws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008902}
8903
Anton Yartsevfc83c602010-08-19 03:21:36 +00008904static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008905vec_vsubuws(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008906{
David Blaikie3302f2b2013-01-16 23:08:36 +00008907 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008908}
8909
8910static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008911vec_vsubuws(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008912{
David Blaikie3302f2b2013-01-16 23:08:36 +00008913 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008914}
8915
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008916/* vec_sum4s */
8917
8918static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008919vec_sum4s(vector signed char __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008920{
David Blaikie3302f2b2013-01-16 23:08:36 +00008921 return __builtin_altivec_vsum4sbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008922}
8923
8924static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008925vec_sum4s(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008926{
David Blaikie3302f2b2013-01-16 23:08:36 +00008927 return __builtin_altivec_vsum4ubs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008928}
8929
8930static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008931vec_sum4s(vector signed short __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008932{
David Blaikie3302f2b2013-01-16 23:08:36 +00008933 return __builtin_altivec_vsum4shs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008934}
8935
8936/* vec_vsum4sbs */
8937
8938static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008939vec_vsum4sbs(vector signed char __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008940{
David Blaikie3302f2b2013-01-16 23:08:36 +00008941 return __builtin_altivec_vsum4sbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008942}
8943
8944/* vec_vsum4ubs */
8945
8946static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008947vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008948{
David Blaikie3302f2b2013-01-16 23:08:36 +00008949 return __builtin_altivec_vsum4ubs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008950}
8951
8952/* vec_vsum4shs */
8953
8954static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008955vec_vsum4shs(vector signed short __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008956{
David Blaikie3302f2b2013-01-16 23:08:36 +00008957 return __builtin_altivec_vsum4shs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008958}
8959
8960/* vec_sum2s */
8961
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008962/* The vsum2sws instruction has a big-endian bias, so that the second
8963 input vector and the result always reference big-endian elements
8964 1 and 3 (little-endian element 0 and 2). For ease of porting the
8965 programmer wants elements 1 and 3 in both cases, so for little
8966 endian we must perform some permutes. */
8967
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008968static vector signed int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008969vec_sum2s(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008970{
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008971#ifdef __LITTLE_ENDIAN__
8972 vector int __c = (vector signed int)
8973 vec_perm(__b, __b, (vector unsigned char)
Eric Christopherc67e1b62014-12-10 00:57:43 +00008974 (4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11));
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008975 __c = __builtin_altivec_vsum2sws(__a, __c);
8976 return (vector signed int)
8977 vec_perm(__c, __c, (vector unsigned char)
Eric Christopherc67e1b62014-12-10 00:57:43 +00008978 (4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11));
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008979#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008980 return __builtin_altivec_vsum2sws(__a, __b);
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008981#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008982}
8983
8984/* vec_vsum2sws */
8985
8986static vector signed int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008987vec_vsum2sws(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008988{
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008989#ifdef __LITTLE_ENDIAN__
8990 vector int __c = (vector signed int)
8991 vec_perm(__b, __b, (vector unsigned char)
Eric Christopherc67e1b62014-12-10 00:57:43 +00008992 (4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11));
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008993 __c = __builtin_altivec_vsum2sws(__a, __c);
8994 return (vector signed int)
8995 vec_perm(__c, __c, (vector unsigned char)
Eric Christopherc67e1b62014-12-10 00:57:43 +00008996 (4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11));
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008997#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008998 return __builtin_altivec_vsum2sws(__a, __b);
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008999#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009000}
9001
9002/* vec_sums */
9003
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00009004/* The vsumsws instruction has a big-endian bias, so that the second
9005 input vector and the result always reference big-endian element 3
9006 (little-endian element 0). For ease of porting the programmer
9007 wants element 3 in both cases, so for little endian we must perform
9008 some permutes. */
9009
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009010static vector signed int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00009011vec_sums(vector signed int __a, vector signed int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009012{
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00009013#ifdef __LITTLE_ENDIAN__
Bill Schmidtccbe0a82014-08-04 23:21:26 +00009014 __b = (vector signed int)vec_splat(__b, 3);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00009015 __b = __builtin_altivec_vsumsws(__a, __b);
Bill Schmidtccbe0a82014-08-04 23:21:26 +00009016 return (vector signed int)(0, 0, 0, __b[0]);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00009017#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009018 return __builtin_altivec_vsumsws(__a, __b);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00009019#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009020}
9021
9022/* vec_vsumsws */
9023
9024static vector signed int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00009025vec_vsumsws(vector signed int __a, vector signed int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009026{
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00009027#ifdef __LITTLE_ENDIAN__
Bill Schmidtccbe0a82014-08-04 23:21:26 +00009028 __b = (vector signed int)vec_splat(__b, 3);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00009029 __b = __builtin_altivec_vsumsws(__a, __b);
Bill Schmidtccbe0a82014-08-04 23:21:26 +00009030 return (vector signed int)(0, 0, 0, __b[0]);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00009031#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009032 return __builtin_altivec_vsumsws(__a, __b);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00009033#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009034}
9035
9036/* vec_trunc */
9037
9038static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00009039vec_trunc(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009040{
David Blaikie3302f2b2013-01-16 23:08:36 +00009041 return __builtin_altivec_vrfiz(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009042}
9043
9044/* vec_vrfiz */
9045
9046static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00009047vec_vrfiz(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009048{
David Blaikie3302f2b2013-01-16 23:08:36 +00009049 return __builtin_altivec_vrfiz(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009050}
9051
9052/* vec_unpackh */
9053
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009054/* The vector unpack instructions all have a big-endian bias, so for
9055 little endian we must reverse the meanings of "high" and "low." */
9056
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009057static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009058vec_unpackh(vector signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009059{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009060#ifdef __LITTLE_ENDIAN__
9061 return __builtin_altivec_vupklsb((vector char)__a);
9062#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009063 return __builtin_altivec_vupkhsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009064#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009065}
9066
Anton Yartsevfc83c602010-08-19 03:21:36 +00009067static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009068vec_unpackh(vector bool char __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009069{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009070#ifdef __LITTLE_ENDIAN__
9071 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
9072#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009073 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009074#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00009075}
9076
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009077static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009078vec_unpackh(vector short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009079{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009080#ifdef __LITTLE_ENDIAN__
9081 return __builtin_altivec_vupklsh(__a);
9082#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009083 return __builtin_altivec_vupkhsh(__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009084#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009085}
9086
Anton Yartsevfc83c602010-08-19 03:21:36 +00009087static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009088vec_unpackh(vector bool short __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009089{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009090#ifdef __LITTLE_ENDIAN__
9091 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
9092#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009093 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009094#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00009095}
9096
9097static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009098vec_unpackh(vector pixel __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009099{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009100#ifdef __LITTLE_ENDIAN__
9101 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
9102#else
9103 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
9104#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00009105}
9106
Bill Schmidt41e14c42015-05-16 01:02:25 +00009107#ifdef __POWER8_VECTOR__
9108static vector long long __ATTRS_o_ai
9109vec_unpackh(vector int __a)
9110{
9111#ifdef __LITTLE_ENDIAN__
9112 return __builtin_altivec_vupklsw(__a);
9113#else
9114 return __builtin_altivec_vupkhsw(__a);
9115#endif
9116}
9117
9118static vector bool long long __ATTRS_o_ai
9119vec_unpackh(vector bool int __a)
9120{
9121#ifdef __LITTLE_ENDIAN__
9122 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
9123#else
9124 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
9125#endif
9126}
9127#endif
9128
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009129/* vec_vupkhsb */
9130
Anton Yartsevfc83c602010-08-19 03:21:36 +00009131static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009132vec_vupkhsb(vector signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009133{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009134#ifdef __LITTLE_ENDIAN__
9135 return __builtin_altivec_vupklsb((vector char)__a);
9136#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009137 return __builtin_altivec_vupkhsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009138#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009139}
9140
Anton Yartsevfc83c602010-08-19 03:21:36 +00009141static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009142vec_vupkhsb(vector bool char __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009143{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009144#ifdef __LITTLE_ENDIAN__
9145 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
9146#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009147 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009148#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00009149}
9150
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009151/* vec_vupkhsh */
9152
Anton Yartsevfc83c602010-08-19 03:21:36 +00009153static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009154vec_vupkhsh(vector short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009155{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009156#ifdef __LITTLE_ENDIAN__
9157 return __builtin_altivec_vupklsh(__a);
9158#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009159 return __builtin_altivec_vupkhsh(__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009160#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009161}
9162
Anton Yartsevfc83c602010-08-19 03:21:36 +00009163static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009164vec_vupkhsh(vector bool short __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009165{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009166#ifdef __LITTLE_ENDIAN__
9167 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
9168#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009169 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009170#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00009171}
9172
9173static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009174vec_vupkhsh(vector pixel __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009175{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009176#ifdef __LITTLE_ENDIAN__
9177 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
9178#else
9179 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
9180#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00009181}
9182
Bill Schmidt41e14c42015-05-16 01:02:25 +00009183/* vec_vupkhsw */
9184
9185#ifdef __POWER8_VECTOR__
9186static vector long long __ATTRS_o_ai
9187vec_vupkhsw(vector int __a)
9188{
9189#ifdef __LITTLE_ENDIAN__
9190 return __builtin_altivec_vupklsw(__a);
9191#else
9192 return __builtin_altivec_vupkhsw(__a);
9193#endif
9194}
9195
9196static vector bool long long __ATTRS_o_ai
9197vec_vupkhsw(vector bool int __a)
9198{
9199#ifdef __LITTLE_ENDIAN__
9200 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
9201#else
9202 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
9203#endif
9204}
9205#endif
9206
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009207/* vec_unpackl */
9208
9209static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009210vec_unpackl(vector signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009211{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009212#ifdef __LITTLE_ENDIAN__
9213 return __builtin_altivec_vupkhsb((vector char)__a);
9214#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009215 return __builtin_altivec_vupklsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009216#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009217}
9218
Anton Yartsevfc83c602010-08-19 03:21:36 +00009219static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009220vec_unpackl(vector bool char __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009221{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009222#ifdef __LITTLE_ENDIAN__
9223 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
9224#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009225 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009226#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00009227}
9228
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009229static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009230vec_unpackl(vector short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009231{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009232#ifdef __LITTLE_ENDIAN__
9233 return __builtin_altivec_vupkhsh(__a);
9234#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009235 return __builtin_altivec_vupklsh(__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009236#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009237}
9238
Anton Yartsevfc83c602010-08-19 03:21:36 +00009239static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009240vec_unpackl(vector bool short __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009241{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009242#ifdef __LITTLE_ENDIAN__
9243 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
9244#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009245 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009246#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00009247}
9248
9249static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009250vec_unpackl(vector pixel __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009251{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009252#ifdef __LITTLE_ENDIAN__
9253 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
9254#else
9255 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
9256#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00009257}
9258
Bill Schmidt41e14c42015-05-16 01:02:25 +00009259#ifdef __POWER8_VECTOR__
9260static vector long long __ATTRS_o_ai
9261vec_unpackl(vector int __a)
9262{
9263#ifdef __LITTLE_ENDIAN__
9264 return __builtin_altivec_vupkhsw(__a);
9265#else
9266 return __builtin_altivec_vupklsw(__a);
9267#endif
9268}
9269
9270static vector bool long long __ATTRS_o_ai
9271vec_unpackl(vector bool int __a)
9272{
9273#ifdef __LITTLE_ENDIAN__
9274 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
9275#else
9276 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
9277#endif
9278}
9279#endif
9280
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009281/* vec_vupklsb */
9282
Anton Yartsevfc83c602010-08-19 03:21:36 +00009283static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009284vec_vupklsb(vector signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009285{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009286#ifdef __LITTLE_ENDIAN__
9287 return __builtin_altivec_vupkhsb((vector char)__a);
9288#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009289 return __builtin_altivec_vupklsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009290#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009291}
9292
Anton Yartsevfc83c602010-08-19 03:21:36 +00009293static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009294vec_vupklsb(vector bool char __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009295{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009296#ifdef __LITTLE_ENDIAN__
9297 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
9298#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009299 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009300#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00009301}
9302
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009303/* vec_vupklsh */
9304
Anton Yartsevfc83c602010-08-19 03:21:36 +00009305static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009306vec_vupklsh(vector short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009307{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009308#ifdef __LITTLE_ENDIAN__
9309 return __builtin_altivec_vupkhsh(__a);
9310#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009311 return __builtin_altivec_vupklsh(__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 int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009316vec_vupklsh(vector bool short __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009317{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009318#ifdef __LITTLE_ENDIAN__
9319 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
9320#else
David Blaikie3302f2b2013-01-16 23:08:36 +00009321 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009322#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00009323}
9324
9325static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009326vec_vupklsh(vector pixel __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009327{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00009328#ifdef __LITTLE_ENDIAN__
9329 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
9330#else
9331 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
9332#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00009333}
9334
Bill Schmidt41e14c42015-05-16 01:02:25 +00009335/* vec_vupklsw */
9336
9337#ifdef __POWER8_VECTOR__
9338static vector long long __ATTRS_o_ai
9339vec_vupklsw(vector int __a)
9340{
9341#ifdef __LITTLE_ENDIAN__
9342 return __builtin_altivec_vupkhsw(__a);
9343#else
9344 return __builtin_altivec_vupklsw(__a);
9345#endif
9346}
9347
9348static vector bool long long __ATTRS_o_ai
9349vec_vupklsw(vector bool int __a)
9350{
9351#ifdef __LITTLE_ENDIAN__
9352 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
9353#else
9354 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
9355#endif
9356}
9357#endif
9358
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00009359/* vec_vsx_ld */
9360
9361#ifdef __VSX__
9362
9363static vector signed int __ATTRS_o_ai
9364vec_vsx_ld(int __a, const vector signed int *__b)
9365{
9366 return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
9367}
9368
9369static vector unsigned int __ATTRS_o_ai
9370vec_vsx_ld(int __a, const vector unsigned int *__b)
9371{
9372 return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
9373}
9374
9375static vector float __ATTRS_o_ai
9376vec_vsx_ld(int __a, const vector float *__b)
9377{
9378 return (vector float)__builtin_vsx_lxvw4x(__a, __b);
9379}
9380
9381static vector signed long long __ATTRS_o_ai
9382vec_vsx_ld(int __a, const vector signed long long *__b)
9383{
9384 return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b);
9385}
9386
9387static vector unsigned long long __ATTRS_o_ai
9388vec_vsx_ld(int __a, const vector unsigned long long *__b)
9389{
9390 return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b);
9391}
9392
9393static vector double __ATTRS_o_ai
9394vec_vsx_ld(int __a, const vector double *__b)
9395{
9396 return (vector double)__builtin_vsx_lxvd2x(__a, __b);
9397}
9398
9399#endif
9400
9401/* vec_vsx_st */
9402
9403#ifdef __VSX__
9404
9405static void __ATTRS_o_ai
9406vec_vsx_st(vector signed int __a, int __b, vector signed int *__c)
9407{
9408 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
9409}
9410
9411static void __ATTRS_o_ai
9412vec_vsx_st(vector unsigned int __a, int __b, vector unsigned int *__c)
9413{
9414 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
9415}
9416
9417static void __ATTRS_o_ai
9418vec_vsx_st(vector float __a, int __b, vector float *__c)
9419{
9420 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
9421}
9422
9423static void __ATTRS_o_ai
9424vec_vsx_st(vector signed long long __a, int __b, vector signed long long *__c)
9425{
9426 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
9427}
9428
9429static void __ATTRS_o_ai
9430vec_vsx_st(vector unsigned long long __a, int __b,
9431 vector unsigned long long *__c)
9432{
9433 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
9434}
9435
9436static void __ATTRS_o_ai
9437vec_vsx_st(vector double __a, int __b, vector double *__c)
9438{
9439 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
9440}
9441
9442#endif
9443
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009444/* vec_xor */
9445
9446#define __builtin_altivec_vxor vec_xor
9447
9448static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009449vec_xor(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009450{
David Blaikie3302f2b2013-01-16 23:08:36 +00009451 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009452}
9453
Anton Yartsevfc83c602010-08-19 03:21:36 +00009454static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009455vec_xor(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009456{
David Blaikie3302f2b2013-01-16 23:08:36 +00009457 return (vector signed char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009458}
9459
9460static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009461vec_xor(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009462{
David Blaikie3302f2b2013-01-16 23:08:36 +00009463 return __a ^ (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009464}
9465
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009466static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009467vec_xor(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009468{
David Blaikie3302f2b2013-01-16 23:08:36 +00009469 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009470}
9471
Anton Yartsevfc83c602010-08-19 03:21:36 +00009472static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009473vec_xor(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009474{
David Blaikie3302f2b2013-01-16 23:08:36 +00009475 return (vector unsigned char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009476}
9477
9478static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009479vec_xor(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009480{
David Blaikie3302f2b2013-01-16 23:08:36 +00009481 return __a ^ (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009482}
9483
9484static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009485vec_xor(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009486{
David Blaikie3302f2b2013-01-16 23:08:36 +00009487 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009488}
9489
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009490static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009491vec_xor(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009492{
David Blaikie3302f2b2013-01-16 23:08:36 +00009493 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009494}
9495
Anton Yartsevfc83c602010-08-19 03:21:36 +00009496static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009497vec_xor(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009498{
David Blaikie3302f2b2013-01-16 23:08:36 +00009499 return (vector short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009500}
9501
9502static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009503vec_xor(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009504{
David Blaikie3302f2b2013-01-16 23:08:36 +00009505 return __a ^ (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009506}
9507
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009508static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009509vec_xor(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009510{
David Blaikie3302f2b2013-01-16 23:08:36 +00009511 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009512}
9513
Anton Yartsevfc83c602010-08-19 03:21:36 +00009514static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009515vec_xor(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009516{
David Blaikie3302f2b2013-01-16 23:08:36 +00009517 return (vector unsigned short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009518}
9519
9520static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009521vec_xor(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009522{
David Blaikie3302f2b2013-01-16 23:08:36 +00009523 return __a ^ (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009524}
9525
9526static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009527vec_xor(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009528{
David Blaikie3302f2b2013-01-16 23:08:36 +00009529 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009530}
9531
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009532static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009533vec_xor(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009534{
David Blaikie3302f2b2013-01-16 23:08:36 +00009535 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009536}
9537
Anton Yartsevfc83c602010-08-19 03:21:36 +00009538static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009539vec_xor(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009540{
David Blaikie3302f2b2013-01-16 23:08:36 +00009541 return (vector int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009542}
9543
9544static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009545vec_xor(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009546{
David Blaikie3302f2b2013-01-16 23:08:36 +00009547 return __a ^ (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009548}
9549
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009550static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009551vec_xor(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009552{
David Blaikie3302f2b2013-01-16 23:08:36 +00009553 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009554}
9555
Anton Yartsevfc83c602010-08-19 03:21:36 +00009556static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009557vec_xor(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009558{
David Blaikie3302f2b2013-01-16 23:08:36 +00009559 return (vector unsigned int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009560}
9561
9562static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009563vec_xor(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009564{
David Blaikie3302f2b2013-01-16 23:08:36 +00009565 return __a ^ (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009566}
9567
9568static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009569vec_xor(vector bool int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009570{
David Blaikie3302f2b2013-01-16 23:08:36 +00009571 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009572}
9573
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009574static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009575vec_xor(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009576{
David Blaikie3302f2b2013-01-16 23:08:36 +00009577 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
9578 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009579}
9580
Anton Yartsevfc83c602010-08-19 03:21:36 +00009581static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009582vec_xor(vector bool int __a, vector float __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009583{
David Blaikie3302f2b2013-01-16 23:08:36 +00009584 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
9585 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009586}
9587
9588static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009589vec_xor(vector float __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009590{
David Blaikie3302f2b2013-01-16 23:08:36 +00009591 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
9592 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009593}
9594
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009595/* vec_vxor */
9596
9597static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009598vec_vxor(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009599{
David Blaikie3302f2b2013-01-16 23:08:36 +00009600 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009601}
9602
Anton Yartsevfc83c602010-08-19 03:21:36 +00009603static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009604vec_vxor(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009605{
David Blaikie3302f2b2013-01-16 23:08:36 +00009606 return (vector signed char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009607}
9608
9609static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009610vec_vxor(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009611{
David Blaikie3302f2b2013-01-16 23:08:36 +00009612 return __a ^ (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009613}
9614
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009615static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009616vec_vxor(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009617{
David Blaikie3302f2b2013-01-16 23:08:36 +00009618 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009619}
9620
Anton Yartsevfc83c602010-08-19 03:21:36 +00009621static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009622vec_vxor(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009623{
David Blaikie3302f2b2013-01-16 23:08:36 +00009624 return (vector unsigned char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009625}
9626
9627static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009628vec_vxor(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009629{
David Blaikie3302f2b2013-01-16 23:08:36 +00009630 return __a ^ (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009631}
9632
9633static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009634vec_vxor(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009635{
David Blaikie3302f2b2013-01-16 23:08:36 +00009636 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009637}
9638
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009639static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009640vec_vxor(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009641{
David Blaikie3302f2b2013-01-16 23:08:36 +00009642 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009643}
9644
Anton Yartsevfc83c602010-08-19 03:21:36 +00009645static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009646vec_vxor(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009647{
David Blaikie3302f2b2013-01-16 23:08:36 +00009648 return (vector short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009649}
9650
9651static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009652vec_vxor(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009653{
David Blaikie3302f2b2013-01-16 23:08:36 +00009654 return __a ^ (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009655}
9656
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009657static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009658vec_vxor(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009659{
David Blaikie3302f2b2013-01-16 23:08:36 +00009660 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009661}
9662
Anton Yartsevfc83c602010-08-19 03:21:36 +00009663static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009664vec_vxor(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009665{
David Blaikie3302f2b2013-01-16 23:08:36 +00009666 return (vector unsigned short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009667}
9668
9669static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009670vec_vxor(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009671{
David Blaikie3302f2b2013-01-16 23:08:36 +00009672 return __a ^ (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009673}
9674
9675static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009676vec_vxor(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009677{
David Blaikie3302f2b2013-01-16 23:08:36 +00009678 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009679}
9680
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009681static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009682vec_vxor(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009683{
David Blaikie3302f2b2013-01-16 23:08:36 +00009684 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009685}
9686
Anton Yartsevfc83c602010-08-19 03:21:36 +00009687static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009688vec_vxor(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009689{
David Blaikie3302f2b2013-01-16 23:08:36 +00009690 return (vector int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009691}
9692
9693static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009694vec_vxor(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009695{
David Blaikie3302f2b2013-01-16 23:08:36 +00009696 return __a ^ (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009697}
9698
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009699static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009700vec_vxor(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009701{
David Blaikie3302f2b2013-01-16 23:08:36 +00009702 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009703}
9704
Anton Yartsevfc83c602010-08-19 03:21:36 +00009705static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009706vec_vxor(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009707{
David Blaikie3302f2b2013-01-16 23:08:36 +00009708 return (vector unsigned int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009709}
9710
9711static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009712vec_vxor(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009713{
David Blaikie3302f2b2013-01-16 23:08:36 +00009714 return __a ^ (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009715}
9716
9717static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009718vec_vxor(vector bool int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009719{
David Blaikie3302f2b2013-01-16 23:08:36 +00009720 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009721}
9722
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009723static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009724vec_vxor(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009725{
David Blaikie3302f2b2013-01-16 23:08:36 +00009726 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
9727 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009728}
Chris Lattnerdad40622010-04-14 03:54:58 +00009729
Anton Yartsevfc83c602010-08-19 03:21:36 +00009730static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009731vec_vxor(vector bool int __a, vector float __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009732{
David Blaikie3302f2b2013-01-16 23:08:36 +00009733 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
9734 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009735}
9736
9737static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009738vec_vxor(vector float __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009739{
David Blaikie3302f2b2013-01-16 23:08:36 +00009740 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
9741 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009742}
9743
Anton Yartsev79d6af32010-09-18 00:39:16 +00009744/* ------------------------ extensions for CBEA ----------------------------- */
Anton Yartsev73d40232010-10-14 14:37:46 +00009745
9746/* vec_extract */
9747
9748static signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009749vec_extract(vector signed char __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009750{
David Blaikie3302f2b2013-01-16 23:08:36 +00009751 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009752}
9753
9754static unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009755vec_extract(vector unsigned char __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009756{
David Blaikie3302f2b2013-01-16 23:08:36 +00009757 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009758}
9759
9760static short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009761vec_extract(vector short __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009762{
David Blaikie3302f2b2013-01-16 23:08:36 +00009763 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009764}
9765
9766static unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009767vec_extract(vector unsigned short __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009768{
David Blaikie3302f2b2013-01-16 23:08:36 +00009769 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009770}
9771
9772static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009773vec_extract(vector int __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009774{
David Blaikie3302f2b2013-01-16 23:08:36 +00009775 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009776}
9777
9778static unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009779vec_extract(vector unsigned int __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009780{
David Blaikie3302f2b2013-01-16 23:08:36 +00009781 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009782}
9783
9784static float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009785vec_extract(vector float __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009786{
David Blaikie3302f2b2013-01-16 23:08:36 +00009787 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009788}
9789
9790/* vec_insert */
9791
9792static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009793vec_insert(signed char __a, vector signed char __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009794{
David Blaikie3302f2b2013-01-16 23:08:36 +00009795 __b[__c] = __a;
9796 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009797}
9798
9799static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009800vec_insert(unsigned char __a, vector unsigned char __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009801{
David Blaikie3302f2b2013-01-16 23:08:36 +00009802 __b[__c] = __a;
9803 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009804}
9805
9806static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009807vec_insert(short __a, vector short __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009808{
David Blaikie3302f2b2013-01-16 23:08:36 +00009809 __b[__c] = __a;
9810 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009811}
9812
9813static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009814vec_insert(unsigned short __a, vector unsigned short __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009815{
David Blaikie3302f2b2013-01-16 23:08:36 +00009816 __b[__c] = __a;
9817 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009818}
9819
9820static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009821vec_insert(int __a, vector int __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009822{
David Blaikie3302f2b2013-01-16 23:08:36 +00009823 __b[__c] = __a;
9824 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009825}
9826
9827static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009828vec_insert(unsigned int __a, vector unsigned int __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009829{
David Blaikie3302f2b2013-01-16 23:08:36 +00009830 __b[__c] = __a;
9831 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009832}
9833
9834static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009835vec_insert(float __a, vector float __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009836{
David Blaikie3302f2b2013-01-16 23:08:36 +00009837 __b[__c] = __a;
9838 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009839}
9840
9841/* vec_lvlx */
9842
9843static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009844vec_lvlx(int __a, const signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009845{
David Blaikie3302f2b2013-01-16 23:08:36 +00009846 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009847 (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009848 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009849}
9850
9851static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009852vec_lvlx(int __a, const vector signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009853{
David Blaikie3302f2b2013-01-16 23:08:36 +00009854 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009855 (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009856 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009857}
9858
9859static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009860vec_lvlx(int __a, const unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009861{
David Blaikie3302f2b2013-01-16 23:08:36 +00009862 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009863 (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009864 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009865}
9866
9867static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009868vec_lvlx(int __a, const vector unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009869{
David Blaikie3302f2b2013-01-16 23:08:36 +00009870 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009871 (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009872 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009873}
9874
9875static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009876vec_lvlx(int __a, const vector bool char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009877{
David Blaikie3302f2b2013-01-16 23:08:36 +00009878 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009879 (vector bool char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009880 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009881}
9882
9883static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009884vec_lvlx(int __a, const short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009885{
David Blaikie3302f2b2013-01-16 23:08:36 +00009886 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009887 (vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009888 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009889}
9890
9891static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009892vec_lvlx(int __a, const vector short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009893{
David Blaikie3302f2b2013-01-16 23:08:36 +00009894 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009895 (vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009896 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009897}
9898
9899static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009900vec_lvlx(int __a, const unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009901{
David Blaikie3302f2b2013-01-16 23:08:36 +00009902 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009903 (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009904 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009905}
9906
9907static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009908vec_lvlx(int __a, const vector unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009909{
David Blaikie3302f2b2013-01-16 23:08:36 +00009910 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009911 (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009912 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009913}
9914
9915static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009916vec_lvlx(int __a, const vector bool short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009917{
David Blaikie3302f2b2013-01-16 23:08:36 +00009918 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009919 (vector bool short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009920 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009921}
9922
9923static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009924vec_lvlx(int __a, const vector pixel *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009925{
David Blaikie3302f2b2013-01-16 23:08:36 +00009926 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009927 (vector pixel)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009928 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009929}
9930
9931static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009932vec_lvlx(int __a, const int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009933{
David Blaikie3302f2b2013-01-16 23:08:36 +00009934 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009935 (vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009936 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009937}
9938
9939static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009940vec_lvlx(int __a, const vector int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009941{
David Blaikie3302f2b2013-01-16 23:08:36 +00009942 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009943 (vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009944 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009945}
9946
9947static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009948vec_lvlx(int __a, const unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009949{
David Blaikie3302f2b2013-01-16 23:08:36 +00009950 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009951 (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009952 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009953}
9954
9955static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009956vec_lvlx(int __a, const vector unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009957{
David Blaikie3302f2b2013-01-16 23:08:36 +00009958 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009959 (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009960 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009961}
9962
9963static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009964vec_lvlx(int __a, const vector bool int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009965{
David Blaikie3302f2b2013-01-16 23:08:36 +00009966 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009967 (vector bool int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009968 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009969}
9970
9971static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009972vec_lvlx(int __a, const float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009973{
David Blaikie3302f2b2013-01-16 23:08:36 +00009974 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009975 (vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009976 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009977}
9978
9979static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009980vec_lvlx(int __a, const vector float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009981{
David Blaikie3302f2b2013-01-16 23:08:36 +00009982 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009983 (vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009984 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009985}
9986
9987/* vec_lvlxl */
9988
9989static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009990vec_lvlxl(int __a, const signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009991{
David Blaikie3302f2b2013-01-16 23:08:36 +00009992 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009993 (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009994 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009995}
9996
9997static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009998vec_lvlxl(int __a, const vector signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009999{
David Blaikie3302f2b2013-01-16 23:08:36 +000010000 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010001 (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010002 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010003}
10004
10005static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010006vec_lvlxl(int __a, const unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010007{
David Blaikie3302f2b2013-01-16 23:08:36 +000010008 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010009 (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010010 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010011}
10012
10013static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010014vec_lvlxl(int __a, const vector unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010015{
David Blaikie3302f2b2013-01-16 23:08:36 +000010016 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010017 (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010018 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010019}
10020
10021static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010022vec_lvlxl(int __a, const vector bool char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010023{
David Blaikie3302f2b2013-01-16 23:08:36 +000010024 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010025 (vector bool char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010026 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010027}
10028
10029static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010030vec_lvlxl(int __a, const short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010031{
David Blaikie3302f2b2013-01-16 23:08:36 +000010032 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010033 (vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010034 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010035}
10036
10037static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010038vec_lvlxl(int __a, const vector short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010039{
David Blaikie3302f2b2013-01-16 23:08:36 +000010040 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010041 (vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010042 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010043}
10044
10045static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010046vec_lvlxl(int __a, const unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010047{
David Blaikie3302f2b2013-01-16 23:08:36 +000010048 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010049 (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010050 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010051}
10052
10053static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010054vec_lvlxl(int __a, const vector unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010055{
David Blaikie3302f2b2013-01-16 23:08:36 +000010056 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010057 (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010058 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010059}
10060
10061static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010062vec_lvlxl(int __a, const vector bool short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010063{
David Blaikie3302f2b2013-01-16 23:08:36 +000010064 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010065 (vector bool short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010066 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010067}
10068
10069static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010070vec_lvlxl(int __a, const vector pixel *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010071{
David Blaikie3302f2b2013-01-16 23:08:36 +000010072 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010073 (vector pixel)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010074 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010075}
10076
10077static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010078vec_lvlxl(int __a, const int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010079{
David Blaikie3302f2b2013-01-16 23:08:36 +000010080 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010081 (vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010082 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010083}
10084
10085static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010086vec_lvlxl(int __a, const vector int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010087{
David Blaikie3302f2b2013-01-16 23:08:36 +000010088 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010089 (vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010090 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010091}
10092
10093static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010094vec_lvlxl(int __a, const unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010095{
David Blaikie3302f2b2013-01-16 23:08:36 +000010096 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010097 (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010098 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010099}
10100
10101static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010102vec_lvlxl(int __a, const vector unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010103{
David Blaikie3302f2b2013-01-16 23:08:36 +000010104 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010105 (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010106 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010107}
10108
10109static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010110vec_lvlxl(int __a, const vector bool int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010111{
David Blaikie3302f2b2013-01-16 23:08:36 +000010112 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010113 (vector bool int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010114 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010115}
10116
10117static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010118vec_lvlxl(int __a, const float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010119{
David Blaikie3302f2b2013-01-16 23:08:36 +000010120 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010121 (vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010122 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010123}
10124
10125static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010126vec_lvlxl(int __a, vector float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010127{
David Blaikie3302f2b2013-01-16 23:08:36 +000010128 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +000010129 (vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010130 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010131}
10132
10133/* vec_lvrx */
10134
10135static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010136vec_lvrx(int __a, const signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010137{
10138 return vec_perm((vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010139 vec_ld(__a, __b),
10140 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010141}
10142
10143static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010144vec_lvrx(int __a, const vector signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010145{
10146 return vec_perm((vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010147 vec_ld(__a, __b),
10148 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010149}
10150
10151static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010152vec_lvrx(int __a, const unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010153{
10154 return vec_perm((vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010155 vec_ld(__a, __b),
10156 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010157}
10158
10159static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010160vec_lvrx(int __a, const vector unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010161{
10162 return vec_perm((vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010163 vec_ld(__a, __b),
10164 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010165}
10166
10167static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010168vec_lvrx(int __a, const vector bool char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010169{
10170 return vec_perm((vector bool char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010171 vec_ld(__a, __b),
10172 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010173}
10174
10175static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010176vec_lvrx(int __a, const short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010177{
10178 return vec_perm((vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010179 vec_ld(__a, __b),
10180 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010181}
10182
10183static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010184vec_lvrx(int __a, const vector short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010185{
10186 return vec_perm((vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010187 vec_ld(__a, __b),
10188 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010189}
10190
10191static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010192vec_lvrx(int __a, const unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010193{
10194 return vec_perm((vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010195 vec_ld(__a, __b),
10196 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010197}
10198
10199static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010200vec_lvrx(int __a, const vector unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010201{
10202 return vec_perm((vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010203 vec_ld(__a, __b),
10204 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010205}
10206
10207static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010208vec_lvrx(int __a, const vector bool short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010209{
10210 return vec_perm((vector bool short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010211 vec_ld(__a, __b),
10212 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010213}
10214
10215static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010216vec_lvrx(int __a, const vector pixel *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010217{
10218 return vec_perm((vector pixel)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010219 vec_ld(__a, __b),
10220 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010221}
10222
10223static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010224vec_lvrx(int __a, const int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010225{
10226 return vec_perm((vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010227 vec_ld(__a, __b),
10228 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010229}
10230
10231static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010232vec_lvrx(int __a, const vector int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010233{
10234 return vec_perm((vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010235 vec_ld(__a, __b),
10236 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010237}
10238
10239static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010240vec_lvrx(int __a, const unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010241{
10242 return vec_perm((vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010243 vec_ld(__a, __b),
10244 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010245}
10246
10247static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010248vec_lvrx(int __a, const vector unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010249{
10250 return vec_perm((vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010251 vec_ld(__a, __b),
10252 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010253}
10254
10255static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010256vec_lvrx(int __a, const vector bool int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010257{
10258 return vec_perm((vector bool int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010259 vec_ld(__a, __b),
10260 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010261}
10262
10263static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010264vec_lvrx(int __a, const float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010265{
10266 return vec_perm((vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010267 vec_ld(__a, __b),
10268 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010269}
10270
10271static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010272vec_lvrx(int __a, const vector float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010273{
10274 return vec_perm((vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010275 vec_ld(__a, __b),
10276 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010277}
10278
10279/* vec_lvrxl */
10280
10281static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010282vec_lvrxl(int __a, const signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010283{
10284 return vec_perm((vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010285 vec_ldl(__a, __b),
10286 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010287}
10288
10289static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010290vec_lvrxl(int __a, const vector signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010291{
10292 return vec_perm((vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010293 vec_ldl(__a, __b),
10294 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010295}
10296
10297static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010298vec_lvrxl(int __a, const unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010299{
10300 return vec_perm((vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010301 vec_ldl(__a, __b),
10302 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010303}
10304
10305static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010306vec_lvrxl(int __a, const vector unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010307{
10308 return vec_perm((vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010309 vec_ldl(__a, __b),
10310 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010311}
10312
10313static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010314vec_lvrxl(int __a, const vector bool char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010315{
10316 return vec_perm((vector bool char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010317 vec_ldl(__a, __b),
10318 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010319}
10320
10321static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010322vec_lvrxl(int __a, const short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010323{
10324 return vec_perm((vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010325 vec_ldl(__a, __b),
10326 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010327}
10328
10329static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010330vec_lvrxl(int __a, const vector short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010331{
10332 return vec_perm((vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010333 vec_ldl(__a, __b),
10334 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010335}
10336
10337static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010338vec_lvrxl(int __a, const unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010339{
10340 return vec_perm((vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010341 vec_ldl(__a, __b),
10342 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010343}
10344
10345static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010346vec_lvrxl(int __a, const vector unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010347{
10348 return vec_perm((vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010349 vec_ldl(__a, __b),
10350 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010351}
10352
10353static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010354vec_lvrxl(int __a, const vector bool short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010355{
10356 return vec_perm((vector bool short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010357 vec_ldl(__a, __b),
10358 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010359}
10360
10361static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010362vec_lvrxl(int __a, const vector pixel *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010363{
10364 return vec_perm((vector pixel)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010365 vec_ldl(__a, __b),
10366 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010367}
10368
10369static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010370vec_lvrxl(int __a, const int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010371{
10372 return vec_perm((vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010373 vec_ldl(__a, __b),
10374 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010375}
10376
10377static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010378vec_lvrxl(int __a, const vector int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010379{
10380 return vec_perm((vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010381 vec_ldl(__a, __b),
10382 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010383}
10384
10385static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010386vec_lvrxl(int __a, const unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010387{
10388 return vec_perm((vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010389 vec_ldl(__a, __b),
10390 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010391}
10392
10393static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010394vec_lvrxl(int __a, const vector unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010395{
10396 return vec_perm((vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010397 vec_ldl(__a, __b),
10398 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010399}
10400
10401static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010402vec_lvrxl(int __a, const vector bool int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010403{
10404 return vec_perm((vector bool int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010405 vec_ldl(__a, __b),
10406 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010407}
10408
10409static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010410vec_lvrxl(int __a, const float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010411{
10412 return vec_perm((vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010413 vec_ldl(__a, __b),
10414 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010415}
10416
10417static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010418vec_lvrxl(int __a, const vector float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010419{
10420 return vec_perm((vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010421 vec_ldl(__a, __b),
10422 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010423}
10424
10425/* vec_stvlx */
10426
10427static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010428vec_stvlx(vector signed char __a, int __b, signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010429{
David Blaikie3302f2b2013-01-16 23:08:36 +000010430 return vec_st(vec_perm(vec_lvrx(__b, __c),
10431 __a,
10432 vec_lvsr(__b, __c)),
10433 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010434}
10435
10436static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010437vec_stvlx(vector signed char __a, int __b, vector signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010438{
David Blaikie3302f2b2013-01-16 23:08:36 +000010439 return vec_st(vec_perm(vec_lvrx(__b, __c),
10440 __a,
10441 vec_lvsr(__b, (unsigned char *)__c)),
10442 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010443}
10444
10445static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010446vec_stvlx(vector unsigned char __a, int __b, unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010447{
David Blaikie3302f2b2013-01-16 23:08:36 +000010448 return vec_st(vec_perm(vec_lvrx(__b, __c),
10449 __a,
10450 vec_lvsr(__b, __c)),
10451 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010452}
10453
10454static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010455vec_stvlx(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010456{
David Blaikie3302f2b2013-01-16 23:08:36 +000010457 return vec_st(vec_perm(vec_lvrx(__b, __c),
10458 __a,
10459 vec_lvsr(__b, (unsigned char *)__c)),
10460 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010461}
10462
10463static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010464vec_stvlx(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010465{
David Blaikie3302f2b2013-01-16 23:08:36 +000010466 return vec_st(vec_perm(vec_lvrx(__b, __c),
10467 __a,
10468 vec_lvsr(__b, (unsigned char *)__c)),
10469 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010470}
10471
10472static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010473vec_stvlx(vector short __a, int __b, short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010474{
David Blaikie3302f2b2013-01-16 23:08:36 +000010475 return vec_st(vec_perm(vec_lvrx(__b, __c),
10476 __a,
10477 vec_lvsr(__b, __c)),
10478 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010479}
10480
10481static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010482vec_stvlx(vector short __a, int __b, vector short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010483{
David Blaikie3302f2b2013-01-16 23:08:36 +000010484 return vec_st(vec_perm(vec_lvrx(__b, __c),
10485 __a,
10486 vec_lvsr(__b, (unsigned char *)__c)),
10487 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010488}
10489
10490static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010491vec_stvlx(vector unsigned short __a, int __b, unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010492{
David Blaikie3302f2b2013-01-16 23:08:36 +000010493 return vec_st(vec_perm(vec_lvrx(__b, __c),
10494 __a,
10495 vec_lvsr(__b, __c)),
10496 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010497}
10498
10499static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010500vec_stvlx(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010501{
David Blaikie3302f2b2013-01-16 23:08:36 +000010502 return vec_st(vec_perm(vec_lvrx(__b, __c),
10503 __a,
10504 vec_lvsr(__b, (unsigned char *)__c)),
10505 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010506}
10507
10508static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010509vec_stvlx(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010510{
David Blaikie3302f2b2013-01-16 23:08:36 +000010511 return vec_st(vec_perm(vec_lvrx(__b, __c),
10512 __a,
10513 vec_lvsr(__b, (unsigned char *)__c)),
10514 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010515}
10516
10517static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010518vec_stvlx(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010519{
David Blaikie3302f2b2013-01-16 23:08:36 +000010520 return vec_st(vec_perm(vec_lvrx(__b, __c),
10521 __a,
10522 vec_lvsr(__b, (unsigned char *)__c)),
10523 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010524}
10525
10526static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010527vec_stvlx(vector int __a, int __b, int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010528{
David Blaikie3302f2b2013-01-16 23:08:36 +000010529 return vec_st(vec_perm(vec_lvrx(__b, __c),
10530 __a,
10531 vec_lvsr(__b, __c)),
10532 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010533}
10534
10535static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010536vec_stvlx(vector int __a, int __b, vector int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010537{
David Blaikie3302f2b2013-01-16 23:08:36 +000010538 return vec_st(vec_perm(vec_lvrx(__b, __c),
10539 __a,
10540 vec_lvsr(__b, (unsigned char *)__c)),
10541 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010542}
10543
10544static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010545vec_stvlx(vector unsigned int __a, int __b, unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010546{
David Blaikie3302f2b2013-01-16 23:08:36 +000010547 return vec_st(vec_perm(vec_lvrx(__b, __c),
10548 __a,
10549 vec_lvsr(__b, __c)),
10550 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010551}
10552
10553static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010554vec_stvlx(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010555{
David Blaikie3302f2b2013-01-16 23:08:36 +000010556 return vec_st(vec_perm(vec_lvrx(__b, __c),
10557 __a,
10558 vec_lvsr(__b, (unsigned char *)__c)),
10559 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010560}
10561
10562static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010563vec_stvlx(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010564{
David Blaikie3302f2b2013-01-16 23:08:36 +000010565 return vec_st(vec_perm(vec_lvrx(__b, __c),
10566 __a,
10567 vec_lvsr(__b, (unsigned char *)__c)),
10568 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010569}
10570
10571static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010572vec_stvlx(vector float __a, int __b, vector float *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010573{
David Blaikie3302f2b2013-01-16 23:08:36 +000010574 return vec_st(vec_perm(vec_lvrx(__b, __c),
10575 __a,
10576 vec_lvsr(__b, (unsigned char *)__c)),
10577 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010578}
10579
10580/* vec_stvlxl */
10581
10582static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010583vec_stvlxl(vector signed char __a, int __b, signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010584{
David Blaikie3302f2b2013-01-16 23:08:36 +000010585 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10586 __a,
10587 vec_lvsr(__b, __c)),
10588 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010589}
10590
10591static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010592vec_stvlxl(vector signed char __a, int __b, vector signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010593{
David Blaikie3302f2b2013-01-16 23:08:36 +000010594 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10595 __a,
10596 vec_lvsr(__b, (unsigned char *)__c)),
10597 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010598}
10599
10600static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010601vec_stvlxl(vector unsigned char __a, int __b, unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010602{
David Blaikie3302f2b2013-01-16 23:08:36 +000010603 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10604 __a,
10605 vec_lvsr(__b, __c)),
10606 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010607}
10608
10609static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010610vec_stvlxl(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010611{
David Blaikie3302f2b2013-01-16 23:08:36 +000010612 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10613 __a,
10614 vec_lvsr(__b, (unsigned char *)__c)),
10615 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010616}
10617
10618static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010619vec_stvlxl(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010620{
David Blaikie3302f2b2013-01-16 23:08:36 +000010621 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10622 __a,
10623 vec_lvsr(__b, (unsigned char *)__c)),
10624 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010625}
10626
10627static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010628vec_stvlxl(vector short __a, int __b, short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010629{
David Blaikie3302f2b2013-01-16 23:08:36 +000010630 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10631 __a,
10632 vec_lvsr(__b, __c)),
10633 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010634}
10635
10636static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010637vec_stvlxl(vector short __a, int __b, vector short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010638{
David Blaikie3302f2b2013-01-16 23:08:36 +000010639 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10640 __a,
10641 vec_lvsr(__b, (unsigned char *)__c)),
10642 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010643}
10644
10645static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010646vec_stvlxl(vector unsigned short __a, int __b, unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010647{
David Blaikie3302f2b2013-01-16 23:08:36 +000010648 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10649 __a,
10650 vec_lvsr(__b, __c)),
10651 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010652}
10653
10654static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010655vec_stvlxl(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010656{
David Blaikie3302f2b2013-01-16 23:08:36 +000010657 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10658 __a,
10659 vec_lvsr(__b, (unsigned char *)__c)),
10660 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010661}
10662
10663static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010664vec_stvlxl(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010665{
David Blaikie3302f2b2013-01-16 23:08:36 +000010666 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10667 __a,
10668 vec_lvsr(__b, (unsigned char *)__c)),
10669 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010670}
10671
10672static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010673vec_stvlxl(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010674{
David Blaikie3302f2b2013-01-16 23:08:36 +000010675 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10676 __a,
10677 vec_lvsr(__b, (unsigned char *)__c)),
10678 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010679}
10680
10681static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010682vec_stvlxl(vector int __a, int __b, int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010683{
David Blaikie3302f2b2013-01-16 23:08:36 +000010684 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10685 __a,
10686 vec_lvsr(__b, __c)),
10687 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010688}
10689
10690static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010691vec_stvlxl(vector int __a, int __b, vector int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010692{
David Blaikie3302f2b2013-01-16 23:08:36 +000010693 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10694 __a,
10695 vec_lvsr(__b, (unsigned char *)__c)),
10696 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010697}
10698
10699static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010700vec_stvlxl(vector unsigned int __a, int __b, unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010701{
David Blaikie3302f2b2013-01-16 23:08:36 +000010702 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10703 __a,
10704 vec_lvsr(__b, __c)),
10705 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010706}
10707
10708static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010709vec_stvlxl(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010710{
David Blaikie3302f2b2013-01-16 23:08:36 +000010711 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10712 __a,
10713 vec_lvsr(__b, (unsigned char *)__c)),
10714 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010715}
10716
10717static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010718vec_stvlxl(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010719{
David Blaikie3302f2b2013-01-16 23:08:36 +000010720 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10721 __a,
10722 vec_lvsr(__b, (unsigned char *)__c)),
10723 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010724}
10725
10726static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010727vec_stvlxl(vector float __a, int __b, vector float *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010728{
David Blaikie3302f2b2013-01-16 23:08:36 +000010729 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10730 __a,
10731 vec_lvsr(__b, (unsigned char *)__c)),
10732 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010733}
10734
10735/* vec_stvrx */
10736
10737static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010738vec_stvrx(vector signed char __a, int __b, signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010739{
David Blaikie3302f2b2013-01-16 23:08:36 +000010740 return vec_st(vec_perm(__a,
10741 vec_lvlx(__b, __c),
10742 vec_lvsr(__b, __c)),
10743 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010744}
10745
10746static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010747vec_stvrx(vector signed char __a, int __b, vector signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010748{
David Blaikie3302f2b2013-01-16 23:08:36 +000010749 return vec_st(vec_perm(__a,
10750 vec_lvlx(__b, __c),
10751 vec_lvsr(__b, (unsigned char *)__c)),
10752 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010753}
10754
10755static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010756vec_stvrx(vector unsigned char __a, int __b, unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010757{
David Blaikie3302f2b2013-01-16 23:08:36 +000010758 return vec_st(vec_perm(__a,
10759 vec_lvlx(__b, __c),
10760 vec_lvsr(__b, __c)),
10761 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010762}
10763
10764static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010765vec_stvrx(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010766{
David Blaikie3302f2b2013-01-16 23:08:36 +000010767 return vec_st(vec_perm(__a,
10768 vec_lvlx(__b, __c),
10769 vec_lvsr(__b, (unsigned char *)__c)),
10770 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010771}
10772
10773static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010774vec_stvrx(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010775{
David Blaikie3302f2b2013-01-16 23:08:36 +000010776 return vec_st(vec_perm(__a,
10777 vec_lvlx(__b, __c),
10778 vec_lvsr(__b, (unsigned char *)__c)),
10779 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010780}
10781
10782static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010783vec_stvrx(vector short __a, int __b, short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010784{
David Blaikie3302f2b2013-01-16 23:08:36 +000010785 return vec_st(vec_perm(__a,
10786 vec_lvlx(__b, __c),
10787 vec_lvsr(__b, __c)),
10788 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010789}
10790
10791static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010792vec_stvrx(vector short __a, int __b, vector short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010793{
David Blaikie3302f2b2013-01-16 23:08:36 +000010794 return vec_st(vec_perm(__a,
10795 vec_lvlx(__b, __c),
10796 vec_lvsr(__b, (unsigned char *)__c)),
10797 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010798}
10799
10800static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010801vec_stvrx(vector unsigned short __a, int __b, unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010802{
David Blaikie3302f2b2013-01-16 23:08:36 +000010803 return vec_st(vec_perm(__a,
10804 vec_lvlx(__b, __c),
10805 vec_lvsr(__b, __c)),
10806 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010807}
10808
10809static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010810vec_stvrx(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010811{
David Blaikie3302f2b2013-01-16 23:08:36 +000010812 return vec_st(vec_perm(__a,
10813 vec_lvlx(__b, __c),
10814 vec_lvsr(__b, (unsigned char *)__c)),
10815 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010816}
10817
10818static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010819vec_stvrx(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010820{
David Blaikie3302f2b2013-01-16 23:08:36 +000010821 return vec_st(vec_perm(__a,
10822 vec_lvlx(__b, __c),
10823 vec_lvsr(__b, (unsigned char *)__c)),
10824 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010825}
10826
10827static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010828vec_stvrx(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010829{
David Blaikie3302f2b2013-01-16 23:08:36 +000010830 return vec_st(vec_perm(__a,
10831 vec_lvlx(__b, __c),
10832 vec_lvsr(__b, (unsigned char *)__c)),
10833 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010834}
10835
10836static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010837vec_stvrx(vector int __a, int __b, int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010838{
David Blaikie3302f2b2013-01-16 23:08:36 +000010839 return vec_st(vec_perm(__a,
10840 vec_lvlx(__b, __c),
10841 vec_lvsr(__b, __c)),
10842 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010843}
10844
10845static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010846vec_stvrx(vector int __a, int __b, vector int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010847{
David Blaikie3302f2b2013-01-16 23:08:36 +000010848 return vec_st(vec_perm(__a,
10849 vec_lvlx(__b, __c),
10850 vec_lvsr(__b, (unsigned char *)__c)),
10851 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010852}
10853
10854static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010855vec_stvrx(vector unsigned int __a, int __b, unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010856{
David Blaikie3302f2b2013-01-16 23:08:36 +000010857 return vec_st(vec_perm(__a,
10858 vec_lvlx(__b, __c),
10859 vec_lvsr(__b, __c)),
10860 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010861}
10862
10863static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010864vec_stvrx(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010865{
David Blaikie3302f2b2013-01-16 23:08:36 +000010866 return vec_st(vec_perm(__a,
10867 vec_lvlx(__b, __c),
10868 vec_lvsr(__b, (unsigned char *)__c)),
10869 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010870}
10871
10872static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010873vec_stvrx(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010874{
David Blaikie3302f2b2013-01-16 23:08:36 +000010875 return vec_st(vec_perm(__a,
10876 vec_lvlx(__b, __c),
10877 vec_lvsr(__b, (unsigned char *)__c)),
10878 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010879}
10880
10881static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010882vec_stvrx(vector float __a, int __b, vector float *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010883{
David Blaikie3302f2b2013-01-16 23:08:36 +000010884 return vec_st(vec_perm(__a,
10885 vec_lvlx(__b, __c),
10886 vec_lvsr(__b, (unsigned char *)__c)),
10887 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010888}
10889
10890/* vec_stvrxl */
10891
10892static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010893vec_stvrxl(vector signed char __a, int __b, signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010894{
David Blaikie3302f2b2013-01-16 23:08:36 +000010895 return vec_stl(vec_perm(__a,
10896 vec_lvlx(__b, __c),
10897 vec_lvsr(__b, __c)),
10898 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010899}
10900
10901static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010902vec_stvrxl(vector signed char __a, int __b, vector signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010903{
David Blaikie3302f2b2013-01-16 23:08:36 +000010904 return vec_stl(vec_perm(__a,
10905 vec_lvlx(__b, __c),
10906 vec_lvsr(__b, (unsigned char *)__c)),
10907 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010908}
10909
10910static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010911vec_stvrxl(vector unsigned char __a, int __b, unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010912{
David Blaikie3302f2b2013-01-16 23:08:36 +000010913 return vec_stl(vec_perm(__a,
10914 vec_lvlx(__b, __c),
10915 vec_lvsr(__b, __c)),
10916 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010917}
10918
10919static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010920vec_stvrxl(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010921{
David Blaikie3302f2b2013-01-16 23:08:36 +000010922 return vec_stl(vec_perm(__a,
10923 vec_lvlx(__b, __c),
10924 vec_lvsr(__b, (unsigned char *)__c)),
10925 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010926}
10927
10928static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010929vec_stvrxl(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010930{
David Blaikie3302f2b2013-01-16 23:08:36 +000010931 return vec_stl(vec_perm(__a,
10932 vec_lvlx(__b, __c),
10933 vec_lvsr(__b, (unsigned char *)__c)),
10934 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010935}
10936
10937static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010938vec_stvrxl(vector short __a, int __b, short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010939{
David Blaikie3302f2b2013-01-16 23:08:36 +000010940 return vec_stl(vec_perm(__a,
10941 vec_lvlx(__b, __c),
10942 vec_lvsr(__b, __c)),
10943 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010944}
10945
10946static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010947vec_stvrxl(vector short __a, int __b, vector short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010948{
David Blaikie3302f2b2013-01-16 23:08:36 +000010949 return vec_stl(vec_perm(__a,
10950 vec_lvlx(__b, __c),
10951 vec_lvsr(__b, (unsigned char *)__c)),
10952 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010953}
10954
10955static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010956vec_stvrxl(vector unsigned short __a, int __b, unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010957{
David Blaikie3302f2b2013-01-16 23:08:36 +000010958 return vec_stl(vec_perm(__a,
10959 vec_lvlx(__b, __c),
10960 vec_lvsr(__b, __c)),
10961 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010962}
10963
10964static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010965vec_stvrxl(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010966{
David Blaikie3302f2b2013-01-16 23:08:36 +000010967 return vec_stl(vec_perm(__a,
10968 vec_lvlx(__b, __c),
10969 vec_lvsr(__b, (unsigned char *)__c)),
10970 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010971}
10972
10973static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010974vec_stvrxl(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010975{
David Blaikie3302f2b2013-01-16 23:08:36 +000010976 return vec_stl(vec_perm(__a,
10977 vec_lvlx(__b, __c),
10978 vec_lvsr(__b, (unsigned char *)__c)),
10979 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010980}
10981
10982static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010983vec_stvrxl(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010984{
David Blaikie3302f2b2013-01-16 23:08:36 +000010985 return vec_stl(vec_perm(__a,
10986 vec_lvlx(__b, __c),
10987 vec_lvsr(__b, (unsigned char *)__c)),
10988 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010989}
10990
10991static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010992vec_stvrxl(vector int __a, int __b, int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010993{
David Blaikie3302f2b2013-01-16 23:08:36 +000010994 return vec_stl(vec_perm(__a,
10995 vec_lvlx(__b, __c),
10996 vec_lvsr(__b, __c)),
10997 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010998}
10999
11000static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011001vec_stvrxl(vector int __a, int __b, vector int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000011002{
David Blaikie3302f2b2013-01-16 23:08:36 +000011003 return vec_stl(vec_perm(__a,
11004 vec_lvlx(__b, __c),
11005 vec_lvsr(__b, (unsigned char *)__c)),
11006 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000011007}
11008
11009static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011010vec_stvrxl(vector unsigned int __a, int __b, unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000011011{
David Blaikie3302f2b2013-01-16 23:08:36 +000011012 return vec_stl(vec_perm(__a,
11013 vec_lvlx(__b, __c),
11014 vec_lvsr(__b, __c)),
11015 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000011016}
11017
11018static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011019vec_stvrxl(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000011020{
David Blaikie3302f2b2013-01-16 23:08:36 +000011021 return vec_stl(vec_perm(__a,
11022 vec_lvlx(__b, __c),
11023 vec_lvsr(__b, (unsigned char *)__c)),
11024 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000011025}
11026
11027static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011028vec_stvrxl(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000011029{
David Blaikie3302f2b2013-01-16 23:08:36 +000011030 return vec_stl(vec_perm(__a,
11031 vec_lvlx(__b, __c),
11032 vec_lvsr(__b, (unsigned char *)__c)),
11033 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000011034}
11035
11036static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011037vec_stvrxl(vector float __a, int __b, vector float *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000011038{
David Blaikie3302f2b2013-01-16 23:08:36 +000011039 return vec_stl(vec_perm(__a,
11040 vec_lvlx(__b, __c),
11041 vec_lvsr(__b, (unsigned char *)__c)),
11042 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000011043}
11044
11045/* vec_promote */
11046
11047static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011048vec_promote(signed char __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000011049{
David Blaikie3302f2b2013-01-16 23:08:36 +000011050 vector signed char __res = (vector signed char)(0);
11051 __res[__b] = __a;
11052 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000011053}
11054
11055static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011056vec_promote(unsigned char __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000011057{
David Blaikie3302f2b2013-01-16 23:08:36 +000011058 vector unsigned char __res = (vector unsigned char)(0);
11059 __res[__b] = __a;
11060 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000011061}
11062
11063static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011064vec_promote(short __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000011065{
David Blaikie3302f2b2013-01-16 23:08:36 +000011066 vector short __res = (vector short)(0);
11067 __res[__b] = __a;
11068 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000011069}
11070
11071static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011072vec_promote(unsigned short __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000011073{
David Blaikie3302f2b2013-01-16 23:08:36 +000011074 vector unsigned short __res = (vector unsigned short)(0);
11075 __res[__b] = __a;
11076 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000011077}
11078
11079static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011080vec_promote(int __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000011081{
David Blaikie3302f2b2013-01-16 23:08:36 +000011082 vector int __res = (vector int)(0);
11083 __res[__b] = __a;
11084 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000011085}
11086
11087static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011088vec_promote(unsigned int __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000011089{
David Blaikie3302f2b2013-01-16 23:08:36 +000011090 vector unsigned int __res = (vector unsigned int)(0);
11091 __res[__b] = __a;
11092 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000011093}
11094
11095static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011096vec_promote(float __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000011097{
David Blaikie3302f2b2013-01-16 23:08:36 +000011098 vector float __res = (vector float)(0);
11099 __res[__b] = __a;
11100 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000011101}
11102
11103/* vec_splats */
11104
11105static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011106vec_splats(signed char __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000011107{
David Blaikie3302f2b2013-01-16 23:08:36 +000011108 return (vector signed char)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000011109}
11110
11111static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011112vec_splats(unsigned char __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000011113{
David Blaikie3302f2b2013-01-16 23:08:36 +000011114 return (vector unsigned char)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000011115}
11116
11117static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011118vec_splats(short __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000011119{
David Blaikie3302f2b2013-01-16 23:08:36 +000011120 return (vector short)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000011121}
11122
11123static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011124vec_splats(unsigned short __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000011125{
David Blaikie3302f2b2013-01-16 23:08:36 +000011126 return (vector unsigned short)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000011127}
11128
11129static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011130vec_splats(int __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000011131{
David Blaikie3302f2b2013-01-16 23:08:36 +000011132 return (vector int)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000011133}
11134
11135static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011136vec_splats(unsigned int __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000011137{
David Blaikie3302f2b2013-01-16 23:08:36 +000011138 return (vector unsigned int)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000011139}
11140
11141static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011142vec_splats(float __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000011143{
David Blaikie3302f2b2013-01-16 23:08:36 +000011144 return (vector float)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000011145}
11146
Anton Yartsev79d6af32010-09-18 00:39:16 +000011147/* ----------------------------- predicates --------------------------------- */
Chris Lattnerdad40622010-04-14 03:54:58 +000011148
Chris Lattnerdad40622010-04-14 03:54:58 +000011149/* vec_all_eq */
11150
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011151static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011152vec_all_eq(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011153{
David Blaikie3302f2b2013-01-16 23:08:36 +000011154 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011155}
11156
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011157static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011158vec_all_eq(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011159{
David Blaikie3302f2b2013-01-16 23:08:36 +000011160 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011161}
11162
11163static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011164vec_all_eq(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011165{
David Blaikie3302f2b2013-01-16 23:08:36 +000011166 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011167}
11168
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011169static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011170vec_all_eq(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011171{
David Blaikie3302f2b2013-01-16 23:08:36 +000011172 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011173}
11174
11175static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011176vec_all_eq(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011177{
David Blaikie3302f2b2013-01-16 23:08:36 +000011178 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011179}
11180
11181static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011182vec_all_eq(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011183{
David Blaikie3302f2b2013-01-16 23:08:36 +000011184 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011185}
11186
11187static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011188vec_all_eq(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011189{
David Blaikie3302f2b2013-01-16 23:08:36 +000011190 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011191}
11192
11193static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011194vec_all_eq(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011195{
David Blaikie3302f2b2013-01-16 23:08:36 +000011196 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011197}
11198
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011199static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011200vec_all_eq(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011201{
David Blaikie3302f2b2013-01-16 23:08:36 +000011202 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011203}
11204
11205static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011206vec_all_eq(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011207{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011208 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011209 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011210}
11211
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011212static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011213vec_all_eq(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011214{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011215 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011216 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011217}
11218
11219static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011220vec_all_eq(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011221{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011222 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011223 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011224}
11225
11226static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011227vec_all_eq(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011228{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011229 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011230 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011231}
11232
11233static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011234vec_all_eq(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011235{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011236 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011237 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011238}
11239
11240static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011241vec_all_eq(vector pixel __a, vector pixel __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011242{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011243 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011244 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011245}
11246
11247static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011248vec_all_eq(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011249{
David Blaikie3302f2b2013-01-16 23:08:36 +000011250 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011251}
11252
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011253static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011254vec_all_eq(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011255{
David Blaikie3302f2b2013-01-16 23:08:36 +000011256 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011257}
11258
11259static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011260vec_all_eq(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011261{
David Blaikie3302f2b2013-01-16 23:08:36 +000011262 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011263}
11264
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011265static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011266vec_all_eq(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011267{
David Blaikie3302f2b2013-01-16 23:08:36 +000011268 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011269}
11270
11271static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011272vec_all_eq(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011273{
David Blaikie3302f2b2013-01-16 23:08:36 +000011274 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011275}
11276
11277static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011278vec_all_eq(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011279{
David Blaikie3302f2b2013-01-16 23:08:36 +000011280 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011281}
11282
11283static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011284vec_all_eq(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011285{
David Blaikie3302f2b2013-01-16 23:08:36 +000011286 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011287}
11288
Kit Barton8553bec2015-03-11 15:57:19 +000011289#ifdef __POWER8_VECTOR__
11290static int __ATTRS_o_ai
11291vec_all_eq(vector signed long long __a, vector signed long long __b)
11292{
11293 return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, __b);
11294}
11295
11296static int __ATTRS_o_ai
11297vec_all_eq(vector long long __a, vector bool long long __b)
11298{
11299 return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, (vector long long)__b);
11300}
11301
11302static int __ATTRS_o_ai
11303vec_all_eq(vector unsigned long long __a, vector unsigned long long __b)
11304{
11305 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
11306 (vector long long)__b);
11307}
11308
11309static int __ATTRS_o_ai
11310vec_all_eq(vector unsigned long long __a, vector bool long long __b)
11311{
11312 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
11313 (vector long long)__b);
11314}
11315
11316static int __ATTRS_o_ai
11317vec_all_eq(vector bool long long __a, vector long long __b)
11318{
11319 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
11320 (vector long long)__b);
11321}
11322
11323static int __ATTRS_o_ai
11324vec_all_eq(vector bool long long __a, vector unsigned long long __b)
11325{
11326 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
11327 (vector long long)__b);
11328}
11329
11330static int __ATTRS_o_ai
11331vec_all_eq(vector bool long long __a, vector bool long long __b)
11332{
11333 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
11334 (vector long long)__b);
11335}
11336#endif
11337
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011338static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011339vec_all_eq(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011340{
David Blaikie3302f2b2013-01-16 23:08:36 +000011341 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011342}
11343
11344/* vec_all_ge */
11345
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011346static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011347vec_all_ge(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011348{
David Blaikie3302f2b2013-01-16 23:08:36 +000011349 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011350}
11351
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011352static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011353vec_all_ge(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011354{
David Blaikie3302f2b2013-01-16 23:08:36 +000011355 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011356}
11357
11358static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011359vec_all_ge(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011360{
David Blaikie3302f2b2013-01-16 23:08:36 +000011361 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011362}
11363
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011364static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011365vec_all_ge(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011366{
David Blaikie3302f2b2013-01-16 23:08:36 +000011367 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011368}
11369
11370static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011371vec_all_ge(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011372{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011373 return __builtin_altivec_vcmpgtub_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011374 (vector unsigned char)__b,
11375 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011376}
11377
11378static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011379vec_all_ge(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011380{
David Blaikie3302f2b2013-01-16 23:08:36 +000011381 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011382}
11383
11384static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011385vec_all_ge(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011386{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011387 return __builtin_altivec_vcmpgtub_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011388 (vector unsigned char)__b,
11389 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011390}
11391
11392static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011393vec_all_ge(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011394{
David Blaikie3302f2b2013-01-16 23:08:36 +000011395 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011396}
11397
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011398static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011399vec_all_ge(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011400{
David Blaikie3302f2b2013-01-16 23:08:36 +000011401 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011402}
11403
11404static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011405vec_all_ge(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011406{
David Blaikie3302f2b2013-01-16 23:08:36 +000011407 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011408}
11409
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011410static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011411vec_all_ge(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011412{
David Blaikie3302f2b2013-01-16 23:08:36 +000011413 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011414}
11415
11416static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011417vec_all_ge(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011418{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011419 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011420 (vector unsigned short)__b,
11421 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011422}
11423
11424static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011425vec_all_ge(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011426{
David Blaikie3302f2b2013-01-16 23:08:36 +000011427 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011428}
11429
11430static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011431vec_all_ge(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011432{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011433 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011434 (vector unsigned short)__b,
11435 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011436}
11437
11438static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011439vec_all_ge(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011440{
David Blaikie3302f2b2013-01-16 23:08:36 +000011441 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011442}
11443
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011444static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011445vec_all_ge(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011446{
David Blaikie3302f2b2013-01-16 23:08:36 +000011447 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011448}
11449
11450static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011451vec_all_ge(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011452{
David Blaikie3302f2b2013-01-16 23:08:36 +000011453 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011454}
11455
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011456static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011457vec_all_ge(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011458{
David Blaikie3302f2b2013-01-16 23:08:36 +000011459 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011460}
11461
11462static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011463vec_all_ge(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011464{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011465 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011466 (vector unsigned int)__b,
11467 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011468}
11469
11470static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011471vec_all_ge(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011472{
David Blaikie3302f2b2013-01-16 23:08:36 +000011473 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011474}
11475
11476static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011477vec_all_ge(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011478{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011479 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011480 (vector unsigned int)__b,
11481 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011482}
11483
Kit Barton8553bec2015-03-11 15:57:19 +000011484#ifdef __POWER8_VECTOR__
11485static int __ATTRS_o_ai
11486vec_all_ge(vector signed long long __a, vector signed long long __b)
11487{
11488 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, __a);
11489}
11490static int __ATTRS_o_ai
11491vec_all_ge(vector signed long long __a, vector bool long long __b)
11492{
11493 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__b,
11494 __a);
11495}
11496
11497static int __ATTRS_o_ai
11498vec_all_ge(vector unsigned long long __a, vector unsigned long long __b)
11499{
11500 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, __a);
11501}
11502
11503static int __ATTRS_o_ai
11504vec_all_ge(vector unsigned long long __a, vector bool long long __b)
11505{
11506 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
11507 __a);
11508}
11509
11510static int __ATTRS_o_ai
11511vec_all_ge(vector bool long long __a, vector signed long long __b)
11512{
11513 return __builtin_altivec_vcmpgtud_p(__CR6_EQ,
11514 (vector unsigned long long)__b,
11515 (vector unsigned long long)__a);
11516}
11517
11518static int __ATTRS_o_ai
11519vec_all_ge(vector bool long long __a, vector unsigned long long __b)
11520{
11521 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b,
11522 (vector unsigned long long)__a);
11523}
11524
11525static int __ATTRS_o_ai
11526vec_all_ge(vector bool long long __a, vector bool long long __b)
11527{
11528 return __builtin_altivec_vcmpgtud_p(__CR6_EQ,
11529 (vector unsigned long long)__b,
11530 (vector unsigned long long)__a);
11531}
11532#endif
11533
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011534static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011535vec_all_ge(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011536{
David Blaikie3302f2b2013-01-16 23:08:36 +000011537 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011538}
11539
11540/* vec_all_gt */
11541
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011542static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011543vec_all_gt(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011544{
David Blaikie3302f2b2013-01-16 23:08:36 +000011545 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011546}
11547
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011548static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011549vec_all_gt(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011550{
David Blaikie3302f2b2013-01-16 23:08:36 +000011551 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011552}
11553
11554static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011555vec_all_gt(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011556{
David Blaikie3302f2b2013-01-16 23:08:36 +000011557 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011558}
11559
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011560static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011561vec_all_gt(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011562{
David Blaikie3302f2b2013-01-16 23:08:36 +000011563 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011564}
11565
11566static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011567vec_all_gt(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011568{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011569 return __builtin_altivec_vcmpgtub_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011570 (vector unsigned char)__a,
11571 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011572}
11573
11574static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011575vec_all_gt(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011576{
David Blaikie3302f2b2013-01-16 23:08:36 +000011577 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011578}
11579
11580static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011581vec_all_gt(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011582{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011583 return __builtin_altivec_vcmpgtub_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011584 (vector unsigned char)__a,
11585 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011586}
11587
11588static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011589vec_all_gt(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011590{
David Blaikie3302f2b2013-01-16 23:08:36 +000011591 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011592}
11593
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011594static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011595vec_all_gt(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011596{
David Blaikie3302f2b2013-01-16 23:08:36 +000011597 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011598}
11599
11600static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011601vec_all_gt(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011602{
David Blaikie3302f2b2013-01-16 23:08:36 +000011603 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011604}
11605
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011606static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011607vec_all_gt(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011608{
David Blaikie3302f2b2013-01-16 23:08:36 +000011609 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011610}
11611
11612static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011613vec_all_gt(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011614{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011615 return __builtin_altivec_vcmpgtuh_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011616 (vector unsigned short)__a,
11617 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011618}
11619
11620static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011621vec_all_gt(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011622{
David Blaikie3302f2b2013-01-16 23:08:36 +000011623 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011624}
11625
11626static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011627vec_all_gt(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011628{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011629 return __builtin_altivec_vcmpgtuh_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011630 (vector unsigned short)__a,
11631 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011632}
11633
11634static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011635vec_all_gt(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011636{
David Blaikie3302f2b2013-01-16 23:08:36 +000011637 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011638}
11639
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011640static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011641vec_all_gt(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011642{
David Blaikie3302f2b2013-01-16 23:08:36 +000011643 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011644}
11645
11646static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011647vec_all_gt(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011648{
David Blaikie3302f2b2013-01-16 23:08:36 +000011649 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011650}
11651
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011652static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011653vec_all_gt(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011654{
David Blaikie3302f2b2013-01-16 23:08:36 +000011655 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011656}
11657
11658static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011659vec_all_gt(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011660{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011661 return __builtin_altivec_vcmpgtuw_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011662 (vector unsigned int)__a,
11663 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011664}
11665
11666static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011667vec_all_gt(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011668{
David Blaikie3302f2b2013-01-16 23:08:36 +000011669 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011670}
11671
11672static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011673vec_all_gt(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011674{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011675 return __builtin_altivec_vcmpgtuw_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011676 (vector unsigned int)__a,
11677 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011678}
11679
Kit Barton8553bec2015-03-11 15:57:19 +000011680#ifdef __POWER8_VECTOR__
11681static int __ATTRS_o_ai
11682vec_all_gt(vector signed long long __a, vector signed long long __b)
11683{
11684 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, __b);
11685}
11686static int __ATTRS_o_ai
11687vec_all_gt(vector signed long long __a, vector bool long long __b)
11688{
11689 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a,
11690 (vector signed long long)__b);
11691}
11692
11693static int __ATTRS_o_ai
11694vec_all_gt(vector unsigned long long __a, vector unsigned long long __b)
11695{
11696 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, __b);
11697}
11698
11699static int __ATTRS_o_ai
11700vec_all_gt(vector unsigned long long __a, vector bool long long __b)
11701{
11702 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a,
11703 (vector unsigned long long)__b);
11704}
11705
11706static int __ATTRS_o_ai
11707vec_all_gt(vector bool long long __a, vector signed long long __b)
11708{
11709 return __builtin_altivec_vcmpgtud_p(__CR6_LT,
11710 (vector unsigned long long)__a,
11711 (vector unsigned long long)__b);
11712}
11713
11714static int __ATTRS_o_ai
11715vec_all_gt(vector bool long long __a, vector unsigned long long __b)
11716{
11717 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
11718 __b);
11719}
11720
11721static int __ATTRS_o_ai
11722vec_all_gt(vector bool long long __a, vector bool long long __b)
11723{
11724 return __builtin_altivec_vcmpgtud_p(__CR6_LT,
11725 (vector unsigned long long)__a,
11726 (vector unsigned long long)__b);
11727}
11728#endif
11729
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011730static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011731vec_all_gt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011732{
David Blaikie3302f2b2013-01-16 23:08:36 +000011733 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011734}
11735
11736/* vec_all_in */
11737
11738static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000011739vec_all_in(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011740{
David Blaikie3302f2b2013-01-16 23:08:36 +000011741 return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011742}
11743
11744/* vec_all_le */
11745
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011746static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011747vec_all_le(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011748{
David Blaikie3302f2b2013-01-16 23:08:36 +000011749 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011750}
11751
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011752static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011753vec_all_le(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011754{
David Blaikie3302f2b2013-01-16 23:08:36 +000011755 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011756}
11757
11758static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011759vec_all_le(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011760{
David Blaikie3302f2b2013-01-16 23:08:36 +000011761 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011762}
11763
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011764static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011765vec_all_le(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011766{
David Blaikie3302f2b2013-01-16 23:08:36 +000011767 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011768}
11769
11770static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011771vec_all_le(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011772{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011773 return __builtin_altivec_vcmpgtub_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011774 (vector unsigned char)__a,
11775 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011776}
11777
11778static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011779vec_all_le(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011780{
David Blaikie3302f2b2013-01-16 23:08:36 +000011781 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011782}
11783
11784static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011785vec_all_le(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011786{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011787 return __builtin_altivec_vcmpgtub_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011788 (vector unsigned char)__a,
11789 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011790}
11791
11792static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011793vec_all_le(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011794{
David Blaikie3302f2b2013-01-16 23:08:36 +000011795 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011796}
11797
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011798static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011799vec_all_le(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011800{
David Blaikie3302f2b2013-01-16 23:08:36 +000011801 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011802}
11803
11804static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011805vec_all_le(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011806{
David Blaikie3302f2b2013-01-16 23:08:36 +000011807 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011808}
11809
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011810static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011811vec_all_le(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011812{
David Blaikie3302f2b2013-01-16 23:08:36 +000011813 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011814}
11815
11816static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011817vec_all_le(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011818{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011819 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011820 (vector unsigned short)__a,
11821 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011822}
11823
11824static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011825vec_all_le(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011826{
David Blaikie3302f2b2013-01-16 23:08:36 +000011827 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011828}
11829
11830static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011831vec_all_le(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011832{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011833 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011834 (vector unsigned short)__a,
11835 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011836}
11837
11838static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011839vec_all_le(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011840{
David Blaikie3302f2b2013-01-16 23:08:36 +000011841 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011842}
11843
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011844static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011845vec_all_le(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011846{
David Blaikie3302f2b2013-01-16 23:08:36 +000011847 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011848}
11849
11850static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011851vec_all_le(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011852{
David Blaikie3302f2b2013-01-16 23:08:36 +000011853 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011854}
11855
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011856static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011857vec_all_le(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011858{
David Blaikie3302f2b2013-01-16 23:08:36 +000011859 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011860}
11861
11862static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011863vec_all_le(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011864{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011865 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011866 (vector unsigned int)__a,
11867 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011868}
11869
11870static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011871vec_all_le(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011872{
David Blaikie3302f2b2013-01-16 23:08:36 +000011873 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011874}
11875
11876static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011877vec_all_le(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011878{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011879 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011880 (vector unsigned int)__a,
11881 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011882}
11883
Kit Barton8553bec2015-03-11 15:57:19 +000011884#ifdef __POWER8_VECTOR__
11885static int __ATTRS_o_ai
11886vec_all_le(vector signed long long __a, vector signed long long __b)
11887{
11888 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, __b);
11889}
11890
11891static int __ATTRS_o_ai
11892vec_all_le(vector unsigned long long __a, vector unsigned long long __b)
11893{
11894 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, __b);
11895}
11896
11897static int __ATTRS_o_ai
11898vec_all_le(vector signed long long __a, vector bool long long __b)
11899{
11900 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a,
11901 (vector signed long long)__b);
11902}
11903
11904static int __ATTRS_o_ai
11905vec_all_le(vector unsigned long long __a, vector bool long long __b)
11906{
11907 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a,
11908 (vector unsigned long long)__b);
11909}
11910
11911static int __ATTRS_o_ai
11912vec_all_le(vector bool long long __a, vector signed long long __b)
11913{
11914 return __builtin_altivec_vcmpgtud_p(__CR6_EQ,
11915 (vector unsigned long long)__a,
11916 (vector unsigned long long)__b);
11917}
11918
11919static int __ATTRS_o_ai
11920vec_all_le(vector bool long long __a, vector unsigned long long __b)
11921{
11922 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
11923 __b);
11924}
11925
11926static int __ATTRS_o_ai
11927vec_all_le(vector bool long long __a, vector bool long long __b)
11928{
11929 return __builtin_altivec_vcmpgtud_p(__CR6_EQ,
11930 (vector unsigned long long)__a,
11931 (vector unsigned long long)__b);
11932}
11933#endif
11934
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011935static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011936vec_all_le(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011937{
David Blaikie3302f2b2013-01-16 23:08:36 +000011938 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011939}
11940
11941/* vec_all_lt */
11942
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011943static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011944vec_all_lt(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011945{
David Blaikie3302f2b2013-01-16 23:08:36 +000011946 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011947}
11948
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011949static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011950vec_all_lt(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011951{
David Blaikie3302f2b2013-01-16 23:08:36 +000011952 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011953}
11954
11955static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011956vec_all_lt(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011957{
David Blaikie3302f2b2013-01-16 23:08:36 +000011958 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011959}
11960
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011961static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011962vec_all_lt(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011963{
David Blaikie3302f2b2013-01-16 23:08:36 +000011964 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011965}
11966
11967static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011968vec_all_lt(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011969{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011970 return __builtin_altivec_vcmpgtub_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011971 (vector unsigned char)__b,
11972 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011973}
11974
11975static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011976vec_all_lt(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011977{
David Blaikie3302f2b2013-01-16 23:08:36 +000011978 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011979}
11980
11981static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011982vec_all_lt(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011983{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011984 return __builtin_altivec_vcmpgtub_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011985 (vector unsigned char)__b,
11986 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011987}
11988
11989static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011990vec_all_lt(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011991{
David Blaikie3302f2b2013-01-16 23:08:36 +000011992 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011993}
11994
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011995static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011996vec_all_lt(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011997{
David Blaikie3302f2b2013-01-16 23:08:36 +000011998 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011999}
12000
12001static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012002vec_all_lt(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012003{
David Blaikie3302f2b2013-01-16 23:08:36 +000012004 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012005}
12006
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012007static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012008vec_all_lt(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012009{
David Blaikie3302f2b2013-01-16 23:08:36 +000012010 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012011}
12012
12013static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012014vec_all_lt(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012015{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012016 return __builtin_altivec_vcmpgtuh_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000012017 (vector unsigned short)__b,
12018 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012019}
12020
12021static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012022vec_all_lt(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012023{
David Blaikie3302f2b2013-01-16 23:08:36 +000012024 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012025}
12026
12027static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012028vec_all_lt(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012029{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012030 return __builtin_altivec_vcmpgtuh_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000012031 (vector unsigned short)__b,
12032 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012033}
12034
12035static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012036vec_all_lt(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012037{
David Blaikie3302f2b2013-01-16 23:08:36 +000012038 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012039}
12040
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012041static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012042vec_all_lt(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012043{
David Blaikie3302f2b2013-01-16 23:08:36 +000012044 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012045}
12046
12047static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012048vec_all_lt(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012049{
David Blaikie3302f2b2013-01-16 23:08:36 +000012050 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012051}
12052
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012053static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012054vec_all_lt(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012055{
David Blaikie3302f2b2013-01-16 23:08:36 +000012056 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012057}
12058
12059static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012060vec_all_lt(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012061{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012062 return __builtin_altivec_vcmpgtuw_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000012063 (vector unsigned int)__b,
12064 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012065}
12066
12067static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012068vec_all_lt(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012069{
David Blaikie3302f2b2013-01-16 23:08:36 +000012070 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012071}
12072
12073static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012074vec_all_lt(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012075{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012076 return __builtin_altivec_vcmpgtuw_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000012077 (vector unsigned int)__b,
12078 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012079}
12080
Kit Barton8553bec2015-03-11 15:57:19 +000012081#ifdef __POWER8_VECTOR__
12082static int __ATTRS_o_ai
12083vec_all_lt(vector signed long long __a, vector signed long long __b)
12084{
12085 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, __a);
12086}
12087
12088static int __ATTRS_o_ai
12089vec_all_lt(vector unsigned long long __a, vector unsigned long long __b)
12090{
12091 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, __a);
12092}
12093
12094static int __ATTRS_o_ai
12095vec_all_lt(vector signed long long __a, vector bool long long __b)
12096{
12097 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__b,
12098 __a);
12099}
12100
12101static int __ATTRS_o_ai
12102vec_all_lt(vector unsigned long long __a, vector bool long long __b)
12103{
12104 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
12105 __a);
12106}
12107
12108static int __ATTRS_o_ai
12109vec_all_lt(vector bool long long __a, vector signed long long __b)
12110{
12111 return __builtin_altivec_vcmpgtud_p(__CR6_LT,
12112 (vector unsigned long long)__b,
12113 (vector unsigned long long)__a);
12114}
12115
12116static int __ATTRS_o_ai
12117vec_all_lt(vector bool long long __a, vector unsigned long long __b)
12118{
12119 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b,
12120 (vector unsigned long long)__a);
12121}
12122
12123static int __ATTRS_o_ai
12124vec_all_lt(vector bool long long __a, vector bool long long __b)
12125{
12126 return __builtin_altivec_vcmpgtud_p(__CR6_LT,
12127 (vector unsigned long long)__b,
12128 (vector unsigned long long)__a);
12129}
12130#endif
12131
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012132static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012133vec_all_lt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012134{
David Blaikie3302f2b2013-01-16 23:08:36 +000012135 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012136}
12137
12138/* vec_all_nan */
12139
12140static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012141vec_all_nan(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +000012142{
David Blaikie3302f2b2013-01-16 23:08:36 +000012143 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012144}
12145
12146/* vec_all_ne */
12147
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012148static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012149vec_all_ne(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012150{
David Blaikie3302f2b2013-01-16 23:08:36 +000012151 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012152}
12153
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012154static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012155vec_all_ne(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012156{
David Blaikie3302f2b2013-01-16 23:08:36 +000012157 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012158}
12159
12160static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012161vec_all_ne(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012162{
David Blaikie3302f2b2013-01-16 23:08:36 +000012163 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012164}
12165
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012166static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012167vec_all_ne(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012168{
David Blaikie3302f2b2013-01-16 23:08:36 +000012169 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012170}
12171
12172static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012173vec_all_ne(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012174{
David Blaikie3302f2b2013-01-16 23:08:36 +000012175 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012176}
12177
12178static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012179vec_all_ne(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012180{
David Blaikie3302f2b2013-01-16 23:08:36 +000012181 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012182}
12183
12184static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012185vec_all_ne(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012186{
David Blaikie3302f2b2013-01-16 23:08:36 +000012187 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012188}
12189
12190static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012191vec_all_ne(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012192{
David Blaikie3302f2b2013-01-16 23:08:36 +000012193 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012194}
12195
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012196static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012197vec_all_ne(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012198{
David Blaikie3302f2b2013-01-16 23:08:36 +000012199 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012200}
12201
12202static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012203vec_all_ne(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012204{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012205 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012206 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012207}
12208
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012209static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012210vec_all_ne(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012211{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012212 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012213 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012214}
12215
12216static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012217vec_all_ne(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012218{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012219 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012220 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012221}
12222
12223static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012224vec_all_ne(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012225{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012226 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012227 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012228}
12229
12230static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012231vec_all_ne(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012232{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012233 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012234 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012235}
12236
12237static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012238vec_all_ne(vector pixel __a, vector pixel __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012239{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012240 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012241 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012242}
12243
12244static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012245vec_all_ne(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012246{
David Blaikie3302f2b2013-01-16 23:08:36 +000012247 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012248}
12249
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012250static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012251vec_all_ne(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012252{
David Blaikie3302f2b2013-01-16 23:08:36 +000012253 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012254}
12255
12256static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012257vec_all_ne(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012258{
David Blaikie3302f2b2013-01-16 23:08:36 +000012259 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012260}
12261
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012262static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012263vec_all_ne(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012264{
David Blaikie3302f2b2013-01-16 23:08:36 +000012265 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012266}
12267
12268static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012269vec_all_ne(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012270{
David Blaikie3302f2b2013-01-16 23:08:36 +000012271 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012272}
12273
12274static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012275vec_all_ne(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012276{
David Blaikie3302f2b2013-01-16 23:08:36 +000012277 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012278}
12279
12280static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012281vec_all_ne(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012282{
David Blaikie3302f2b2013-01-16 23:08:36 +000012283 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012284}
12285
Kit Barton8553bec2015-03-11 15:57:19 +000012286#ifdef __POWER8_VECTOR__
12287static int __ATTRS_o_ai
12288vec_all_ne(vector signed long long __a, vector signed long long __b)
12289{
12290 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, __b);
12291}
12292
12293static int __ATTRS_o_ai
12294vec_all_ne(vector unsigned long long __a, vector unsigned long long __b)
12295{
12296 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector long long)__a,
12297 (vector long long)__b);
12298}
12299
12300static int __ATTRS_o_ai
12301vec_all_ne(vector signed long long __a, vector bool long long __b)
12302{
12303 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a,
12304 (vector signed long long)__b);
12305}
12306
12307static int __ATTRS_o_ai
12308vec_all_ne(vector unsigned long long __a, vector bool long long __b)
12309{
12310 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
12311 (vector signed long long)__b);
12312}
12313
12314static int __ATTRS_o_ai
12315vec_all_ne(vector bool long long __a, vector signed long long __b)
12316{
12317 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
12318 (vector signed long long)__b);
12319}
12320
12321static int __ATTRS_o_ai
12322vec_all_ne(vector bool long long __a, vector unsigned long long __b)
12323{
12324 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
12325 (vector signed long long)__b);
12326}
12327
12328static int __ATTRS_o_ai
12329vec_all_ne(vector bool long long __a, vector bool long long __b)
12330{
12331 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
12332 (vector signed long long)__b);
12333}
12334#endif
12335
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012336static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012337vec_all_ne(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012338{
David Blaikie3302f2b2013-01-16 23:08:36 +000012339 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012340}
12341
12342/* vec_all_nge */
12343
12344static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012345vec_all_nge(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012346{
David Blaikie3302f2b2013-01-16 23:08:36 +000012347 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012348}
12349
12350/* vec_all_ngt */
12351
12352static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012353vec_all_ngt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012354{
David Blaikie3302f2b2013-01-16 23:08:36 +000012355 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012356}
12357
12358/* vec_all_nle */
12359
12360static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012361vec_all_nle(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012362{
David Blaikie3302f2b2013-01-16 23:08:36 +000012363 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012364}
12365
12366/* vec_all_nlt */
12367
12368static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012369vec_all_nlt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012370{
David Blaikie3302f2b2013-01-16 23:08:36 +000012371 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012372}
12373
12374/* vec_all_numeric */
12375
12376static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012377vec_all_numeric(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +000012378{
David Blaikie3302f2b2013-01-16 23:08:36 +000012379 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012380}
12381
12382/* vec_any_eq */
12383
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012384static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012385vec_any_eq(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012386{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012387 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012388 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012389}
12390
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012391static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012392vec_any_eq(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012393{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012394 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012395 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012396}
12397
12398static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012399vec_any_eq(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012400{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012401 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012402 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012403}
12404
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012405static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012406vec_any_eq(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012407{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012408 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012409 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012410}
12411
12412static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012413vec_any_eq(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012414{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012415 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012416 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012417}
12418
12419static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012420vec_any_eq(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012421{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012422 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012423 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012424}
12425
12426static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012427vec_any_eq(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012428{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012429 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012430 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012431}
12432
12433static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012434vec_any_eq(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012435{
David Blaikie3302f2b2013-01-16 23:08:36 +000012436 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012437}
12438
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012439static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012440vec_any_eq(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012441{
David Blaikie3302f2b2013-01-16 23:08:36 +000012442 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012443}
12444
12445static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012446vec_any_eq(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012447{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012448 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012449 (vector short)__a,
12450 (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012451}
12452
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012453static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012454vec_any_eq(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012455{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012456 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012457 (vector short)__a,
12458 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012459}
12460
12461static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012462vec_any_eq(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012463{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012464 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012465 (vector short)__a,
12466 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012467}
12468
12469static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012470vec_any_eq(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012471{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012472 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012473 (vector short)__a,
12474 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012475}
12476
12477static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012478vec_any_eq(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012479{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012480 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012481 (vector short)__a,
12482 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012483}
12484
12485static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012486vec_any_eq(vector pixel __a, vector pixel __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012487{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012488 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012489 (vector short)__a,
12490 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012491}
12492
12493static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012494vec_any_eq(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012495{
David Blaikie3302f2b2013-01-16 23:08:36 +000012496 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012497}
12498
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012499static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012500vec_any_eq(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012501{
David Blaikie3302f2b2013-01-16 23:08:36 +000012502 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012503}
12504
12505static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012506vec_any_eq(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012507{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012508 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012509 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012510}
12511
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012512static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012513vec_any_eq(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012514{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012515 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012516 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012517}
12518
12519static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012520vec_any_eq(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012521{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012522 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012523 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012524}
12525
12526static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012527vec_any_eq(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012528{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012529 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012530 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012531}
12532
12533static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012534vec_any_eq(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012535{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012536 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012537 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012538}
12539
Kit Barton8553bec2015-03-11 15:57:19 +000012540#ifdef __POWER8_VECTOR__
12541static int __ATTRS_o_ai
12542vec_any_eq(vector signed long long __a, vector signed long long __b)
12543{
12544 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, __b);
12545}
12546
12547static int __ATTRS_o_ai
12548vec_any_eq(vector unsigned long long __a, vector unsigned long long __b)
12549{
12550 return
12551 __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector long long)__a,
12552 (vector long long)__b);
12553}
12554
12555static int __ATTRS_o_ai
12556vec_any_eq(vector signed long long __a, vector bool long long __b)
12557{
12558 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a,
12559 (vector signed long long)__b);
12560}
12561
12562static int __ATTRS_o_ai
12563vec_any_eq(vector unsigned long long __a, vector bool long long __b)
12564{
12565 return
12566 __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector signed long long)__a,
12567 (vector signed long long)__b);
12568}
12569
12570static int __ATTRS_o_ai
12571vec_any_eq(vector bool long long __a, vector signed long long __b)
12572{
12573 return
12574 __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector signed long long)__a,
12575 (vector signed long long)__b);
12576}
12577
12578static int __ATTRS_o_ai
12579vec_any_eq(vector bool long long __a, vector unsigned long long __b)
12580{
12581 return
12582 __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector signed long long)__a,
12583 (vector signed long long)__b);
12584}
12585
12586static int __ATTRS_o_ai
12587vec_any_eq(vector bool long long __a, vector bool long long __b)
12588{
12589 return
12590 __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector signed long long)__a,
12591 (vector signed long long)__b);
12592}
12593#endif
12594
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012595static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012596vec_any_eq(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012597{
David Blaikie3302f2b2013-01-16 23:08:36 +000012598 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012599}
12600
12601/* vec_any_ge */
12602
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012603static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012604vec_any_ge(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012605{
David Blaikie3302f2b2013-01-16 23:08:36 +000012606 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012607}
12608
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012609static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012610vec_any_ge(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012611{
David Blaikie3302f2b2013-01-16 23:08:36 +000012612 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012613}
12614
12615static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012616vec_any_ge(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012617{
David Blaikie3302f2b2013-01-16 23:08:36 +000012618 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012619}
12620
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012621static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012622vec_any_ge(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012623{
David Blaikie3302f2b2013-01-16 23:08:36 +000012624 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012625}
12626
12627static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012628vec_any_ge(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012629{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012630 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012631 (vector unsigned char)__b,
12632 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012633}
12634
12635static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012636vec_any_ge(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012637{
David Blaikie3302f2b2013-01-16 23:08:36 +000012638 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012639}
12640
12641static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012642vec_any_ge(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012643{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012644 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012645 (vector unsigned char)__b,
12646 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012647}
12648
12649static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012650vec_any_ge(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012651{
David Blaikie3302f2b2013-01-16 23:08:36 +000012652 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012653}
12654
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012655static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012656vec_any_ge(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012657{
David Blaikie3302f2b2013-01-16 23:08:36 +000012658 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012659}
12660
12661static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012662vec_any_ge(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012663{
David Blaikie3302f2b2013-01-16 23:08:36 +000012664 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012665}
12666
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012667static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012668vec_any_ge(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012669{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012670 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012671 __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012672}
12673
12674static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012675vec_any_ge(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012676{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012677 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012678 (vector unsigned short)__b,
12679 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012680}
12681
12682static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012683vec_any_ge(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012684{
12685 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012686 __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012687}
12688
12689static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012690vec_any_ge(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012691{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012692 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012693 (vector unsigned short)__b,
12694 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012695}
12696
12697static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012698vec_any_ge(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012699{
David Blaikie3302f2b2013-01-16 23:08:36 +000012700 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012701}
12702
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012703static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012704vec_any_ge(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012705{
David Blaikie3302f2b2013-01-16 23:08:36 +000012706 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012707}
12708
12709static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012710vec_any_ge(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012711{
David Blaikie3302f2b2013-01-16 23:08:36 +000012712 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012713}
12714
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012715static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012716vec_any_ge(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012717{
David Blaikie3302f2b2013-01-16 23:08:36 +000012718 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012719}
12720
12721static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012722vec_any_ge(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012723{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012724 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012725 (vector unsigned int)__b,
12726 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012727}
12728
12729static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012730vec_any_ge(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012731{
David Blaikie3302f2b2013-01-16 23:08:36 +000012732 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012733}
12734
12735static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012736vec_any_ge(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012737{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012738 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012739 (vector unsigned int)__b,
12740 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012741}
12742
Kit Barton8553bec2015-03-11 15:57:19 +000012743#ifdef __POWER8_VECTOR__
12744static int __ATTRS_o_ai
12745vec_any_ge(vector signed long long __a, vector signed long long __b)
12746{
12747 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, __a);
12748}
12749
12750static int __ATTRS_o_ai
12751vec_any_ge(vector unsigned long long __a, vector unsigned long long __b)
12752{
12753 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, __a);
12754}
12755
12756static int __ATTRS_o_ai
12757vec_any_ge(vector signed long long __a, vector bool long long __b)
12758{
12759 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV,
12760 (vector signed long long)__b, __a);
12761}
12762
12763static int __ATTRS_o_ai
12764vec_any_ge(vector unsigned long long __a, vector bool long long __b)
12765{
12766 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
12767 (vector unsigned long long)__b, __a);
12768}
12769
12770static int __ATTRS_o_ai
12771vec_any_ge(vector bool long long __a, vector signed long long __b)
12772{
12773 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
12774 (vector unsigned long long)__b,
12775 (vector unsigned long long)__a);
12776}
12777
12778static int __ATTRS_o_ai
12779vec_any_ge(vector bool long long __a, vector unsigned long long __b)
12780{
12781 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b,
12782 (vector unsigned long long)__a);
12783}
12784
12785static int __ATTRS_o_ai
12786vec_any_ge(vector bool long long __a, vector bool long long __b)
12787{
12788 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
12789 (vector unsigned long long)__b,
12790 (vector unsigned long long)__a);
12791}
12792#endif
12793
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012794static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012795vec_any_ge(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012796{
David Blaikie3302f2b2013-01-16 23:08:36 +000012797 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012798}
12799
12800/* vec_any_gt */
12801
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012802static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012803vec_any_gt(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012804{
David Blaikie3302f2b2013-01-16 23:08:36 +000012805 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012806}
12807
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012808static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012809vec_any_gt(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012810{
David Blaikie3302f2b2013-01-16 23:08:36 +000012811 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012812}
12813
12814static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012815vec_any_gt(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012816{
David Blaikie3302f2b2013-01-16 23:08:36 +000012817 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012818}
12819
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012820static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012821vec_any_gt(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012822{
12823 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012824 __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012825}
12826
12827static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012828vec_any_gt(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012829{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012830 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012831 (vector unsigned char)__a,
12832 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012833}
12834
12835static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012836vec_any_gt(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012837{
12838 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012839 __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012840}
12841
12842static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012843vec_any_gt(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012844{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012845 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012846 (vector unsigned char)__a,
12847 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012848}
12849
12850static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012851vec_any_gt(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012852{
David Blaikie3302f2b2013-01-16 23:08:36 +000012853 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012854}
12855
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012856static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012857vec_any_gt(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012858{
David Blaikie3302f2b2013-01-16 23:08:36 +000012859 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012860}
12861
12862static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012863vec_any_gt(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012864{
David Blaikie3302f2b2013-01-16 23:08:36 +000012865 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012866}
12867
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012868static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012869vec_any_gt(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012870{
12871 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012872 __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012873}
12874
12875static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012876vec_any_gt(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012877{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012878 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012879 (vector unsigned short)__a,
12880 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012881}
12882
12883static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012884vec_any_gt(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012885{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012886 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012887 __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012888}
12889
12890static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012891vec_any_gt(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012892{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012893 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012894 (vector unsigned short)__a,
12895 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012896}
12897
12898static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012899vec_any_gt(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012900{
David Blaikie3302f2b2013-01-16 23:08:36 +000012901 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012902}
12903
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012904static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012905vec_any_gt(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012906{
David Blaikie3302f2b2013-01-16 23:08:36 +000012907 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012908}
12909
12910static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012911vec_any_gt(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012912{
David Blaikie3302f2b2013-01-16 23:08:36 +000012913 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012914}
12915
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012916static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012917vec_any_gt(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012918{
David Blaikie3302f2b2013-01-16 23:08:36 +000012919 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012920}
12921
12922static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012923vec_any_gt(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012924{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012925 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012926 (vector unsigned int)__a,
12927 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012928}
12929
12930static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012931vec_any_gt(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012932{
David Blaikie3302f2b2013-01-16 23:08:36 +000012933 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012934}
12935
12936static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012937vec_any_gt(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012938{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012939 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012940 (vector unsigned int)__a,
12941 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012942}
12943
Kit Barton8553bec2015-03-11 15:57:19 +000012944#ifdef __POWER8_VECTOR__
12945static int __ATTRS_o_ai
12946vec_any_gt(vector signed long long __a, vector signed long long __b)
12947{
12948 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, __b);
12949}
12950
12951static int __ATTRS_o_ai
12952vec_any_gt(vector unsigned long long __a, vector unsigned long long __b)
12953{
12954 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, __b);
12955}
12956
12957static int __ATTRS_o_ai
12958vec_any_gt(vector signed long long __a, vector bool long long __b)
12959{
12960 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a,
12961 (vector signed long long)__b);
12962}
12963
12964
12965static int __ATTRS_o_ai
12966vec_any_gt(vector unsigned long long __a, vector bool long long __b)
12967{
12968 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a,
12969 (vector unsigned long long)__b);
12970}
12971
12972static int __ATTRS_o_ai
12973vec_any_gt(vector bool long long __a, vector signed long long __b)
12974{
12975 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
12976 (vector unsigned long long)__a,
12977 (vector unsigned long long)__b);
12978}
12979
12980static int __ATTRS_o_ai
12981vec_any_gt(vector bool long long __a, vector unsigned long long __b)
12982{
12983 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
12984 (vector unsigned long long)__a, __b);
12985}
12986
12987static int __ATTRS_o_ai
12988vec_any_gt(vector bool long long __a, vector bool long long __b)
12989{
12990 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
12991 (vector unsigned long long)__a,
12992 (vector unsigned long long)__b);
12993}
12994#endif
12995
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012996static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012997vec_any_gt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012998{
David Blaikie3302f2b2013-01-16 23:08:36 +000012999 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013000}
13001
13002/* vec_any_le */
13003
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013004static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013005vec_any_le(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013006{
David Blaikie3302f2b2013-01-16 23:08:36 +000013007 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013008}
13009
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013010static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013011vec_any_le(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013012{
David Blaikie3302f2b2013-01-16 23:08:36 +000013013 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013014}
13015
13016static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013017vec_any_le(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013018{
David Blaikie3302f2b2013-01-16 23:08:36 +000013019 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013020}
13021
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013022static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013023vec_any_le(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013024{
13025 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013026 __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013027}
13028
13029static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013030vec_any_le(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013031{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013032 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013033 (vector unsigned char)__a,
13034 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013035}
13036
13037static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013038vec_any_le(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013039{
13040 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013041 __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013042}
13043
13044static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013045vec_any_le(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013046{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013047 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013048 (vector unsigned char)__a,
13049 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013050}
13051
13052static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013053vec_any_le(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013054{
David Blaikie3302f2b2013-01-16 23:08:36 +000013055 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013056}
13057
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013058static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013059vec_any_le(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013060{
David Blaikie3302f2b2013-01-16 23:08:36 +000013061 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013062}
13063
13064static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013065vec_any_le(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013066{
David Blaikie3302f2b2013-01-16 23:08:36 +000013067 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013068}
13069
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013070static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013071vec_any_le(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013072{
13073 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013074 __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013075}
13076
13077static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013078vec_any_le(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013079{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013080 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013081 (vector unsigned short)__a,
13082 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013083}
13084
13085static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013086vec_any_le(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013087{
13088 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013089 __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013090}
13091
13092static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013093vec_any_le(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013094{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013095 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013096 (vector unsigned short)__a,
13097 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013098}
13099
13100static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013101vec_any_le(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013102{
David Blaikie3302f2b2013-01-16 23:08:36 +000013103 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013104}
13105
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013106static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013107vec_any_le(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013108{
David Blaikie3302f2b2013-01-16 23:08:36 +000013109 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013110}
13111
13112static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013113vec_any_le(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013114{
David Blaikie3302f2b2013-01-16 23:08:36 +000013115 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013116}
13117
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013118static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013119vec_any_le(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013120{
David Blaikie3302f2b2013-01-16 23:08:36 +000013121 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013122}
13123
13124static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013125vec_any_le(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013126{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013127 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013128 (vector unsigned int)__a,
13129 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013130}
13131
13132static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013133vec_any_le(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013134{
David Blaikie3302f2b2013-01-16 23:08:36 +000013135 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013136}
13137
13138static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013139vec_any_le(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013140{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013141 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013142 (vector unsigned int)__a,
13143 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013144}
13145
Kit Barton8553bec2015-03-11 15:57:19 +000013146#ifdef __POWER8_VECTOR__
13147static int __ATTRS_o_ai
13148vec_any_le(vector signed long long __a, vector signed long long __b)
13149{
13150 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, __b);
13151}
13152
13153static int __ATTRS_o_ai
13154vec_any_le(vector unsigned long long __a, vector unsigned long long __b)
13155{
13156 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, __b);
13157}
13158
13159static int __ATTRS_o_ai
13160vec_any_le(vector signed long long __a, vector bool long long __b)
13161{
13162 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a,
13163 (vector signed long long)__b);
13164}
13165
13166static int __ATTRS_o_ai
13167vec_any_le(vector unsigned long long __a, vector bool long long __b)
13168{
13169 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a,
13170 (vector unsigned long long)__b);
13171}
13172
13173static int __ATTRS_o_ai
13174vec_any_le(vector bool long long __a, vector signed long long __b)
13175{
13176 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
13177 (vector unsigned long long)__a,
13178 (vector unsigned long long)__b);
13179}
13180
13181static int __ATTRS_o_ai
13182vec_any_le(vector bool long long __a, vector unsigned long long __b)
13183{
13184 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
13185 (vector unsigned long long)__a, __b);
13186}
13187
13188static int __ATTRS_o_ai
13189vec_any_le(vector bool long long __a, vector bool long long __b)
13190{
13191 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
13192 (vector unsigned long long)__a,
13193 (vector unsigned long long)__b);
13194}
13195#endif
13196
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013197static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013198vec_any_le(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013199{
David Blaikie3302f2b2013-01-16 23:08:36 +000013200 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000013201}
13202
13203/* vec_any_lt */
13204
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013205static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013206vec_any_lt(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013207{
David Blaikie3302f2b2013-01-16 23:08:36 +000013208 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000013209}
13210
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013211static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013212vec_any_lt(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013213{
David Blaikie3302f2b2013-01-16 23:08:36 +000013214 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013215}
13216
13217static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013218vec_any_lt(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013219{
David Blaikie3302f2b2013-01-16 23:08:36 +000013220 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000013221}
13222
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013223static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013224vec_any_lt(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013225{
13226 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013227 __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013228}
13229
13230static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013231vec_any_lt(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013232{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013233 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013234 (vector unsigned char)__b,
13235 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013236}
13237
13238static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013239vec_any_lt(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013240{
13241 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013242 __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013243}
13244
13245static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013246vec_any_lt(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013247{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013248 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013249 (vector unsigned char)__b,
13250 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013251}
13252
13253static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013254vec_any_lt(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013255{
David Blaikie3302f2b2013-01-16 23:08:36 +000013256 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000013257}
13258
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013259static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013260vec_any_lt(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013261{
David Blaikie3302f2b2013-01-16 23:08:36 +000013262 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013263}
13264
13265static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013266vec_any_lt(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013267{
David Blaikie3302f2b2013-01-16 23:08:36 +000013268 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000013269}
13270
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013271static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013272vec_any_lt(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013273{
13274 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013275 __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013276}
13277
13278static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013279vec_any_lt(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013280{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013281 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013282 (vector unsigned short)__b,
13283 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013284}
13285
13286static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013287vec_any_lt(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013288{
13289 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013290 __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013291}
13292
13293static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013294vec_any_lt(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013295{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013296 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013297 (vector unsigned short)__b,
13298 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013299}
13300
13301static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013302vec_any_lt(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013303{
David Blaikie3302f2b2013-01-16 23:08:36 +000013304 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000013305}
13306
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013307static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013308vec_any_lt(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013309{
David Blaikie3302f2b2013-01-16 23:08:36 +000013310 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013311}
13312
13313static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013314vec_any_lt(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013315{
David Blaikie3302f2b2013-01-16 23:08:36 +000013316 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000013317}
13318
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013319static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013320vec_any_lt(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013321{
David Blaikie3302f2b2013-01-16 23:08:36 +000013322 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013323}
13324
13325static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013326vec_any_lt(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013327{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013328 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013329 (vector unsigned int)__b,
13330 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013331}
13332
13333static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013334vec_any_lt(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013335{
David Blaikie3302f2b2013-01-16 23:08:36 +000013336 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013337}
13338
13339static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013340vec_any_lt(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013341{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013342 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013343 (vector unsigned int)__b,
13344 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013345}
13346
Kit Barton8553bec2015-03-11 15:57:19 +000013347#ifdef __POWER8_VECTOR__
13348static int __ATTRS_o_ai
13349vec_any_lt(vector signed long long __a, vector signed long long __b)
13350{
13351 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, __a);
13352}
13353
13354static int __ATTRS_o_ai
13355vec_any_lt(vector unsigned long long __a, vector unsigned long long __b)
13356{
13357 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, __a);
13358}
13359
13360static int __ATTRS_o_ai
13361vec_any_lt(vector signed long long __a, vector bool long long __b)
13362{
13363 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV,
13364 (vector signed long long)__b, __a);
13365}
13366
13367static int __ATTRS_o_ai
13368vec_any_lt(vector unsigned long long __a, vector bool long long __b)
13369{
13370 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
13371 (vector unsigned long long)__b, __a);
13372}
13373
13374static int __ATTRS_o_ai
13375vec_any_lt(vector bool long long __a, vector signed long long __b)
13376{
13377 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
13378 (vector unsigned long long)__b,
13379 (vector unsigned long long)__a);
13380}
13381
13382static int __ATTRS_o_ai
13383vec_any_lt(vector bool long long __a, vector unsigned long long __b)
13384{
13385 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b,
13386 (vector unsigned long long)__a);
13387}
13388
13389static int __ATTRS_o_ai
13390vec_any_lt(vector bool long long __a, vector bool long long __b)
13391{
13392 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
13393 (vector unsigned long long)__b,
13394 (vector unsigned long long)__a);
13395}
13396#endif
13397
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013398static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013399vec_any_lt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013400{
David Blaikie3302f2b2013-01-16 23:08:36 +000013401 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000013402}
13403
13404/* vec_any_nan */
13405
13406static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000013407vec_any_nan(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +000013408{
David Blaikie3302f2b2013-01-16 23:08:36 +000013409 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000013410}
13411
13412/* vec_any_ne */
13413
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013414static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013415vec_any_ne(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013416{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013417 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013418 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013419}
13420
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013421static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013422vec_any_ne(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013423{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013424 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013425 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013426}
13427
13428static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013429vec_any_ne(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013430{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013431 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013432 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013433}
13434
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013435static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013436vec_any_ne(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013437{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013438 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013439 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013440}
13441
13442static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013443vec_any_ne(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013444{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013445 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013446 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013447}
13448
13449static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013450vec_any_ne(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013451{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013452 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013453 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013454}
13455
13456static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013457vec_any_ne(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013458{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013459 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013460 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013461}
13462
13463static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013464vec_any_ne(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013465{
David Blaikie3302f2b2013-01-16 23:08:36 +000013466 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013467}
13468
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013469static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013470vec_any_ne(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013471{
David Blaikie3302f2b2013-01-16 23:08:36 +000013472 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013473}
13474
13475static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013476vec_any_ne(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013477{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013478 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013479 (vector short)__a,
13480 (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013481}
13482
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013483static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013484vec_any_ne(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013485{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013486 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013487 (vector short)__a,
13488 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013489}
13490
13491static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013492vec_any_ne(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013493{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013494 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013495 (vector short)__a,
13496 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013497}
13498
13499static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013500vec_any_ne(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013501{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013502 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013503 (vector short)__a,
13504 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013505}
13506
13507static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013508vec_any_ne(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013509{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013510 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013511 (vector short)__a,
13512 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013513}
13514
13515static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013516vec_any_ne(vector pixel __a, vector pixel __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013517{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013518 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000013519 (vector short)__a,
13520 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013521}
13522
13523static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013524vec_any_ne(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013525{
David Blaikie3302f2b2013-01-16 23:08:36 +000013526 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013527}
13528
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013529static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013530vec_any_ne(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013531{
David Blaikie3302f2b2013-01-16 23:08:36 +000013532 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013533}
13534
13535static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013536vec_any_ne(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013537{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013538 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013539 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013540}
13541
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013542static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013543vec_any_ne(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013544{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013545 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013546 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013547}
13548
13549static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013550vec_any_ne(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013551{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013552 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013553 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013554}
13555
13556static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013557vec_any_ne(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013558{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013559 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013560 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013561}
13562
13563static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013564vec_any_ne(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013565{
Anton Yartsev79d6af32010-09-18 00:39:16 +000013566 return
David Blaikie3302f2b2013-01-16 23:08:36 +000013567 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013568}
13569
Kit Barton8553bec2015-03-11 15:57:19 +000013570#ifdef __POWER8_VECTOR__
13571static int __ATTRS_o_ai
13572vec_any_ne(vector signed long long __a, vector signed long long __b)
13573{
13574 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, __b);
13575}
13576
13577static int __ATTRS_o_ai
13578vec_any_ne(vector unsigned long long __a, vector unsigned long long __b)
13579{
13580 return
13581 __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector long long)__a,
13582 (vector long long)__b);
13583}
13584
13585static int __ATTRS_o_ai
13586vec_any_ne(vector signed long long __a, vector bool long long __b)
13587{
13588 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a,
13589 (vector signed long long)__b);
13590}
13591
13592static int __ATTRS_o_ai
13593vec_any_ne(vector unsigned long long __a, vector bool long long __b)
13594{
13595 return
13596 __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector signed long long)__a,
13597 (vector signed long long)__b);
13598}
13599
13600static int __ATTRS_o_ai
13601vec_any_ne(vector bool long long __a, vector signed long long __b)
13602{
13603 return
13604 __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector signed long long)__a,
13605 (vector signed long long)__b);
13606}
13607
13608static int __ATTRS_o_ai
13609vec_any_ne(vector bool long long __a, vector unsigned long long __b)
13610{
13611 return
13612 __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector signed long long)__a,
13613 (vector signed long long)__b);
13614}
13615
13616static int __ATTRS_o_ai
13617vec_any_ne(vector bool long long __a, vector bool long long __b)
13618{
13619 return
13620 __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector signed long long)__a,
13621 (vector signed long long)__b);
13622}
13623#endif
13624
Anton Yartsev583a1cf2010-08-19 11:57:49 +000013625static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000013626vec_any_ne(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013627{
David Blaikie3302f2b2013-01-16 23:08:36 +000013628 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013629}
13630
13631/* vec_any_nge */
13632
13633static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000013634vec_any_nge(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013635{
David Blaikie3302f2b2013-01-16 23:08:36 +000013636 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013637}
13638
13639/* vec_any_ngt */
13640
13641static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000013642vec_any_ngt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013643{
David Blaikie3302f2b2013-01-16 23:08:36 +000013644 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013645}
13646
13647/* vec_any_nle */
13648
13649static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000013650vec_any_nle(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013651{
David Blaikie3302f2b2013-01-16 23:08:36 +000013652 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000013653}
13654
13655/* vec_any_nlt */
13656
13657static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000013658vec_any_nlt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013659{
David Blaikie3302f2b2013-01-16 23:08:36 +000013660 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000013661}
13662
13663/* vec_any_numeric */
13664
13665static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000013666vec_any_numeric(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +000013667{
David Blaikie3302f2b2013-01-16 23:08:36 +000013668 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000013669}
13670
13671/* vec_any_out */
13672
13673static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000013674vec_any_out(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000013675{
David Blaikie3302f2b2013-01-16 23:08:36 +000013676 return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000013677}
13678
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000013679/* Power 8 Crypto functions
13680Note: We diverge from the current GCC implementation with regard
13681to cryptography and related functions as follows:
13682- Only the SHA and AES instructions and builtins are disabled by -mno-crypto
13683- The remaining ones are only available on Power8 and up so
13684 require -mpower8-vector
13685The justification for this is that export requirements require that
13686Category:Vector.Crypto is optional (i.e. compliant hardware may not provide
13687support). As a result, we need to be able to turn off support for those.
13688The remaining ones (currently controlled by -mcrypto for GCC) still
13689need to be provided on compliant hardware even if Vector.Crypto is not
13690provided.
13691FIXME: the naming convention for the builtins will be adjusted due
13692to the inconsistency (__builtin_crypto_ prefix on builtins that cannot be
13693removed with -mno-crypto). This is under development.
13694*/
13695#ifdef __CRYPTO__
13696static vector unsigned long long __attribute__((__always_inline__))
13697__builtin_crypto_vsbox (vector unsigned long long __a)
13698{
13699 return __builtin_altivec_crypto_vsbox(__a);
13700}
13701
13702static vector unsigned long long __attribute__((__always_inline__))
13703__builtin_crypto_vcipher (vector unsigned long long __a,
13704 vector unsigned long long __b)
13705{
13706 return __builtin_altivec_crypto_vcipher(__a, __b);
13707}
13708
13709static vector unsigned long long __attribute__((__always_inline__))
13710__builtin_crypto_vcipherlast (vector unsigned long long __a,
13711 vector unsigned long long __b)
13712{
13713 return __builtin_altivec_crypto_vcipherlast(__a, __b);
13714}
13715
13716static vector unsigned long long __attribute__((__always_inline__))
13717__builtin_crypto_vncipher (vector unsigned long long __a,
13718 vector unsigned long long __b)
13719{
13720 return __builtin_altivec_crypto_vncipher(__a, __b);
13721}
13722
13723static vector unsigned long long __attribute__((__always_inline__))
13724__builtin_crypto_vncipherlast (vector unsigned long long __a,
13725 vector unsigned long long __b)
13726{
13727 return __builtin_altivec_crypto_vncipherlast(__a, __b);
13728}
13729
13730
13731#define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad
13732#define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw
13733#endif
13734
13735#ifdef __POWER8_VECTOR__
13736static vector unsigned char __ATTRS_o_ai
13737__builtin_crypto_vpermxor (vector unsigned char __a,
13738 vector unsigned char __b,
13739 vector unsigned char __c)
13740{
13741 return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
13742}
13743
13744static vector unsigned short __ATTRS_o_ai
13745__builtin_crypto_vpermxor (vector unsigned short __a,
13746 vector unsigned short __b,
13747 vector unsigned short __c)
13748{
13749 return (vector unsigned short)
13750 __builtin_altivec_crypto_vpermxor((vector unsigned char) __a,
13751 (vector unsigned char) __b,
13752 (vector unsigned char) __c);
13753}
13754
13755static vector unsigned int __ATTRS_o_ai
13756__builtin_crypto_vpermxor (vector unsigned int __a,
13757 vector unsigned int __b,
13758 vector unsigned int __c)
13759{
13760 return (vector unsigned int)
13761 __builtin_altivec_crypto_vpermxor((vector unsigned char) __a,
13762 (vector unsigned char) __b,
13763 (vector unsigned char) __c);
13764}
13765
13766static vector unsigned long long __ATTRS_o_ai
13767__builtin_crypto_vpermxor (vector unsigned long long __a,
13768 vector unsigned long long __b,
13769 vector unsigned long long __c)
13770{
13771 return (vector unsigned long long)
13772 __builtin_altivec_crypto_vpermxor((vector unsigned char) __a,
13773 (vector unsigned char) __b,
13774 (vector unsigned char) __c);
13775}
13776
13777static vector unsigned char __ATTRS_o_ai
13778__builtin_crypto_vpmsumb (vector unsigned char __a,
13779 vector unsigned char __b)
13780{
13781 return __builtin_altivec_crypto_vpmsumb(__a, __b);
13782}
13783
13784static vector unsigned short __ATTRS_o_ai
13785__builtin_crypto_vpmsumb (vector unsigned short __a,
13786 vector unsigned short __b)
13787{
13788 return __builtin_altivec_crypto_vpmsumh(__a, __b);
13789}
13790
13791static vector unsigned int __ATTRS_o_ai
13792__builtin_crypto_vpmsumb (vector unsigned int __a,
13793 vector unsigned int __b)
13794{
13795 return __builtin_altivec_crypto_vpmsumw(__a, __b);
13796}
13797
13798static vector unsigned long long __ATTRS_o_ai
13799__builtin_crypto_vpmsumb (vector unsigned long long __a,
13800 vector unsigned long long __b)
13801{
13802 return __builtin_altivec_crypto_vpmsumd(__a, __b);
13803}
13804#endif
13805
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000013806#undef __ATTRS_o_ai
Chris Lattnerdad40622010-04-14 03:54:58 +000013807
13808#endif /* __ALTIVEC_H */