blob: 48cc44c2ca283b66121cb06c97a25e3694effebb [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 Schmidtf7e289c2014-06-05 19:07:40 +000076static vector unsigned char __ATTRS_o_ai
77vec_xor(vector unsigned char __a, vector unsigned char __b);
78
Chris Lattnerdad40622010-04-14 03:54:58 +000079/* vec_abs */
80
Chris Lattnerdad40622010-04-14 03:54:58 +000081#define __builtin_altivec_abs_v16qi vec_abs
82#define __builtin_altivec_abs_v8hi vec_abs
83#define __builtin_altivec_abs_v4si vec_abs
84
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000085static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000086vec_abs(vector signed char __a)
Chris Lattnerdad40622010-04-14 03:54:58 +000087{
David Blaikie3302f2b2013-01-16 23:08:36 +000088 return __builtin_altivec_vmaxsb(__a, -__a);
Chris Lattnerdad40622010-04-14 03:54:58 +000089}
90
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000091static vector signed short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000092vec_abs(vector signed short __a)
Chris Lattnerdad40622010-04-14 03:54:58 +000093{
David Blaikie3302f2b2013-01-16 23:08:36 +000094 return __builtin_altivec_vmaxsh(__a, -__a);
Chris Lattnerdad40622010-04-14 03:54:58 +000095}
96
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000097static vector signed int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000098vec_abs(vector signed int __a)
Chris Lattnerdad40622010-04-14 03:54:58 +000099{
David Blaikie3302f2b2013-01-16 23:08:36 +0000100 return __builtin_altivec_vmaxsw(__a, -__a);
Chris Lattnerdad40622010-04-14 03:54:58 +0000101}
102
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000103static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000104vec_abs(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +0000105{
David Blaikie3302f2b2013-01-16 23:08:36 +0000106 vector unsigned int __res = (vector unsigned int)__a
Anton Yartsev79d6af32010-09-18 00:39:16 +0000107 & (vector unsigned int)(0x7FFFFFFF);
David Blaikie3302f2b2013-01-16 23:08:36 +0000108 return (vector float)__res;
Chris Lattnerdad40622010-04-14 03:54:58 +0000109}
110
111/* vec_abss */
112
Chris Lattnerdad40622010-04-14 03:54:58 +0000113#define __builtin_altivec_abss_v16qi vec_abss
114#define __builtin_altivec_abss_v8hi vec_abss
115#define __builtin_altivec_abss_v4si vec_abss
116
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000117static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000118vec_abss(vector signed char __a)
Chris Lattnerdad40622010-04-14 03:54:58 +0000119{
Anton Yartsev79d6af32010-09-18 00:39:16 +0000120 return __builtin_altivec_vmaxsb
David Blaikie3302f2b2013-01-16 23:08:36 +0000121 (__a, __builtin_altivec_vsubsbs((vector signed char)(0), __a));
Chris Lattnerdad40622010-04-14 03:54:58 +0000122}
123
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000124static vector signed short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000125vec_abss(vector signed short __a)
Chris Lattnerdad40622010-04-14 03:54:58 +0000126{
Anton Yartsev79d6af32010-09-18 00:39:16 +0000127 return __builtin_altivec_vmaxsh
David Blaikie3302f2b2013-01-16 23:08:36 +0000128 (__a, __builtin_altivec_vsubshs((vector signed short)(0), __a));
Chris Lattnerdad40622010-04-14 03:54:58 +0000129}
130
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000131static vector signed int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000132vec_abss(vector signed int __a)
Chris Lattnerdad40622010-04-14 03:54:58 +0000133{
Anton Yartsev79d6af32010-09-18 00:39:16 +0000134 return __builtin_altivec_vmaxsw
David Blaikie3302f2b2013-01-16 23:08:36 +0000135 (__a, __builtin_altivec_vsubsws((vector signed int)(0), __a));
Chris Lattnerdad40622010-04-14 03:54:58 +0000136}
137
138/* vec_add */
139
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000140static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000141vec_add(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000142{
David Blaikie3302f2b2013-01-16 23:08:36 +0000143 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000144}
145
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000146static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000147vec_add(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000148{
David Blaikie3302f2b2013-01-16 23:08:36 +0000149 return (vector signed char)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000150}
151
152static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000153vec_add(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000154{
David Blaikie3302f2b2013-01-16 23:08:36 +0000155 return __a + (vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000156}
157
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000158static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000159vec_add(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000160{
David Blaikie3302f2b2013-01-16 23:08:36 +0000161 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000162}
163
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000164static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000165vec_add(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000166{
David Blaikie3302f2b2013-01-16 23:08:36 +0000167 return (vector unsigned char)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000168}
169
170static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000171vec_add(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000172{
David Blaikie3302f2b2013-01-16 23:08:36 +0000173 return __a + (vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000174}
175
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000176static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000177vec_add(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000178{
David Blaikie3302f2b2013-01-16 23:08:36 +0000179 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000180}
181
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000182static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000183vec_add(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000184{
David Blaikie3302f2b2013-01-16 23:08:36 +0000185 return (vector short)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000186}
187
188static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000189vec_add(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000190{
David Blaikie3302f2b2013-01-16 23:08:36 +0000191 return __a + (vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000192}
193
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000194static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000195vec_add(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000196{
David Blaikie3302f2b2013-01-16 23:08:36 +0000197 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000198}
199
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000200static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000201vec_add(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000202{
David Blaikie3302f2b2013-01-16 23:08:36 +0000203 return (vector unsigned short)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000204}
205
206static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000207vec_add(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000208{
David Blaikie3302f2b2013-01-16 23:08:36 +0000209 return __a + (vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000210}
211
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000212static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000213vec_add(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000214{
David Blaikie3302f2b2013-01-16 23:08:36 +0000215 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000216}
217
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000218static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000219vec_add(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000220{
David Blaikie3302f2b2013-01-16 23:08:36 +0000221 return (vector int)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000222}
223
224static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000225vec_add(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000226{
David Blaikie3302f2b2013-01-16 23:08:36 +0000227 return __a + (vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000228}
229
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000230static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000231vec_add(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000232{
David Blaikie3302f2b2013-01-16 23:08:36 +0000233 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000234}
235
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000236static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000237vec_add(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000238{
David Blaikie3302f2b2013-01-16 23:08:36 +0000239 return (vector unsigned int)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000240}
241
242static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000243vec_add(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000244{
David Blaikie3302f2b2013-01-16 23:08:36 +0000245 return __a + (vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000246}
247
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000248static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000249vec_add(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000250{
David Blaikie3302f2b2013-01-16 23:08:36 +0000251 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000252}
253
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000254/* vec_vaddubm */
255
256#define __builtin_altivec_vaddubm vec_vaddubm
257
258static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000259vec_vaddubm(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000260{
David Blaikie3302f2b2013-01-16 23:08:36 +0000261 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000262}
263
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000264static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000265vec_vaddubm(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000266{
David Blaikie3302f2b2013-01-16 23:08:36 +0000267 return (vector signed char)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000268}
269
270static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000271vec_vaddubm(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000272{
David Blaikie3302f2b2013-01-16 23:08:36 +0000273 return __a + (vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000274}
275
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000276static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000277vec_vaddubm(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000278{
David Blaikie3302f2b2013-01-16 23:08:36 +0000279 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000280}
281
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000282static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000283vec_vaddubm(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000284{
David Blaikie3302f2b2013-01-16 23:08:36 +0000285 return (vector unsigned char)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000286}
287
288static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000289vec_vaddubm(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000290{
David Blaikie3302f2b2013-01-16 23:08:36 +0000291 return __a + (vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000292}
293
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000294/* vec_vadduhm */
295
296#define __builtin_altivec_vadduhm vec_vadduhm
297
298static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000299vec_vadduhm(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000300{
David Blaikie3302f2b2013-01-16 23:08:36 +0000301 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000302}
303
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000304static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000305vec_vadduhm(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000306{
David Blaikie3302f2b2013-01-16 23:08:36 +0000307 return (vector short)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000308}
309
310static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000311vec_vadduhm(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000312{
David Blaikie3302f2b2013-01-16 23:08:36 +0000313 return __a + (vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000314}
315
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000316static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000317vec_vadduhm(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000318{
David Blaikie3302f2b2013-01-16 23:08:36 +0000319 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000320}
321
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000322static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000323vec_vadduhm(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000324{
David Blaikie3302f2b2013-01-16 23:08:36 +0000325 return (vector unsigned short)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000326}
327
328static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000329vec_vadduhm(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000330{
David Blaikie3302f2b2013-01-16 23:08:36 +0000331 return __a + (vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000332}
333
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000334/* vec_vadduwm */
335
336#define __builtin_altivec_vadduwm vec_vadduwm
337
338static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000339vec_vadduwm(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000340{
David Blaikie3302f2b2013-01-16 23:08:36 +0000341 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000342}
343
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000344static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000345vec_vadduwm(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000346{
David Blaikie3302f2b2013-01-16 23:08:36 +0000347 return (vector int)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000348}
349
350static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000351vec_vadduwm(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000352{
David Blaikie3302f2b2013-01-16 23:08:36 +0000353 return __a + (vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000354}
355
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000356static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000357vec_vadduwm(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000358{
David Blaikie3302f2b2013-01-16 23:08:36 +0000359 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000360}
361
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000362static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000363vec_vadduwm(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000364{
David Blaikie3302f2b2013-01-16 23:08:36 +0000365 return (vector unsigned int)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000366}
367
368static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000369vec_vadduwm(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000370{
David Blaikie3302f2b2013-01-16 23:08:36 +0000371 return __a + (vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000372}
373
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000374/* vec_vaddfp */
375
376#define __builtin_altivec_vaddfp vec_vaddfp
377
378static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +0000379vec_vaddfp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000380{
David Blaikie3302f2b2013-01-16 23:08:36 +0000381 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000382}
383
Chris Lattnerdad40622010-04-14 03:54:58 +0000384/* vec_addc */
385
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000386static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +0000387vec_addc(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000388{
David Blaikie3302f2b2013-01-16 23:08:36 +0000389 return __builtin_altivec_vaddcuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000390}
391
392/* vec_vaddcuw */
393
394static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +0000395vec_vaddcuw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000396{
David Blaikie3302f2b2013-01-16 23:08:36 +0000397 return __builtin_altivec_vaddcuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000398}
Chris Lattnerdad40622010-04-14 03:54:58 +0000399
400/* vec_adds */
401
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000402static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000403vec_adds(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000404{
David Blaikie3302f2b2013-01-16 23:08:36 +0000405 return __builtin_altivec_vaddsbs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000406}
407
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000408static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000409vec_adds(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000410{
David Blaikie3302f2b2013-01-16 23:08:36 +0000411 return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000412}
413
414static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000415vec_adds(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000416{
David Blaikie3302f2b2013-01-16 23:08:36 +0000417 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000418}
419
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000420static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000421vec_adds(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000422{
David Blaikie3302f2b2013-01-16 23:08:36 +0000423 return __builtin_altivec_vaddubs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000424}
425
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000426static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000427vec_adds(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000428{
David Blaikie3302f2b2013-01-16 23:08:36 +0000429 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000430}
431
432static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000433vec_adds(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000434{
David Blaikie3302f2b2013-01-16 23:08:36 +0000435 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000436}
437
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000438static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000439vec_adds(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000440{
David Blaikie3302f2b2013-01-16 23:08:36 +0000441 return __builtin_altivec_vaddshs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000442}
443
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000444static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000445vec_adds(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000446{
David Blaikie3302f2b2013-01-16 23:08:36 +0000447 return __builtin_altivec_vaddshs((vector short)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000448}
449
450static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000451vec_adds(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000452{
David Blaikie3302f2b2013-01-16 23:08:36 +0000453 return __builtin_altivec_vaddshs(__a, (vector short)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000454}
455
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000456static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000457vec_adds(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000458{
David Blaikie3302f2b2013-01-16 23:08:36 +0000459 return __builtin_altivec_vadduhs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000460}
461
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000462static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000463vec_adds(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000464{
David Blaikie3302f2b2013-01-16 23:08:36 +0000465 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000466}
467
468static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000469vec_adds(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000470{
David Blaikie3302f2b2013-01-16 23:08:36 +0000471 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000472}
473
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000474static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000475vec_adds(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000476{
David Blaikie3302f2b2013-01-16 23:08:36 +0000477 return __builtin_altivec_vaddsws(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000478}
479
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000480static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000481vec_adds(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000482{
David Blaikie3302f2b2013-01-16 23:08:36 +0000483 return __builtin_altivec_vaddsws((vector int)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000484}
485
486static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000487vec_adds(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000488{
David Blaikie3302f2b2013-01-16 23:08:36 +0000489 return __builtin_altivec_vaddsws(__a, (vector int)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000490}
491
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000492static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000493vec_adds(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000494{
David Blaikie3302f2b2013-01-16 23:08:36 +0000495 return __builtin_altivec_vadduws(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000496}
497
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000498static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000499vec_adds(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000500{
David Blaikie3302f2b2013-01-16 23:08:36 +0000501 return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000502}
503
504static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000505vec_adds(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000506{
David Blaikie3302f2b2013-01-16 23:08:36 +0000507 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000508}
509
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000510/* vec_vaddsbs */
Chris Lattnerdad40622010-04-14 03:54:58 +0000511
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000512static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000513vec_vaddsbs(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000514{
David Blaikie3302f2b2013-01-16 23:08:36 +0000515 return __builtin_altivec_vaddsbs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000516}
517
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000518static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000519vec_vaddsbs(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000520{
David Blaikie3302f2b2013-01-16 23:08:36 +0000521 return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000522}
523
524static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000525vec_vaddsbs(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000526{
David Blaikie3302f2b2013-01-16 23:08:36 +0000527 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000528}
529
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000530/* vec_vaddubs */
531
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000532static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000533vec_vaddubs(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000534{
David Blaikie3302f2b2013-01-16 23:08:36 +0000535 return __builtin_altivec_vaddubs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000536}
537
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000538static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000539vec_vaddubs(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000540{
David Blaikie3302f2b2013-01-16 23:08:36 +0000541 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000542}
543
544static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000545vec_vaddubs(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000546{
David Blaikie3302f2b2013-01-16 23:08:36 +0000547 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000548}
549
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000550/* vec_vaddshs */
551
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000552static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000553vec_vaddshs(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000554{
David Blaikie3302f2b2013-01-16 23:08:36 +0000555 return __builtin_altivec_vaddshs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000556}
557
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000558static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000559vec_vaddshs(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000560{
David Blaikie3302f2b2013-01-16 23:08:36 +0000561 return __builtin_altivec_vaddshs((vector short)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000562}
563
564static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000565vec_vaddshs(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000566{
David Blaikie3302f2b2013-01-16 23:08:36 +0000567 return __builtin_altivec_vaddshs(__a, (vector short)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000568}
569
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000570/* vec_vadduhs */
571
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000572static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000573vec_vadduhs(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000574{
David Blaikie3302f2b2013-01-16 23:08:36 +0000575 return __builtin_altivec_vadduhs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000576}
577
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000578static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000579vec_vadduhs(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000580{
David Blaikie3302f2b2013-01-16 23:08:36 +0000581 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000582}
583
584static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000585vec_vadduhs(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000586{
David Blaikie3302f2b2013-01-16 23:08:36 +0000587 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000588}
589
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000590/* vec_vaddsws */
591
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000592static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000593vec_vaddsws(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000594{
David Blaikie3302f2b2013-01-16 23:08:36 +0000595 return __builtin_altivec_vaddsws(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000596}
597
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000598static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000599vec_vaddsws(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000600{
David Blaikie3302f2b2013-01-16 23:08:36 +0000601 return __builtin_altivec_vaddsws((vector int)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000602}
603
604static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000605vec_vaddsws(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000606{
David Blaikie3302f2b2013-01-16 23:08:36 +0000607 return __builtin_altivec_vaddsws(__a, (vector int)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000608}
609
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000610/* vec_vadduws */
611
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000612static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000613vec_vadduws(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000614{
David Blaikie3302f2b2013-01-16 23:08:36 +0000615 return __builtin_altivec_vadduws(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000616}
617
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000618static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000619vec_vadduws(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000620{
David Blaikie3302f2b2013-01-16 23:08:36 +0000621 return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000622}
623
624static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000625vec_vadduws(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000626{
David Blaikie3302f2b2013-01-16 23:08:36 +0000627 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000628}
629
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000630/* vec_and */
631
632#define __builtin_altivec_vand vec_and
633
634static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000635vec_and(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000636{
David Blaikie3302f2b2013-01-16 23:08:36 +0000637 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000638}
639
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000640static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000641vec_and(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000642{
David Blaikie3302f2b2013-01-16 23:08:36 +0000643 return (vector signed char)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000644}
645
646static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000647vec_and(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000648{
David Blaikie3302f2b2013-01-16 23:08:36 +0000649 return __a & (vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000650}
651
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000652static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000653vec_and(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000654{
David Blaikie3302f2b2013-01-16 23:08:36 +0000655 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000656}
657
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000658static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000659vec_and(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000660{
David Blaikie3302f2b2013-01-16 23:08:36 +0000661 return (vector unsigned char)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000662}
663
664static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000665vec_and(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000666{
David Blaikie3302f2b2013-01-16 23:08:36 +0000667 return __a & (vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000668}
669
670static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000671vec_and(vector bool char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000672{
David Blaikie3302f2b2013-01-16 23:08:36 +0000673 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000674}
675
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000676static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000677vec_and(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000678{
David Blaikie3302f2b2013-01-16 23:08:36 +0000679 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000680}
681
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000682static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000683vec_and(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000684{
David Blaikie3302f2b2013-01-16 23:08:36 +0000685 return (vector short)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000686}
687
688static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000689vec_and(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000690{
David Blaikie3302f2b2013-01-16 23:08:36 +0000691 return __a & (vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000692}
693
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000694static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000695vec_and(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000696{
David Blaikie3302f2b2013-01-16 23:08:36 +0000697 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000698}
699
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000700static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000701vec_and(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000702{
David Blaikie3302f2b2013-01-16 23:08:36 +0000703 return (vector unsigned short)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000704}
705
706static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000707vec_and(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000708{
David Blaikie3302f2b2013-01-16 23:08:36 +0000709 return __a & (vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000710}
711
712static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000713vec_and(vector bool short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000714{
David Blaikie3302f2b2013-01-16 23:08:36 +0000715 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000716}
717
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000718static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000719vec_and(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000720{
David Blaikie3302f2b2013-01-16 23:08:36 +0000721 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000722}
723
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000724static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000725vec_and(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000726{
David Blaikie3302f2b2013-01-16 23:08:36 +0000727 return (vector int)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000728}
729
730static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000731vec_and(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000732{
David Blaikie3302f2b2013-01-16 23:08:36 +0000733 return __a & (vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000734}
735
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000736static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000737vec_and(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000738{
David Blaikie3302f2b2013-01-16 23:08:36 +0000739 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000740}
741
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000742static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000743vec_and(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000744{
David Blaikie3302f2b2013-01-16 23:08:36 +0000745 return (vector unsigned int)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000746}
747
748static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000749vec_and(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000750{
David Blaikie3302f2b2013-01-16 23:08:36 +0000751 return __a & (vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000752}
753
754static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000755vec_and(vector bool int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000756{
David Blaikie3302f2b2013-01-16 23:08:36 +0000757 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000758}
759
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000760static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000761vec_and(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000762{
David Blaikie3302f2b2013-01-16 23:08:36 +0000763 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
764 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000765}
766
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000767static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000768vec_and(vector bool int __a, vector float __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000769{
David Blaikie3302f2b2013-01-16 23:08:36 +0000770 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
771 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000772}
773
774static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000775vec_and(vector float __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000776{
David Blaikie3302f2b2013-01-16 23:08:36 +0000777 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
778 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000779}
780
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000781/* vec_vand */
782
783static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000784vec_vand(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000785{
David Blaikie3302f2b2013-01-16 23:08:36 +0000786 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000787}
788
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000789static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000790vec_vand(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000791{
David Blaikie3302f2b2013-01-16 23:08:36 +0000792 return (vector signed char)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000793}
794
795static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000796vec_vand(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000797{
David Blaikie3302f2b2013-01-16 23:08:36 +0000798 return __a & (vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000799}
800
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000801static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000802vec_vand(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000803{
David Blaikie3302f2b2013-01-16 23:08:36 +0000804 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000805}
806
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000807static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000808vec_vand(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000809{
David Blaikie3302f2b2013-01-16 23:08:36 +0000810 return (vector unsigned char)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000811}
812
813static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000814vec_vand(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000815{
David Blaikie3302f2b2013-01-16 23:08:36 +0000816 return __a & (vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000817}
818
819static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000820vec_vand(vector bool char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000821{
David Blaikie3302f2b2013-01-16 23:08:36 +0000822 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000823}
824
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000825static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000826vec_vand(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000827{
David Blaikie3302f2b2013-01-16 23:08:36 +0000828 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000829}
830
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000831static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000832vec_vand(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000833{
David Blaikie3302f2b2013-01-16 23:08:36 +0000834 return (vector short)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000835}
836
837static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000838vec_vand(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000839{
David Blaikie3302f2b2013-01-16 23:08:36 +0000840 return __a & (vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000841}
842
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000843static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000844vec_vand(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000845{
David Blaikie3302f2b2013-01-16 23:08:36 +0000846 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000847}
848
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000849static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000850vec_vand(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000851{
David Blaikie3302f2b2013-01-16 23:08:36 +0000852 return (vector unsigned short)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000853}
854
855static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000856vec_vand(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000857{
David Blaikie3302f2b2013-01-16 23:08:36 +0000858 return __a & (vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000859}
860
861static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000862vec_vand(vector bool short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000863{
David Blaikie3302f2b2013-01-16 23:08:36 +0000864 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000865}
866
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000867static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000868vec_vand(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000869{
David Blaikie3302f2b2013-01-16 23:08:36 +0000870 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000871}
872
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000873static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000874vec_vand(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000875{
David Blaikie3302f2b2013-01-16 23:08:36 +0000876 return (vector int)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000877}
878
879static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000880vec_vand(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000881{
David Blaikie3302f2b2013-01-16 23:08:36 +0000882 return __a & (vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000883}
884
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000885static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000886vec_vand(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000887{
David Blaikie3302f2b2013-01-16 23:08:36 +0000888 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000889}
890
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000891static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000892vec_vand(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000893{
David Blaikie3302f2b2013-01-16 23:08:36 +0000894 return (vector unsigned int)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000895}
896
897static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000898vec_vand(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000899{
David Blaikie3302f2b2013-01-16 23:08:36 +0000900 return __a & (vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000901}
902
903static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000904vec_vand(vector bool int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000905{
David Blaikie3302f2b2013-01-16 23:08:36 +0000906 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000907}
908
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000909static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000910vec_vand(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000911{
David Blaikie3302f2b2013-01-16 23:08:36 +0000912 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
913 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000914}
915
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000916static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000917vec_vand(vector bool int __a, vector float __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000918{
David Blaikie3302f2b2013-01-16 23:08:36 +0000919 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
920 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000921}
922
923static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000924vec_vand(vector float __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000925{
David Blaikie3302f2b2013-01-16 23:08:36 +0000926 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
927 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000928}
929
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000930/* vec_andc */
931
932#define __builtin_altivec_vandc vec_andc
933
934static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000935vec_andc(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000936{
David Blaikie3302f2b2013-01-16 23:08:36 +0000937 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000938}
939
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000940static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000941vec_andc(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000942{
David Blaikie3302f2b2013-01-16 23:08:36 +0000943 return (vector signed char)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000944}
945
946static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000947vec_andc(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000948{
David Blaikie3302f2b2013-01-16 23:08:36 +0000949 return __a & ~(vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000950}
951
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000952static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000953vec_andc(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000954{
David Blaikie3302f2b2013-01-16 23:08:36 +0000955 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000956}
957
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000958static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000959vec_andc(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000960{
David Blaikie3302f2b2013-01-16 23:08:36 +0000961 return (vector unsigned char)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000962}
963
964static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000965vec_andc(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000966{
David Blaikie3302f2b2013-01-16 23:08:36 +0000967 return __a & ~(vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000968}
969
970static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000971vec_andc(vector bool char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000972{
David Blaikie3302f2b2013-01-16 23:08:36 +0000973 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000974}
975
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000976static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000977vec_andc(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000978{
David Blaikie3302f2b2013-01-16 23:08:36 +0000979 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000980}
981
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000982static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000983vec_andc(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000984{
David Blaikie3302f2b2013-01-16 23:08:36 +0000985 return (vector short)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000986}
987
988static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000989vec_andc(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000990{
David Blaikie3302f2b2013-01-16 23:08:36 +0000991 return __a & ~(vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000992}
993
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000994static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000995vec_andc(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000996{
David Blaikie3302f2b2013-01-16 23:08:36 +0000997 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000998}
999
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001000static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001001vec_andc(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001002{
David Blaikie3302f2b2013-01-16 23:08:36 +00001003 return (vector unsigned short)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001004}
1005
1006static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001007vec_andc(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001008{
David Blaikie3302f2b2013-01-16 23:08:36 +00001009 return __a & ~(vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001010}
1011
1012static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001013vec_andc(vector bool short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001014{
David Blaikie3302f2b2013-01-16 23:08:36 +00001015 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001016}
1017
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001018static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001019vec_andc(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001020{
David Blaikie3302f2b2013-01-16 23:08:36 +00001021 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001022}
1023
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001024static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001025vec_andc(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001026{
David Blaikie3302f2b2013-01-16 23:08:36 +00001027 return (vector int)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001028}
1029
1030static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001031vec_andc(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001032{
David Blaikie3302f2b2013-01-16 23:08:36 +00001033 return __a & ~(vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001034}
1035
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001036static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001037vec_andc(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001038{
David Blaikie3302f2b2013-01-16 23:08:36 +00001039 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001040}
1041
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001042static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001043vec_andc(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001044{
David Blaikie3302f2b2013-01-16 23:08:36 +00001045 return (vector unsigned int)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001046}
1047
1048static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001049vec_andc(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001050{
David Blaikie3302f2b2013-01-16 23:08:36 +00001051 return __a & ~(vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001052}
1053
1054static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001055vec_andc(vector bool int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001056{
David Blaikie3302f2b2013-01-16 23:08:36 +00001057 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001058}
1059
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001060static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001061vec_andc(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001062{
David Blaikie3302f2b2013-01-16 23:08:36 +00001063 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1064 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001065}
1066
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001067static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001068vec_andc(vector bool int __a, vector float __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001069{
David Blaikie3302f2b2013-01-16 23:08:36 +00001070 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1071 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001072}
1073
1074static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001075vec_andc(vector float __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001076{
David Blaikie3302f2b2013-01-16 23:08:36 +00001077 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1078 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001079}
1080
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001081/* vec_vandc */
1082
1083static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001084vec_vandc(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001085{
David Blaikie3302f2b2013-01-16 23:08:36 +00001086 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001087}
1088
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001089static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001090vec_vandc(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001091{
David Blaikie3302f2b2013-01-16 23:08:36 +00001092 return (vector signed char)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001093}
1094
1095static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001096vec_vandc(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001097{
David Blaikie3302f2b2013-01-16 23:08:36 +00001098 return __a & ~(vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001099}
1100
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001101static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001102vec_vandc(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001103{
David Blaikie3302f2b2013-01-16 23:08:36 +00001104 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001105}
1106
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001107static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001108vec_vandc(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001109{
David Blaikie3302f2b2013-01-16 23:08:36 +00001110 return (vector unsigned char)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001111}
1112
1113static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001114vec_vandc(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001115{
David Blaikie3302f2b2013-01-16 23:08:36 +00001116 return __a & ~(vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001117}
1118
1119static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001120vec_vandc(vector bool char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001121{
David Blaikie3302f2b2013-01-16 23:08:36 +00001122 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001123}
1124
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001125static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001126vec_vandc(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001127{
David Blaikie3302f2b2013-01-16 23:08:36 +00001128 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001129}
1130
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001131static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001132vec_vandc(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001133{
David Blaikie3302f2b2013-01-16 23:08:36 +00001134 return (vector short)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001135}
1136
1137static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001138vec_vandc(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001139{
David Blaikie3302f2b2013-01-16 23:08:36 +00001140 return __a & ~(vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001141}
1142
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001143static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001144vec_vandc(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001145{
David Blaikie3302f2b2013-01-16 23:08:36 +00001146 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001147}
1148
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001149static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001150vec_vandc(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001151{
David Blaikie3302f2b2013-01-16 23:08:36 +00001152 return (vector unsigned short)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001153}
1154
1155static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001156vec_vandc(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001157{
David Blaikie3302f2b2013-01-16 23:08:36 +00001158 return __a & ~(vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001159}
1160
1161static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001162vec_vandc(vector bool short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001163{
David Blaikie3302f2b2013-01-16 23:08:36 +00001164 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001165}
1166
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001167static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001168vec_vandc(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001169{
David Blaikie3302f2b2013-01-16 23:08:36 +00001170 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001171}
1172
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001173static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001174vec_vandc(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001175{
David Blaikie3302f2b2013-01-16 23:08:36 +00001176 return (vector int)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001177}
1178
1179static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001180vec_vandc(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001181{
David Blaikie3302f2b2013-01-16 23:08:36 +00001182 return __a & ~(vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001183}
1184
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001185static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001186vec_vandc(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001187{
David Blaikie3302f2b2013-01-16 23:08:36 +00001188 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001189}
1190
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001191static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001192vec_vandc(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001193{
David Blaikie3302f2b2013-01-16 23:08:36 +00001194 return (vector unsigned int)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001195}
1196
1197static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001198vec_vandc(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001199{
David Blaikie3302f2b2013-01-16 23:08:36 +00001200 return __a & ~(vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001201}
1202
1203static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001204vec_vandc(vector bool int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001205{
David Blaikie3302f2b2013-01-16 23:08:36 +00001206 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001207}
1208
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001209static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001210vec_vandc(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001211{
David Blaikie3302f2b2013-01-16 23:08:36 +00001212 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1213 return (vector float)__res;
Chris Lattnerdad40622010-04-14 03:54:58 +00001214}
1215
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001216static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001217vec_vandc(vector bool int __a, vector float __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001218{
David Blaikie3302f2b2013-01-16 23:08:36 +00001219 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1220 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001221}
1222
1223static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001224vec_vandc(vector float __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001225{
David Blaikie3302f2b2013-01-16 23:08:36 +00001226 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1227 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001228}
1229
Chris Lattnerdad40622010-04-14 03:54:58 +00001230/* vec_avg */
1231
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001232static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001233vec_avg(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001234{
David Blaikie3302f2b2013-01-16 23:08:36 +00001235 return __builtin_altivec_vavgsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001236}
1237
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001238static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001239vec_avg(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001240{
David Blaikie3302f2b2013-01-16 23:08:36 +00001241 return __builtin_altivec_vavgub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001242}
1243
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001244static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001245vec_avg(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001246{
David Blaikie3302f2b2013-01-16 23:08:36 +00001247 return __builtin_altivec_vavgsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001248}
1249
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001250static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001251vec_avg(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001252{
David Blaikie3302f2b2013-01-16 23:08:36 +00001253 return __builtin_altivec_vavguh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001254}
1255
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001256static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001257vec_avg(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001258{
David Blaikie3302f2b2013-01-16 23:08:36 +00001259 return __builtin_altivec_vavgsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001260}
1261
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001262static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001263vec_avg(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001264{
David Blaikie3302f2b2013-01-16 23:08:36 +00001265 return __builtin_altivec_vavguw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001266}
1267
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001268/* vec_vavgsb */
Chris Lattnerdad40622010-04-14 03:54:58 +00001269
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001270static vector signed char __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001271vec_vavgsb(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001272{
David Blaikie3302f2b2013-01-16 23:08:36 +00001273 return __builtin_altivec_vavgsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001274}
1275
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001276/* vec_vavgub */
1277
1278static vector unsigned char __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001279vec_vavgub(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001280{
David Blaikie3302f2b2013-01-16 23:08:36 +00001281 return __builtin_altivec_vavgub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001282}
1283
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001284/* vec_vavgsh */
1285
1286static vector short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001287vec_vavgsh(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001288{
David Blaikie3302f2b2013-01-16 23:08:36 +00001289 return __builtin_altivec_vavgsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001290}
1291
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001292/* vec_vavguh */
1293
1294static vector unsigned short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001295vec_vavguh(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001296{
David Blaikie3302f2b2013-01-16 23:08:36 +00001297 return __builtin_altivec_vavguh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001298}
1299
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001300/* vec_vavgsw */
1301
1302static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001303vec_vavgsw(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001304{
David Blaikie3302f2b2013-01-16 23:08:36 +00001305 return __builtin_altivec_vavgsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001306}
1307
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001308/* vec_vavguw */
1309
1310static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001311vec_vavguw(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001312{
David Blaikie3302f2b2013-01-16 23:08:36 +00001313 return __builtin_altivec_vavguw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001314}
1315
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001316/* vec_ceil */
1317
1318static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001319vec_ceil(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +00001320{
David Blaikie3302f2b2013-01-16 23:08:36 +00001321 return __builtin_altivec_vrfip(__a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001322}
1323
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001324/* vec_vrfip */
Chris Lattnerdad40622010-04-14 03:54:58 +00001325
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001326static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001327vec_vrfip(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +00001328{
David Blaikie3302f2b2013-01-16 23:08:36 +00001329 return __builtin_altivec_vrfip(__a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001330}
1331
1332/* vec_cmpb */
1333
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001334static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001335vec_cmpb(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001336{
David Blaikie3302f2b2013-01-16 23:08:36 +00001337 return __builtin_altivec_vcmpbfp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001338}
1339
1340/* vec_vcmpbfp */
1341
1342static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001343vec_vcmpbfp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001344{
David Blaikie3302f2b2013-01-16 23:08:36 +00001345 return __builtin_altivec_vcmpbfp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001346}
Chris Lattnerdad40622010-04-14 03:54:58 +00001347
1348/* vec_cmpeq */
1349
Anton Yartsevfc83c602010-08-19 03:21:36 +00001350static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001351vec_cmpeq(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001352{
Anton Yartsevfc83c602010-08-19 03:21:36 +00001353 return (vector bool char)
David Blaikie3302f2b2013-01-16 23:08:36 +00001354 __builtin_altivec_vcmpequb((vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001355}
1356
Anton Yartsevfc83c602010-08-19 03:21:36 +00001357static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001358vec_cmpeq(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001359{
Anton Yartsevfc83c602010-08-19 03:21:36 +00001360 return (vector bool char)
David Blaikie3302f2b2013-01-16 23:08:36 +00001361 __builtin_altivec_vcmpequb((vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001362}
1363
Anton Yartsevfc83c602010-08-19 03:21:36 +00001364static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001365vec_cmpeq(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001366{
David Blaikie3302f2b2013-01-16 23:08:36 +00001367 return (vector bool short)__builtin_altivec_vcmpequh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001368}
1369
Anton Yartsevfc83c602010-08-19 03:21:36 +00001370static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001371vec_cmpeq(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001372{
Anton Yartsevfc83c602010-08-19 03:21:36 +00001373 return (vector bool short)
David Blaikie3302f2b2013-01-16 23:08:36 +00001374 __builtin_altivec_vcmpequh((vector short)__a, (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001375}
1376
Anton Yartsevfc83c602010-08-19 03:21:36 +00001377static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001378vec_cmpeq(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001379{
David Blaikie3302f2b2013-01-16 23:08:36 +00001380 return (vector bool int)__builtin_altivec_vcmpequw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001381}
1382
Anton Yartsevfc83c602010-08-19 03:21:36 +00001383static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001384vec_cmpeq(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001385{
Anton Yartsevfc83c602010-08-19 03:21:36 +00001386 return (vector bool int)
David Blaikie3302f2b2013-01-16 23:08:36 +00001387 __builtin_altivec_vcmpequw((vector int)__a, (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001388}
1389
Anton Yartsevfc83c602010-08-19 03:21:36 +00001390static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001391vec_cmpeq(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001392{
David Blaikie3302f2b2013-01-16 23:08:36 +00001393 return (vector bool int)__builtin_altivec_vcmpeqfp(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001394}
1395
1396/* vec_cmpge */
1397
Anton Yartsevfc83c602010-08-19 03:21:36 +00001398static vector bool int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001399vec_cmpge(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001400{
David Blaikie3302f2b2013-01-16 23:08:36 +00001401 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001402}
1403
1404/* vec_vcmpgefp */
1405
Anton Yartsevfc83c602010-08-19 03:21:36 +00001406static vector bool int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001407vec_vcmpgefp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001408{
David Blaikie3302f2b2013-01-16 23:08:36 +00001409 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001410}
Chris Lattnerdad40622010-04-14 03:54:58 +00001411
1412/* vec_cmpgt */
1413
Anton Yartsevfc83c602010-08-19 03:21:36 +00001414static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001415vec_cmpgt(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001416{
David Blaikie3302f2b2013-01-16 23:08:36 +00001417 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001418}
1419
Anton Yartsevfc83c602010-08-19 03:21:36 +00001420static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001421vec_cmpgt(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001422{
David Blaikie3302f2b2013-01-16 23:08:36 +00001423 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001424}
1425
Anton Yartsevfc83c602010-08-19 03:21:36 +00001426static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001427vec_cmpgt(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001428{
David Blaikie3302f2b2013-01-16 23:08:36 +00001429 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001430}
1431
Anton Yartsevfc83c602010-08-19 03:21:36 +00001432static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001433vec_cmpgt(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001434{
David Blaikie3302f2b2013-01-16 23:08:36 +00001435 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001436}
1437
Anton Yartsevfc83c602010-08-19 03:21:36 +00001438static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001439vec_cmpgt(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001440{
David Blaikie3302f2b2013-01-16 23:08:36 +00001441 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001442}
1443
Anton Yartsevfc83c602010-08-19 03:21:36 +00001444static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001445vec_cmpgt(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001446{
David Blaikie3302f2b2013-01-16 23:08:36 +00001447 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001448}
1449
Anton Yartsevfc83c602010-08-19 03:21:36 +00001450static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001451vec_cmpgt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001452{
David Blaikie3302f2b2013-01-16 23:08:36 +00001453 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001454}
1455
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001456/* vec_vcmpgtsb */
Chris Lattnerdad40622010-04-14 03:54:58 +00001457
Anton Yartsevfc83c602010-08-19 03:21:36 +00001458static vector bool char __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001459vec_vcmpgtsb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001460{
David Blaikie3302f2b2013-01-16 23:08:36 +00001461 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001462}
1463
1464/* vec_vcmpgtub */
1465
Anton Yartsevfc83c602010-08-19 03:21:36 +00001466static vector bool char __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001467vec_vcmpgtub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001468{
David Blaikie3302f2b2013-01-16 23:08:36 +00001469 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001470}
1471
1472/* vec_vcmpgtsh */
1473
Anton Yartsevfc83c602010-08-19 03:21:36 +00001474static vector bool short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001475vec_vcmpgtsh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001476{
David Blaikie3302f2b2013-01-16 23:08:36 +00001477 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001478}
1479
1480/* vec_vcmpgtuh */
1481
Anton Yartsevfc83c602010-08-19 03:21:36 +00001482static vector bool short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001483vec_vcmpgtuh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001484{
David Blaikie3302f2b2013-01-16 23:08:36 +00001485 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001486}
1487
1488/* vec_vcmpgtsw */
1489
Anton Yartsevfc83c602010-08-19 03:21:36 +00001490static vector bool int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001491vec_vcmpgtsw(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001492{
David Blaikie3302f2b2013-01-16 23:08:36 +00001493 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001494}
1495
1496/* vec_vcmpgtuw */
1497
Anton Yartsevfc83c602010-08-19 03:21:36 +00001498static vector bool int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001499vec_vcmpgtuw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001500{
David Blaikie3302f2b2013-01-16 23:08:36 +00001501 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001502}
1503
1504/* vec_vcmpgtfp */
1505
Anton Yartsevfc83c602010-08-19 03:21:36 +00001506static vector bool int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001507vec_vcmpgtfp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001508{
David Blaikie3302f2b2013-01-16 23:08:36 +00001509 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001510}
1511
1512/* vec_cmple */
Chris Lattnerdad40622010-04-14 03:54:58 +00001513
Anton Yartsevfc83c602010-08-19 03:21:36 +00001514static vector bool int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001515vec_cmple(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001516{
David Blaikie3302f2b2013-01-16 23:08:36 +00001517 return (vector bool int)__builtin_altivec_vcmpgefp(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001518}
1519
1520/* vec_cmplt */
1521
Anton Yartsevfc83c602010-08-19 03:21:36 +00001522static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001523vec_cmplt(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001524{
David Blaikie3302f2b2013-01-16 23:08:36 +00001525 return (vector bool char)__builtin_altivec_vcmpgtsb(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001526}
1527
Anton Yartsevfc83c602010-08-19 03:21:36 +00001528static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001529vec_cmplt(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001530{
David Blaikie3302f2b2013-01-16 23:08:36 +00001531 return (vector bool char)__builtin_altivec_vcmpgtub(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001532}
1533
Anton Yartsevfc83c602010-08-19 03:21:36 +00001534static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001535vec_cmplt(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001536{
David Blaikie3302f2b2013-01-16 23:08:36 +00001537 return (vector bool short)__builtin_altivec_vcmpgtsh(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001538}
1539
Anton Yartsevfc83c602010-08-19 03:21:36 +00001540static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001541vec_cmplt(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001542{
David Blaikie3302f2b2013-01-16 23:08:36 +00001543 return (vector bool short)__builtin_altivec_vcmpgtuh(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001544}
1545
Anton Yartsevfc83c602010-08-19 03:21:36 +00001546static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001547vec_cmplt(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001548{
David Blaikie3302f2b2013-01-16 23:08:36 +00001549 return (vector bool int)__builtin_altivec_vcmpgtsw(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001550}
1551
Anton Yartsevfc83c602010-08-19 03:21:36 +00001552static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001553vec_cmplt(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001554{
David Blaikie3302f2b2013-01-16 23:08:36 +00001555 return (vector bool int)__builtin_altivec_vcmpgtuw(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001556}
1557
Anton Yartsevfc83c602010-08-19 03:21:36 +00001558static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001559vec_cmplt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001560{
David Blaikie3302f2b2013-01-16 23:08:36 +00001561 return (vector bool int)__builtin_altivec_vcmpgtfp(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001562}
1563
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001564/* vec_ctf */
1565
1566static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001567vec_ctf(vector int __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001568{
David Blaikie3302f2b2013-01-16 23:08:36 +00001569 return __builtin_altivec_vcfsx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001570}
1571
1572static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001573vec_ctf(vector unsigned int __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001574{
David Blaikie3302f2b2013-01-16 23:08:36 +00001575 return __builtin_altivec_vcfux((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001576}
1577
1578/* vec_vcfsx */
1579
1580static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001581vec_vcfsx(vector int __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001582{
David Blaikie3302f2b2013-01-16 23:08:36 +00001583 return __builtin_altivec_vcfsx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001584}
1585
1586/* vec_vcfux */
1587
1588static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001589vec_vcfux(vector unsigned int __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001590{
David Blaikie3302f2b2013-01-16 23:08:36 +00001591 return __builtin_altivec_vcfux((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001592}
1593
1594/* vec_cts */
1595
1596static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001597vec_cts(vector float __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001598{
David Blaikie3302f2b2013-01-16 23:08:36 +00001599 return __builtin_altivec_vctsxs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001600}
1601
1602/* vec_vctsxs */
1603
1604static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001605vec_vctsxs(vector float __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001606{
David Blaikie3302f2b2013-01-16 23:08:36 +00001607 return __builtin_altivec_vctsxs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001608}
1609
1610/* vec_ctu */
1611
1612static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001613vec_ctu(vector float __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001614{
David Blaikie3302f2b2013-01-16 23:08:36 +00001615 return __builtin_altivec_vctuxs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001616}
1617
1618/* vec_vctuxs */
1619
1620static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001621vec_vctuxs(vector float __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001622{
David Blaikie3302f2b2013-01-16 23:08:36 +00001623 return __builtin_altivec_vctuxs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001624}
1625
Bill Schmidtcee13a22014-11-14 12:10:51 +00001626/* vec_div */
1627#ifdef __VSX__
1628static vector float __ATTRS_o_ai
1629vec_div(vector float __a, vector float __b)
1630{
1631 return __builtin_vsx_xvdivsp(__a, __b);
1632}
1633
1634static vector double __ATTRS_o_ai
1635vec_div(vector double __a, vector double __b)
1636{
1637 return __builtin_vsx_xvdivdp(__a, __b);
1638}
1639#endif
1640
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001641/* vec_dss */
1642
1643static void __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001644vec_dss(int __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001645{
David Blaikie3302f2b2013-01-16 23:08:36 +00001646 __builtin_altivec_dss(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001647}
1648
1649/* vec_dssall */
1650
1651static void __attribute__((__always_inline__))
1652vec_dssall(void)
1653{
1654 __builtin_altivec_dssall();
1655}
1656
1657/* vec_dst */
1658
1659static void __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001660vec_dst(const void *__a, int __b, int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001661{
David Blaikie3302f2b2013-01-16 23:08:36 +00001662 __builtin_altivec_dst(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001663}
1664
1665/* vec_dstst */
1666
1667static void __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001668vec_dstst(const void *__a, int __b, int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001669{
David Blaikie3302f2b2013-01-16 23:08:36 +00001670 __builtin_altivec_dstst(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001671}
1672
1673/* vec_dststt */
1674
1675static void __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001676vec_dststt(const void *__a, int __b, int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001677{
David Blaikie3302f2b2013-01-16 23:08:36 +00001678 __builtin_altivec_dststt(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001679}
1680
1681/* vec_dstt */
1682
1683static void __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001684vec_dstt(const void *__a, int __b, int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001685{
David Blaikie3302f2b2013-01-16 23:08:36 +00001686 __builtin_altivec_dstt(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001687}
1688
1689/* vec_expte */
1690
1691static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001692vec_expte(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001693{
David Blaikie3302f2b2013-01-16 23:08:36 +00001694 return __builtin_altivec_vexptefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001695}
1696
1697/* vec_vexptefp */
1698
1699static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001700vec_vexptefp(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001701{
David Blaikie3302f2b2013-01-16 23:08:36 +00001702 return __builtin_altivec_vexptefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001703}
1704
1705/* vec_floor */
1706
1707static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001708vec_floor(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001709{
David Blaikie3302f2b2013-01-16 23:08:36 +00001710 return __builtin_altivec_vrfim(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001711}
1712
1713/* vec_vrfim */
1714
1715static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001716vec_vrfim(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001717{
David Blaikie3302f2b2013-01-16 23:08:36 +00001718 return __builtin_altivec_vrfim(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001719}
1720
1721/* vec_ld */
1722
1723static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001724vec_ld(int __a, const vector signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001725{
David Blaikie3302f2b2013-01-16 23:08:36 +00001726 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001727}
1728
1729static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001730vec_ld(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001731{
David Blaikie3302f2b2013-01-16 23:08:36 +00001732 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001733}
1734
1735static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001736vec_ld(int __a, const vector unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001737{
David Blaikie3302f2b2013-01-16 23:08:36 +00001738 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001739}
1740
1741static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001742vec_ld(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001743{
David Blaikie3302f2b2013-01-16 23:08:36 +00001744 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001745}
1746
Anton Yartsevfc83c602010-08-19 03:21:36 +00001747static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001748vec_ld(int __a, const vector bool char *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001749{
David Blaikie3302f2b2013-01-16 23:08:36 +00001750 return (vector bool char)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001751}
1752
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001753static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001754vec_ld(int __a, const vector short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001755{
David Blaikie3302f2b2013-01-16 23:08:36 +00001756 return (vector short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001757}
1758
1759static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001760vec_ld(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001761{
David Blaikie3302f2b2013-01-16 23:08:36 +00001762 return (vector short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001763}
1764
1765static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001766vec_ld(int __a, const vector unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001767{
David Blaikie3302f2b2013-01-16 23:08:36 +00001768 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001769}
1770
1771static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001772vec_ld(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001773{
David Blaikie3302f2b2013-01-16 23:08:36 +00001774 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001775}
1776
Anton Yartsevfc83c602010-08-19 03:21:36 +00001777static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001778vec_ld(int __a, const vector bool short *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001779{
David Blaikie3302f2b2013-01-16 23:08:36 +00001780 return (vector bool short)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001781}
1782
1783static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001784vec_ld(int __a, const vector pixel *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001785{
David Blaikie3302f2b2013-01-16 23:08:36 +00001786 return (vector pixel)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001787}
1788
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001789static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001790vec_ld(int __a, const vector int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001791{
David Blaikie3302f2b2013-01-16 23:08:36 +00001792 return (vector int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001793}
1794
1795static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001796vec_ld(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001797{
David Blaikie3302f2b2013-01-16 23:08:36 +00001798 return (vector int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001799}
1800
1801static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001802vec_ld(int __a, const vector unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001803{
David Blaikie3302f2b2013-01-16 23:08:36 +00001804 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001805}
1806
1807static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001808vec_ld(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001809{
David Blaikie3302f2b2013-01-16 23:08:36 +00001810 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001811}
1812
Anton Yartsevfc83c602010-08-19 03:21:36 +00001813static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001814vec_ld(int __a, const vector bool int *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001815{
David Blaikie3302f2b2013-01-16 23:08:36 +00001816 return (vector bool int)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001817}
1818
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001819static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001820vec_ld(int __a, const vector float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001821{
David Blaikie3302f2b2013-01-16 23:08:36 +00001822 return (vector float)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001823}
1824
1825static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001826vec_ld(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001827{
David Blaikie3302f2b2013-01-16 23:08:36 +00001828 return (vector float)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001829}
1830
1831/* vec_lvx */
1832
1833static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001834vec_lvx(int __a, const vector signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001835{
David Blaikie3302f2b2013-01-16 23:08:36 +00001836 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001837}
1838
1839static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001840vec_lvx(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001841{
David Blaikie3302f2b2013-01-16 23:08:36 +00001842 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001843}
1844
1845static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001846vec_lvx(int __a, const vector unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001847{
David Blaikie3302f2b2013-01-16 23:08:36 +00001848 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001849}
1850
1851static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001852vec_lvx(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001853{
David Blaikie3302f2b2013-01-16 23:08:36 +00001854 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001855}
1856
Anton Yartsevfc83c602010-08-19 03:21:36 +00001857static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001858vec_lvx(int __a, const vector bool char *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001859{
David Blaikie3302f2b2013-01-16 23:08:36 +00001860 return (vector bool char)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001861}
1862
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001863static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001864vec_lvx(int __a, const vector short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001865{
David Blaikie3302f2b2013-01-16 23:08:36 +00001866 return (vector short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001867}
1868
1869static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001870vec_lvx(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001871{
David Blaikie3302f2b2013-01-16 23:08:36 +00001872 return (vector short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001873}
1874
1875static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001876vec_lvx(int __a, const vector unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001877{
David Blaikie3302f2b2013-01-16 23:08:36 +00001878 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001879}
1880
1881static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001882vec_lvx(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001883{
David Blaikie3302f2b2013-01-16 23:08:36 +00001884 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001885}
1886
Anton Yartsevfc83c602010-08-19 03:21:36 +00001887static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001888vec_lvx(int __a, const vector bool short *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001889{
David Blaikie3302f2b2013-01-16 23:08:36 +00001890 return (vector bool short)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001891}
1892
1893static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001894vec_lvx(int __a, const vector pixel *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001895{
David Blaikie3302f2b2013-01-16 23:08:36 +00001896 return (vector pixel)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001897}
1898
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001899static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001900vec_lvx(int __a, const vector int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001901{
David Blaikie3302f2b2013-01-16 23:08:36 +00001902 return (vector int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001903}
1904
1905static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001906vec_lvx(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001907{
David Blaikie3302f2b2013-01-16 23:08:36 +00001908 return (vector int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001909}
1910
1911static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001912vec_lvx(int __a, const vector unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001913{
David Blaikie3302f2b2013-01-16 23:08:36 +00001914 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001915}
1916
1917static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001918vec_lvx(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001919{
David Blaikie3302f2b2013-01-16 23:08:36 +00001920 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001921}
1922
Anton Yartsevfc83c602010-08-19 03:21:36 +00001923static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001924vec_lvx(int __a, const vector bool int *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001925{
David Blaikie3302f2b2013-01-16 23:08:36 +00001926 return (vector bool int)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001927}
1928
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001929static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001930vec_lvx(int __a, const vector float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001931{
David Blaikie3302f2b2013-01-16 23:08:36 +00001932 return (vector float)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001933}
1934
1935static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001936vec_lvx(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001937{
David Blaikie3302f2b2013-01-16 23:08:36 +00001938 return (vector float)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001939}
1940
1941/* vec_lde */
1942
1943static vector signed char __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001944vec_lde(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001945{
David Blaikie3302f2b2013-01-16 23:08:36 +00001946 return (vector signed char)__builtin_altivec_lvebx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001947}
1948
1949static vector unsigned char __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001950vec_lde(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001951{
David Blaikie3302f2b2013-01-16 23:08:36 +00001952 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001953}
1954
1955static vector short __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001956vec_lde(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001957{
David Blaikie3302f2b2013-01-16 23:08:36 +00001958 return (vector short)__builtin_altivec_lvehx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001959}
1960
1961static vector unsigned short __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001962vec_lde(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001963{
David Blaikie3302f2b2013-01-16 23:08:36 +00001964 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001965}
1966
1967static vector int __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001968vec_lde(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001969{
David Blaikie3302f2b2013-01-16 23:08:36 +00001970 return (vector int)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001971}
1972
1973static vector unsigned int __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001974vec_lde(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001975{
David Blaikie3302f2b2013-01-16 23:08:36 +00001976 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001977}
1978
1979static vector float __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001980vec_lde(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001981{
David Blaikie3302f2b2013-01-16 23:08:36 +00001982 return (vector float)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001983}
1984
1985/* vec_lvebx */
1986
1987static vector signed char __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001988vec_lvebx(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001989{
David Blaikie3302f2b2013-01-16 23:08:36 +00001990 return (vector signed char)__builtin_altivec_lvebx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001991}
1992
1993static vector unsigned char __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001994vec_lvebx(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001995{
David Blaikie3302f2b2013-01-16 23:08:36 +00001996 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001997}
1998
1999/* vec_lvehx */
2000
2001static vector short __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002002vec_lvehx(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002003{
David Blaikie3302f2b2013-01-16 23:08:36 +00002004 return (vector short)__builtin_altivec_lvehx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002005}
2006
2007static vector unsigned short __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002008vec_lvehx(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002009{
David Blaikie3302f2b2013-01-16 23:08:36 +00002010 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002011}
2012
2013/* vec_lvewx */
2014
2015static vector int __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002016vec_lvewx(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002017{
David Blaikie3302f2b2013-01-16 23:08:36 +00002018 return (vector int)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002019}
2020
2021static vector unsigned int __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002022vec_lvewx(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002023{
David Blaikie3302f2b2013-01-16 23:08:36 +00002024 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002025}
2026
2027static vector float __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002028vec_lvewx(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002029{
David Blaikie3302f2b2013-01-16 23:08:36 +00002030 return (vector float)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002031}
2032
2033/* vec_ldl */
2034
2035static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002036vec_ldl(int __a, const vector signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002037{
David Blaikie3302f2b2013-01-16 23:08:36 +00002038 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002039}
2040
2041static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002042vec_ldl(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002043{
David Blaikie3302f2b2013-01-16 23:08:36 +00002044 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002045}
2046
2047static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002048vec_ldl(int __a, const vector unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002049{
David Blaikie3302f2b2013-01-16 23:08:36 +00002050 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002051}
2052
2053static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002054vec_ldl(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002055{
David Blaikie3302f2b2013-01-16 23:08:36 +00002056 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002057}
2058
Anton Yartsevfc83c602010-08-19 03:21:36 +00002059static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002060vec_ldl(int __a, const vector bool char *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002061{
David Blaikie3302f2b2013-01-16 23:08:36 +00002062 return (vector bool char)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002063}
2064
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002065static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002066vec_ldl(int __a, const vector short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002067{
David Blaikie3302f2b2013-01-16 23:08:36 +00002068 return (vector short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002069}
2070
2071static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002072vec_ldl(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002073{
David Blaikie3302f2b2013-01-16 23:08:36 +00002074 return (vector short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002075}
2076
2077static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002078vec_ldl(int __a, const vector unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002079{
David Blaikie3302f2b2013-01-16 23:08:36 +00002080 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002081}
2082
2083static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002084vec_ldl(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002085{
David Blaikie3302f2b2013-01-16 23:08:36 +00002086 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002087}
2088
Anton Yartsevfc83c602010-08-19 03:21:36 +00002089static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002090vec_ldl(int __a, const vector bool short *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002091{
David Blaikie3302f2b2013-01-16 23:08:36 +00002092 return (vector bool short)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002093}
2094
2095static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002096vec_ldl(int __a, const vector pixel *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002097{
David Blaikie3302f2b2013-01-16 23:08:36 +00002098 return (vector pixel short)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002099}
2100
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002101static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002102vec_ldl(int __a, const vector int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002103{
David Blaikie3302f2b2013-01-16 23:08:36 +00002104 return (vector int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002105}
2106
2107static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002108vec_ldl(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002109{
David Blaikie3302f2b2013-01-16 23:08:36 +00002110 return (vector int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002111}
2112
2113static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002114vec_ldl(int __a, const vector unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002115{
David Blaikie3302f2b2013-01-16 23:08:36 +00002116 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002117}
2118
2119static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002120vec_ldl(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002121{
David Blaikie3302f2b2013-01-16 23:08:36 +00002122 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002123}
2124
Anton Yartsevfc83c602010-08-19 03:21:36 +00002125static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002126vec_ldl(int __a, const vector bool int *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002127{
David Blaikie3302f2b2013-01-16 23:08:36 +00002128 return (vector bool int)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002129}
2130
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002131static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002132vec_ldl(int __a, const vector float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002133{
David Blaikie3302f2b2013-01-16 23:08:36 +00002134 return (vector float)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002135}
2136
2137static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002138vec_ldl(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002139{
David Blaikie3302f2b2013-01-16 23:08:36 +00002140 return (vector float)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002141}
2142
2143/* vec_lvxl */
2144
2145static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002146vec_lvxl(int __a, const vector signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002147{
David Blaikie3302f2b2013-01-16 23:08:36 +00002148 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002149}
2150
2151static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002152vec_lvxl(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002153{
David Blaikie3302f2b2013-01-16 23:08:36 +00002154 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002155}
2156
2157static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002158vec_lvxl(int __a, const vector unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002159{
David Blaikie3302f2b2013-01-16 23:08:36 +00002160 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002161}
2162
2163static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002164vec_lvxl(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002165{
David Blaikie3302f2b2013-01-16 23:08:36 +00002166 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002167}
2168
Anton Yartsevfc83c602010-08-19 03:21:36 +00002169static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002170vec_lvxl(int __a, const vector bool char *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002171{
David Blaikie3302f2b2013-01-16 23:08:36 +00002172 return (vector bool char)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002173}
2174
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002175static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002176vec_lvxl(int __a, const vector short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002177{
David Blaikie3302f2b2013-01-16 23:08:36 +00002178 return (vector short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002179}
2180
2181static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002182vec_lvxl(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002183{
David Blaikie3302f2b2013-01-16 23:08:36 +00002184 return (vector short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002185}
2186
2187static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002188vec_lvxl(int __a, const vector unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002189{
David Blaikie3302f2b2013-01-16 23:08:36 +00002190 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002191}
2192
2193static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002194vec_lvxl(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002195{
David Blaikie3302f2b2013-01-16 23:08:36 +00002196 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002197}
2198
Anton Yartsevfc83c602010-08-19 03:21:36 +00002199static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002200vec_lvxl(int __a, const vector bool short *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002201{
David Blaikie3302f2b2013-01-16 23:08:36 +00002202 return (vector bool short)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002203}
2204
2205static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002206vec_lvxl(int __a, const vector pixel *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002207{
David Blaikie3302f2b2013-01-16 23:08:36 +00002208 return (vector pixel)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002209}
2210
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002211static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002212vec_lvxl(int __a, const vector int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002213{
David Blaikie3302f2b2013-01-16 23:08:36 +00002214 return (vector int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002215}
2216
2217static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002218vec_lvxl(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002219{
David Blaikie3302f2b2013-01-16 23:08:36 +00002220 return (vector int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002221}
2222
2223static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002224vec_lvxl(int __a, const vector unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002225{
David Blaikie3302f2b2013-01-16 23:08:36 +00002226 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002227}
2228
2229static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002230vec_lvxl(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002231{
David Blaikie3302f2b2013-01-16 23:08:36 +00002232 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002233}
2234
Anton Yartsevfc83c602010-08-19 03:21:36 +00002235static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002236vec_lvxl(int __a, const vector bool int *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002237{
David Blaikie3302f2b2013-01-16 23:08:36 +00002238 return (vector bool int)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002239}
2240
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002241static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002242vec_lvxl(int __a, const vector float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002243{
David Blaikie3302f2b2013-01-16 23:08:36 +00002244 return (vector float)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002245}
2246
2247static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002248vec_lvxl(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002249{
David Blaikie3302f2b2013-01-16 23:08:36 +00002250 return (vector float)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002251}
2252
2253/* vec_loge */
2254
2255static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002256vec_loge(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002257{
David Blaikie3302f2b2013-01-16 23:08:36 +00002258 return __builtin_altivec_vlogefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002259}
2260
2261/* vec_vlogefp */
2262
2263static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002264vec_vlogefp(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002265{
David Blaikie3302f2b2013-01-16 23:08:36 +00002266 return __builtin_altivec_vlogefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002267}
2268
2269/* vec_lvsl */
2270
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002271#ifdef __LITTLE_ENDIAN__
2272static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002273__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002274loads/stores")))
2275vec_lvsl(int __a, const signed char *__b)
2276{
2277 vector unsigned char mask =
2278 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2279 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2280 return vec_perm(mask, mask, reverse);
2281}
2282#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002283static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002284vec_lvsl(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002285{
David Blaikie3302f2b2013-01-16 23:08:36 +00002286 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002287}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002288#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002289
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002290#ifdef __LITTLE_ENDIAN__
2291static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002292__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002293loads/stores")))
2294vec_lvsl(int __a, const unsigned char *__b)
2295{
2296 vector unsigned char mask =
2297 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2298 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2299 return vec_perm(mask, mask, reverse);
2300}
2301#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002302static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002303vec_lvsl(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002304{
David Blaikie3302f2b2013-01-16 23:08:36 +00002305 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002306}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002307#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002308
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002309#ifdef __LITTLE_ENDIAN__
2310static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002311__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002312loads/stores")))
2313vec_lvsl(int __a, const short *__b)
2314{
2315 vector unsigned char mask =
2316 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2317 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2318 return vec_perm(mask, mask, reverse);
2319}
2320#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002321static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002322vec_lvsl(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002323{
David Blaikie3302f2b2013-01-16 23:08:36 +00002324 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002325}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002326#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002327
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002328#ifdef __LITTLE_ENDIAN__
2329static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002330__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002331loads/stores")))
2332vec_lvsl(int __a, const unsigned short *__b)
2333{
2334 vector unsigned char mask =
2335 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2336 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2337 return vec_perm(mask, mask, reverse);
2338}
2339#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002340static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002341vec_lvsl(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002342{
David Blaikie3302f2b2013-01-16 23:08:36 +00002343 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002344}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002345#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002346
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002347#ifdef __LITTLE_ENDIAN__
2348static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002349__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002350loads/stores")))
2351vec_lvsl(int __a, const int *__b)
2352{
2353 vector unsigned char mask =
2354 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2355 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2356 return vec_perm(mask, mask, reverse);
2357}
2358#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002359static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002360vec_lvsl(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002361{
David Blaikie3302f2b2013-01-16 23:08:36 +00002362 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002363}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002364#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002365
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002366#ifdef __LITTLE_ENDIAN__
2367static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002368__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002369loads/stores")))
2370vec_lvsl(int __a, const unsigned int *__b)
2371{
2372 vector unsigned char mask =
2373 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2374 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2375 return vec_perm(mask, mask, reverse);
2376}
2377#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002378static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002379vec_lvsl(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002380{
David Blaikie3302f2b2013-01-16 23:08:36 +00002381 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002382}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002383#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002384
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002385#ifdef __LITTLE_ENDIAN__
2386static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002387__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002388loads/stores")))
2389vec_lvsl(int __a, const float *__b)
2390{
2391 vector unsigned char mask =
2392 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2393 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2394 return vec_perm(mask, mask, reverse);
2395}
2396#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002397static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002398vec_lvsl(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002399{
David Blaikie3302f2b2013-01-16 23:08:36 +00002400 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002401}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002402#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002403
2404/* vec_lvsr */
2405
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002406#ifdef __LITTLE_ENDIAN__
2407static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002408__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002409loads/stores")))
2410vec_lvsr(int __a, const signed char *__b)
2411{
2412 vector unsigned char mask =
2413 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2414 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2415 return vec_perm(mask, mask, reverse);
2416}
2417#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002418static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002419vec_lvsr(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002420{
David Blaikie3302f2b2013-01-16 23:08:36 +00002421 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002422}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002423#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002424
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002425#ifdef __LITTLE_ENDIAN__
2426static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002427__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002428loads/stores")))
2429vec_lvsr(int __a, const unsigned char *__b)
2430{
2431 vector unsigned char mask =
2432 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2433 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2434 return vec_perm(mask, mask, reverse);
2435}
2436#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002437static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002438vec_lvsr(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002439{
David Blaikie3302f2b2013-01-16 23:08:36 +00002440 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002441}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002442#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002443
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002444#ifdef __LITTLE_ENDIAN__
2445static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002446__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002447loads/stores")))
2448vec_lvsr(int __a, const short *__b)
2449{
2450 vector unsigned char mask =
2451 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2452 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2453 return vec_perm(mask, mask, reverse);
2454}
2455#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002456static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002457vec_lvsr(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002458{
David Blaikie3302f2b2013-01-16 23:08:36 +00002459 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002460}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002461#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002462
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002463#ifdef __LITTLE_ENDIAN__
2464static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002465__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002466loads/stores")))
2467vec_lvsr(int __a, const unsigned short *__b)
2468{
2469 vector unsigned char mask =
2470 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2471 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2472 return vec_perm(mask, mask, reverse);
2473}
2474#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002475static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002476vec_lvsr(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002477{
David Blaikie3302f2b2013-01-16 23:08:36 +00002478 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002479}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002480#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002481
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002482#ifdef __LITTLE_ENDIAN__
2483static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002484__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002485loads/stores")))
2486vec_lvsr(int __a, const int *__b)
2487{
2488 vector unsigned char mask =
2489 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2490 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2491 return vec_perm(mask, mask, reverse);
2492}
2493#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002494static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002495vec_lvsr(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002496{
David Blaikie3302f2b2013-01-16 23:08:36 +00002497 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002498}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002499#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002500
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002501#ifdef __LITTLE_ENDIAN__
2502static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002503__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002504loads/stores")))
2505vec_lvsr(int __a, const unsigned int *__b)
2506{
2507 vector unsigned char mask =
2508 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2509 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2510 return vec_perm(mask, mask, reverse);
2511}
2512#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002513static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002514vec_lvsr(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002515{
David Blaikie3302f2b2013-01-16 23:08:36 +00002516 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002517}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002518#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002519
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002520#ifdef __LITTLE_ENDIAN__
2521static vector unsigned char __ATTRS_o_ai
David Majnemer1cf22e62015-02-04 00:26:10 +00002522__attribute__((__deprecated__("use assignment for unaligned little endian \
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002523loads/stores")))
2524vec_lvsr(int __a, const float *__b)
2525{
2526 vector unsigned char mask =
2527 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2528 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2529 return vec_perm(mask, mask, reverse);
2530}
2531#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002532static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002533vec_lvsr(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002534{
David Blaikie3302f2b2013-01-16 23:08:36 +00002535 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002536}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002537#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002538
2539/* vec_madd */
2540
2541static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002542vec_madd(vector float __a, vector float __b, vector float __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002543{
David Blaikie3302f2b2013-01-16 23:08:36 +00002544 return __builtin_altivec_vmaddfp(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002545}
2546
2547/* vec_vmaddfp */
2548
2549static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002550vec_vmaddfp(vector float __a, vector float __b, vector float __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002551{
David Blaikie3302f2b2013-01-16 23:08:36 +00002552 return __builtin_altivec_vmaddfp(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002553}
2554
2555/* vec_madds */
2556
2557static vector signed short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002558vec_madds(vector signed short __a, vector signed short __b, vector signed short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002559{
David Blaikie3302f2b2013-01-16 23:08:36 +00002560 return __builtin_altivec_vmhaddshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002561}
2562
2563/* vec_vmhaddshs */
2564static vector signed short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002565vec_vmhaddshs(vector signed short __a,
2566 vector signed short __b,
2567 vector signed short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002568{
David Blaikie3302f2b2013-01-16 23:08:36 +00002569 return __builtin_altivec_vmhaddshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002570}
2571
Chris Lattnerdad40622010-04-14 03:54:58 +00002572/* vec_max */
2573
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002574static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002575vec_max(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002576{
David Blaikie3302f2b2013-01-16 23:08:36 +00002577 return __builtin_altivec_vmaxsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002578}
2579
Anton Yartsevfc83c602010-08-19 03:21:36 +00002580static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002581vec_max(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002582{
David Blaikie3302f2b2013-01-16 23:08:36 +00002583 return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002584}
2585
2586static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002587vec_max(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002588{
David Blaikie3302f2b2013-01-16 23:08:36 +00002589 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002590}
2591
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002592static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002593vec_max(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002594{
David Blaikie3302f2b2013-01-16 23:08:36 +00002595 return __builtin_altivec_vmaxub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002596}
2597
Anton Yartsevfc83c602010-08-19 03:21:36 +00002598static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002599vec_max(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002600{
David Blaikie3302f2b2013-01-16 23:08:36 +00002601 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002602}
2603
2604static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002605vec_max(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002606{
David Blaikie3302f2b2013-01-16 23:08:36 +00002607 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002608}
2609
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002610static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002611vec_max(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002612{
David Blaikie3302f2b2013-01-16 23:08:36 +00002613 return __builtin_altivec_vmaxsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002614}
2615
Anton Yartsevfc83c602010-08-19 03:21:36 +00002616static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002617vec_max(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002618{
David Blaikie3302f2b2013-01-16 23:08:36 +00002619 return __builtin_altivec_vmaxsh((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002620}
2621
2622static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002623vec_max(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002624{
David Blaikie3302f2b2013-01-16 23:08:36 +00002625 return __builtin_altivec_vmaxsh(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002626}
2627
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002628static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002629vec_max(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002630{
David Blaikie3302f2b2013-01-16 23:08:36 +00002631 return __builtin_altivec_vmaxuh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002632}
2633
Anton Yartsevfc83c602010-08-19 03:21:36 +00002634static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002635vec_max(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002636{
David Blaikie3302f2b2013-01-16 23:08:36 +00002637 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002638}
2639
2640static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002641vec_max(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002642{
David Blaikie3302f2b2013-01-16 23:08:36 +00002643 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002644}
2645
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002646static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002647vec_max(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002648{
David Blaikie3302f2b2013-01-16 23:08:36 +00002649 return __builtin_altivec_vmaxsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002650}
2651
Anton Yartsevfc83c602010-08-19 03:21:36 +00002652static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002653vec_max(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002654{
David Blaikie3302f2b2013-01-16 23:08:36 +00002655 return __builtin_altivec_vmaxsw((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002656}
2657
2658static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002659vec_max(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002660{
David Blaikie3302f2b2013-01-16 23:08:36 +00002661 return __builtin_altivec_vmaxsw(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002662}
2663
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002664static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002665vec_max(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002666{
David Blaikie3302f2b2013-01-16 23:08:36 +00002667 return __builtin_altivec_vmaxuw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002668}
2669
Anton Yartsevfc83c602010-08-19 03:21:36 +00002670static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002671vec_max(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002672{
David Blaikie3302f2b2013-01-16 23:08:36 +00002673 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002674}
2675
2676static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002677vec_max(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002678{
David Blaikie3302f2b2013-01-16 23:08:36 +00002679 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002680}
2681
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002682static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002683vec_max(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002684{
Bill Schmidt691e01d2014-10-31 19:19:24 +00002685#ifdef __VSX__
2686 return __builtin_vsx_xvmaxsp(__a, __b);
2687#else
David Blaikie3302f2b2013-01-16 23:08:36 +00002688 return __builtin_altivec_vmaxfp(__a, __b);
Bill Schmidt691e01d2014-10-31 19:19:24 +00002689#endif
Chris Lattnerdad40622010-04-14 03:54:58 +00002690}
2691
Bill Schmidt691e01d2014-10-31 19:19:24 +00002692#ifdef __VSX__
2693static vector double __ATTRS_o_ai
2694vec_max(vector double __a, vector double __b)
2695{
2696 return __builtin_vsx_xvmaxdp(__a, __b);
2697}
2698#endif
2699
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002700/* vec_vmaxsb */
2701
Anton Yartsevfc83c602010-08-19 03:21:36 +00002702static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002703vec_vmaxsb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002704{
David Blaikie3302f2b2013-01-16 23:08:36 +00002705 return __builtin_altivec_vmaxsb(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002706}
2707
Anton Yartsevfc83c602010-08-19 03:21:36 +00002708static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002709vec_vmaxsb(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002710{
David Blaikie3302f2b2013-01-16 23:08:36 +00002711 return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002712}
2713
2714static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002715vec_vmaxsb(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002716{
David Blaikie3302f2b2013-01-16 23:08:36 +00002717 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002718}
2719
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002720/* vec_vmaxub */
2721
Anton Yartsevfc83c602010-08-19 03:21:36 +00002722static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002723vec_vmaxub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002724{
David Blaikie3302f2b2013-01-16 23:08:36 +00002725 return __builtin_altivec_vmaxub(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002726}
2727
Anton Yartsevfc83c602010-08-19 03:21:36 +00002728static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002729vec_vmaxub(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002730{
David Blaikie3302f2b2013-01-16 23:08:36 +00002731 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002732}
2733
2734static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002735vec_vmaxub(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002736{
David Blaikie3302f2b2013-01-16 23:08:36 +00002737 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002738}
2739
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002740/* vec_vmaxsh */
2741
Anton Yartsevfc83c602010-08-19 03:21:36 +00002742static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002743vec_vmaxsh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002744{
David Blaikie3302f2b2013-01-16 23:08:36 +00002745 return __builtin_altivec_vmaxsh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002746}
2747
Anton Yartsevfc83c602010-08-19 03:21:36 +00002748static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002749vec_vmaxsh(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002750{
David Blaikie3302f2b2013-01-16 23:08:36 +00002751 return __builtin_altivec_vmaxsh((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002752}
2753
2754static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002755vec_vmaxsh(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002756{
David Blaikie3302f2b2013-01-16 23:08:36 +00002757 return __builtin_altivec_vmaxsh(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002758}
2759
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002760/* vec_vmaxuh */
2761
Anton Yartsevfc83c602010-08-19 03:21:36 +00002762static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002763vec_vmaxuh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002764{
David Blaikie3302f2b2013-01-16 23:08:36 +00002765 return __builtin_altivec_vmaxuh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002766}
2767
Anton Yartsevfc83c602010-08-19 03:21:36 +00002768static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002769vec_vmaxuh(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002770{
David Blaikie3302f2b2013-01-16 23:08:36 +00002771 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002772}
2773
2774static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002775vec_vmaxuh(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002776{
David Blaikie3302f2b2013-01-16 23:08:36 +00002777 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002778}
2779
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002780/* vec_vmaxsw */
2781
Anton Yartsevfc83c602010-08-19 03:21:36 +00002782static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002783vec_vmaxsw(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002784{
David Blaikie3302f2b2013-01-16 23:08:36 +00002785 return __builtin_altivec_vmaxsw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002786}
2787
Anton Yartsevfc83c602010-08-19 03:21:36 +00002788static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002789vec_vmaxsw(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002790{
David Blaikie3302f2b2013-01-16 23:08:36 +00002791 return __builtin_altivec_vmaxsw((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002792}
2793
2794static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002795vec_vmaxsw(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002796{
David Blaikie3302f2b2013-01-16 23:08:36 +00002797 return __builtin_altivec_vmaxsw(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002798}
2799
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002800/* vec_vmaxuw */
2801
Anton Yartsevfc83c602010-08-19 03:21:36 +00002802static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002803vec_vmaxuw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002804{
David Blaikie3302f2b2013-01-16 23:08:36 +00002805 return __builtin_altivec_vmaxuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002806}
2807
Anton Yartsevfc83c602010-08-19 03:21:36 +00002808static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002809vec_vmaxuw(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002810{
David Blaikie3302f2b2013-01-16 23:08:36 +00002811 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002812}
2813
2814static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002815vec_vmaxuw(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002816{
David Blaikie3302f2b2013-01-16 23:08:36 +00002817 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002818}
2819
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002820/* vec_vmaxfp */
2821
2822static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002823vec_vmaxfp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002824{
Bill Schmidt691e01d2014-10-31 19:19:24 +00002825#ifdef __VSX__
2826 return __builtin_vsx_xvmaxsp(__a, __b);
2827#else
David Blaikie3302f2b2013-01-16 23:08:36 +00002828 return __builtin_altivec_vmaxfp(__a, __b);
Bill Schmidt691e01d2014-10-31 19:19:24 +00002829#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002830}
2831
2832/* vec_mergeh */
2833
2834static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002835vec_mergeh(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002836{
David Blaikie3302f2b2013-01-16 23:08:36 +00002837 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002838 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2839 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2840}
2841
2842static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002843vec_mergeh(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002844{
David Blaikie3302f2b2013-01-16 23:08:36 +00002845 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002846 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2847 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2848}
2849
Anton Yartsev9e968982010-08-19 03:00:09 +00002850static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002851vec_mergeh(vector bool char __a, vector bool char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002852{
David Blaikie3302f2b2013-01-16 23:08:36 +00002853 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002854 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2855 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2856}
2857
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002858static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002859vec_mergeh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002860{
David Blaikie3302f2b2013-01-16 23:08:36 +00002861 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002862 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2863 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2864}
2865
2866static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002867vec_mergeh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002868{
David Blaikie3302f2b2013-01-16 23:08:36 +00002869 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002870 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2871 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2872}
2873
Anton Yartsev9e968982010-08-19 03:00:09 +00002874static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002875vec_mergeh(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002876{
David Blaikie3302f2b2013-01-16 23:08:36 +00002877 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002878 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2879 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2880}
2881
2882static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002883vec_mergeh(vector pixel __a, vector pixel __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002884{
David Blaikie3302f2b2013-01-16 23:08:36 +00002885 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002886 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2887 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2888}
2889
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002890static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002891vec_mergeh(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002892{
David Blaikie3302f2b2013-01-16 23:08:36 +00002893 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002894 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2895 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2896}
2897
2898static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002899vec_mergeh(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002900{
David Blaikie3302f2b2013-01-16 23:08:36 +00002901 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002902 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2903 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2904}
2905
Anton Yartsev9e968982010-08-19 03:00:09 +00002906static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002907vec_mergeh(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002908{
David Blaikie3302f2b2013-01-16 23:08:36 +00002909 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002910 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2911 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2912}
2913
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002914static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002915vec_mergeh(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002916{
David Blaikie3302f2b2013-01-16 23:08:36 +00002917 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002918 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2919 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2920}
2921
2922/* vec_vmrghb */
2923
2924#define __builtin_altivec_vmrghb vec_vmrghb
2925
2926static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002927vec_vmrghb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002928{
David Blaikie3302f2b2013-01-16 23:08:36 +00002929 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002930 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2931 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2932}
2933
2934static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002935vec_vmrghb(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002936{
David Blaikie3302f2b2013-01-16 23:08:36 +00002937 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002938 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2939 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2940}
2941
Anton Yartsev9e968982010-08-19 03:00:09 +00002942static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002943vec_vmrghb(vector bool char __a, vector bool char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002944{
David Blaikie3302f2b2013-01-16 23:08:36 +00002945 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002946 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2947 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2948}
2949
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002950/* vec_vmrghh */
2951
2952#define __builtin_altivec_vmrghh vec_vmrghh
2953
2954static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002955vec_vmrghh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002956{
David Blaikie3302f2b2013-01-16 23:08:36 +00002957 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002958 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2959 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2960}
2961
2962static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002963vec_vmrghh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002964{
David Blaikie3302f2b2013-01-16 23:08:36 +00002965 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002966 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2967 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2968}
2969
Anton Yartsev9e968982010-08-19 03:00:09 +00002970static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002971vec_vmrghh(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002972{
David Blaikie3302f2b2013-01-16 23:08:36 +00002973 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002974 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2975 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2976}
2977
2978static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002979vec_vmrghh(vector pixel __a, vector pixel __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002980{
David Blaikie3302f2b2013-01-16 23:08:36 +00002981 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002982 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2983 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2984}
2985
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002986/* vec_vmrghw */
2987
2988#define __builtin_altivec_vmrghw vec_vmrghw
2989
2990static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002991vec_vmrghw(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002992{
David Blaikie3302f2b2013-01-16 23:08:36 +00002993 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002994 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2995 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2996}
2997
2998static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002999vec_vmrghw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003000{
David Blaikie3302f2b2013-01-16 23:08:36 +00003001 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003002 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
3003 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
3004}
3005
Anton Yartsev9e968982010-08-19 03:00:09 +00003006static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003007vec_vmrghw(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003008{
David Blaikie3302f2b2013-01-16 23:08:36 +00003009 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003010 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
3011 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
3012}
3013
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003014static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003015vec_vmrghw(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003016{
David Blaikie3302f2b2013-01-16 23:08:36 +00003017 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003018 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
3019 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
3020}
3021
3022/* vec_mergel */
3023
3024static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003025vec_mergel(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003026{
David Blaikie3302f2b2013-01-16 23:08:36 +00003027 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003028 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
3029 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
3030}
3031
3032static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003033vec_mergel(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003034{
David Blaikie3302f2b2013-01-16 23:08:36 +00003035 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003036 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
3037 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
3038}
3039
Anton Yartsev9e968982010-08-19 03:00:09 +00003040static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003041vec_mergel(vector bool char __a, vector bool char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003042{
David Blaikie3302f2b2013-01-16 23:08:36 +00003043 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003044 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
3045 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
3046}
3047
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003048static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003049vec_mergel(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003050{
David Blaikie3302f2b2013-01-16 23:08:36 +00003051 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003052 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3053 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3054}
3055
3056static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003057vec_mergel(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003058{
David Blaikie3302f2b2013-01-16 23:08:36 +00003059 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003060 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3061 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3062}
3063
Anton Yartsev9e968982010-08-19 03:00:09 +00003064static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003065vec_mergel(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003066{
David Blaikie3302f2b2013-01-16 23:08:36 +00003067 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003068 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3069 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3070}
3071
3072static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003073vec_mergel(vector pixel __a, vector pixel __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003074{
David Blaikie3302f2b2013-01-16 23:08:36 +00003075 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003076 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3077 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3078}
3079
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003080static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003081vec_mergel(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003082{
David Blaikie3302f2b2013-01-16 23:08:36 +00003083 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003084 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3085 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3086}
3087
3088static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003089vec_mergel(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003090{
David Blaikie3302f2b2013-01-16 23:08:36 +00003091 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003092 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3093 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3094}
3095
Anton Yartsev9e968982010-08-19 03:00:09 +00003096static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003097vec_mergel(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003098{
David Blaikie3302f2b2013-01-16 23:08:36 +00003099 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003100 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3101 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3102}
3103
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003104static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003105vec_mergel(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003106{
David Blaikie3302f2b2013-01-16 23:08:36 +00003107 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003108 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3109 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3110}
3111
3112/* vec_vmrglb */
3113
3114#define __builtin_altivec_vmrglb vec_vmrglb
3115
3116static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003117vec_vmrglb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003118{
David Blaikie3302f2b2013-01-16 23:08:36 +00003119 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003120 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
3121 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
3122}
3123
3124static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003125vec_vmrglb(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003126{
David Blaikie3302f2b2013-01-16 23:08:36 +00003127 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003128 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
3129 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
3130}
3131
Anton Yartsev9e968982010-08-19 03:00:09 +00003132static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003133vec_vmrglb(vector bool char __a, vector bool char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003134{
David Blaikie3302f2b2013-01-16 23:08:36 +00003135 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003136 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
3137 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
3138}
3139
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003140/* vec_vmrglh */
3141
3142#define __builtin_altivec_vmrglh vec_vmrglh
3143
3144static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003145vec_vmrglh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003146{
David Blaikie3302f2b2013-01-16 23:08:36 +00003147 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003148 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3149 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3150}
3151
3152static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003153vec_vmrglh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003154{
David Blaikie3302f2b2013-01-16 23:08:36 +00003155 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003156 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3157 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3158}
3159
Anton Yartsev9e968982010-08-19 03:00:09 +00003160static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003161vec_vmrglh(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003162{
David Blaikie3302f2b2013-01-16 23:08:36 +00003163 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003164 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3165 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3166}
3167
3168static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003169vec_vmrglh(vector pixel __a, vector pixel __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003170{
David Blaikie3302f2b2013-01-16 23:08:36 +00003171 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003172 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3173 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3174}
3175
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003176/* vec_vmrglw */
3177
3178#define __builtin_altivec_vmrglw vec_vmrglw
3179
3180static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003181vec_vmrglw(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003182{
David Blaikie3302f2b2013-01-16 23:08:36 +00003183 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003184 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3185 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3186}
3187
3188static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003189vec_vmrglw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003190{
David Blaikie3302f2b2013-01-16 23:08:36 +00003191 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003192 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3193 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3194}
3195
Anton Yartsev9e968982010-08-19 03:00:09 +00003196static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003197vec_vmrglw(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003198{
David Blaikie3302f2b2013-01-16 23:08:36 +00003199 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003200 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3201 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3202}
3203
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003204static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003205vec_vmrglw(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003206{
David Blaikie3302f2b2013-01-16 23:08:36 +00003207 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003208 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3209 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3210}
3211
Chris Lattnerdad40622010-04-14 03:54:58 +00003212/* vec_mfvscr */
3213
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003214static vector unsigned short __attribute__((__always_inline__))
3215vec_mfvscr(void)
3216{
3217 return __builtin_altivec_mfvscr();
3218}
Chris Lattnerdad40622010-04-14 03:54:58 +00003219
3220/* vec_min */
3221
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003222static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003223vec_min(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003224{
David Blaikie3302f2b2013-01-16 23:08:36 +00003225 return __builtin_altivec_vminsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003226}
3227
Anton Yartsevfc83c602010-08-19 03:21:36 +00003228static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003229vec_min(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003230{
David Blaikie3302f2b2013-01-16 23:08:36 +00003231 return __builtin_altivec_vminsb((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003232}
3233
3234static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003235vec_min(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003236{
David Blaikie3302f2b2013-01-16 23:08:36 +00003237 return __builtin_altivec_vminsb(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003238}
3239
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003240static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003241vec_min(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003242{
David Blaikie3302f2b2013-01-16 23:08:36 +00003243 return __builtin_altivec_vminub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003244}
3245
Anton Yartsevfc83c602010-08-19 03:21:36 +00003246static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003247vec_min(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003248{
David Blaikie3302f2b2013-01-16 23:08:36 +00003249 return __builtin_altivec_vminub((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003250}
3251
3252static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003253vec_min(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003254{
David Blaikie3302f2b2013-01-16 23:08:36 +00003255 return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003256}
3257
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003258static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003259vec_min(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003260{
David Blaikie3302f2b2013-01-16 23:08:36 +00003261 return __builtin_altivec_vminsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003262}
3263
Anton Yartsevfc83c602010-08-19 03:21:36 +00003264static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003265vec_min(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003266{
David Blaikie3302f2b2013-01-16 23:08:36 +00003267 return __builtin_altivec_vminsh((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003268}
3269
3270static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003271vec_min(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003272{
David Blaikie3302f2b2013-01-16 23:08:36 +00003273 return __builtin_altivec_vminsh(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003274}
3275
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003276static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003277vec_min(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003278{
David Blaikie3302f2b2013-01-16 23:08:36 +00003279 return __builtin_altivec_vminuh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003280}
3281
Anton Yartsevfc83c602010-08-19 03:21:36 +00003282static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003283vec_min(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003284{
David Blaikie3302f2b2013-01-16 23:08:36 +00003285 return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003286}
3287
3288static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003289vec_min(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003290{
David Blaikie3302f2b2013-01-16 23:08:36 +00003291 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003292}
3293
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003294static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003295vec_min(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003296{
David Blaikie3302f2b2013-01-16 23:08:36 +00003297 return __builtin_altivec_vminsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003298}
3299
Anton Yartsevfc83c602010-08-19 03:21:36 +00003300static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003301vec_min(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003302{
David Blaikie3302f2b2013-01-16 23:08:36 +00003303 return __builtin_altivec_vminsw((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003304}
3305
3306static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003307vec_min(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003308{
David Blaikie3302f2b2013-01-16 23:08:36 +00003309 return __builtin_altivec_vminsw(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003310}
3311
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003312static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003313vec_min(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003314{
David Blaikie3302f2b2013-01-16 23:08:36 +00003315 return __builtin_altivec_vminuw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003316}
3317
Anton Yartsevfc83c602010-08-19 03:21:36 +00003318static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003319vec_min(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003320{
David Blaikie3302f2b2013-01-16 23:08:36 +00003321 return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003322}
3323
3324static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003325vec_min(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003326{
David Blaikie3302f2b2013-01-16 23:08:36 +00003327 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003328}
3329
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003330static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003331vec_min(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003332{
Bill Schmidt691e01d2014-10-31 19:19:24 +00003333#ifdef __VSX__
3334 return __builtin_vsx_xvminsp(__a, __b);
3335#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003336 return __builtin_altivec_vminfp(__a, __b);
Bill Schmidt691e01d2014-10-31 19:19:24 +00003337#endif
Chris Lattnerdad40622010-04-14 03:54:58 +00003338}
3339
Bill Schmidt691e01d2014-10-31 19:19:24 +00003340#ifdef __VSX__
3341static vector double __ATTRS_o_ai
3342vec_min(vector double __a, vector double __b)
3343{
3344 return __builtin_vsx_xvmindp(__a, __b);
3345}
3346#endif
3347
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003348/* vec_vminsb */
3349
Anton Yartsevfc83c602010-08-19 03:21:36 +00003350static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003351vec_vminsb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003352{
David Blaikie3302f2b2013-01-16 23:08:36 +00003353 return __builtin_altivec_vminsb(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003354}
3355
Anton Yartsevfc83c602010-08-19 03:21:36 +00003356static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003357vec_vminsb(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003358{
David Blaikie3302f2b2013-01-16 23:08:36 +00003359 return __builtin_altivec_vminsb((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003360}
3361
3362static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003363vec_vminsb(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003364{
David Blaikie3302f2b2013-01-16 23:08:36 +00003365 return __builtin_altivec_vminsb(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003366}
3367
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003368/* vec_vminub */
3369
Anton Yartsevfc83c602010-08-19 03:21:36 +00003370static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003371vec_vminub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003372{
David Blaikie3302f2b2013-01-16 23:08:36 +00003373 return __builtin_altivec_vminub(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003374}
3375
Anton Yartsevfc83c602010-08-19 03:21:36 +00003376static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003377vec_vminub(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003378{
David Blaikie3302f2b2013-01-16 23:08:36 +00003379 return __builtin_altivec_vminub((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003380}
3381
3382static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003383vec_vminub(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003384{
David Blaikie3302f2b2013-01-16 23:08:36 +00003385 return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003386}
3387
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003388/* vec_vminsh */
3389
Anton Yartsevfc83c602010-08-19 03:21:36 +00003390static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003391vec_vminsh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003392{
David Blaikie3302f2b2013-01-16 23:08:36 +00003393 return __builtin_altivec_vminsh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003394}
3395
Anton Yartsevfc83c602010-08-19 03:21:36 +00003396static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003397vec_vminsh(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003398{
David Blaikie3302f2b2013-01-16 23:08:36 +00003399 return __builtin_altivec_vminsh((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003400}
3401
3402static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003403vec_vminsh(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003404{
David Blaikie3302f2b2013-01-16 23:08:36 +00003405 return __builtin_altivec_vminsh(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003406}
3407
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003408/* vec_vminuh */
3409
Anton Yartsevfc83c602010-08-19 03:21:36 +00003410static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003411vec_vminuh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003412{
David Blaikie3302f2b2013-01-16 23:08:36 +00003413 return __builtin_altivec_vminuh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003414}
3415
Anton Yartsevfc83c602010-08-19 03:21:36 +00003416static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003417vec_vminuh(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003418{
David Blaikie3302f2b2013-01-16 23:08:36 +00003419 return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003420}
3421
3422static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003423vec_vminuh(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003424{
David Blaikie3302f2b2013-01-16 23:08:36 +00003425 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003426}
3427
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003428/* vec_vminsw */
3429
Anton Yartsevfc83c602010-08-19 03:21:36 +00003430static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003431vec_vminsw(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003432{
David Blaikie3302f2b2013-01-16 23:08:36 +00003433 return __builtin_altivec_vminsw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003434}
3435
Anton Yartsevfc83c602010-08-19 03:21:36 +00003436static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003437vec_vminsw(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003438{
David Blaikie3302f2b2013-01-16 23:08:36 +00003439 return __builtin_altivec_vminsw((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003440}
3441
3442static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003443vec_vminsw(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003444{
David Blaikie3302f2b2013-01-16 23:08:36 +00003445 return __builtin_altivec_vminsw(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003446}
3447
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003448/* vec_vminuw */
3449
Anton Yartsevfc83c602010-08-19 03:21:36 +00003450static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003451vec_vminuw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003452{
David Blaikie3302f2b2013-01-16 23:08:36 +00003453 return __builtin_altivec_vminuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003454}
3455
Anton Yartsevfc83c602010-08-19 03:21:36 +00003456static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003457vec_vminuw(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003458{
David Blaikie3302f2b2013-01-16 23:08:36 +00003459 return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003460}
3461
3462static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003463vec_vminuw(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003464{
David Blaikie3302f2b2013-01-16 23:08:36 +00003465 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003466}
3467
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003468/* vec_vminfp */
3469
3470static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003471vec_vminfp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003472{
Bill Schmidt691e01d2014-10-31 19:19:24 +00003473#ifdef __VSX__
3474 return __builtin_vsx_xvminsp(__a, __b);
3475#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003476 return __builtin_altivec_vminfp(__a, __b);
Bill Schmidt691e01d2014-10-31 19:19:24 +00003477#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003478}
3479
3480/* vec_mladd */
3481
3482#define __builtin_altivec_vmladduhm vec_mladd
3483
3484static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003485vec_mladd(vector short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003486{
David Blaikie3302f2b2013-01-16 23:08:36 +00003487 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003488}
3489
3490static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003491vec_mladd(vector short __a, vector unsigned short __b, vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003492{
David Blaikie3302f2b2013-01-16 23:08:36 +00003493 return __a * (vector short)__b + (vector short)__c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003494}
3495
3496static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003497vec_mladd(vector unsigned short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003498{
David Blaikie3302f2b2013-01-16 23:08:36 +00003499 return (vector short)__a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003500}
3501
3502static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003503vec_mladd(vector unsigned short __a,
3504 vector unsigned short __b,
3505 vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003506{
David Blaikie3302f2b2013-01-16 23:08:36 +00003507 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003508}
3509
3510/* vec_vmladduhm */
3511
3512static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003513vec_vmladduhm(vector short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003514{
David Blaikie3302f2b2013-01-16 23:08:36 +00003515 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003516}
3517
3518static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003519vec_vmladduhm(vector short __a, vector unsigned short __b, vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003520{
David Blaikie3302f2b2013-01-16 23:08:36 +00003521 return __a * (vector short)__b + (vector short)__c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003522}
3523
3524static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003525vec_vmladduhm(vector unsigned short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003526{
David Blaikie3302f2b2013-01-16 23:08:36 +00003527 return (vector short)__a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003528}
3529
3530static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003531vec_vmladduhm(vector unsigned short __a,
3532 vector unsigned short __b,
3533 vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003534{
David Blaikie3302f2b2013-01-16 23:08:36 +00003535 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003536}
3537
3538/* vec_mradds */
3539
3540static vector short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003541vec_mradds(vector short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003542{
David Blaikie3302f2b2013-01-16 23:08:36 +00003543 return __builtin_altivec_vmhraddshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003544}
3545
3546/* vec_vmhraddshs */
3547
3548static vector short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003549vec_vmhraddshs(vector short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003550{
David Blaikie3302f2b2013-01-16 23:08:36 +00003551 return __builtin_altivec_vmhraddshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003552}
3553
3554/* vec_msum */
3555
3556static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003557vec_msum(vector signed char __a, vector unsigned char __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003558{
David Blaikie3302f2b2013-01-16 23:08:36 +00003559 return __builtin_altivec_vmsummbm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003560}
3561
3562static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003563vec_msum(vector unsigned char __a, vector unsigned char __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003564{
David Blaikie3302f2b2013-01-16 23:08:36 +00003565 return __builtin_altivec_vmsumubm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003566}
3567
3568static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003569vec_msum(vector short __a, vector short __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003570{
David Blaikie3302f2b2013-01-16 23:08:36 +00003571 return __builtin_altivec_vmsumshm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003572}
3573
3574static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003575vec_msum(vector unsigned short __a,
3576 vector unsigned short __b,
3577 vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003578{
David Blaikie3302f2b2013-01-16 23:08:36 +00003579 return __builtin_altivec_vmsumuhm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003580}
3581
3582/* vec_vmsummbm */
3583
3584static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003585vec_vmsummbm(vector signed char __a, vector unsigned char __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003586{
David Blaikie3302f2b2013-01-16 23:08:36 +00003587 return __builtin_altivec_vmsummbm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003588}
3589
3590/* vec_vmsumubm */
3591
3592static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003593vec_vmsumubm(vector unsigned char __a,
3594 vector unsigned char __b,
3595 vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003596{
David Blaikie3302f2b2013-01-16 23:08:36 +00003597 return __builtin_altivec_vmsumubm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003598}
3599
3600/* vec_vmsumshm */
3601
3602static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003603vec_vmsumshm(vector short __a, vector short __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003604{
David Blaikie3302f2b2013-01-16 23:08:36 +00003605 return __builtin_altivec_vmsumshm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003606}
3607
3608/* vec_vmsumuhm */
3609
3610static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003611vec_vmsumuhm(vector unsigned short __a,
3612 vector unsigned short __b,
3613 vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003614{
David Blaikie3302f2b2013-01-16 23:08:36 +00003615 return __builtin_altivec_vmsumuhm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003616}
3617
3618/* vec_msums */
3619
3620static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003621vec_msums(vector short __a, vector short __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003622{
David Blaikie3302f2b2013-01-16 23:08:36 +00003623 return __builtin_altivec_vmsumshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003624}
3625
3626static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003627vec_msums(vector unsigned short __a,
3628 vector unsigned short __b,
3629 vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003630{
David Blaikie3302f2b2013-01-16 23:08:36 +00003631 return __builtin_altivec_vmsumuhs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003632}
3633
3634/* vec_vmsumshs */
3635
3636static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003637vec_vmsumshs(vector short __a, vector short __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003638{
David Blaikie3302f2b2013-01-16 23:08:36 +00003639 return __builtin_altivec_vmsumshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003640}
3641
3642/* vec_vmsumuhs */
3643
3644static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003645vec_vmsumuhs(vector unsigned short __a,
3646 vector unsigned short __b,
3647 vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003648{
David Blaikie3302f2b2013-01-16 23:08:36 +00003649 return __builtin_altivec_vmsumuhs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003650}
3651
Chris Lattnerdad40622010-04-14 03:54:58 +00003652/* vec_mtvscr */
3653
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003654static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003655vec_mtvscr(vector signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003656{
David Blaikie3302f2b2013-01-16 23:08:36 +00003657 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003658}
3659
3660static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003661vec_mtvscr(vector unsigned char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003662{
David Blaikie3302f2b2013-01-16 23:08:36 +00003663 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003664}
3665
3666static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003667vec_mtvscr(vector bool char __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003668{
David Blaikie3302f2b2013-01-16 23:08:36 +00003669 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003670}
3671
3672static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003673vec_mtvscr(vector short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003674{
David Blaikie3302f2b2013-01-16 23:08:36 +00003675 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003676}
3677
3678static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003679vec_mtvscr(vector unsigned short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003680{
David Blaikie3302f2b2013-01-16 23:08:36 +00003681 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003682}
3683
3684static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003685vec_mtvscr(vector bool short __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003686{
David Blaikie3302f2b2013-01-16 23:08:36 +00003687 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003688}
3689
3690static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003691vec_mtvscr(vector pixel __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003692{
David Blaikie3302f2b2013-01-16 23:08:36 +00003693 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003694}
3695
3696static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003697vec_mtvscr(vector int __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003698{
David Blaikie3302f2b2013-01-16 23:08:36 +00003699 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003700}
3701
3702static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003703vec_mtvscr(vector unsigned int __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003704{
David Blaikie3302f2b2013-01-16 23:08:36 +00003705 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003706}
3707
3708static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003709vec_mtvscr(vector bool int __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003710{
David Blaikie3302f2b2013-01-16 23:08:36 +00003711 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003712}
3713
3714static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003715vec_mtvscr(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003716{
David Blaikie3302f2b2013-01-16 23:08:36 +00003717 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003718}
3719
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003720/* The vmulos* and vmules* instructions have a big endian bias, so
3721 we must reverse the meaning of "even" and "odd" for little endian. */
3722
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003723/* vec_mule */
3724
3725static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003726vec_mule(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003727{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003728#ifdef __LITTLE_ENDIAN__
3729 return __builtin_altivec_vmulosb(__a, __b);
3730#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003731 return __builtin_altivec_vmulesb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003732#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003733}
3734
3735static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003736vec_mule(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003737{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003738#ifdef __LITTLE_ENDIAN__
3739 return __builtin_altivec_vmuloub(__a, __b);
3740#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003741 return __builtin_altivec_vmuleub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003742#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003743}
3744
3745static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003746vec_mule(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003747{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003748#ifdef __LITTLE_ENDIAN__
3749 return __builtin_altivec_vmulosh(__a, __b);
3750#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003751 return __builtin_altivec_vmulesh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003752#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003753}
3754
3755static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003756vec_mule(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003757{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003758#ifdef __LITTLE_ENDIAN__
3759 return __builtin_altivec_vmulouh(__a, __b);
3760#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003761 return __builtin_altivec_vmuleuh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003762#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003763}
3764
3765/* vec_vmulesb */
3766
3767static vector short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003768vec_vmulesb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003769{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003770#ifdef __LITTLE_ENDIAN__
3771 return __builtin_altivec_vmulosb(__a, __b);
3772#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003773 return __builtin_altivec_vmulesb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003774#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003775}
3776
3777/* vec_vmuleub */
3778
3779static vector unsigned short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003780vec_vmuleub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003781{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003782#ifdef __LITTLE_ENDIAN__
3783 return __builtin_altivec_vmuloub(__a, __b);
3784#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003785 return __builtin_altivec_vmuleub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003786#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003787}
3788
3789/* vec_vmulesh */
3790
3791static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003792vec_vmulesh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003793{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003794#ifdef __LITTLE_ENDIAN__
3795 return __builtin_altivec_vmulosh(__a, __b);
3796#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003797 return __builtin_altivec_vmulesh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003798#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003799}
3800
3801/* vec_vmuleuh */
3802
3803static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003804vec_vmuleuh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003805{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003806#ifdef __LITTLE_ENDIAN__
3807 return __builtin_altivec_vmulouh(__a, __b);
3808#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003809 return __builtin_altivec_vmuleuh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003810#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003811}
3812
3813/* vec_mulo */
3814
3815static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003816vec_mulo(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003817{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003818#ifdef __LITTLE_ENDIAN__
3819 return __builtin_altivec_vmulesb(__a, __b);
3820#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003821 return __builtin_altivec_vmulosb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003822#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003823}
3824
3825static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003826vec_mulo(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003827{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003828#ifdef __LITTLE_ENDIAN__
3829 return __builtin_altivec_vmuleub(__a, __b);
3830#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003831 return __builtin_altivec_vmuloub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003832#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003833}
3834
3835static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003836vec_mulo(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003837{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003838#ifdef __LITTLE_ENDIAN__
3839 return __builtin_altivec_vmulesh(__a, __b);
3840#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003841 return __builtin_altivec_vmulosh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003842#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003843}
3844
3845static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003846vec_mulo(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003847{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003848#ifdef __LITTLE_ENDIAN__
3849 return __builtin_altivec_vmuleuh(__a, __b);
3850#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003851 return __builtin_altivec_vmulouh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003852#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003853}
3854
3855/* vec_vmulosb */
3856
3857static vector short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003858vec_vmulosb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003859{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003860#ifdef __LITTLE_ENDIAN__
3861 return __builtin_altivec_vmulesb(__a, __b);
3862#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003863 return __builtin_altivec_vmulosb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003864#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003865}
3866
3867/* vec_vmuloub */
3868
3869static vector unsigned short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003870vec_vmuloub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003871{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003872#ifdef __LITTLE_ENDIAN__
3873 return __builtin_altivec_vmuleub(__a, __b);
3874#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003875 return __builtin_altivec_vmuloub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003876#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003877}
3878
3879/* vec_vmulosh */
3880
3881static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003882vec_vmulosh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003883{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003884#ifdef __LITTLE_ENDIAN__
3885 return __builtin_altivec_vmulesh(__a, __b);
3886#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003887 return __builtin_altivec_vmulosh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003888#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003889}
3890
3891/* vec_vmulouh */
3892
3893static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003894vec_vmulouh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003895{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003896#ifdef __LITTLE_ENDIAN__
3897 return __builtin_altivec_vmuleuh(__a, __b);
3898#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003899 return __builtin_altivec_vmulouh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003900#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003901}
3902
3903/* vec_nmsub */
3904
3905static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003906vec_nmsub(vector float __a, vector float __b, vector float __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003907{
David Blaikie3302f2b2013-01-16 23:08:36 +00003908 return __builtin_altivec_vnmsubfp(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003909}
3910
3911/* vec_vnmsubfp */
3912
3913static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003914vec_vnmsubfp(vector float __a, vector float __b, vector float __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003915{
David Blaikie3302f2b2013-01-16 23:08:36 +00003916 return __builtin_altivec_vnmsubfp(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003917}
3918
3919/* vec_nor */
3920
3921#define __builtin_altivec_vnor vec_nor
3922
3923static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003924vec_nor(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003925{
David Blaikie3302f2b2013-01-16 23:08:36 +00003926 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003927}
3928
3929static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003930vec_nor(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003931{
David Blaikie3302f2b2013-01-16 23:08:36 +00003932 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003933}
3934
Anton Yartsevfc83c602010-08-19 03:21:36 +00003935static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003936vec_nor(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003937{
David Blaikie3302f2b2013-01-16 23:08:36 +00003938 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003939}
3940
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003941static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003942vec_nor(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003943{
David Blaikie3302f2b2013-01-16 23:08:36 +00003944 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003945}
3946
3947static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003948vec_nor(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003949{
David Blaikie3302f2b2013-01-16 23:08:36 +00003950 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003951}
3952
Anton Yartsevfc83c602010-08-19 03:21:36 +00003953static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003954vec_nor(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003955{
David Blaikie3302f2b2013-01-16 23:08:36 +00003956 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003957}
3958
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003959static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003960vec_nor(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003961{
David Blaikie3302f2b2013-01-16 23:08:36 +00003962 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003963}
3964
3965static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003966vec_nor(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003967{
David Blaikie3302f2b2013-01-16 23:08:36 +00003968 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003969}
3970
Anton Yartsevfc83c602010-08-19 03:21:36 +00003971static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003972vec_nor(vector bool int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003973{
David Blaikie3302f2b2013-01-16 23:08:36 +00003974 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003975}
3976
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003977static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003978vec_nor(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003979{
David Blaikie3302f2b2013-01-16 23:08:36 +00003980 vector unsigned int __res = ~((vector unsigned int)__a | (vector unsigned int)__b);
3981 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003982}
3983
3984/* vec_vnor */
3985
3986static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003987vec_vnor(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003988{
David Blaikie3302f2b2013-01-16 23:08:36 +00003989 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003990}
3991
3992static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003993vec_vnor(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003994{
David Blaikie3302f2b2013-01-16 23:08:36 +00003995 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003996}
3997
Anton Yartsevfc83c602010-08-19 03:21:36 +00003998static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003999vec_vnor(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004000{
David Blaikie3302f2b2013-01-16 23:08:36 +00004001 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00004002}
4003
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004004static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004005vec_vnor(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004006{
David Blaikie3302f2b2013-01-16 23:08:36 +00004007 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004008}
4009
4010static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004011vec_vnor(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004012{
David Blaikie3302f2b2013-01-16 23:08:36 +00004013 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004014}
4015
Anton Yartsevfc83c602010-08-19 03:21:36 +00004016static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004017vec_vnor(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004018{
David Blaikie3302f2b2013-01-16 23:08:36 +00004019 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00004020}
4021
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004022static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004023vec_vnor(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004024{
David Blaikie3302f2b2013-01-16 23:08:36 +00004025 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004026}
4027
4028static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004029vec_vnor(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004030{
David Blaikie3302f2b2013-01-16 23:08:36 +00004031 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004032}
4033
Anton Yartsevfc83c602010-08-19 03:21:36 +00004034static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004035vec_vnor(vector bool int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004036{
David Blaikie3302f2b2013-01-16 23:08:36 +00004037 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00004038}
4039
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004040static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004041vec_vnor(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004042{
David Blaikie3302f2b2013-01-16 23:08:36 +00004043 vector unsigned int __res = ~((vector unsigned int)__a | (vector unsigned int)__b);
4044 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004045}
4046
4047/* vec_or */
4048
4049#define __builtin_altivec_vor vec_or
4050
4051static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004052vec_or(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004053{
David Blaikie3302f2b2013-01-16 23:08:36 +00004054 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004055}
4056
Anton Yartsevfc83c602010-08-19 03:21:36 +00004057static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004058vec_or(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004059{
David Blaikie3302f2b2013-01-16 23:08:36 +00004060 return (vector signed char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004061}
4062
4063static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004064vec_or(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004065{
David Blaikie3302f2b2013-01-16 23:08:36 +00004066 return __a | (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004067}
4068
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004069static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004070vec_or(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004071{
David Blaikie3302f2b2013-01-16 23:08:36 +00004072 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004073}
4074
Anton Yartsevfc83c602010-08-19 03:21:36 +00004075static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004076vec_or(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004077{
David Blaikie3302f2b2013-01-16 23:08:36 +00004078 return (vector unsigned char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004079}
4080
4081static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004082vec_or(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004083{
David Blaikie3302f2b2013-01-16 23:08:36 +00004084 return __a | (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004085}
4086
4087static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004088vec_or(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004089{
David Blaikie3302f2b2013-01-16 23:08:36 +00004090 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004091}
4092
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004093static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004094vec_or(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004095{
David Blaikie3302f2b2013-01-16 23:08:36 +00004096 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004097}
4098
Anton Yartsevfc83c602010-08-19 03:21:36 +00004099static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004100vec_or(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004101{
David Blaikie3302f2b2013-01-16 23:08:36 +00004102 return (vector short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004103}
4104
4105static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004106vec_or(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004107{
David Blaikie3302f2b2013-01-16 23:08:36 +00004108 return __a | (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004109}
4110
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004111static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004112vec_or(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004113{
David Blaikie3302f2b2013-01-16 23:08:36 +00004114 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004115}
4116
Anton Yartsevfc83c602010-08-19 03:21:36 +00004117static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004118vec_or(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004119{
David Blaikie3302f2b2013-01-16 23:08:36 +00004120 return (vector unsigned short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004121}
4122
4123static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004124vec_or(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004125{
David Blaikie3302f2b2013-01-16 23:08:36 +00004126 return __a | (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004127}
4128
4129static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004130vec_or(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_or(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
Anton Yartsevfc83c602010-08-19 03:21:36 +00004141static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004142vec_or(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004143{
David Blaikie3302f2b2013-01-16 23:08:36 +00004144 return (vector int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004145}
4146
4147static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004148vec_or(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004149{
David Blaikie3302f2b2013-01-16 23:08:36 +00004150 return __a | (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004151}
4152
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004153static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004154vec_or(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004155{
David Blaikie3302f2b2013-01-16 23:08:36 +00004156 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004157}
4158
Anton Yartsevfc83c602010-08-19 03:21:36 +00004159static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004160vec_or(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004161{
David Blaikie3302f2b2013-01-16 23:08:36 +00004162 return (vector unsigned int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004163}
4164
4165static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004166vec_or(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004167{
David Blaikie3302f2b2013-01-16 23:08:36 +00004168 return __a | (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004169}
4170
4171static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004172vec_or(vector bool int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004173{
David Blaikie3302f2b2013-01-16 23:08:36 +00004174 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004175}
4176
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004177static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004178vec_or(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004179{
David Blaikie3302f2b2013-01-16 23:08:36 +00004180 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4181 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004182}
4183
Anton Yartsevfc83c602010-08-19 03:21:36 +00004184static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004185vec_or(vector bool int __a, vector float __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004186{
David Blaikie3302f2b2013-01-16 23:08:36 +00004187 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4188 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004189}
4190
4191static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004192vec_or(vector float __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004193{
David Blaikie3302f2b2013-01-16 23:08:36 +00004194 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4195 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004196}
4197
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004198/* vec_vor */
4199
4200static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004201vec_vor(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004202{
David Blaikie3302f2b2013-01-16 23:08:36 +00004203 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004204}
4205
Anton Yartsevfc83c602010-08-19 03:21:36 +00004206static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004207vec_vor(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004208{
David Blaikie3302f2b2013-01-16 23:08:36 +00004209 return (vector signed char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004210}
4211
4212static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004213vec_vor(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004214{
David Blaikie3302f2b2013-01-16 23:08:36 +00004215 return __a | (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004216}
4217
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004218static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004219vec_vor(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004220{
David Blaikie3302f2b2013-01-16 23:08:36 +00004221 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004222}
4223
Anton Yartsevfc83c602010-08-19 03:21:36 +00004224static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004225vec_vor(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004226{
David Blaikie3302f2b2013-01-16 23:08:36 +00004227 return (vector unsigned char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004228}
4229
4230static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004231vec_vor(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004232{
David Blaikie3302f2b2013-01-16 23:08:36 +00004233 return __a | (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004234}
4235
4236static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004237vec_vor(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004238{
David Blaikie3302f2b2013-01-16 23:08:36 +00004239 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004240}
4241
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004242static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004243vec_vor(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004244{
David Blaikie3302f2b2013-01-16 23:08:36 +00004245 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004246}
4247
Anton Yartsevfc83c602010-08-19 03:21:36 +00004248static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004249vec_vor(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004250{
David Blaikie3302f2b2013-01-16 23:08:36 +00004251 return (vector short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004252}
4253
4254static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004255vec_vor(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004256{
David Blaikie3302f2b2013-01-16 23:08:36 +00004257 return __a | (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004258}
4259
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004260static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004261vec_vor(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004262{
David Blaikie3302f2b2013-01-16 23:08:36 +00004263 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004264}
4265
Anton Yartsevfc83c602010-08-19 03:21:36 +00004266static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004267vec_vor(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004268{
David Blaikie3302f2b2013-01-16 23:08:36 +00004269 return (vector unsigned short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004270}
4271
4272static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004273vec_vor(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004274{
David Blaikie3302f2b2013-01-16 23:08:36 +00004275 return __a | (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004276}
4277
4278static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004279vec_vor(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004280{
David Blaikie3302f2b2013-01-16 23:08:36 +00004281 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004282}
4283
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004284static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004285vec_vor(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004286{
David Blaikie3302f2b2013-01-16 23:08:36 +00004287 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004288}
4289
Anton Yartsevfc83c602010-08-19 03:21:36 +00004290static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004291vec_vor(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004292{
David Blaikie3302f2b2013-01-16 23:08:36 +00004293 return (vector int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004294}
4295
4296static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004297vec_vor(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004298{
David Blaikie3302f2b2013-01-16 23:08:36 +00004299 return __a | (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004300}
4301
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004302static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004303vec_vor(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004304{
David Blaikie3302f2b2013-01-16 23:08:36 +00004305 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004306}
4307
Anton Yartsevfc83c602010-08-19 03:21:36 +00004308static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004309vec_vor(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004310{
David Blaikie3302f2b2013-01-16 23:08:36 +00004311 return (vector unsigned int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004312}
4313
4314static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004315vec_vor(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004316{
David Blaikie3302f2b2013-01-16 23:08:36 +00004317 return __a | (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004318}
4319
4320static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004321vec_vor(vector bool int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004322{
David Blaikie3302f2b2013-01-16 23:08:36 +00004323 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004324}
4325
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004326static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004327vec_vor(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004328{
David Blaikie3302f2b2013-01-16 23:08:36 +00004329 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4330 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004331}
4332
Anton Yartsevfc83c602010-08-19 03:21:36 +00004333static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004334vec_vor(vector bool int __a, vector float __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004335{
David Blaikie3302f2b2013-01-16 23:08:36 +00004336 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4337 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004338}
4339
4340static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004341vec_vor(vector float __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004342{
David Blaikie3302f2b2013-01-16 23:08:36 +00004343 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4344 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004345}
4346
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004347/* vec_pack */
4348
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004349/* The various vector pack instructions have a big-endian bias, so for
4350 little endian we must handle reversed element numbering. */
4351
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004352static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004353vec_pack(vector signed short __a, vector signed short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004354{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004355#ifdef __LITTLE_ENDIAN__
4356 return (vector signed char)vec_perm(__a, __b, (vector unsigned char)
4357 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4358 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4359#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004360 return (vector signed char)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004361 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4362 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004363#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004364}
4365
4366static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004367vec_pack(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004368{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004369#ifdef __LITTLE_ENDIAN__
4370 return (vector unsigned char)vec_perm(__a, __b, (vector unsigned char)
4371 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4372 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4373#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004374 return (vector unsigned char)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004375 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4376 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004377#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004378}
4379
Anton Yartsev9e968982010-08-19 03:00:09 +00004380static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004381vec_pack(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00004382{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004383#ifdef __LITTLE_ENDIAN__
4384 return (vector bool char)vec_perm(__a, __b, (vector unsigned char)
4385 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4386 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4387#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004388 return (vector bool char)vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00004389 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4390 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004391#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004392}
4393
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004394static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004395vec_pack(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004396{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004397#ifdef __LITTLE_ENDIAN__
4398 return (vector short)vec_perm(__a, __b, (vector unsigned char)
4399 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4400 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4401#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004402 return (vector short)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004403 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4404 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004405#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004406}
4407
4408static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004409vec_pack(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004410{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004411#ifdef __LITTLE_ENDIAN__
4412 return (vector unsigned short)vec_perm(__a, __b, (vector unsigned char)
4413 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4414 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4415#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004416 return (vector unsigned short)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004417 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4418 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004419#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004420}
4421
Anton Yartsev9e968982010-08-19 03:00:09 +00004422static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004423vec_pack(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00004424{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004425#ifdef __LITTLE_ENDIAN__
Bill Schmidt1cf7c642014-06-13 18:30:06 +00004426 return (vector bool short)vec_perm(__a, __b, (vector unsigned char)
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004427 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4428 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4429#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004430 return (vector bool short)vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00004431 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4432 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004433#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004434}
4435
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004436/* vec_vpkuhum */
4437
4438#define __builtin_altivec_vpkuhum vec_vpkuhum
4439
4440static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004441vec_vpkuhum(vector signed short __a, vector signed short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004442{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004443#ifdef __LITTLE_ENDIAN__
4444 return (vector signed char)vec_perm(__a, __b, (vector unsigned char)
4445 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4446 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4447#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004448 return (vector signed char)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004449 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4450 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004451#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004452}
4453
4454static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004455vec_vpkuhum(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004456{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004457#ifdef __LITTLE_ENDIAN__
4458 return (vector unsigned char)vec_perm(__a, __b, (vector unsigned char)
4459 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4460 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4461#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004462 return (vector unsigned char)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004463 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4464 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004465#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004466}
4467
Anton Yartsev9e968982010-08-19 03:00:09 +00004468static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004469vec_vpkuhum(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00004470{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004471#ifdef __LITTLE_ENDIAN__
4472 return (vector bool char)vec_perm(__a, __b, (vector unsigned char)
4473 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4474 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4475#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004476 return (vector bool char)vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00004477 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4478 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004479#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004480}
4481
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004482/* vec_vpkuwum */
4483
4484#define __builtin_altivec_vpkuwum vec_vpkuwum
4485
4486static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004487vec_vpkuwum(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004488{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004489#ifdef __LITTLE_ENDIAN__
4490 return (vector short)vec_perm(__a, __b, (vector unsigned char)
4491 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4492 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4493#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004494 return (vector short)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004495 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4496 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004497#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004498}
4499
4500static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004501vec_vpkuwum(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004502{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004503#ifdef __LITTLE_ENDIAN__
4504 return (vector unsigned short)vec_perm(__a, __b, (vector unsigned char)
4505 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4506 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4507#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004508 return (vector unsigned short)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004509 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4510 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004511#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004512}
4513
Anton Yartsev9e968982010-08-19 03:00:09 +00004514static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004515vec_vpkuwum(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00004516{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004517#ifdef __LITTLE_ENDIAN__
4518 return (vector bool short)vec_perm(__a, __b, (vector unsigned char)
4519 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4520 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4521#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004522 return (vector bool short)vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00004523 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4524 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004525#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004526}
4527
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004528/* vec_packpx */
4529
4530static vector pixel __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004531vec_packpx(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004532{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004533#ifdef __LITTLE_ENDIAN__
4534 return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
4535#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004536 return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004537#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004538}
4539
4540/* vec_vpkpx */
4541
4542static vector pixel __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004543vec_vpkpx(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004544{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004545#ifdef __LITTLE_ENDIAN__
4546 return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
4547#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004548 return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004549#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004550}
4551
4552/* vec_packs */
4553
4554static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004555vec_packs(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004556{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004557#ifdef __LITTLE_ENDIAN__
4558 return __builtin_altivec_vpkshss(__b, __a);
4559#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004560 return __builtin_altivec_vpkshss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004561#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004562}
4563
4564static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004565vec_packs(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004566{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004567#ifdef __LITTLE_ENDIAN__
4568 return __builtin_altivec_vpkuhus(__b, __a);
4569#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004570 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004571#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004572}
4573
4574static vector signed short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004575vec_packs(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004576{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004577#ifdef __LITTLE_ENDIAN__
4578 return __builtin_altivec_vpkswss(__b, __a);
4579#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004580 return __builtin_altivec_vpkswss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004581#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004582}
4583
4584static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004585vec_packs(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004586{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004587#ifdef __LITTLE_ENDIAN__
4588 return __builtin_altivec_vpkuwus(__b, __a);
4589#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004590 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004591#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004592}
4593
4594/* vec_vpkshss */
4595
4596static vector signed char __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004597vec_vpkshss(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004598{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004599#ifdef __LITTLE_ENDIAN__
4600 return __builtin_altivec_vpkshss(__b, __a);
4601#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004602 return __builtin_altivec_vpkshss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004603#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004604}
4605
4606/* vec_vpkuhus */
4607
4608static vector unsigned char __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004609vec_vpkuhus(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004610{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004611#ifdef __LITTLE_ENDIAN__
4612 return __builtin_altivec_vpkuhus(__b, __a);
4613#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004614 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004615#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004616}
4617
4618/* vec_vpkswss */
4619
4620static vector signed short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004621vec_vpkswss(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004622{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004623#ifdef __LITTLE_ENDIAN__
4624 return __builtin_altivec_vpkswss(__b, __a);
4625#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004626 return __builtin_altivec_vpkswss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004627#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004628}
4629
4630/* vec_vpkuwus */
4631
4632static vector unsigned short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004633vec_vpkuwus(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004634{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004635#ifdef __LITTLE_ENDIAN__
4636 return __builtin_altivec_vpkuwus(__b, __a);
4637#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004638 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004639#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004640}
4641
4642/* vec_packsu */
4643
4644static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004645vec_packsu(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004646{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004647#ifdef __LITTLE_ENDIAN__
4648 return __builtin_altivec_vpkshus(__b, __a);
4649#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004650 return __builtin_altivec_vpkshus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004651#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004652}
4653
4654static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004655vec_packsu(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004656{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004657#ifdef __LITTLE_ENDIAN__
4658 return __builtin_altivec_vpkuhus(__b, __a);
4659#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004660 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004661#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004662}
4663
4664static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004665vec_packsu(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004666{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004667#ifdef __LITTLE_ENDIAN__
4668 return __builtin_altivec_vpkswus(__b, __a);
4669#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004670 return __builtin_altivec_vpkswus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004671#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004672}
4673
4674static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004675vec_packsu(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004676{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004677#ifdef __LITTLE_ENDIAN__
4678 return __builtin_altivec_vpkuwus(__b, __a);
4679#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004680 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004681#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004682}
4683
4684/* vec_vpkshus */
4685
4686static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004687vec_vpkshus(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004688{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004689#ifdef __LITTLE_ENDIAN__
4690 return __builtin_altivec_vpkshus(__b, __a);
4691#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004692 return __builtin_altivec_vpkshus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004693#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004694}
4695
4696static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004697vec_vpkshus(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004698{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004699#ifdef __LITTLE_ENDIAN__
4700 return __builtin_altivec_vpkuhus(__b, __a);
4701#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004702 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004703#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004704}
4705
4706/* vec_vpkswus */
4707
4708static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004709vec_vpkswus(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004710{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004711#ifdef __LITTLE_ENDIAN__
4712 return __builtin_altivec_vpkswus(__b, __a);
4713#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004714 return __builtin_altivec_vpkswus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004715#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004716}
4717
4718static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004719vec_vpkswus(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004720{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004721#ifdef __LITTLE_ENDIAN__
4722 return __builtin_altivec_vpkuwus(__b, __a);
4723#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004724 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004725#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004726}
4727
4728/* vec_perm */
4729
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004730// The vperm instruction is defined architecturally with a big-endian bias.
4731// For little endian, we swap the input operands and invert the permute
4732// control vector. Only the rightmost 5 bits matter, so we could use
4733// a vector of all 31s instead of all 255s to perform the inversion.
4734// However, when the PCV is not a constant, using 255 has an advantage
4735// in that the vec_xor can be recognized as a vec_nor (and for P8 and
4736// later, possibly a vec_nand).
4737
Eric Christopherc67e1b62014-12-10 00:57:43 +00004738static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004739vec_perm(vector signed char __a, vector signed char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004740{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004741#ifdef __LITTLE_ENDIAN__
4742 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4743 255,255,255,255,255,255,255,255};
4744 __d = vec_xor(__c, __d);
4745 return (vector signed char)
4746 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4747#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004748 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00004749 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004750#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004751}
4752
Eric Christopherc67e1b62014-12-10 00:57:43 +00004753static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004754vec_perm(vector unsigned char __a,
4755 vector unsigned char __b,
4756 vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004757{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004758#ifdef __LITTLE_ENDIAN__
4759 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4760 255,255,255,255,255,255,255,255};
4761 __d = vec_xor(__c, __d);
4762 return (vector unsigned char)
4763 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4764#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004765 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00004766 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004767#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004768}
4769
Eric Christopherc67e1b62014-12-10 00:57:43 +00004770static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004771vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00004772{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004773#ifdef __LITTLE_ENDIAN__
4774 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4775 255,255,255,255,255,255,255,255};
4776 __d = vec_xor(__c, __d);
4777 return (vector bool char)
4778 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4779#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004780 return (vector bool char)
David Blaikie3302f2b2013-01-16 23:08:36 +00004781 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004782#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004783}
4784
Eric Christopherc67e1b62014-12-10 00:57:43 +00004785static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004786vec_perm(vector short __a, vector short __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004787{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004788#ifdef __LITTLE_ENDIAN__
4789 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4790 255,255,255,255,255,255,255,255};
4791 __d = vec_xor(__c, __d);
4792 return (vector short)
4793 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4794#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004795 return (vector short)
David Blaikie3302f2b2013-01-16 23:08:36 +00004796 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004797#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004798}
4799
Eric Christopherc67e1b62014-12-10 00:57:43 +00004800static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004801vec_perm(vector unsigned short __a,
4802 vector unsigned short __b,
4803 vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004804{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004805#ifdef __LITTLE_ENDIAN__
4806 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4807 255,255,255,255,255,255,255,255};
4808 __d = vec_xor(__c, __d);
4809 return (vector unsigned short)
4810 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4811#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004812 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00004813 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004814#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004815}
4816
Eric Christopherc67e1b62014-12-10 00:57:43 +00004817static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004818vec_perm(vector bool short __a, vector bool short __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00004819{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004820#ifdef __LITTLE_ENDIAN__
4821 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4822 255,255,255,255,255,255,255,255};
4823 __d = vec_xor(__c, __d);
4824 return (vector bool short)
4825 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4826#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004827 return (vector bool short)
David Blaikie3302f2b2013-01-16 23:08:36 +00004828 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004829#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004830}
4831
Eric Christopherc67e1b62014-12-10 00:57:43 +00004832static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004833vec_perm(vector pixel __a, vector pixel __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00004834{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004835#ifdef __LITTLE_ENDIAN__
4836 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4837 255,255,255,255,255,255,255,255};
4838 __d = vec_xor(__c, __d);
4839 return (vector pixel)
4840 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4841#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004842 return (vector pixel)
David Blaikie3302f2b2013-01-16 23:08:36 +00004843 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004844#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004845}
4846
Eric Christopherc67e1b62014-12-10 00:57:43 +00004847static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004848vec_perm(vector int __a, vector int __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004849{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004850#ifdef __LITTLE_ENDIAN__
4851 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4852 255,255,255,255,255,255,255,255};
4853 __d = vec_xor(__c, __d);
4854 return (vector int)__builtin_altivec_vperm_4si(__b, __a, __d);
4855#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004856 return (vector int)__builtin_altivec_vperm_4si(__a, __b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004857#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004858}
4859
Eric Christopherc67e1b62014-12-10 00:57:43 +00004860static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004861vec_perm(vector unsigned int __a, vector unsigned int __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004862{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004863#ifdef __LITTLE_ENDIAN__
4864 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4865 255,255,255,255,255,255,255,255};
4866 __d = vec_xor(__c, __d);
4867 return (vector unsigned int)
4868 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4869#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004870 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00004871 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004872#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004873}
4874
Eric Christopherc67e1b62014-12-10 00:57:43 +00004875static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004876vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00004877{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004878#ifdef __LITTLE_ENDIAN__
4879 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4880 255,255,255,255,255,255,255,255};
4881 __d = vec_xor(__c, __d);
4882 return (vector bool int)
4883 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4884#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004885 return (vector bool int)
David Blaikie3302f2b2013-01-16 23:08:36 +00004886 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004887#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004888}
4889
Eric Christopherc67e1b62014-12-10 00:57:43 +00004890static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004891vec_perm(vector float __a, vector float __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004892{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004893#ifdef __LITTLE_ENDIAN__
4894 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4895 255,255,255,255,255,255,255,255};
4896 __d = vec_xor(__c, __d);
4897 return (vector float)
4898 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4899#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004900 return (vector float)
David Blaikie3302f2b2013-01-16 23:08:36 +00004901 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004902#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004903}
4904
Bill Schmidt8ff672d2014-11-14 13:10:13 +00004905#ifdef __VSX__
Eric Christopherc67e1b62014-12-10 00:57:43 +00004906static vector long long __ATTRS_o_ai
Bill Schmidt8ff672d2014-11-14 13:10:13 +00004907vec_perm(vector long long __a, vector long long __b, vector unsigned char __c)
4908{
4909#ifdef __LITTLE_ENDIAN__
4910 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4911 255,255,255,255,255,255,255,255};
4912 __d = vec_xor(__c, __d);
4913 return (vector long long)__builtin_altivec_vperm_4si(__b, __a, __d);
4914#else
4915 return (vector long long)__builtin_altivec_vperm_4si(__a, __b, __c);
4916#endif
4917}
4918
Eric Christopherc67e1b62014-12-10 00:57:43 +00004919static vector unsigned long long __ATTRS_o_ai
Bill Schmidt8ff672d2014-11-14 13:10:13 +00004920vec_perm(vector unsigned long long __a, vector unsigned long long __b,
4921 vector unsigned char __c)
4922{
4923#ifdef __LITTLE_ENDIAN__
4924 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4925 255,255,255,255,255,255,255,255};
4926 __d = vec_xor(__c, __d);
4927 return (vector unsigned long long)
4928 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4929#else
4930 return (vector unsigned long long)
4931 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
4932#endif
4933}
4934
Eric Christopherc67e1b62014-12-10 00:57:43 +00004935static vector double __ATTRS_o_ai
Bill Schmidt8ff672d2014-11-14 13:10:13 +00004936vec_perm(vector double __a, vector double __b, vector unsigned char __c)
4937{
4938#ifdef __LITTLE_ENDIAN__
4939 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4940 255,255,255,255,255,255,255,255};
4941 __d = vec_xor(__c, __d);
4942 return (vector double)
4943 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4944#else
4945 return (vector double)
4946 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
4947#endif
4948}
4949#endif
4950
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004951/* vec_vperm */
4952
Ulrich Weigand9936f132012-10-31 18:17:07 +00004953static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004954vec_vperm(vector signed char __a, vector signed char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004955{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004956 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004957}
4958
Ulrich Weigand9936f132012-10-31 18:17:07 +00004959static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004960vec_vperm(vector unsigned char __a,
4961 vector unsigned char __b,
4962 vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004963{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004964 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004965}
4966
Ulrich Weigand9936f132012-10-31 18:17:07 +00004967static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004968vec_vperm(vector bool char __a, vector bool char __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00004969{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004970 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00004971}
4972
Ulrich Weigand9936f132012-10-31 18:17:07 +00004973static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004974vec_vperm(vector short __a, vector short __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004975{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004976 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004977}
4978
Ulrich Weigand9936f132012-10-31 18:17:07 +00004979static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004980vec_vperm(vector unsigned short __a,
4981 vector unsigned short __b,
4982 vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004983{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004984 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004985}
4986
Ulrich Weigand9936f132012-10-31 18:17:07 +00004987static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004988vec_vperm(vector bool short __a, vector bool short __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00004989{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004990 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00004991}
4992
Ulrich Weigand9936f132012-10-31 18:17:07 +00004993static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004994vec_vperm(vector pixel __a, vector pixel __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00004995{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004996 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00004997}
4998
Ulrich Weigand9936f132012-10-31 18:17:07 +00004999static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005000vec_vperm(vector int __a, vector int __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005001{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005002 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005003}
5004
Ulrich Weigand9936f132012-10-31 18:17:07 +00005005static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005006vec_vperm(vector unsigned int __a, vector unsigned int __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005007{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005008 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005009}
5010
Ulrich Weigand9936f132012-10-31 18:17:07 +00005011static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005012vec_vperm(vector bool int __a, vector bool int __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00005013{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005014 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00005015}
5016
Ulrich Weigand9936f132012-10-31 18:17:07 +00005017static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005018vec_vperm(vector float __a, vector float __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005019{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00005020 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005021}
5022
Bill Schmidt8ff672d2014-11-14 13:10:13 +00005023#ifdef __VSX__
5024static vector long long __ATTRS_o_ai
5025vec_vperm(vector long long __a, vector long long __b, vector unsigned char __c)
5026{
5027 return vec_perm(__a, __b, __c);
5028}
5029
5030static vector unsigned long long __ATTRS_o_ai
5031vec_vperm(vector unsigned long long __a, vector unsigned long long __b,
5032 vector unsigned char __c)
5033{
5034 return vec_perm(__a, __b, __c);
5035}
5036
5037static vector double __ATTRS_o_ai
5038vec_vperm(vector double __a, vector double __b, vector unsigned char __c)
5039{
5040 return vec_perm(__a, __b, __c);
5041}
5042#endif
5043
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005044/* vec_re */
5045
Ulrich Weigand9936f132012-10-31 18:17:07 +00005046static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00005047vec_re(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005048{
David Blaikie3302f2b2013-01-16 23:08:36 +00005049 return __builtin_altivec_vrefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005050}
5051
5052/* vec_vrefp */
5053
Ulrich Weigand9936f132012-10-31 18:17:07 +00005054static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00005055vec_vrefp(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005056{
David Blaikie3302f2b2013-01-16 23:08:36 +00005057 return __builtin_altivec_vrefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005058}
5059
5060/* vec_rl */
5061
5062static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005063vec_rl(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005064{
David Blaikie3302f2b2013-01-16 23:08:36 +00005065 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005066}
5067
5068static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005069vec_rl(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005070{
David Blaikie3302f2b2013-01-16 23:08:36 +00005071 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005072}
5073
5074static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005075vec_rl(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005076{
David Blaikie3302f2b2013-01-16 23:08:36 +00005077 return __builtin_altivec_vrlh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005078}
5079
5080static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005081vec_rl(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005082{
David Blaikie3302f2b2013-01-16 23:08:36 +00005083 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005084}
5085
5086static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005087vec_rl(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005088{
David Blaikie3302f2b2013-01-16 23:08:36 +00005089 return __builtin_altivec_vrlw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005090}
5091
5092static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005093vec_rl(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005094{
David Blaikie3302f2b2013-01-16 23:08:36 +00005095 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005096}
5097
5098/* vec_vrlb */
5099
5100static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005101vec_vrlb(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005102{
David Blaikie3302f2b2013-01-16 23:08:36 +00005103 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005104}
5105
5106static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005107vec_vrlb(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005108{
David Blaikie3302f2b2013-01-16 23:08:36 +00005109 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005110}
5111
5112/* vec_vrlh */
5113
5114static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005115vec_vrlh(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005116{
David Blaikie3302f2b2013-01-16 23:08:36 +00005117 return __builtin_altivec_vrlh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005118}
5119
5120static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005121vec_vrlh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005122{
David Blaikie3302f2b2013-01-16 23:08:36 +00005123 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005124}
5125
5126/* vec_vrlw */
5127
5128static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005129vec_vrlw(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005130{
David Blaikie3302f2b2013-01-16 23:08:36 +00005131 return __builtin_altivec_vrlw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005132}
5133
5134static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005135vec_vrlw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005136{
David Blaikie3302f2b2013-01-16 23:08:36 +00005137 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005138}
5139
5140/* vec_round */
5141
5142static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00005143vec_round(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005144{
David Blaikie3302f2b2013-01-16 23:08:36 +00005145 return __builtin_altivec_vrfin(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005146}
5147
5148/* vec_vrfin */
5149
5150static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00005151vec_vrfin(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005152{
David Blaikie3302f2b2013-01-16 23:08:36 +00005153 return __builtin_altivec_vrfin(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005154}
5155
5156/* vec_rsqrte */
5157
5158static __vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00005159vec_rsqrte(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005160{
David Blaikie3302f2b2013-01-16 23:08:36 +00005161 return __builtin_altivec_vrsqrtefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005162}
5163
5164/* vec_vrsqrtefp */
5165
5166static __vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00005167vec_vrsqrtefp(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005168{
David Blaikie3302f2b2013-01-16 23:08:36 +00005169 return __builtin_altivec_vrsqrtefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005170}
5171
5172/* vec_sel */
5173
5174#define __builtin_altivec_vsel_4si vec_sel
5175
5176static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005177vec_sel(vector signed char __a, vector signed char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005178{
David Blaikie3302f2b2013-01-16 23:08:36 +00005179 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005180}
5181
Anton Yartsevfc83c602010-08-19 03:21:36 +00005182static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005183vec_sel(vector signed char __a, vector signed char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005184{
David Blaikie3302f2b2013-01-16 23:08:36 +00005185 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005186}
5187
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005188static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005189vec_sel(vector unsigned char __a, vector unsigned char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005190{
David Blaikie3302f2b2013-01-16 23:08:36 +00005191 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005192}
5193
Anton Yartsevfc83c602010-08-19 03:21:36 +00005194static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005195vec_sel(vector unsigned char __a, vector unsigned char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005196{
David Blaikie3302f2b2013-01-16 23:08:36 +00005197 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005198}
5199
5200static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005201vec_sel(vector bool char __a, vector bool char __b, vector unsigned char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005202{
David Blaikie3302f2b2013-01-16 23:08:36 +00005203 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005204}
5205
5206static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005207vec_sel(vector bool char __a, vector bool char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005208{
David Blaikie3302f2b2013-01-16 23:08:36 +00005209 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005210}
5211
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005212static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005213vec_sel(vector short __a, vector short __b, vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005214{
David Blaikie3302f2b2013-01-16 23:08:36 +00005215 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005216}
5217
Anton Yartsevfc83c602010-08-19 03:21:36 +00005218static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005219vec_sel(vector short __a, vector short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005220{
David Blaikie3302f2b2013-01-16 23:08:36 +00005221 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005222}
5223
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005224static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005225vec_sel(vector unsigned short __a,
5226 vector unsigned short __b,
5227 vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005228{
David Blaikie3302f2b2013-01-16 23:08:36 +00005229 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005230}
5231
Anton Yartsevfc83c602010-08-19 03:21:36 +00005232static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005233vec_sel(vector unsigned short __a, vector unsigned short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005234{
David Blaikie3302f2b2013-01-16 23:08:36 +00005235 return (__a & ~(vector unsigned short)__c) | (__b & (vector unsigned short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005236}
5237
5238static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005239vec_sel(vector bool short __a, vector bool short __b, vector unsigned short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005240{
David Blaikie3302f2b2013-01-16 23:08:36 +00005241 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005242}
5243
5244static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005245vec_sel(vector bool short __a, vector bool short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005246{
David Blaikie3302f2b2013-01-16 23:08:36 +00005247 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005248}
5249
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005250static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005251vec_sel(vector int __a, vector int __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005252{
David Blaikie3302f2b2013-01-16 23:08:36 +00005253 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005254}
5255
Anton Yartsevfc83c602010-08-19 03:21:36 +00005256static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005257vec_sel(vector int __a, vector int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005258{
David Blaikie3302f2b2013-01-16 23:08:36 +00005259 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005260}
5261
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005262static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005263vec_sel(vector unsigned int __a, vector unsigned int __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005264{
David Blaikie3302f2b2013-01-16 23:08:36 +00005265 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005266}
5267
Anton Yartsevfc83c602010-08-19 03:21:36 +00005268static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005269vec_sel(vector unsigned int __a, vector unsigned int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005270{
David Blaikie3302f2b2013-01-16 23:08:36 +00005271 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005272}
5273
5274static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005275vec_sel(vector bool int __a, vector bool int __b, vector unsigned int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005276{
David Blaikie3302f2b2013-01-16 23:08:36 +00005277 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005278}
5279
5280static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005281vec_sel(vector bool int __a, vector bool int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005282{
David Blaikie3302f2b2013-01-16 23:08:36 +00005283 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005284}
5285
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005286static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005287vec_sel(vector float __a, vector float __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005288{
David Blaikie3302f2b2013-01-16 23:08:36 +00005289 vector int __res = ((vector int)__a & ~(vector int)__c)
5290 | ((vector int)__b & (vector int)__c);
5291 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005292}
5293
Anton Yartsevfc83c602010-08-19 03:21:36 +00005294static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005295vec_sel(vector float __a, vector float __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005296{
David Blaikie3302f2b2013-01-16 23:08:36 +00005297 vector int __res = ((vector int)__a & ~(vector int)__c)
5298 | ((vector int)__b & (vector int)__c);
5299 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00005300}
5301
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005302/* vec_vsel */
5303
5304static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005305vec_vsel(vector signed char __a, vector signed char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005306{
David Blaikie3302f2b2013-01-16 23:08:36 +00005307 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005308}
5309
Anton Yartsevfc83c602010-08-19 03:21:36 +00005310static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005311vec_vsel(vector signed char __a, vector signed char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005312{
David Blaikie3302f2b2013-01-16 23:08:36 +00005313 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005314}
5315
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005316static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005317vec_vsel(vector unsigned char __a, vector unsigned char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005318{
David Blaikie3302f2b2013-01-16 23:08:36 +00005319 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005320}
5321
Anton Yartsevfc83c602010-08-19 03:21:36 +00005322static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005323vec_vsel(vector unsigned char __a, vector unsigned char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005324{
David Blaikie3302f2b2013-01-16 23:08:36 +00005325 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005326}
5327
5328static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005329vec_vsel(vector bool char __a, vector bool char __b, vector unsigned char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005330{
David Blaikie3302f2b2013-01-16 23:08:36 +00005331 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005332}
5333
5334static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005335vec_vsel(vector bool char __a, vector bool char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005336{
David Blaikie3302f2b2013-01-16 23:08:36 +00005337 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005338}
5339
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005340static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005341vec_vsel(vector short __a, vector short __b, vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005342{
David Blaikie3302f2b2013-01-16 23:08:36 +00005343 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005344}
5345
Anton Yartsevfc83c602010-08-19 03:21:36 +00005346static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005347vec_vsel(vector short __a, vector short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005348{
David Blaikie3302f2b2013-01-16 23:08:36 +00005349 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005350}
5351
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005352static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005353vec_vsel(vector unsigned short __a,
5354 vector unsigned short __b,
5355 vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005356{
David Blaikie3302f2b2013-01-16 23:08:36 +00005357 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005358}
5359
Anton Yartsevfc83c602010-08-19 03:21:36 +00005360static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005361vec_vsel(vector unsigned short __a, vector unsigned short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005362{
David Blaikie3302f2b2013-01-16 23:08:36 +00005363 return (__a & ~(vector unsigned short)__c) | (__b & (vector unsigned short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005364}
5365
5366static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005367vec_vsel(vector bool short __a, vector bool short __b, vector unsigned short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005368{
David Blaikie3302f2b2013-01-16 23:08:36 +00005369 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005370}
5371
5372static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005373vec_vsel(vector bool short __a, vector bool short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005374{
David Blaikie3302f2b2013-01-16 23:08:36 +00005375 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005376}
5377
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005378static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005379vec_vsel(vector int __a, vector int __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005380{
David Blaikie3302f2b2013-01-16 23:08:36 +00005381 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005382}
5383
Anton Yartsevfc83c602010-08-19 03:21:36 +00005384static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005385vec_vsel(vector int __a, vector int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005386{
David Blaikie3302f2b2013-01-16 23:08:36 +00005387 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005388}
5389
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005390static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005391vec_vsel(vector unsigned int __a, vector unsigned int __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005392{
David Blaikie3302f2b2013-01-16 23:08:36 +00005393 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005394}
5395
Anton Yartsevfc83c602010-08-19 03:21:36 +00005396static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005397vec_vsel(vector unsigned int __a, vector unsigned int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005398{
David Blaikie3302f2b2013-01-16 23:08:36 +00005399 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005400}
5401
5402static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005403vec_vsel(vector bool int __a, vector bool int __b, vector unsigned int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005404{
David Blaikie3302f2b2013-01-16 23:08:36 +00005405 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005406}
5407
5408static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005409vec_vsel(vector bool int __a, vector bool int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005410{
David Blaikie3302f2b2013-01-16 23:08:36 +00005411 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005412}
5413
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005414static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005415vec_vsel(vector float __a, vector float __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005416{
David Blaikie3302f2b2013-01-16 23:08:36 +00005417 vector int __res = ((vector int)__a & ~(vector int)__c)
5418 | ((vector int)__b & (vector int)__c);
5419 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005420}
5421
Anton Yartsevfc83c602010-08-19 03:21:36 +00005422static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005423vec_vsel(vector float __a, vector float __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005424{
David Blaikie3302f2b2013-01-16 23:08:36 +00005425 vector int __res = ((vector int)__a & ~(vector int)__c)
5426 | ((vector int)__b & (vector int)__c);
5427 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00005428}
5429
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005430/* vec_sl */
5431
5432static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005433vec_sl(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005434{
David Blaikie3302f2b2013-01-16 23:08:36 +00005435 return __a << (vector signed char)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005436}
5437
5438static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005439vec_sl(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005440{
David Blaikie3302f2b2013-01-16 23:08:36 +00005441 return __a << __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005442}
5443
5444static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005445vec_sl(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005446{
David Blaikie3302f2b2013-01-16 23:08:36 +00005447 return __a << (vector short)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005448}
5449
5450static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005451vec_sl(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005452{
David Blaikie3302f2b2013-01-16 23:08:36 +00005453 return __a << __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005454}
5455
5456static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005457vec_sl(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005458{
David Blaikie3302f2b2013-01-16 23:08:36 +00005459 return __a << (vector int)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005460}
5461
5462static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005463vec_sl(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005464{
David Blaikie3302f2b2013-01-16 23:08:36 +00005465 return __a << __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005466}
5467
5468/* vec_vslb */
5469
5470#define __builtin_altivec_vslb vec_vslb
5471
5472static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005473vec_vslb(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005474{
David Blaikie3302f2b2013-01-16 23:08:36 +00005475 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005476}
5477
5478static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005479vec_vslb(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005480{
David Blaikie3302f2b2013-01-16 23:08:36 +00005481 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005482}
5483
5484/* vec_vslh */
5485
5486#define __builtin_altivec_vslh vec_vslh
5487
5488static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005489vec_vslh(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005490{
David Blaikie3302f2b2013-01-16 23:08:36 +00005491 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005492}
5493
5494static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005495vec_vslh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005496{
David Blaikie3302f2b2013-01-16 23:08:36 +00005497 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005498}
5499
5500/* vec_vslw */
5501
5502#define __builtin_altivec_vslw vec_vslw
5503
5504static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005505vec_vslw(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005506{
David Blaikie3302f2b2013-01-16 23:08:36 +00005507 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005508}
5509
5510static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005511vec_vslw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005512{
David Blaikie3302f2b2013-01-16 23:08:36 +00005513 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005514}
5515
5516/* vec_sld */
5517
5518#define __builtin_altivec_vsldoi_4si vec_sld
5519
5520static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005521vec_sld(vector signed char __a, vector signed char __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005522{
David Blaikie3302f2b2013-01-16 23:08:36 +00005523 return vec_perm(__a, __b, (vector unsigned char)
5524 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5525 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005526}
5527
5528static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005529vec_sld(vector unsigned char __a, vector unsigned char __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005530{
David Blaikie3302f2b2013-01-16 23:08:36 +00005531 return vec_perm(__a, __b, (vector unsigned char)
5532 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5533 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005534}
5535
5536static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005537vec_sld(vector short __a, vector short __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005538{
David Blaikie3302f2b2013-01-16 23:08:36 +00005539 return vec_perm(__a, __b, (vector unsigned char)
5540 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5541 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005542}
5543
5544static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005545vec_sld(vector unsigned short __a, vector unsigned short __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005546{
David Blaikie3302f2b2013-01-16 23:08:36 +00005547 return vec_perm(__a, __b, (vector unsigned char)
5548 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5549 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Yartsev9e968982010-08-19 03:00:09 +00005550}
5551
5552static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005553vec_sld(vector pixel __a, vector pixel __b, unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00005554{
David Blaikie3302f2b2013-01-16 23:08:36 +00005555 return vec_perm(__a, __b, (vector unsigned char)
5556 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5557 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005558}
5559
5560static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005561vec_sld(vector int __a, vector int __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005562{
David Blaikie3302f2b2013-01-16 23:08:36 +00005563 return vec_perm(__a, __b, (vector unsigned char)
5564 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5565 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005566}
5567
5568static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005569vec_sld(vector unsigned int __a, vector unsigned int __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005570{
David Blaikie3302f2b2013-01-16 23:08:36 +00005571 return vec_perm(__a, __b, (vector unsigned char)
5572 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5573 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005574}
5575
5576static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005577vec_sld(vector float __a, vector float __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005578{
David Blaikie3302f2b2013-01-16 23:08:36 +00005579 return vec_perm(__a, __b, (vector unsigned char)
5580 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5581 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005582}
5583
5584/* vec_vsldoi */
5585
5586static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005587vec_vsldoi(vector signed char __a, vector signed char __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005588{
David Blaikie3302f2b2013-01-16 23:08:36 +00005589 return vec_perm(__a, __b, (vector unsigned char)
5590 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5591 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005592}
5593
5594static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005595vec_vsldoi(vector unsigned char __a, vector unsigned char __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005596{
David Blaikie3302f2b2013-01-16 23:08:36 +00005597 return vec_perm(__a, __b, (vector unsigned char)
5598 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5599 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005600}
5601
5602static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005603vec_vsldoi(vector short __a, vector short __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005604{
David Blaikie3302f2b2013-01-16 23:08:36 +00005605 return vec_perm(__a, __b, (vector unsigned char)
5606 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5607 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005608}
5609
5610static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005611vec_vsldoi(vector unsigned short __a, vector unsigned short __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005612{
David Blaikie3302f2b2013-01-16 23:08:36 +00005613 return vec_perm(__a, __b, (vector unsigned char)
5614 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5615 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Yartsev9e968982010-08-19 03:00:09 +00005616}
5617
5618static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005619vec_vsldoi(vector pixel __a, vector pixel __b, unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00005620{
David Blaikie3302f2b2013-01-16 23:08:36 +00005621 return vec_perm(__a, __b, (vector unsigned char)
5622 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5623 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005624}
5625
5626static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005627vec_vsldoi(vector int __a, vector int __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005628{
David Blaikie3302f2b2013-01-16 23:08:36 +00005629 return vec_perm(__a, __b, (vector unsigned char)
5630 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5631 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005632}
5633
5634static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005635vec_vsldoi(vector unsigned int __a, vector unsigned int __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005636{
David Blaikie3302f2b2013-01-16 23:08:36 +00005637 return vec_perm(__a, __b, (vector unsigned char)
5638 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5639 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005640}
5641
5642static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005643vec_vsldoi(vector float __a, vector float __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005644{
David Blaikie3302f2b2013-01-16 23:08:36 +00005645 return vec_perm(__a, __b, (vector unsigned char)
5646 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5647 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005648}
5649
5650/* vec_sll */
5651
5652static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005653vec_sll(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005654{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005655 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005656 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005657}
5658
5659static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005660vec_sll(vector signed char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005661{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005662 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005663 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005664}
5665
5666static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005667vec_sll(vector signed char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005668{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005669 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005670 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005671}
5672
5673static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005674vec_sll(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005675{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005676 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005677 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005678}
5679
5680static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005681vec_sll(vector unsigned char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005682{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005683 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005684 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005685}
5686
5687static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005688vec_sll(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005689{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005690 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005691 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005692}
5693
Anton Yartsevfc83c602010-08-19 03:21:36 +00005694static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005695vec_sll(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005696{
David Blaikie3302f2b2013-01-16 23:08:36 +00005697 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005698}
5699
5700static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005701vec_sll(vector bool char __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005702{
David Blaikie3302f2b2013-01-16 23:08:36 +00005703 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005704}
5705
5706static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005707vec_sll(vector bool char __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005708{
David Blaikie3302f2b2013-01-16 23:08:36 +00005709 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005710}
5711
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005712static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005713vec_sll(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005714{
David Blaikie3302f2b2013-01-16 23:08:36 +00005715 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005716}
5717
5718static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005719vec_sll(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005720{
David Blaikie3302f2b2013-01-16 23:08:36 +00005721 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005722}
5723
5724static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005725vec_sll(vector short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005726{
David Blaikie3302f2b2013-01-16 23:08:36 +00005727 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005728}
5729
5730static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005731vec_sll(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005732{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005733 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00005734 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005735}
5736
5737static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005738vec_sll(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005739{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005740 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00005741 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005742}
5743
5744static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005745vec_sll(vector unsigned short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005746{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005747 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00005748 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005749}
5750
Anton Yartsevfc83c602010-08-19 03:21:36 +00005751static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005752vec_sll(vector bool short __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005753{
David Blaikie3302f2b2013-01-16 23:08:36 +00005754 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005755}
5756
5757static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005758vec_sll(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005759{
David Blaikie3302f2b2013-01-16 23:08:36 +00005760 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005761}
5762
5763static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005764vec_sll(vector bool short __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005765{
David Blaikie3302f2b2013-01-16 23:08:36 +00005766 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005767}
5768
5769static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005770vec_sll(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005771{
David Blaikie3302f2b2013-01-16 23:08:36 +00005772 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005773}
5774
5775static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005776vec_sll(vector pixel __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005777{
David Blaikie3302f2b2013-01-16 23:08:36 +00005778 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005779}
5780
5781static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005782vec_sll(vector pixel __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005783{
David Blaikie3302f2b2013-01-16 23:08:36 +00005784 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005785}
5786
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005787static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005788vec_sll(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005789{
David Blaikie3302f2b2013-01-16 23:08:36 +00005790 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005791}
5792
5793static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005794vec_sll(vector int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005795{
David Blaikie3302f2b2013-01-16 23:08:36 +00005796 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005797}
5798
5799static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005800vec_sll(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005801{
David Blaikie3302f2b2013-01-16 23:08:36 +00005802 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005803}
5804
5805static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005806vec_sll(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005807{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005808 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00005809 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005810}
5811
5812static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005813vec_sll(vector unsigned int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005814{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005815 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00005816 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005817}
5818
5819static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005820vec_sll(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005821{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005822 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00005823 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005824}
5825
Anton Yartsevfc83c602010-08-19 03:21:36 +00005826static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005827vec_sll(vector bool int __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005828{
David Blaikie3302f2b2013-01-16 23:08:36 +00005829 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005830}
5831
5832static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005833vec_sll(vector bool int __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005834{
David Blaikie3302f2b2013-01-16 23:08:36 +00005835 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005836}
5837
5838static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005839vec_sll(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005840{
David Blaikie3302f2b2013-01-16 23:08:36 +00005841 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005842}
5843
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005844/* vec_vsl */
5845
5846static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005847vec_vsl(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005848{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005849 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005850 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005851}
5852
5853static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005854vec_vsl(vector signed char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005855{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005856 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005857 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005858}
5859
5860static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005861vec_vsl(vector signed char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005862{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005863 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005864 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005865}
5866
5867static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005868vec_vsl(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005869{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005870 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005871 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005872}
5873
5874static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005875vec_vsl(vector unsigned char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005876{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005877 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005878 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005879}
5880
5881static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005882vec_vsl(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005883{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005884 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005885 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005886}
5887
Anton Yartsevfc83c602010-08-19 03:21:36 +00005888static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005889vec_vsl(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005890{
David Blaikie3302f2b2013-01-16 23:08:36 +00005891 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005892}
5893
5894static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005895vec_vsl(vector bool char __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005896{
David Blaikie3302f2b2013-01-16 23:08:36 +00005897 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005898}
5899
5900static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005901vec_vsl(vector bool char __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005902{
David Blaikie3302f2b2013-01-16 23:08:36 +00005903 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005904}
5905
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005906static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005907vec_vsl(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005908{
David Blaikie3302f2b2013-01-16 23:08:36 +00005909 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005910}
5911
5912static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005913vec_vsl(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005914{
David Blaikie3302f2b2013-01-16 23:08:36 +00005915 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005916}
5917
5918static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005919vec_vsl(vector short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005920{
David Blaikie3302f2b2013-01-16 23:08:36 +00005921 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005922}
5923
5924static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005925vec_vsl(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005926{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005927 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00005928 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005929}
5930
5931static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005932vec_vsl(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005933{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005934 return (vector unsigned short)
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 unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005939vec_vsl(vector unsigned short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005940{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005941 return (vector unsigned short)
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
Anton Yartsevfc83c602010-08-19 03:21:36 +00005945static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005946vec_vsl(vector bool short __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005947{
David Blaikie3302f2b2013-01-16 23:08:36 +00005948 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005949}
5950
5951static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005952vec_vsl(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005953{
David Blaikie3302f2b2013-01-16 23:08:36 +00005954 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005955}
5956
5957static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005958vec_vsl(vector bool short __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005959{
David Blaikie3302f2b2013-01-16 23:08:36 +00005960 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005961}
5962
5963static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005964vec_vsl(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005965{
David Blaikie3302f2b2013-01-16 23:08:36 +00005966 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005967}
5968
5969static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005970vec_vsl(vector pixel __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005971{
David Blaikie3302f2b2013-01-16 23:08:36 +00005972 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005973}
5974
5975static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005976vec_vsl(vector pixel __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005977{
David Blaikie3302f2b2013-01-16 23:08:36 +00005978 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005979}
5980
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005981static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005982vec_vsl(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005983{
David Blaikie3302f2b2013-01-16 23:08:36 +00005984 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005985}
5986
5987static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005988vec_vsl(vector int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005989{
David Blaikie3302f2b2013-01-16 23:08:36 +00005990 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005991}
5992
5993static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005994vec_vsl(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005995{
David Blaikie3302f2b2013-01-16 23:08:36 +00005996 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005997}
5998
5999static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006000vec_vsl(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006001{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006002 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006003 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006004}
6005
6006static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006007vec_vsl(vector unsigned int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006008{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006009 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006010 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006011}
6012
6013static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006014vec_vsl(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006015{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006016 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006017 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006018}
6019
Anton Yartsevfc83c602010-08-19 03:21:36 +00006020static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006021vec_vsl(vector bool int __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006022{
David Blaikie3302f2b2013-01-16 23:08:36 +00006023 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006024}
6025
6026static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006027vec_vsl(vector bool int __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006028{
David Blaikie3302f2b2013-01-16 23:08:36 +00006029 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006030}
6031
6032static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006033vec_vsl(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006034{
David Blaikie3302f2b2013-01-16 23:08:36 +00006035 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006036}
6037
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006038/* vec_slo */
6039
6040static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006041vec_slo(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006042{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006043 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006044 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006045}
6046
6047static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006048vec_slo(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006049{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006050 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006051 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006052}
6053
6054static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006055vec_slo(vector unsigned char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006056{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006057 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006058 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006059}
6060
6061static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006062vec_slo(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006063{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006064 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006065 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006066}
6067
6068static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006069vec_slo(vector short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006070{
David Blaikie3302f2b2013-01-16 23:08:36 +00006071 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006072}
6073
6074static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006075vec_slo(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006076{
David Blaikie3302f2b2013-01-16 23:08:36 +00006077 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006078}
6079
6080static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006081vec_slo(vector unsigned short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006082{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006083 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006084 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006085}
6086
6087static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006088vec_slo(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006089{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006090 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006091 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006092}
6093
Anton Yartsevfc83c602010-08-19 03:21:36 +00006094static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006095vec_slo(vector pixel __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006096{
David Blaikie3302f2b2013-01-16 23:08:36 +00006097 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006098}
6099
6100static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006101vec_slo(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006102{
David Blaikie3302f2b2013-01-16 23:08:36 +00006103 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006104}
6105
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006106static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006107vec_slo(vector int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006108{
David Blaikie3302f2b2013-01-16 23:08:36 +00006109 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006110}
6111
6112static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006113vec_slo(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006114{
David Blaikie3302f2b2013-01-16 23:08:36 +00006115 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006116}
6117
6118static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006119vec_slo(vector unsigned int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006120{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006121 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006122 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006123}
6124
6125static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006126vec_slo(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006127{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006128 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006129 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006130}
6131
6132static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006133vec_slo(vector float __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006134{
David Blaikie3302f2b2013-01-16 23:08:36 +00006135 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006136}
6137
6138static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006139vec_slo(vector float __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006140{
David Blaikie3302f2b2013-01-16 23:08:36 +00006141 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006142}
6143
6144/* vec_vslo */
6145
6146static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006147vec_vslo(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006148{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006149 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006150 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006151}
6152
6153static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006154vec_vslo(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006155{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006156 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006157 __builtin_altivec_vslo((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_vslo(vector unsigned char __a, vector signed char __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_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006165}
6166
6167static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006168vec_vslo(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006169{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006170 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006171 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006172}
6173
6174static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006175vec_vslo(vector short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006176{
David Blaikie3302f2b2013-01-16 23:08:36 +00006177 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006178}
6179
6180static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006181vec_vslo(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006182{
David Blaikie3302f2b2013-01-16 23:08:36 +00006183 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006184}
6185
6186static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006187vec_vslo(vector unsigned short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006188{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006189 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006190 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006191}
6192
6193static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006194vec_vslo(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006195{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006196 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006197 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006198}
6199
Anton Yartsevfc83c602010-08-19 03:21:36 +00006200static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006201vec_vslo(vector pixel __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006202{
David Blaikie3302f2b2013-01-16 23:08:36 +00006203 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006204}
6205
6206static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006207vec_vslo(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006208{
David Blaikie3302f2b2013-01-16 23:08:36 +00006209 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006210}
6211
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006212static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006213vec_vslo(vector int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006214{
David Blaikie3302f2b2013-01-16 23:08:36 +00006215 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006216}
6217
6218static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006219vec_vslo(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006220{
David Blaikie3302f2b2013-01-16 23:08:36 +00006221 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006222}
6223
6224static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006225vec_vslo(vector unsigned int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006226{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006227 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006228 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006229}
6230
6231static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006232vec_vslo(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006233{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006234 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006235 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006236}
6237
6238static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006239vec_vslo(vector float __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006240{
David Blaikie3302f2b2013-01-16 23:08:36 +00006241 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006242}
6243
6244static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006245vec_vslo(vector float __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006246{
David Blaikie3302f2b2013-01-16 23:08:36 +00006247 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006248}
6249
6250/* vec_splat */
6251
6252static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006253vec_splat(vector signed char __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006254{
David Blaikie3302f2b2013-01-16 23:08:36 +00006255 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006256}
6257
6258static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006259vec_splat(vector unsigned char __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006260{
David Blaikie3302f2b2013-01-16 23:08:36 +00006261 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Yartsev9e968982010-08-19 03:00:09 +00006262}
6263
6264static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006265vec_splat(vector bool char __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006266{
David Blaikie3302f2b2013-01-16 23:08:36 +00006267 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006268}
6269
6270static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006271vec_splat(vector short __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006272{
David Blaikie3302f2b2013-01-16 23:08:36 +00006273 __b *= 2;
6274 unsigned char b1=__b+1;
6275 return vec_perm(__a, __a, (vector unsigned char)
6276 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006277}
6278
6279static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006280vec_splat(vector unsigned short __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006281{
David Blaikie3302f2b2013-01-16 23:08:36 +00006282 __b *= 2;
6283 unsigned char b1=__b+1;
6284 return vec_perm(__a, __a, (vector unsigned char)
6285 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00006286}
6287
6288static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006289vec_splat(vector bool short __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006290{
David Blaikie3302f2b2013-01-16 23:08:36 +00006291 __b *= 2;
6292 unsigned char b1=__b+1;
6293 return vec_perm(__a, __a, (vector unsigned char)
6294 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00006295}
6296
6297static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006298vec_splat(vector pixel __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006299{
David Blaikie3302f2b2013-01-16 23:08:36 +00006300 __b *= 2;
6301 unsigned char b1=__b+1;
6302 return vec_perm(__a, __a, (vector unsigned char)
6303 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006304}
6305
6306static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006307vec_splat(vector int __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006308{
David Blaikie3302f2b2013-01-16 23:08:36 +00006309 __b *= 4;
6310 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6311 return vec_perm(__a, __a, (vector unsigned char)
6312 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006313}
6314
6315static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006316vec_splat(vector unsigned int __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006317{
David Blaikie3302f2b2013-01-16 23:08:36 +00006318 __b *= 4;
6319 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6320 return vec_perm(__a, __a, (vector unsigned char)
6321 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Yartsev9e968982010-08-19 03:00:09 +00006322}
6323
6324static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006325vec_splat(vector bool int __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006326{
David Blaikie3302f2b2013-01-16 23:08:36 +00006327 __b *= 4;
6328 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6329 return vec_perm(__a, __a, (vector unsigned char)
6330 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006331}
6332
6333static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006334vec_splat(vector float __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006335{
David Blaikie3302f2b2013-01-16 23:08:36 +00006336 __b *= 4;
6337 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6338 return vec_perm(__a, __a, (vector unsigned char)
6339 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006340}
6341
6342/* vec_vspltb */
6343
6344#define __builtin_altivec_vspltb vec_vspltb
6345
6346static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006347vec_vspltb(vector signed char __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006348{
David Blaikie3302f2b2013-01-16 23:08:36 +00006349 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006350}
6351
6352static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006353vec_vspltb(vector unsigned char __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006354{
David Blaikie3302f2b2013-01-16 23:08:36 +00006355 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Yartsev9e968982010-08-19 03:00:09 +00006356}
6357
6358static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006359vec_vspltb(vector bool char __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006360{
David Blaikie3302f2b2013-01-16 23:08:36 +00006361 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006362}
6363
6364/* vec_vsplth */
6365
6366#define __builtin_altivec_vsplth vec_vsplth
6367
6368static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006369vec_vsplth(vector short __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006370{
David Blaikie3302f2b2013-01-16 23:08:36 +00006371 __b *= 2;
6372 unsigned char b1=__b+1;
6373 return vec_perm(__a, __a, (vector unsigned char)
6374 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006375}
6376
6377static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006378vec_vsplth(vector unsigned short __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006379{
David Blaikie3302f2b2013-01-16 23:08:36 +00006380 __b *= 2;
6381 unsigned char b1=__b+1;
6382 return vec_perm(__a, __a, (vector unsigned char)
6383 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00006384}
6385
6386static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006387vec_vsplth(vector bool short __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006388{
David Blaikie3302f2b2013-01-16 23:08:36 +00006389 __b *= 2;
6390 unsigned char b1=__b+1;
6391 return vec_perm(__a, __a, (vector unsigned char)
6392 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00006393}
6394
6395static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006396vec_vsplth(vector pixel __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006397{
David Blaikie3302f2b2013-01-16 23:08:36 +00006398 __b *= 2;
6399 unsigned char b1=__b+1;
6400 return vec_perm(__a, __a, (vector unsigned char)
6401 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006402}
6403
6404/* vec_vspltw */
6405
6406#define __builtin_altivec_vspltw vec_vspltw
6407
6408static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006409vec_vspltw(vector int __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006410{
David Blaikie3302f2b2013-01-16 23:08:36 +00006411 __b *= 4;
6412 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6413 return vec_perm(__a, __a, (vector unsigned char)
6414 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006415}
6416
6417static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006418vec_vspltw(vector unsigned int __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006419{
David Blaikie3302f2b2013-01-16 23:08:36 +00006420 __b *= 4;
6421 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6422 return vec_perm(__a, __a, (vector unsigned char)
6423 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Yartsev9e968982010-08-19 03:00:09 +00006424}
6425
6426static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006427vec_vspltw(vector bool int __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006428{
David Blaikie3302f2b2013-01-16 23:08:36 +00006429 __b *= 4;
6430 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6431 return vec_perm(__a, __a, (vector unsigned char)
6432 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006433}
6434
6435static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006436vec_vspltw(vector float __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006437{
David Blaikie3302f2b2013-01-16 23:08:36 +00006438 __b *= 4;
6439 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6440 return vec_perm(__a, __a, (vector unsigned char)
6441 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006442}
6443
6444/* vec_splat_s8 */
6445
6446#define __builtin_altivec_vspltisb vec_splat_s8
6447
6448// FIXME: parameter should be treated as 5-bit signed literal
6449static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006450vec_splat_s8(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006451{
David Blaikie3302f2b2013-01-16 23:08:36 +00006452 return (vector signed char)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006453}
6454
6455/* vec_vspltisb */
6456
6457// FIXME: parameter should be treated as 5-bit signed literal
6458static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006459vec_vspltisb(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006460{
David Blaikie3302f2b2013-01-16 23:08:36 +00006461 return (vector signed char)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006462}
6463
6464/* vec_splat_s16 */
6465
6466#define __builtin_altivec_vspltish vec_splat_s16
6467
6468// FIXME: parameter should be treated as 5-bit signed literal
6469static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006470vec_splat_s16(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006471{
David Blaikie3302f2b2013-01-16 23:08:36 +00006472 return (vector short)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006473}
6474
6475/* vec_vspltish */
6476
6477// FIXME: parameter should be treated as 5-bit signed literal
6478static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006479vec_vspltish(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006480{
David Blaikie3302f2b2013-01-16 23:08:36 +00006481 return (vector short)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006482}
6483
6484/* vec_splat_s32 */
6485
6486#define __builtin_altivec_vspltisw vec_splat_s32
6487
6488// FIXME: parameter should be treated as 5-bit signed literal
6489static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006490vec_splat_s32(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006491{
David Blaikie3302f2b2013-01-16 23:08:36 +00006492 return (vector int)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006493}
6494
6495/* vec_vspltisw */
6496
6497// FIXME: parameter should be treated as 5-bit signed literal
6498static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006499vec_vspltisw(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006500{
David Blaikie3302f2b2013-01-16 23:08:36 +00006501 return (vector int)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006502}
6503
6504/* vec_splat_u8 */
6505
6506// FIXME: parameter should be treated as 5-bit signed literal
6507static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006508vec_splat_u8(unsigned char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006509{
David Blaikie3302f2b2013-01-16 23:08:36 +00006510 return (vector unsigned char)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006511}
6512
6513/* vec_splat_u16 */
6514
6515// FIXME: parameter should be treated as 5-bit signed literal
6516static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006517vec_splat_u16(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006518{
David Blaikie3302f2b2013-01-16 23:08:36 +00006519 return (vector unsigned short)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006520}
6521
6522/* vec_splat_u32 */
6523
6524// FIXME: parameter should be treated as 5-bit signed literal
6525static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006526vec_splat_u32(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006527{
David Blaikie3302f2b2013-01-16 23:08:36 +00006528 return (vector unsigned int)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006529}
6530
6531/* vec_sr */
6532
6533static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006534vec_sr(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006535{
David Blaikie3302f2b2013-01-16 23:08:36 +00006536 return __a >> (vector signed char)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006537}
6538
6539static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006540vec_sr(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006541{
David Blaikie3302f2b2013-01-16 23:08:36 +00006542 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006543}
6544
6545static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006546vec_sr(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006547{
David Blaikie3302f2b2013-01-16 23:08:36 +00006548 return __a >> (vector short)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006549}
6550
6551static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006552vec_sr(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006553{
David Blaikie3302f2b2013-01-16 23:08:36 +00006554 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006555}
6556
6557static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006558vec_sr(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006559{
David Blaikie3302f2b2013-01-16 23:08:36 +00006560 return __a >> (vector int)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006561}
6562
6563static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006564vec_sr(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006565{
David Blaikie3302f2b2013-01-16 23:08:36 +00006566 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006567}
6568
6569/* vec_vsrb */
6570
6571#define __builtin_altivec_vsrb vec_vsrb
6572
6573static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006574vec_vsrb(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006575{
David Blaikie3302f2b2013-01-16 23:08:36 +00006576 return __a >> (vector signed char)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006577}
6578
6579static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006580vec_vsrb(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006581{
David Blaikie3302f2b2013-01-16 23:08:36 +00006582 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006583}
6584
6585/* vec_vsrh */
6586
6587#define __builtin_altivec_vsrh vec_vsrh
6588
6589static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006590vec_vsrh(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006591{
David Blaikie3302f2b2013-01-16 23:08:36 +00006592 return __a >> (vector short)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006593}
6594
6595static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006596vec_vsrh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006597{
David Blaikie3302f2b2013-01-16 23:08:36 +00006598 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006599}
6600
6601/* vec_vsrw */
6602
6603#define __builtin_altivec_vsrw vec_vsrw
6604
6605static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006606vec_vsrw(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006607{
David Blaikie3302f2b2013-01-16 23:08:36 +00006608 return __a >> (vector int)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006609}
6610
6611static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006612vec_vsrw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006613{
David Blaikie3302f2b2013-01-16 23:08:36 +00006614 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006615}
6616
6617/* vec_sra */
6618
6619static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006620vec_sra(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006621{
David Blaikie3302f2b2013-01-16 23:08:36 +00006622 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006623}
6624
6625static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006626vec_sra(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006627{
David Blaikie3302f2b2013-01-16 23:08:36 +00006628 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006629}
6630
6631static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006632vec_sra(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006633{
David Blaikie3302f2b2013-01-16 23:08:36 +00006634 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006635}
6636
6637static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006638vec_sra(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006639{
David Blaikie3302f2b2013-01-16 23:08:36 +00006640 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006641}
6642
6643static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006644vec_sra(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006645{
David Blaikie3302f2b2013-01-16 23:08:36 +00006646 return __builtin_altivec_vsraw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006647}
6648
6649static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006650vec_sra(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006651{
David Blaikie3302f2b2013-01-16 23:08:36 +00006652 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006653}
6654
6655/* vec_vsrab */
6656
6657static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006658vec_vsrab(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006659{
David Blaikie3302f2b2013-01-16 23:08:36 +00006660 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006661}
6662
6663static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006664vec_vsrab(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006665{
David Blaikie3302f2b2013-01-16 23:08:36 +00006666 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006667}
6668
6669/* vec_vsrah */
6670
6671static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006672vec_vsrah(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006673{
David Blaikie3302f2b2013-01-16 23:08:36 +00006674 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006675}
6676
6677static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006678vec_vsrah(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006679{
David Blaikie3302f2b2013-01-16 23:08:36 +00006680 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006681}
6682
6683/* vec_vsraw */
6684
6685static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006686vec_vsraw(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006687{
David Blaikie3302f2b2013-01-16 23:08:36 +00006688 return __builtin_altivec_vsraw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006689}
6690
6691static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006692vec_vsraw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006693{
David Blaikie3302f2b2013-01-16 23:08:36 +00006694 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006695}
6696
6697/* vec_srl */
6698
6699static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006700vec_srl(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006701{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006702 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006703 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006704}
6705
6706static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006707vec_srl(vector signed char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006708{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006709 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006710 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006711}
6712
6713static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006714vec_srl(vector signed char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006715{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006716 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006717 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006718}
6719
6720static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006721vec_srl(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006722{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006723 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006724 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006725}
6726
6727static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006728vec_srl(vector unsigned char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006729{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006730 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006731 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006732}
6733
6734static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006735vec_srl(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006736{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006737 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006738 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006739}
6740
Anton Yartsevfc83c602010-08-19 03:21:36 +00006741static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006742vec_srl(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006743{
David Blaikie3302f2b2013-01-16 23:08:36 +00006744 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006745}
6746
6747static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006748vec_srl(vector bool char __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006749{
David Blaikie3302f2b2013-01-16 23:08:36 +00006750 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006751}
6752
6753static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006754vec_srl(vector bool char __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006755{
David Blaikie3302f2b2013-01-16 23:08:36 +00006756 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006757}
6758
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006759static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006760vec_srl(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006761{
David Blaikie3302f2b2013-01-16 23:08:36 +00006762 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006763}
6764
6765static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006766vec_srl(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006767{
David Blaikie3302f2b2013-01-16 23:08:36 +00006768 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006769}
6770
6771static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006772vec_srl(vector short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006773{
David Blaikie3302f2b2013-01-16 23:08:36 +00006774 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006775}
6776
6777static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006778vec_srl(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006779{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006780 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006781 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006782}
6783
6784static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006785vec_srl(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006786{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006787 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006788 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006789}
6790
6791static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006792vec_srl(vector unsigned short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006793{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006794 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006795 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006796}
6797
Anton Yartsevfc83c602010-08-19 03:21:36 +00006798static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006799vec_srl(vector bool short __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006800{
David Blaikie3302f2b2013-01-16 23:08:36 +00006801 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006802}
6803
6804static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006805vec_srl(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006806{
David Blaikie3302f2b2013-01-16 23:08:36 +00006807 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006808}
6809
6810static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006811vec_srl(vector bool short __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006812{
David Blaikie3302f2b2013-01-16 23:08:36 +00006813 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006814}
6815
6816static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006817vec_srl(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006818{
David Blaikie3302f2b2013-01-16 23:08:36 +00006819 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006820}
6821
6822static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006823vec_srl(vector pixel __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006824{
David Blaikie3302f2b2013-01-16 23:08:36 +00006825 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006826}
6827
6828static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006829vec_srl(vector pixel __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006830{
David Blaikie3302f2b2013-01-16 23:08:36 +00006831 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006832}
6833
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006834static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006835vec_srl(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006836{
David Blaikie3302f2b2013-01-16 23:08:36 +00006837 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006838}
6839
6840static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006841vec_srl(vector int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006842{
David Blaikie3302f2b2013-01-16 23:08:36 +00006843 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006844}
6845
6846static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006847vec_srl(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006848{
David Blaikie3302f2b2013-01-16 23:08:36 +00006849 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006850}
6851
6852static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006853vec_srl(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006854{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006855 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006856 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006857}
6858
6859static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006860vec_srl(vector unsigned int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006861{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006862 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006863 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006864}
6865
6866static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006867vec_srl(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006868{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006869 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006870 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006871}
6872
Anton Yartsevfc83c602010-08-19 03:21:36 +00006873static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006874vec_srl(vector bool int __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006875{
David Blaikie3302f2b2013-01-16 23:08:36 +00006876 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006877}
6878
6879static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006880vec_srl(vector bool int __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006881{
David Blaikie3302f2b2013-01-16 23:08:36 +00006882 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006883}
6884
6885static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006886vec_srl(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006887{
David Blaikie3302f2b2013-01-16 23:08:36 +00006888 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006889}
6890
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006891/* vec_vsr */
6892
6893static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006894vec_vsr(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006895{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006896 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006897 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006898}
6899
6900static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006901vec_vsr(vector signed char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006902{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006903 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006904 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006905}
6906
6907static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006908vec_vsr(vector signed char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006909{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006910 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006911 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006912}
6913
6914static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006915vec_vsr(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006916{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006917 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006918 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006919}
6920
6921static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006922vec_vsr(vector unsigned char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006923{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006924 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006925 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006926}
6927
6928static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006929vec_vsr(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006930{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006931 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006932 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006933}
6934
Anton Yartsevfc83c602010-08-19 03:21:36 +00006935static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006936vec_vsr(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006937{
David Blaikie3302f2b2013-01-16 23:08:36 +00006938 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006939}
6940
6941static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006942vec_vsr(vector bool char __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006943{
David Blaikie3302f2b2013-01-16 23:08:36 +00006944 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006945}
6946
6947static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006948vec_vsr(vector bool char __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006949{
David Blaikie3302f2b2013-01-16 23:08:36 +00006950 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006951}
6952
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006953static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006954vec_vsr(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006955{
David Blaikie3302f2b2013-01-16 23:08:36 +00006956 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006957}
6958
6959static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006960vec_vsr(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006961{
David Blaikie3302f2b2013-01-16 23:08:36 +00006962 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006963}
6964
6965static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006966vec_vsr(vector short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006967{
David Blaikie3302f2b2013-01-16 23:08:36 +00006968 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006969}
6970
6971static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006972vec_vsr(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006973{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006974 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006975 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006976}
6977
6978static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006979vec_vsr(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006980{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006981 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006982 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006983}
6984
6985static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006986vec_vsr(vector unsigned short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006987{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006988 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006989 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006990}
6991
Anton Yartsevfc83c602010-08-19 03:21:36 +00006992static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006993vec_vsr(vector bool short __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006994{
David Blaikie3302f2b2013-01-16 23:08:36 +00006995 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006996}
6997
6998static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006999vec_vsr(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007000{
David Blaikie3302f2b2013-01-16 23:08:36 +00007001 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007002}
7003
7004static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007005vec_vsr(vector bool short __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007006{
David Blaikie3302f2b2013-01-16 23:08:36 +00007007 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007008}
7009
7010static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007011vec_vsr(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007012{
David Blaikie3302f2b2013-01-16 23:08:36 +00007013 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007014}
7015
7016static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007017vec_vsr(vector pixel __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007018{
David Blaikie3302f2b2013-01-16 23:08:36 +00007019 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007020}
7021
7022static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007023vec_vsr(vector pixel __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007024{
David Blaikie3302f2b2013-01-16 23:08:36 +00007025 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007026}
7027
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007028static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007029vec_vsr(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007030{
David Blaikie3302f2b2013-01-16 23:08:36 +00007031 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007032}
7033
7034static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007035vec_vsr(vector int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007036{
David Blaikie3302f2b2013-01-16 23:08:36 +00007037 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007038}
7039
7040static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007041vec_vsr(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007042{
David Blaikie3302f2b2013-01-16 23:08:36 +00007043 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007044}
7045
7046static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007047vec_vsr(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007048{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007049 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007050 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007051}
7052
7053static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007054vec_vsr(vector unsigned int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007055{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007056 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007057 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007058}
7059
7060static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007061vec_vsr(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007062{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007063 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007064 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007065}
7066
Anton Yartsevfc83c602010-08-19 03:21:36 +00007067static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007068vec_vsr(vector bool int __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007069{
David Blaikie3302f2b2013-01-16 23:08:36 +00007070 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007071}
7072
7073static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007074vec_vsr(vector bool int __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007075{
David Blaikie3302f2b2013-01-16 23:08:36 +00007076 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007077}
7078
7079static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007080vec_vsr(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007081{
David Blaikie3302f2b2013-01-16 23:08:36 +00007082 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007083}
7084
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007085/* vec_sro */
7086
7087static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007088vec_sro(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007089{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007090 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007091 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007092}
7093
7094static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007095vec_sro(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007096{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007097 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007098 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007099}
7100
7101static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007102vec_sro(vector unsigned char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007103{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007104 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007105 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007106}
7107
7108static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007109vec_sro(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007110{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007111 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007112 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007113}
7114
7115static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007116vec_sro(vector short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007117{
David Blaikie3302f2b2013-01-16 23:08:36 +00007118 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007119}
7120
7121static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007122vec_sro(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007123{
David Blaikie3302f2b2013-01-16 23:08:36 +00007124 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007125}
7126
7127static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007128vec_sro(vector unsigned short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007129{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007130 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00007131 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007132}
7133
7134static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007135vec_sro(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007136{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007137 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00007138 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007139}
7140
Anton Yartsevfc83c602010-08-19 03:21:36 +00007141static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007142vec_sro(vector pixel __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007143{
David Blaikie3302f2b2013-01-16 23:08:36 +00007144 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007145}
7146
7147static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007148vec_sro(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007149{
David Blaikie3302f2b2013-01-16 23:08:36 +00007150 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007151}
7152
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007153static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007154vec_sro(vector int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007155{
David Blaikie3302f2b2013-01-16 23:08:36 +00007156 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007157}
7158
7159static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007160vec_sro(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007161{
David Blaikie3302f2b2013-01-16 23:08:36 +00007162 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007163}
7164
7165static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007166vec_sro(vector unsigned int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007167{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007168 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007169 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007170}
7171
7172static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007173vec_sro(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007174{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007175 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007176 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007177}
7178
7179static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007180vec_sro(vector float __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007181{
David Blaikie3302f2b2013-01-16 23:08:36 +00007182 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007183}
7184
7185static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007186vec_sro(vector float __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007187{
David Blaikie3302f2b2013-01-16 23:08:36 +00007188 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007189}
7190
7191/* vec_vsro */
7192
7193static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007194vec_vsro(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007195{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007196 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007197 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007198}
7199
7200static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007201vec_vsro(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_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007205}
7206
7207static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007208vec_vsro(vector unsigned char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007209{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007210 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007211 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007212}
7213
7214static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007215vec_vsro(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007216{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007217 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007218 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007219}
7220
7221static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007222vec_vsro(vector short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007223{
David Blaikie3302f2b2013-01-16 23:08:36 +00007224 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007225}
7226
7227static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007228vec_vsro(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007229{
David Blaikie3302f2b2013-01-16 23:08:36 +00007230 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007231}
7232
7233static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007234vec_vsro(vector unsigned short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007235{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007236 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00007237 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007238}
7239
7240static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007241vec_vsro(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007242{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007243 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00007244 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007245}
7246
Anton Yartsevfc83c602010-08-19 03:21:36 +00007247static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007248vec_vsro(vector pixel __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007249{
David Blaikie3302f2b2013-01-16 23:08:36 +00007250 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007251}
7252
7253static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007254vec_vsro(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007255{
David Blaikie3302f2b2013-01-16 23:08:36 +00007256 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007257}
7258
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007259static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007260vec_vsro(vector int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007261{
David Blaikie3302f2b2013-01-16 23:08:36 +00007262 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007263}
7264
7265static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007266vec_vsro(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007267{
David Blaikie3302f2b2013-01-16 23:08:36 +00007268 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007269}
7270
7271static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007272vec_vsro(vector unsigned int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007273{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007274 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007275 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007276}
7277
7278static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007279vec_vsro(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007280{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007281 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007282 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007283}
7284
7285static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007286vec_vsro(vector float __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007287{
David Blaikie3302f2b2013-01-16 23:08:36 +00007288 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007289}
7290
7291static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007292vec_vsro(vector float __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007293{
David Blaikie3302f2b2013-01-16 23:08:36 +00007294 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007295}
7296
7297/* vec_st */
7298
7299static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007300vec_st(vector signed char __a, int __b, vector signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007301{
David Blaikie3302f2b2013-01-16 23:08:36 +00007302 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007303}
7304
7305static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007306vec_st(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007307{
David Blaikie3302f2b2013-01-16 23:08:36 +00007308 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007309}
7310
7311static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007312vec_st(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007313{
David Blaikie3302f2b2013-01-16 23:08:36 +00007314 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007315}
7316
7317static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007318vec_st(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007319{
David Blaikie3302f2b2013-01-16 23:08:36 +00007320 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007321}
7322
7323static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007324vec_st(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007325{
David Blaikie3302f2b2013-01-16 23:08:36 +00007326 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007327}
7328
7329static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007330vec_st(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007331{
David Blaikie3302f2b2013-01-16 23:08:36 +00007332 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007333}
7334
7335static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007336vec_st(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007337{
David Blaikie3302f2b2013-01-16 23:08:36 +00007338 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007339}
7340
7341static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007342vec_st(vector short __a, int __b, vector short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007343{
David Blaikie3302f2b2013-01-16 23:08:36 +00007344 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007345}
7346
7347static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007348vec_st(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007349{
David Blaikie3302f2b2013-01-16 23:08:36 +00007350 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007351}
7352
7353static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007354vec_st(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007355{
David Blaikie3302f2b2013-01-16 23:08:36 +00007356 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007357}
7358
7359static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007360vec_st(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007361{
David Blaikie3302f2b2013-01-16 23:08:36 +00007362 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007363}
7364
7365static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007366vec_st(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007367{
David Blaikie3302f2b2013-01-16 23:08:36 +00007368 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007369}
7370
7371static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007372vec_st(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007373{
David Blaikie3302f2b2013-01-16 23:08:36 +00007374 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007375}
7376
7377static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007378vec_st(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007379{
David Blaikie3302f2b2013-01-16 23:08:36 +00007380 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007381}
7382
7383static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007384vec_st(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007385{
David Blaikie3302f2b2013-01-16 23:08:36 +00007386 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007387}
7388
7389static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007390vec_st(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007391{
David Blaikie3302f2b2013-01-16 23:08:36 +00007392 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007393}
7394
7395static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007396vec_st(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007397{
David Blaikie3302f2b2013-01-16 23:08:36 +00007398 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007399}
7400
7401static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007402vec_st(vector int __a, int __b, vector int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007403{
David Blaikie3302f2b2013-01-16 23:08:36 +00007404 __builtin_altivec_stvx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007405}
7406
7407static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007408vec_st(vector int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007409{
David Blaikie3302f2b2013-01-16 23:08:36 +00007410 __builtin_altivec_stvx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007411}
7412
7413static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007414vec_st(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007415{
David Blaikie3302f2b2013-01-16 23:08:36 +00007416 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007417}
7418
7419static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007420vec_st(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007421{
David Blaikie3302f2b2013-01-16 23:08:36 +00007422 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007423}
7424
7425static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007426vec_st(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007427{
David Blaikie3302f2b2013-01-16 23:08:36 +00007428 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007429}
7430
7431static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007432vec_st(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007433{
David Blaikie3302f2b2013-01-16 23:08:36 +00007434 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007435}
7436
7437static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007438vec_st(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007439{
David Blaikie3302f2b2013-01-16 23:08:36 +00007440 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007441}
7442
7443static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007444vec_st(vector float __a, int __b, vector float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007445{
David Blaikie3302f2b2013-01-16 23:08:36 +00007446 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007447}
7448
7449static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007450vec_st(vector float __a, int __b, float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007451{
David Blaikie3302f2b2013-01-16 23:08:36 +00007452 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007453}
7454
7455/* vec_stvx */
7456
7457static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007458vec_stvx(vector signed char __a, int __b, vector signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007459{
David Blaikie3302f2b2013-01-16 23:08:36 +00007460 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007461}
7462
7463static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007464vec_stvx(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007465{
David Blaikie3302f2b2013-01-16 23:08:36 +00007466 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007467}
7468
7469static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007470vec_stvx(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007471{
David Blaikie3302f2b2013-01-16 23:08:36 +00007472 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007473}
7474
7475static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007476vec_stvx(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007477{
David Blaikie3302f2b2013-01-16 23:08:36 +00007478 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007479}
7480
7481static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007482vec_stvx(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007483{
David Blaikie3302f2b2013-01-16 23:08:36 +00007484 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007485}
7486
7487static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007488vec_stvx(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007489{
David Blaikie3302f2b2013-01-16 23:08:36 +00007490 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007491}
7492
7493static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007494vec_stvx(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007495{
David Blaikie3302f2b2013-01-16 23:08:36 +00007496 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007497}
7498
7499static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007500vec_stvx(vector short __a, int __b, vector short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007501{
David Blaikie3302f2b2013-01-16 23:08:36 +00007502 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007503}
7504
7505static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007506vec_stvx(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007507{
David Blaikie3302f2b2013-01-16 23:08:36 +00007508 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007509}
7510
7511static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007512vec_stvx(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007513{
David Blaikie3302f2b2013-01-16 23:08:36 +00007514 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007515}
7516
7517static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007518vec_stvx(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007519{
David Blaikie3302f2b2013-01-16 23:08:36 +00007520 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007521}
7522
7523static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007524vec_stvx(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007525{
David Blaikie3302f2b2013-01-16 23:08:36 +00007526 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007527}
7528
7529static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007530vec_stvx(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007531{
David Blaikie3302f2b2013-01-16 23:08:36 +00007532 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007533}
7534
7535static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007536vec_stvx(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007537{
David Blaikie3302f2b2013-01-16 23:08:36 +00007538 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007539}
7540
7541static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007542vec_stvx(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007543{
David Blaikie3302f2b2013-01-16 23:08:36 +00007544 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007545}
7546
7547static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007548vec_stvx(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007549{
David Blaikie3302f2b2013-01-16 23:08:36 +00007550 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007551}
7552
7553static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007554vec_stvx(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007555{
David Blaikie3302f2b2013-01-16 23:08:36 +00007556 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007557}
7558
7559static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007560vec_stvx(vector int __a, int __b, vector int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007561{
David Blaikie3302f2b2013-01-16 23:08:36 +00007562 __builtin_altivec_stvx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007563}
7564
7565static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007566vec_stvx(vector int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007567{
David Blaikie3302f2b2013-01-16 23:08:36 +00007568 __builtin_altivec_stvx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007569}
7570
7571static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007572vec_stvx(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007573{
David Blaikie3302f2b2013-01-16 23:08:36 +00007574 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007575}
7576
7577static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007578vec_stvx(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007579{
David Blaikie3302f2b2013-01-16 23:08:36 +00007580 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007581}
7582
7583static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007584vec_stvx(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007585{
David Blaikie3302f2b2013-01-16 23:08:36 +00007586 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007587}
7588
7589static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007590vec_stvx(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007591{
David Blaikie3302f2b2013-01-16 23:08:36 +00007592 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007593}
7594
7595static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007596vec_stvx(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007597{
David Blaikie3302f2b2013-01-16 23:08:36 +00007598 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007599}
7600
7601static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007602vec_stvx(vector float __a, int __b, vector float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007603{
David Blaikie3302f2b2013-01-16 23:08:36 +00007604 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007605}
7606
7607static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007608vec_stvx(vector float __a, int __b, float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007609{
David Blaikie3302f2b2013-01-16 23:08:36 +00007610 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007611}
7612
7613/* vec_ste */
7614
7615static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007616vec_ste(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007617{
David Blaikie3302f2b2013-01-16 23:08:36 +00007618 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007619}
7620
7621static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007622vec_ste(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007623{
David Blaikie3302f2b2013-01-16 23:08:36 +00007624 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007625}
7626
7627static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007628vec_ste(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007629{
David Blaikie3302f2b2013-01-16 23:08:36 +00007630 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007631}
7632
7633static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007634vec_ste(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007635{
David Blaikie3302f2b2013-01-16 23:08:36 +00007636 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007637}
7638
7639static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007640vec_ste(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007641{
David Blaikie3302f2b2013-01-16 23:08:36 +00007642 __builtin_altivec_stvehx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007643}
7644
7645static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007646vec_ste(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007647{
David Blaikie3302f2b2013-01-16 23:08:36 +00007648 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007649}
7650
7651static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007652vec_ste(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007653{
David Blaikie3302f2b2013-01-16 23:08:36 +00007654 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007655}
7656
7657static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007658vec_ste(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007659{
David Blaikie3302f2b2013-01-16 23:08:36 +00007660 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007661}
7662
7663static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007664vec_ste(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007665{
David Blaikie3302f2b2013-01-16 23:08:36 +00007666 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007667}
7668
7669static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007670vec_ste(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007671{
David Blaikie3302f2b2013-01-16 23:08:36 +00007672 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007673}
7674
7675static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007676vec_ste(vector int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007677{
David Blaikie3302f2b2013-01-16 23:08:36 +00007678 __builtin_altivec_stvewx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007679}
7680
7681static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007682vec_ste(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007683{
David Blaikie3302f2b2013-01-16 23:08:36 +00007684 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007685}
7686
7687static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007688vec_ste(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007689{
David Blaikie3302f2b2013-01-16 23:08:36 +00007690 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007691}
7692
7693static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007694vec_ste(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007695{
David Blaikie3302f2b2013-01-16 23:08:36 +00007696 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007697}
7698
7699static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007700vec_ste(vector float __a, int __b, float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007701{
David Blaikie3302f2b2013-01-16 23:08:36 +00007702 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007703}
7704
7705/* vec_stvebx */
7706
7707static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007708vec_stvebx(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007709{
David Blaikie3302f2b2013-01-16 23:08:36 +00007710 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007711}
7712
7713static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007714vec_stvebx(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007715{
David Blaikie3302f2b2013-01-16 23:08:36 +00007716 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007717}
7718
Anton Yartsevfc83c602010-08-19 03:21:36 +00007719static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007720vec_stvebx(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007721{
David Blaikie3302f2b2013-01-16 23:08:36 +00007722 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007723}
7724
7725static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007726vec_stvebx(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007727{
David Blaikie3302f2b2013-01-16 23:08:36 +00007728 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007729}
7730
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007731/* vec_stvehx */
7732
7733static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007734vec_stvehx(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007735{
David Blaikie3302f2b2013-01-16 23:08:36 +00007736 __builtin_altivec_stvehx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007737}
7738
7739static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007740vec_stvehx(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007741{
David Blaikie3302f2b2013-01-16 23:08:36 +00007742 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007743}
7744
Anton Yartsevfc83c602010-08-19 03:21:36 +00007745static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007746vec_stvehx(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007747{
David Blaikie3302f2b2013-01-16 23:08:36 +00007748 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007749}
7750
7751static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007752vec_stvehx(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007753{
David Blaikie3302f2b2013-01-16 23:08:36 +00007754 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007755}
7756
7757static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007758vec_stvehx(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007759{
David Blaikie3302f2b2013-01-16 23:08:36 +00007760 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007761}
7762
7763static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007764vec_stvehx(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007765{
David Blaikie3302f2b2013-01-16 23:08:36 +00007766 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007767}
7768
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007769/* vec_stvewx */
7770
7771static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007772vec_stvewx(vector int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007773{
David Blaikie3302f2b2013-01-16 23:08:36 +00007774 __builtin_altivec_stvewx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007775}
7776
7777static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007778vec_stvewx(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007779{
David Blaikie3302f2b2013-01-16 23:08:36 +00007780 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007781}
7782
7783static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007784vec_stvewx(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007785{
David Blaikie3302f2b2013-01-16 23:08:36 +00007786 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007787}
7788
7789static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007790vec_stvewx(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007791{
David Blaikie3302f2b2013-01-16 23:08:36 +00007792 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007793}
7794
7795static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007796vec_stvewx(vector float __a, int __b, float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007797{
David Blaikie3302f2b2013-01-16 23:08:36 +00007798 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007799}
7800
7801/* vec_stl */
7802
7803static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007804vec_stl(vector signed char __a, int __b, vector signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007805{
David Blaikie3302f2b2013-01-16 23:08:36 +00007806 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007807}
7808
7809static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007810vec_stl(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007811{
David Blaikie3302f2b2013-01-16 23:08:36 +00007812 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007813}
7814
7815static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007816vec_stl(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007817{
David Blaikie3302f2b2013-01-16 23:08:36 +00007818 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007819}
7820
7821static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007822vec_stl(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007823{
David Blaikie3302f2b2013-01-16 23:08:36 +00007824 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007825}
7826
7827static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007828vec_stl(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007829{
David Blaikie3302f2b2013-01-16 23:08:36 +00007830 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007831}
7832
7833static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007834vec_stl(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007835{
David Blaikie3302f2b2013-01-16 23:08:36 +00007836 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007837}
7838
7839static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007840vec_stl(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007841{
David Blaikie3302f2b2013-01-16 23:08:36 +00007842 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007843}
7844
7845static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007846vec_stl(vector short __a, int __b, vector short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007847{
David Blaikie3302f2b2013-01-16 23:08:36 +00007848 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007849}
7850
7851static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007852vec_stl(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007853{
David Blaikie3302f2b2013-01-16 23:08:36 +00007854 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007855}
7856
7857static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007858vec_stl(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007859{
David Blaikie3302f2b2013-01-16 23:08:36 +00007860 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007861}
7862
7863static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007864vec_stl(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007865{
David Blaikie3302f2b2013-01-16 23:08:36 +00007866 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007867}
7868
7869static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007870vec_stl(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007871{
David Blaikie3302f2b2013-01-16 23:08:36 +00007872 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007873}
7874
7875static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007876vec_stl(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007877{
David Blaikie3302f2b2013-01-16 23:08:36 +00007878 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007879}
7880
7881static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007882vec_stl(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007883{
David Blaikie3302f2b2013-01-16 23:08:36 +00007884 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007885}
7886
7887static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007888vec_stl(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007889{
David Blaikie3302f2b2013-01-16 23:08:36 +00007890 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007891}
7892
7893static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007894vec_stl(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007895{
David Blaikie3302f2b2013-01-16 23:08:36 +00007896 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007897}
7898
7899static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007900vec_stl(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007901{
David Blaikie3302f2b2013-01-16 23:08:36 +00007902 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007903}
7904
7905static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007906vec_stl(vector int __a, int __b, vector int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007907{
David Blaikie3302f2b2013-01-16 23:08:36 +00007908 __builtin_altivec_stvxl(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007909}
7910
7911static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007912vec_stl(vector int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007913{
David Blaikie3302f2b2013-01-16 23:08:36 +00007914 __builtin_altivec_stvxl(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007915}
7916
7917static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007918vec_stl(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007919{
David Blaikie3302f2b2013-01-16 23:08:36 +00007920 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007921}
7922
7923static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007924vec_stl(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007925{
David Blaikie3302f2b2013-01-16 23:08:36 +00007926 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007927}
7928
7929static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007930vec_stl(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007931{
David Blaikie3302f2b2013-01-16 23:08:36 +00007932 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007933}
7934
7935static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007936vec_stl(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007937{
David Blaikie3302f2b2013-01-16 23:08:36 +00007938 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007939}
7940
7941static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007942vec_stl(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007943{
David Blaikie3302f2b2013-01-16 23:08:36 +00007944 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007945}
7946
7947static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007948vec_stl(vector float __a, int __b, vector float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007949{
David Blaikie3302f2b2013-01-16 23:08:36 +00007950 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007951}
7952
7953static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007954vec_stl(vector float __a, int __b, float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007955{
David Blaikie3302f2b2013-01-16 23:08:36 +00007956 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007957}
7958
7959/* vec_stvxl */
7960
7961static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007962vec_stvxl(vector signed char __a, int __b, vector signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007963{
David Blaikie3302f2b2013-01-16 23:08:36 +00007964 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007965}
7966
7967static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007968vec_stvxl(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007969{
David Blaikie3302f2b2013-01-16 23:08:36 +00007970 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007971}
7972
7973static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007974vec_stvxl(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007975{
David Blaikie3302f2b2013-01-16 23:08:36 +00007976 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007977}
7978
7979static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007980vec_stvxl(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007981{
David Blaikie3302f2b2013-01-16 23:08:36 +00007982 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007983}
7984
7985static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007986vec_stvxl(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007987{
David Blaikie3302f2b2013-01-16 23:08:36 +00007988 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007989}
7990
7991static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007992vec_stvxl(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007993{
David Blaikie3302f2b2013-01-16 23:08:36 +00007994 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007995}
7996
7997static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007998vec_stvxl(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007999{
David Blaikie3302f2b2013-01-16 23:08:36 +00008000 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008001}
8002
8003static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008004vec_stvxl(vector short __a, int __b, vector short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008005{
David Blaikie3302f2b2013-01-16 23:08:36 +00008006 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008007}
8008
8009static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008010vec_stvxl(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008011{
David Blaikie3302f2b2013-01-16 23:08:36 +00008012 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008013}
8014
8015static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008016vec_stvxl(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008017{
David Blaikie3302f2b2013-01-16 23:08:36 +00008018 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008019}
8020
8021static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008022vec_stvxl(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008023{
David Blaikie3302f2b2013-01-16 23:08:36 +00008024 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008025}
8026
8027static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008028vec_stvxl(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008029{
David Blaikie3302f2b2013-01-16 23:08:36 +00008030 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008031}
8032
8033static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008034vec_stvxl(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008035{
David Blaikie3302f2b2013-01-16 23:08:36 +00008036 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008037}
8038
8039static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008040vec_stvxl(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008041{
David Blaikie3302f2b2013-01-16 23:08:36 +00008042 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008043}
8044
8045static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008046vec_stvxl(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008047{
David Blaikie3302f2b2013-01-16 23:08:36 +00008048 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008049}
8050
8051static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008052vec_stvxl(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008053{
David Blaikie3302f2b2013-01-16 23:08:36 +00008054 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008055}
8056
8057static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008058vec_stvxl(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008059{
David Blaikie3302f2b2013-01-16 23:08:36 +00008060 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008061}
8062
8063static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008064vec_stvxl(vector int __a, int __b, vector int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008065{
David Blaikie3302f2b2013-01-16 23:08:36 +00008066 __builtin_altivec_stvxl(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008067}
8068
8069static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008070vec_stvxl(vector int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008071{
David Blaikie3302f2b2013-01-16 23:08:36 +00008072 __builtin_altivec_stvxl(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008073}
8074
8075static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008076vec_stvxl(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008077{
David Blaikie3302f2b2013-01-16 23:08:36 +00008078 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008079}
8080
8081static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008082vec_stvxl(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008083{
David Blaikie3302f2b2013-01-16 23:08:36 +00008084 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008085}
8086
8087static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008088vec_stvxl(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008089{
David Blaikie3302f2b2013-01-16 23:08:36 +00008090 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008091}
8092
8093static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008094vec_stvxl(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008095{
David Blaikie3302f2b2013-01-16 23:08:36 +00008096 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008097}
8098
8099static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008100vec_stvxl(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008101{
David Blaikie3302f2b2013-01-16 23:08:36 +00008102 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008103}
8104
8105static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008106vec_stvxl(vector float __a, int __b, vector float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008107{
David Blaikie3302f2b2013-01-16 23:08:36 +00008108 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008109}
8110
8111static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008112vec_stvxl(vector float __a, int __b, float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008113{
David Blaikie3302f2b2013-01-16 23:08:36 +00008114 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008115}
8116
8117/* vec_sub */
8118
8119static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008120vec_sub(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008121{
David Blaikie3302f2b2013-01-16 23:08:36 +00008122 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008123}
8124
Anton Yartsevfc83c602010-08-19 03:21:36 +00008125static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008126vec_sub(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008127{
David Blaikie3302f2b2013-01-16 23:08:36 +00008128 return (vector signed char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008129}
8130
8131static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008132vec_sub(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008133{
David Blaikie3302f2b2013-01-16 23:08:36 +00008134 return __a - (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008135}
8136
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008137static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008138vec_sub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008139{
David Blaikie3302f2b2013-01-16 23:08:36 +00008140 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008141}
8142
Anton Yartsevfc83c602010-08-19 03:21:36 +00008143static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008144vec_sub(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008145{
David Blaikie3302f2b2013-01-16 23:08:36 +00008146 return (vector unsigned char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008147}
8148
8149static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008150vec_sub(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008151{
David Blaikie3302f2b2013-01-16 23:08:36 +00008152 return __a - (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008153}
8154
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008155static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008156vec_sub(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008157{
David Blaikie3302f2b2013-01-16 23:08:36 +00008158 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008159}
8160
Anton Yartsevfc83c602010-08-19 03:21:36 +00008161static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008162vec_sub(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008163{
David Blaikie3302f2b2013-01-16 23:08:36 +00008164 return (vector short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008165}
8166
8167static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008168vec_sub(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008169{
David Blaikie3302f2b2013-01-16 23:08:36 +00008170 return __a - (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008171}
8172
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008173static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008174vec_sub(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008175{
David Blaikie3302f2b2013-01-16 23:08:36 +00008176 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008177}
8178
Anton Yartsevfc83c602010-08-19 03:21:36 +00008179static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008180vec_sub(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008181{
David Blaikie3302f2b2013-01-16 23:08:36 +00008182 return (vector unsigned short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008183}
8184
8185static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008186vec_sub(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008187{
David Blaikie3302f2b2013-01-16 23:08:36 +00008188 return __a - (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008189}
8190
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008191static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008192vec_sub(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008193{
David Blaikie3302f2b2013-01-16 23:08:36 +00008194 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008195}
8196
Anton Yartsevfc83c602010-08-19 03:21:36 +00008197static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008198vec_sub(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008199{
David Blaikie3302f2b2013-01-16 23:08:36 +00008200 return (vector int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008201}
8202
8203static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008204vec_sub(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008205{
David Blaikie3302f2b2013-01-16 23:08:36 +00008206 return __a - (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008207}
8208
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008209static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008210vec_sub(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008211{
David Blaikie3302f2b2013-01-16 23:08:36 +00008212 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008213}
8214
Anton Yartsevfc83c602010-08-19 03:21:36 +00008215static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008216vec_sub(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008217{
David Blaikie3302f2b2013-01-16 23:08:36 +00008218 return (vector unsigned int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008219}
8220
8221static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008222vec_sub(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008223{
David Blaikie3302f2b2013-01-16 23:08:36 +00008224 return __a - (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008225}
8226
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008227static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008228vec_sub(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008229{
David Blaikie3302f2b2013-01-16 23:08:36 +00008230 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008231}
8232
8233/* vec_vsububm */
8234
8235#define __builtin_altivec_vsububm vec_vsububm
8236
8237static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008238vec_vsububm(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008239{
David Blaikie3302f2b2013-01-16 23:08:36 +00008240 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008241}
8242
Anton Yartsevfc83c602010-08-19 03:21:36 +00008243static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008244vec_vsububm(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008245{
David Blaikie3302f2b2013-01-16 23:08:36 +00008246 return (vector signed char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008247}
8248
8249static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008250vec_vsububm(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008251{
David Blaikie3302f2b2013-01-16 23:08:36 +00008252 return __a - (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008253}
8254
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008255static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008256vec_vsububm(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008257{
David Blaikie3302f2b2013-01-16 23:08:36 +00008258 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008259}
8260
Anton Yartsevfc83c602010-08-19 03:21:36 +00008261static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008262vec_vsububm(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008263{
David Blaikie3302f2b2013-01-16 23:08:36 +00008264 return (vector unsigned char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008265}
8266
8267static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008268vec_vsububm(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008269{
David Blaikie3302f2b2013-01-16 23:08:36 +00008270 return __a - (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008271}
8272
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008273/* vec_vsubuhm */
8274
8275#define __builtin_altivec_vsubuhm vec_vsubuhm
8276
8277static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008278vec_vsubuhm(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008279{
David Blaikie3302f2b2013-01-16 23:08:36 +00008280 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008281}
8282
Anton Yartsevfc83c602010-08-19 03:21:36 +00008283static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008284vec_vsubuhm(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008285{
David Blaikie3302f2b2013-01-16 23:08:36 +00008286 return (vector short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008287}
8288
8289static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008290vec_vsubuhm(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008291{
David Blaikie3302f2b2013-01-16 23:08:36 +00008292 return __a - (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008293}
8294
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008295static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008296vec_vsubuhm(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008297{
David Blaikie3302f2b2013-01-16 23:08:36 +00008298 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008299}
8300
Anton Yartsevfc83c602010-08-19 03:21:36 +00008301static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008302vec_vsubuhm(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008303{
David Blaikie3302f2b2013-01-16 23:08:36 +00008304 return (vector unsigned short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008305}
8306
8307static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008308vec_vsubuhm(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008309{
David Blaikie3302f2b2013-01-16 23:08:36 +00008310 return __a - (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008311}
8312
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008313/* vec_vsubuwm */
8314
8315#define __builtin_altivec_vsubuwm vec_vsubuwm
8316
8317static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008318vec_vsubuwm(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008319{
David Blaikie3302f2b2013-01-16 23:08:36 +00008320 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008321}
8322
Anton Yartsevfc83c602010-08-19 03:21:36 +00008323static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008324vec_vsubuwm(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008325{
David Blaikie3302f2b2013-01-16 23:08:36 +00008326 return (vector int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008327}
8328
8329static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008330vec_vsubuwm(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008331{
David Blaikie3302f2b2013-01-16 23:08:36 +00008332 return __a - (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008333}
8334
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008335static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008336vec_vsubuwm(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008337{
David Blaikie3302f2b2013-01-16 23:08:36 +00008338 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008339}
8340
Anton Yartsevfc83c602010-08-19 03:21:36 +00008341static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008342vec_vsubuwm(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008343{
David Blaikie3302f2b2013-01-16 23:08:36 +00008344 return (vector unsigned int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008345}
8346
8347static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008348vec_vsubuwm(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008349{
David Blaikie3302f2b2013-01-16 23:08:36 +00008350 return __a - (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008351}
8352
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008353/* vec_vsubfp */
8354
8355#define __builtin_altivec_vsubfp vec_vsubfp
8356
8357static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008358vec_vsubfp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008359{
David Blaikie3302f2b2013-01-16 23:08:36 +00008360 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008361}
8362
8363/* vec_subc */
8364
8365static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008366vec_subc(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008367{
David Blaikie3302f2b2013-01-16 23:08:36 +00008368 return __builtin_altivec_vsubcuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008369}
8370
8371/* vec_vsubcuw */
8372
8373static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008374vec_vsubcuw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008375{
David Blaikie3302f2b2013-01-16 23:08:36 +00008376 return __builtin_altivec_vsubcuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008377}
8378
8379/* vec_subs */
8380
8381static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008382vec_subs(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008383{
David Blaikie3302f2b2013-01-16 23:08:36 +00008384 return __builtin_altivec_vsubsbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008385}
8386
Anton Yartsevfc83c602010-08-19 03:21:36 +00008387static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008388vec_subs(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008389{
David Blaikie3302f2b2013-01-16 23:08:36 +00008390 return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008391}
8392
8393static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008394vec_subs(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008395{
David Blaikie3302f2b2013-01-16 23:08:36 +00008396 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008397}
8398
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008399static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008400vec_subs(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008401{
David Blaikie3302f2b2013-01-16 23:08:36 +00008402 return __builtin_altivec_vsububs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008403}
8404
Anton Yartsevfc83c602010-08-19 03:21:36 +00008405static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008406vec_subs(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008407{
David Blaikie3302f2b2013-01-16 23:08:36 +00008408 return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008409}
8410
8411static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008412vec_subs(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008413{
David Blaikie3302f2b2013-01-16 23:08:36 +00008414 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008415}
8416
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008417static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008418vec_subs(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008419{
David Blaikie3302f2b2013-01-16 23:08:36 +00008420 return __builtin_altivec_vsubshs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008421}
8422
Anton Yartsevfc83c602010-08-19 03:21:36 +00008423static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008424vec_subs(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008425{
David Blaikie3302f2b2013-01-16 23:08:36 +00008426 return __builtin_altivec_vsubshs((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008427}
8428
8429static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008430vec_subs(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008431{
David Blaikie3302f2b2013-01-16 23:08:36 +00008432 return __builtin_altivec_vsubshs(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008433}
8434
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008435static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008436vec_subs(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008437{
David Blaikie3302f2b2013-01-16 23:08:36 +00008438 return __builtin_altivec_vsubuhs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008439}
8440
Anton Yartsevfc83c602010-08-19 03:21:36 +00008441static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008442vec_subs(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008443{
David Blaikie3302f2b2013-01-16 23:08:36 +00008444 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008445}
8446
8447static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008448vec_subs(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008449{
David Blaikie3302f2b2013-01-16 23:08:36 +00008450 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008451}
8452
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008453static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008454vec_subs(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008455{
David Blaikie3302f2b2013-01-16 23:08:36 +00008456 return __builtin_altivec_vsubsws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008457}
8458
Anton Yartsevfc83c602010-08-19 03:21:36 +00008459static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008460vec_subs(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008461{
David Blaikie3302f2b2013-01-16 23:08:36 +00008462 return __builtin_altivec_vsubsws((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008463}
8464
8465static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008466vec_subs(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008467{
David Blaikie3302f2b2013-01-16 23:08:36 +00008468 return __builtin_altivec_vsubsws(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008469}
8470
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008471static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008472vec_subs(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008473{
David Blaikie3302f2b2013-01-16 23:08:36 +00008474 return __builtin_altivec_vsubuws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008475}
8476
Anton Yartsevfc83c602010-08-19 03:21:36 +00008477static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008478vec_subs(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008479{
David Blaikie3302f2b2013-01-16 23:08:36 +00008480 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008481}
8482
8483static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008484vec_subs(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008485{
David Blaikie3302f2b2013-01-16 23:08:36 +00008486 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008487}
8488
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008489/* vec_vsubsbs */
8490
Anton Yartsevfc83c602010-08-19 03:21:36 +00008491static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008492vec_vsubsbs(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008493{
David Blaikie3302f2b2013-01-16 23:08:36 +00008494 return __builtin_altivec_vsubsbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008495}
8496
Anton Yartsevfc83c602010-08-19 03:21:36 +00008497static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008498vec_vsubsbs(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008499{
David Blaikie3302f2b2013-01-16 23:08:36 +00008500 return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008501}
8502
8503static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008504vec_vsubsbs(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008505{
David Blaikie3302f2b2013-01-16 23:08:36 +00008506 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008507}
8508
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008509/* vec_vsububs */
8510
Anton Yartsevfc83c602010-08-19 03:21:36 +00008511static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008512vec_vsububs(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008513{
David Blaikie3302f2b2013-01-16 23:08:36 +00008514 return __builtin_altivec_vsububs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008515}
8516
Anton Yartsevfc83c602010-08-19 03:21:36 +00008517static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008518vec_vsububs(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008519{
David Blaikie3302f2b2013-01-16 23:08:36 +00008520 return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008521}
8522
8523static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008524vec_vsububs(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008525{
David Blaikie3302f2b2013-01-16 23:08:36 +00008526 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008527}
8528
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008529/* vec_vsubshs */
8530
Anton Yartsevfc83c602010-08-19 03:21:36 +00008531static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008532vec_vsubshs(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008533{
David Blaikie3302f2b2013-01-16 23:08:36 +00008534 return __builtin_altivec_vsubshs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008535}
8536
Anton Yartsevfc83c602010-08-19 03:21:36 +00008537static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008538vec_vsubshs(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008539{
David Blaikie3302f2b2013-01-16 23:08:36 +00008540 return __builtin_altivec_vsubshs((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008541}
8542
8543static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008544vec_vsubshs(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008545{
David Blaikie3302f2b2013-01-16 23:08:36 +00008546 return __builtin_altivec_vsubshs(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008547}
8548
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008549/* vec_vsubuhs */
8550
Anton Yartsevfc83c602010-08-19 03:21:36 +00008551static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008552vec_vsubuhs(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008553{
David Blaikie3302f2b2013-01-16 23:08:36 +00008554 return __builtin_altivec_vsubuhs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008555}
8556
Anton Yartsevfc83c602010-08-19 03:21:36 +00008557static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008558vec_vsubuhs(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008559{
David Blaikie3302f2b2013-01-16 23:08:36 +00008560 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008561}
8562
8563static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008564vec_vsubuhs(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008565{
David Blaikie3302f2b2013-01-16 23:08:36 +00008566 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008567}
8568
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008569/* vec_vsubsws */
8570
Anton Yartsevfc83c602010-08-19 03:21:36 +00008571static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008572vec_vsubsws(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008573{
David Blaikie3302f2b2013-01-16 23:08:36 +00008574 return __builtin_altivec_vsubsws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008575}
8576
Anton Yartsevfc83c602010-08-19 03:21:36 +00008577static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008578vec_vsubsws(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008579{
David Blaikie3302f2b2013-01-16 23:08:36 +00008580 return __builtin_altivec_vsubsws((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008581}
8582
8583static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008584vec_vsubsws(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008585{
David Blaikie3302f2b2013-01-16 23:08:36 +00008586 return __builtin_altivec_vsubsws(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008587}
8588
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008589/* vec_vsubuws */
8590
Anton Yartsevfc83c602010-08-19 03:21:36 +00008591static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008592vec_vsubuws(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008593{
David Blaikie3302f2b2013-01-16 23:08:36 +00008594 return __builtin_altivec_vsubuws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008595}
8596
Anton Yartsevfc83c602010-08-19 03:21:36 +00008597static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008598vec_vsubuws(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008599{
David Blaikie3302f2b2013-01-16 23:08:36 +00008600 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008601}
8602
8603static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008604vec_vsubuws(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008605{
David Blaikie3302f2b2013-01-16 23:08:36 +00008606 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008607}
8608
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008609/* vec_sum4s */
8610
8611static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008612vec_sum4s(vector signed char __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008613{
David Blaikie3302f2b2013-01-16 23:08:36 +00008614 return __builtin_altivec_vsum4sbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008615}
8616
8617static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008618vec_sum4s(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008619{
David Blaikie3302f2b2013-01-16 23:08:36 +00008620 return __builtin_altivec_vsum4ubs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008621}
8622
8623static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008624vec_sum4s(vector signed short __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008625{
David Blaikie3302f2b2013-01-16 23:08:36 +00008626 return __builtin_altivec_vsum4shs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008627}
8628
8629/* vec_vsum4sbs */
8630
8631static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008632vec_vsum4sbs(vector signed char __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008633{
David Blaikie3302f2b2013-01-16 23:08:36 +00008634 return __builtin_altivec_vsum4sbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008635}
8636
8637/* vec_vsum4ubs */
8638
8639static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008640vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008641{
David Blaikie3302f2b2013-01-16 23:08:36 +00008642 return __builtin_altivec_vsum4ubs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008643}
8644
8645/* vec_vsum4shs */
8646
8647static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008648vec_vsum4shs(vector signed short __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008649{
David Blaikie3302f2b2013-01-16 23:08:36 +00008650 return __builtin_altivec_vsum4shs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008651}
8652
8653/* vec_sum2s */
8654
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008655/* The vsum2sws instruction has a big-endian bias, so that the second
8656 input vector and the result always reference big-endian elements
8657 1 and 3 (little-endian element 0 and 2). For ease of porting the
8658 programmer wants elements 1 and 3 in both cases, so for little
8659 endian we must perform some permutes. */
8660
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008661static vector signed int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008662vec_sum2s(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008663{
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008664#ifdef __LITTLE_ENDIAN__
8665 vector int __c = (vector signed int)
8666 vec_perm(__b, __b, (vector unsigned char)
Eric Christopherc67e1b62014-12-10 00:57:43 +00008667 (4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11));
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008668 __c = __builtin_altivec_vsum2sws(__a, __c);
8669 return (vector signed int)
8670 vec_perm(__c, __c, (vector unsigned char)
Eric Christopherc67e1b62014-12-10 00:57:43 +00008671 (4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11));
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008672#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008673 return __builtin_altivec_vsum2sws(__a, __b);
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008674#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008675}
8676
8677/* vec_vsum2sws */
8678
8679static vector signed int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008680vec_vsum2sws(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008681{
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008682#ifdef __LITTLE_ENDIAN__
8683 vector int __c = (vector signed int)
8684 vec_perm(__b, __b, (vector unsigned char)
Eric Christopherc67e1b62014-12-10 00:57:43 +00008685 (4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11));
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008686 __c = __builtin_altivec_vsum2sws(__a, __c);
8687 return (vector signed int)
8688 vec_perm(__c, __c, (vector unsigned char)
Eric Christopherc67e1b62014-12-10 00:57:43 +00008689 (4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11));
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008690#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008691 return __builtin_altivec_vsum2sws(__a, __b);
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008692#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008693}
8694
8695/* vec_sums */
8696
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008697/* The vsumsws instruction has a big-endian bias, so that the second
8698 input vector and the result always reference big-endian element 3
8699 (little-endian element 0). For ease of porting the programmer
8700 wants element 3 in both cases, so for little endian we must perform
8701 some permutes. */
8702
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008703static vector signed int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008704vec_sums(vector signed int __a, vector signed int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008705{
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008706#ifdef __LITTLE_ENDIAN__
Bill Schmidtccbe0a82014-08-04 23:21:26 +00008707 __b = (vector signed int)vec_splat(__b, 3);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008708 __b = __builtin_altivec_vsumsws(__a, __b);
Bill Schmidtccbe0a82014-08-04 23:21:26 +00008709 return (vector signed int)(0, 0, 0, __b[0]);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008710#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008711 return __builtin_altivec_vsumsws(__a, __b);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008712#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008713}
8714
8715/* vec_vsumsws */
8716
8717static vector signed int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008718vec_vsumsws(vector signed int __a, vector signed int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008719{
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008720#ifdef __LITTLE_ENDIAN__
Bill Schmidtccbe0a82014-08-04 23:21:26 +00008721 __b = (vector signed int)vec_splat(__b, 3);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008722 __b = __builtin_altivec_vsumsws(__a, __b);
Bill Schmidtccbe0a82014-08-04 23:21:26 +00008723 return (vector signed int)(0, 0, 0, __b[0]);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008724#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008725 return __builtin_altivec_vsumsws(__a, __b);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008726#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008727}
8728
8729/* vec_trunc */
8730
8731static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008732vec_trunc(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008733{
David Blaikie3302f2b2013-01-16 23:08:36 +00008734 return __builtin_altivec_vrfiz(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008735}
8736
8737/* vec_vrfiz */
8738
8739static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008740vec_vrfiz(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008741{
David Blaikie3302f2b2013-01-16 23:08:36 +00008742 return __builtin_altivec_vrfiz(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008743}
8744
8745/* vec_unpackh */
8746
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008747/* The vector unpack instructions all have a big-endian bias, so for
8748 little endian we must reverse the meanings of "high" and "low." */
8749
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008750static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008751vec_unpackh(vector signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008752{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008753#ifdef __LITTLE_ENDIAN__
8754 return __builtin_altivec_vupklsb((vector char)__a);
8755#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008756 return __builtin_altivec_vupkhsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008757#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008758}
8759
Anton Yartsevfc83c602010-08-19 03:21:36 +00008760static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008761vec_unpackh(vector bool char __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008762{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008763#ifdef __LITTLE_ENDIAN__
8764 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
8765#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008766 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008767#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008768}
8769
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008770static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008771vec_unpackh(vector short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008772{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008773#ifdef __LITTLE_ENDIAN__
8774 return __builtin_altivec_vupklsh(__a);
8775#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008776 return __builtin_altivec_vupkhsh(__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008777#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008778}
8779
Anton Yartsevfc83c602010-08-19 03:21:36 +00008780static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008781vec_unpackh(vector bool short __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008782{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008783#ifdef __LITTLE_ENDIAN__
8784 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
8785#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008786 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008787#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008788}
8789
8790static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008791vec_unpackh(vector pixel __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008792{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008793#ifdef __LITTLE_ENDIAN__
8794 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
8795#else
8796 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
8797#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008798}
8799
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008800/* vec_vupkhsb */
8801
Anton Yartsevfc83c602010-08-19 03:21:36 +00008802static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008803vec_vupkhsb(vector signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008804{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008805#ifdef __LITTLE_ENDIAN__
8806 return __builtin_altivec_vupklsb((vector char)__a);
8807#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008808 return __builtin_altivec_vupkhsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008809#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008810}
8811
Anton Yartsevfc83c602010-08-19 03:21:36 +00008812static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008813vec_vupkhsb(vector bool char __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008814{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008815#ifdef __LITTLE_ENDIAN__
8816 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
8817#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008818 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008819#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008820}
8821
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008822/* vec_vupkhsh */
8823
Anton Yartsevfc83c602010-08-19 03:21:36 +00008824static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008825vec_vupkhsh(vector short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008826{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008827#ifdef __LITTLE_ENDIAN__
8828 return __builtin_altivec_vupklsh(__a);
8829#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008830 return __builtin_altivec_vupkhsh(__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008831#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008832}
8833
Anton Yartsevfc83c602010-08-19 03:21:36 +00008834static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008835vec_vupkhsh(vector bool short __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008836{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008837#ifdef __LITTLE_ENDIAN__
8838 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
8839#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008840 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008841#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008842}
8843
8844static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008845vec_vupkhsh(vector pixel __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008846{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008847#ifdef __LITTLE_ENDIAN__
8848 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
8849#else
8850 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
8851#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008852}
8853
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008854/* vec_unpackl */
8855
8856static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008857vec_unpackl(vector signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008858{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008859#ifdef __LITTLE_ENDIAN__
8860 return __builtin_altivec_vupkhsb((vector char)__a);
8861#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008862 return __builtin_altivec_vupklsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008863#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008864}
8865
Anton Yartsevfc83c602010-08-19 03:21:36 +00008866static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008867vec_unpackl(vector bool char __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008868{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008869#ifdef __LITTLE_ENDIAN__
8870 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
8871#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008872 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008873#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008874}
8875
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008876static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008877vec_unpackl(vector short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008878{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008879#ifdef __LITTLE_ENDIAN__
8880 return __builtin_altivec_vupkhsh(__a);
8881#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008882 return __builtin_altivec_vupklsh(__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008883#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008884}
8885
Anton Yartsevfc83c602010-08-19 03:21:36 +00008886static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008887vec_unpackl(vector bool short __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008888{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008889#ifdef __LITTLE_ENDIAN__
8890 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
8891#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008892 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008893#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008894}
8895
8896static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008897vec_unpackl(vector pixel __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008898{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008899#ifdef __LITTLE_ENDIAN__
8900 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
8901#else
8902 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
8903#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008904}
8905
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008906/* vec_vupklsb */
8907
Anton Yartsevfc83c602010-08-19 03:21:36 +00008908static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008909vec_vupklsb(vector signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008910{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008911#ifdef __LITTLE_ENDIAN__
8912 return __builtin_altivec_vupkhsb((vector char)__a);
8913#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008914 return __builtin_altivec_vupklsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008915#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008916}
8917
Anton Yartsevfc83c602010-08-19 03:21:36 +00008918static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008919vec_vupklsb(vector bool char __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008920{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008921#ifdef __LITTLE_ENDIAN__
8922 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
8923#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008924 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008925#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008926}
8927
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008928/* vec_vupklsh */
8929
Anton Yartsevfc83c602010-08-19 03:21:36 +00008930static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008931vec_vupklsh(vector short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008932{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008933#ifdef __LITTLE_ENDIAN__
8934 return __builtin_altivec_vupkhsh(__a);
8935#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008936 return __builtin_altivec_vupklsh(__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008937#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008938}
8939
Anton Yartsevfc83c602010-08-19 03:21:36 +00008940static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008941vec_vupklsh(vector bool short __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008942{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008943#ifdef __LITTLE_ENDIAN__
8944 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
8945#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008946 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008947#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008948}
8949
8950static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008951vec_vupklsh(vector pixel __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008952{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008953#ifdef __LITTLE_ENDIAN__
8954 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
8955#else
8956 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
8957#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008958}
8959
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008960/* vec_vsx_ld */
8961
8962#ifdef __VSX__
8963
8964static vector signed int __ATTRS_o_ai
8965vec_vsx_ld(int __a, const vector signed int *__b)
8966{
8967 return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
8968}
8969
8970static vector unsigned int __ATTRS_o_ai
8971vec_vsx_ld(int __a, const vector unsigned int *__b)
8972{
8973 return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
8974}
8975
8976static vector float __ATTRS_o_ai
8977vec_vsx_ld(int __a, const vector float *__b)
8978{
8979 return (vector float)__builtin_vsx_lxvw4x(__a, __b);
8980}
8981
8982static vector signed long long __ATTRS_o_ai
8983vec_vsx_ld(int __a, const vector signed long long *__b)
8984{
8985 return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b);
8986}
8987
8988static vector unsigned long long __ATTRS_o_ai
8989vec_vsx_ld(int __a, const vector unsigned long long *__b)
8990{
8991 return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b);
8992}
8993
8994static vector double __ATTRS_o_ai
8995vec_vsx_ld(int __a, const vector double *__b)
8996{
8997 return (vector double)__builtin_vsx_lxvd2x(__a, __b);
8998}
8999
9000#endif
9001
9002/* vec_vsx_st */
9003
9004#ifdef __VSX__
9005
9006static void __ATTRS_o_ai
9007vec_vsx_st(vector signed int __a, int __b, vector signed int *__c)
9008{
9009 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
9010}
9011
9012static void __ATTRS_o_ai
9013vec_vsx_st(vector unsigned int __a, int __b, vector unsigned int *__c)
9014{
9015 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
9016}
9017
9018static void __ATTRS_o_ai
9019vec_vsx_st(vector float __a, int __b, vector float *__c)
9020{
9021 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
9022}
9023
9024static void __ATTRS_o_ai
9025vec_vsx_st(vector signed long long __a, int __b, vector signed long long *__c)
9026{
9027 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
9028}
9029
9030static void __ATTRS_o_ai
9031vec_vsx_st(vector unsigned long long __a, int __b,
9032 vector unsigned long long *__c)
9033{
9034 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
9035}
9036
9037static void __ATTRS_o_ai
9038vec_vsx_st(vector double __a, int __b, vector double *__c)
9039{
9040 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
9041}
9042
9043#endif
9044
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009045/* vec_xor */
9046
9047#define __builtin_altivec_vxor vec_xor
9048
9049static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009050vec_xor(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009051{
David Blaikie3302f2b2013-01-16 23:08:36 +00009052 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009053}
9054
Anton Yartsevfc83c602010-08-19 03:21:36 +00009055static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009056vec_xor(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009057{
David Blaikie3302f2b2013-01-16 23:08:36 +00009058 return (vector signed char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009059}
9060
9061static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009062vec_xor(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009063{
David Blaikie3302f2b2013-01-16 23:08:36 +00009064 return __a ^ (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009065}
9066
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009067static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009068vec_xor(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009069{
David Blaikie3302f2b2013-01-16 23:08:36 +00009070 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009071}
9072
Anton Yartsevfc83c602010-08-19 03:21:36 +00009073static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009074vec_xor(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009075{
David Blaikie3302f2b2013-01-16 23:08:36 +00009076 return (vector unsigned char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009077}
9078
9079static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009080vec_xor(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009081{
David Blaikie3302f2b2013-01-16 23:08:36 +00009082 return __a ^ (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009083}
9084
9085static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009086vec_xor(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009087{
David Blaikie3302f2b2013-01-16 23:08:36 +00009088 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009089}
9090
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009091static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009092vec_xor(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009093{
David Blaikie3302f2b2013-01-16 23:08:36 +00009094 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009095}
9096
Anton Yartsevfc83c602010-08-19 03:21:36 +00009097static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009098vec_xor(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009099{
David Blaikie3302f2b2013-01-16 23:08:36 +00009100 return (vector short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009101}
9102
9103static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009104vec_xor(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009105{
David Blaikie3302f2b2013-01-16 23:08:36 +00009106 return __a ^ (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009107}
9108
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009109static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009110vec_xor(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009111{
David Blaikie3302f2b2013-01-16 23:08:36 +00009112 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009113}
9114
Anton Yartsevfc83c602010-08-19 03:21:36 +00009115static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009116vec_xor(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009117{
David Blaikie3302f2b2013-01-16 23:08:36 +00009118 return (vector unsigned short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009119}
9120
9121static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009122vec_xor(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009123{
David Blaikie3302f2b2013-01-16 23:08:36 +00009124 return __a ^ (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009125}
9126
9127static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009128vec_xor(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009129{
David Blaikie3302f2b2013-01-16 23:08:36 +00009130 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009131}
9132
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009133static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009134vec_xor(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009135{
David Blaikie3302f2b2013-01-16 23:08:36 +00009136 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009137}
9138
Anton Yartsevfc83c602010-08-19 03:21:36 +00009139static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009140vec_xor(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009141{
David Blaikie3302f2b2013-01-16 23:08:36 +00009142 return (vector int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009143}
9144
9145static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009146vec_xor(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009147{
David Blaikie3302f2b2013-01-16 23:08:36 +00009148 return __a ^ (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009149}
9150
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009151static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009152vec_xor(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009153{
David Blaikie3302f2b2013-01-16 23:08:36 +00009154 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009155}
9156
Anton Yartsevfc83c602010-08-19 03:21:36 +00009157static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009158vec_xor(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009159{
David Blaikie3302f2b2013-01-16 23:08:36 +00009160 return (vector unsigned int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009161}
9162
9163static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009164vec_xor(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009165{
David Blaikie3302f2b2013-01-16 23:08:36 +00009166 return __a ^ (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009167}
9168
9169static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009170vec_xor(vector bool int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009171{
David Blaikie3302f2b2013-01-16 23:08:36 +00009172 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009173}
9174
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009175static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009176vec_xor(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009177{
David Blaikie3302f2b2013-01-16 23:08:36 +00009178 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
9179 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009180}
9181
Anton Yartsevfc83c602010-08-19 03:21:36 +00009182static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009183vec_xor(vector bool int __a, vector float __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009184{
David Blaikie3302f2b2013-01-16 23:08:36 +00009185 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
9186 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009187}
9188
9189static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009190vec_xor(vector float __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009191{
David Blaikie3302f2b2013-01-16 23:08:36 +00009192 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
9193 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009194}
9195
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009196/* vec_vxor */
9197
9198static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009199vec_vxor(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009200{
David Blaikie3302f2b2013-01-16 23:08:36 +00009201 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009202}
9203
Anton Yartsevfc83c602010-08-19 03:21:36 +00009204static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009205vec_vxor(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009206{
David Blaikie3302f2b2013-01-16 23:08:36 +00009207 return (vector signed char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009208}
9209
9210static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009211vec_vxor(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009212{
David Blaikie3302f2b2013-01-16 23:08:36 +00009213 return __a ^ (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009214}
9215
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009216static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009217vec_vxor(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009218{
David Blaikie3302f2b2013-01-16 23:08:36 +00009219 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009220}
9221
Anton Yartsevfc83c602010-08-19 03:21:36 +00009222static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009223vec_vxor(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009224{
David Blaikie3302f2b2013-01-16 23:08:36 +00009225 return (vector unsigned char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009226}
9227
9228static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009229vec_vxor(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009230{
David Blaikie3302f2b2013-01-16 23:08:36 +00009231 return __a ^ (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009232}
9233
9234static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009235vec_vxor(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009236{
David Blaikie3302f2b2013-01-16 23:08:36 +00009237 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009238}
9239
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009240static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009241vec_vxor(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009242{
David Blaikie3302f2b2013-01-16 23:08:36 +00009243 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009244}
9245
Anton Yartsevfc83c602010-08-19 03:21:36 +00009246static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009247vec_vxor(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009248{
David Blaikie3302f2b2013-01-16 23:08:36 +00009249 return (vector short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009250}
9251
9252static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009253vec_vxor(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009254{
David Blaikie3302f2b2013-01-16 23:08:36 +00009255 return __a ^ (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009256}
9257
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009258static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009259vec_vxor(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009260{
David Blaikie3302f2b2013-01-16 23:08:36 +00009261 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009262}
9263
Anton Yartsevfc83c602010-08-19 03:21:36 +00009264static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009265vec_vxor(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009266{
David Blaikie3302f2b2013-01-16 23:08:36 +00009267 return (vector unsigned short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009268}
9269
9270static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009271vec_vxor(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009272{
David Blaikie3302f2b2013-01-16 23:08:36 +00009273 return __a ^ (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009274}
9275
9276static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009277vec_vxor(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009278{
David Blaikie3302f2b2013-01-16 23:08:36 +00009279 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009280}
9281
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009282static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009283vec_vxor(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009284{
David Blaikie3302f2b2013-01-16 23:08:36 +00009285 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009286}
9287
Anton Yartsevfc83c602010-08-19 03:21:36 +00009288static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009289vec_vxor(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009290{
David Blaikie3302f2b2013-01-16 23:08:36 +00009291 return (vector int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009292}
9293
9294static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009295vec_vxor(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009296{
David Blaikie3302f2b2013-01-16 23:08:36 +00009297 return __a ^ (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009298}
9299
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009300static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009301vec_vxor(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009302{
David Blaikie3302f2b2013-01-16 23:08:36 +00009303 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009304}
9305
Anton Yartsevfc83c602010-08-19 03:21:36 +00009306static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009307vec_vxor(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009308{
David Blaikie3302f2b2013-01-16 23:08:36 +00009309 return (vector unsigned int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009310}
9311
9312static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009313vec_vxor(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009314{
David Blaikie3302f2b2013-01-16 23:08:36 +00009315 return __a ^ (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009316}
9317
9318static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009319vec_vxor(vector bool int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009320{
David Blaikie3302f2b2013-01-16 23:08:36 +00009321 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009322}
9323
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009324static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009325vec_vxor(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009326{
David Blaikie3302f2b2013-01-16 23:08:36 +00009327 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
9328 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009329}
Chris Lattnerdad40622010-04-14 03:54:58 +00009330
Anton Yartsevfc83c602010-08-19 03:21:36 +00009331static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009332vec_vxor(vector bool int __a, vector float __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009333{
David Blaikie3302f2b2013-01-16 23:08:36 +00009334 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
9335 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009336}
9337
9338static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009339vec_vxor(vector float __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009340{
David Blaikie3302f2b2013-01-16 23:08:36 +00009341 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
9342 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009343}
9344
Anton Yartsev79d6af32010-09-18 00:39:16 +00009345/* ------------------------ extensions for CBEA ----------------------------- */
Anton Yartsev73d40232010-10-14 14:37:46 +00009346
9347/* vec_extract */
9348
9349static signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009350vec_extract(vector signed char __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009351{
David Blaikie3302f2b2013-01-16 23:08:36 +00009352 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009353}
9354
9355static unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009356vec_extract(vector unsigned char __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009357{
David Blaikie3302f2b2013-01-16 23:08:36 +00009358 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009359}
9360
9361static short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009362vec_extract(vector short __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009363{
David Blaikie3302f2b2013-01-16 23:08:36 +00009364 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009365}
9366
9367static unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009368vec_extract(vector unsigned short __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009369{
David Blaikie3302f2b2013-01-16 23:08:36 +00009370 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009371}
9372
9373static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009374vec_extract(vector int __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009375{
David Blaikie3302f2b2013-01-16 23:08:36 +00009376 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009377}
9378
9379static unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009380vec_extract(vector unsigned int __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009381{
David Blaikie3302f2b2013-01-16 23:08:36 +00009382 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009383}
9384
9385static float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009386vec_extract(vector float __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009387{
David Blaikie3302f2b2013-01-16 23:08:36 +00009388 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009389}
9390
9391/* vec_insert */
9392
9393static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009394vec_insert(signed char __a, vector signed char __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009395{
David Blaikie3302f2b2013-01-16 23:08:36 +00009396 __b[__c] = __a;
9397 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009398}
9399
9400static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009401vec_insert(unsigned char __a, vector unsigned char __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009402{
David Blaikie3302f2b2013-01-16 23:08:36 +00009403 __b[__c] = __a;
9404 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009405}
9406
9407static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009408vec_insert(short __a, vector short __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009409{
David Blaikie3302f2b2013-01-16 23:08:36 +00009410 __b[__c] = __a;
9411 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009412}
9413
9414static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009415vec_insert(unsigned short __a, vector unsigned short __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009416{
David Blaikie3302f2b2013-01-16 23:08:36 +00009417 __b[__c] = __a;
9418 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009419}
9420
9421static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009422vec_insert(int __a, vector int __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009423{
David Blaikie3302f2b2013-01-16 23:08:36 +00009424 __b[__c] = __a;
9425 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009426}
9427
9428static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009429vec_insert(unsigned int __a, vector unsigned int __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009430{
David Blaikie3302f2b2013-01-16 23:08:36 +00009431 __b[__c] = __a;
9432 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009433}
9434
9435static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009436vec_insert(float __a, vector float __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009437{
David Blaikie3302f2b2013-01-16 23:08:36 +00009438 __b[__c] = __a;
9439 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009440}
9441
9442/* vec_lvlx */
9443
9444static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009445vec_lvlx(int __a, const signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009446{
David Blaikie3302f2b2013-01-16 23:08:36 +00009447 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009448 (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009449 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009450}
9451
9452static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009453vec_lvlx(int __a, const vector signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009454{
David Blaikie3302f2b2013-01-16 23:08:36 +00009455 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009456 (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009457 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009458}
9459
9460static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009461vec_lvlx(int __a, const unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009462{
David Blaikie3302f2b2013-01-16 23:08:36 +00009463 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009464 (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009465 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009466}
9467
9468static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009469vec_lvlx(int __a, const vector unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009470{
David Blaikie3302f2b2013-01-16 23:08:36 +00009471 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009472 (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009473 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009474}
9475
9476static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009477vec_lvlx(int __a, const vector bool char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009478{
David Blaikie3302f2b2013-01-16 23:08:36 +00009479 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009480 (vector bool char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009481 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009482}
9483
9484static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009485vec_lvlx(int __a, const short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009486{
David Blaikie3302f2b2013-01-16 23:08:36 +00009487 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009488 (vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009489 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009490}
9491
9492static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009493vec_lvlx(int __a, const vector short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009494{
David Blaikie3302f2b2013-01-16 23:08:36 +00009495 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009496 (vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009497 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009498}
9499
9500static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009501vec_lvlx(int __a, const unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009502{
David Blaikie3302f2b2013-01-16 23:08:36 +00009503 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009504 (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009505 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009506}
9507
9508static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009509vec_lvlx(int __a, const vector unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009510{
David Blaikie3302f2b2013-01-16 23:08:36 +00009511 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009512 (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009513 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009514}
9515
9516static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009517vec_lvlx(int __a, const vector bool short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009518{
David Blaikie3302f2b2013-01-16 23:08:36 +00009519 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009520 (vector bool short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009521 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009522}
9523
9524static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009525vec_lvlx(int __a, const vector pixel *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009526{
David Blaikie3302f2b2013-01-16 23:08:36 +00009527 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009528 (vector pixel)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009529 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009530}
9531
9532static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009533vec_lvlx(int __a, const int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009534{
David Blaikie3302f2b2013-01-16 23:08:36 +00009535 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009536 (vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009537 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009538}
9539
9540static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009541vec_lvlx(int __a, const vector int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009542{
David Blaikie3302f2b2013-01-16 23:08:36 +00009543 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009544 (vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009545 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009546}
9547
9548static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009549vec_lvlx(int __a, const unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009550{
David Blaikie3302f2b2013-01-16 23:08:36 +00009551 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009552 (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009553 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009554}
9555
9556static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009557vec_lvlx(int __a, const vector unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009558{
David Blaikie3302f2b2013-01-16 23:08:36 +00009559 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009560 (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009561 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009562}
9563
9564static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009565vec_lvlx(int __a, const vector bool int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009566{
David Blaikie3302f2b2013-01-16 23:08:36 +00009567 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009568 (vector bool int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009569 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009570}
9571
9572static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009573vec_lvlx(int __a, const float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009574{
David Blaikie3302f2b2013-01-16 23:08:36 +00009575 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009576 (vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009577 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009578}
9579
9580static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009581vec_lvlx(int __a, const vector float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009582{
David Blaikie3302f2b2013-01-16 23:08:36 +00009583 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009584 (vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009585 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009586}
9587
9588/* vec_lvlxl */
9589
9590static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009591vec_lvlxl(int __a, const signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009592{
David Blaikie3302f2b2013-01-16 23:08:36 +00009593 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009594 (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009595 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009596}
9597
9598static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009599vec_lvlxl(int __a, const vector signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009600{
David Blaikie3302f2b2013-01-16 23:08:36 +00009601 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009602 (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009603 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009604}
9605
9606static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009607vec_lvlxl(int __a, const unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009608{
David Blaikie3302f2b2013-01-16 23:08:36 +00009609 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009610 (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009611 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009612}
9613
9614static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009615vec_lvlxl(int __a, const vector unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009616{
David Blaikie3302f2b2013-01-16 23:08:36 +00009617 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009618 (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009619 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009620}
9621
9622static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009623vec_lvlxl(int __a, const vector bool char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009624{
David Blaikie3302f2b2013-01-16 23:08:36 +00009625 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009626 (vector bool char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009627 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009628}
9629
9630static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009631vec_lvlxl(int __a, const short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009632{
David Blaikie3302f2b2013-01-16 23:08:36 +00009633 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009634 (vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009635 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009636}
9637
9638static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009639vec_lvlxl(int __a, const vector short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009640{
David Blaikie3302f2b2013-01-16 23:08:36 +00009641 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009642 (vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009643 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009644}
9645
9646static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009647vec_lvlxl(int __a, const unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009648{
David Blaikie3302f2b2013-01-16 23:08:36 +00009649 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009650 (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009651 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009652}
9653
9654static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009655vec_lvlxl(int __a, const vector unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009656{
David Blaikie3302f2b2013-01-16 23:08:36 +00009657 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009658 (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009659 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009660}
9661
9662static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009663vec_lvlxl(int __a, const vector bool short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009664{
David Blaikie3302f2b2013-01-16 23:08:36 +00009665 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009666 (vector bool short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009667 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009668}
9669
9670static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009671vec_lvlxl(int __a, const vector pixel *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009672{
David Blaikie3302f2b2013-01-16 23:08:36 +00009673 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009674 (vector pixel)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009675 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009676}
9677
9678static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009679vec_lvlxl(int __a, const int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009680{
David Blaikie3302f2b2013-01-16 23:08:36 +00009681 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009682 (vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009683 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009684}
9685
9686static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009687vec_lvlxl(int __a, const vector int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009688{
David Blaikie3302f2b2013-01-16 23:08:36 +00009689 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009690 (vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009691 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009692}
9693
9694static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009695vec_lvlxl(int __a, const unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009696{
David Blaikie3302f2b2013-01-16 23:08:36 +00009697 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009698 (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009699 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009700}
9701
9702static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009703vec_lvlxl(int __a, const vector unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009704{
David Blaikie3302f2b2013-01-16 23:08:36 +00009705 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009706 (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009707 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009708}
9709
9710static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009711vec_lvlxl(int __a, const vector bool int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009712{
David Blaikie3302f2b2013-01-16 23:08:36 +00009713 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009714 (vector bool int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009715 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009716}
9717
9718static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009719vec_lvlxl(int __a, const float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009720{
David Blaikie3302f2b2013-01-16 23:08:36 +00009721 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009722 (vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009723 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009724}
9725
9726static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009727vec_lvlxl(int __a, vector float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009728{
David Blaikie3302f2b2013-01-16 23:08:36 +00009729 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009730 (vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009731 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009732}
9733
9734/* vec_lvrx */
9735
9736static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009737vec_lvrx(int __a, const signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009738{
9739 return vec_perm((vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009740 vec_ld(__a, __b),
9741 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009742}
9743
9744static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009745vec_lvrx(int __a, const vector signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009746{
9747 return vec_perm((vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009748 vec_ld(__a, __b),
9749 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009750}
9751
9752static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009753vec_lvrx(int __a, const unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009754{
9755 return vec_perm((vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009756 vec_ld(__a, __b),
9757 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009758}
9759
9760static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009761vec_lvrx(int __a, const vector unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009762{
9763 return vec_perm((vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009764 vec_ld(__a, __b),
9765 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009766}
9767
9768static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009769vec_lvrx(int __a, const vector bool char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009770{
9771 return vec_perm((vector bool char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009772 vec_ld(__a, __b),
9773 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009774}
9775
9776static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009777vec_lvrx(int __a, const short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009778{
9779 return vec_perm((vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009780 vec_ld(__a, __b),
9781 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009782}
9783
9784static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009785vec_lvrx(int __a, const vector short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009786{
9787 return vec_perm((vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009788 vec_ld(__a, __b),
9789 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009790}
9791
9792static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009793vec_lvrx(int __a, const unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009794{
9795 return vec_perm((vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009796 vec_ld(__a, __b),
9797 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009798}
9799
9800static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009801vec_lvrx(int __a, const vector unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009802{
9803 return vec_perm((vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009804 vec_ld(__a, __b),
9805 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009806}
9807
9808static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009809vec_lvrx(int __a, const vector bool short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009810{
9811 return vec_perm((vector bool short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009812 vec_ld(__a, __b),
9813 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009814}
9815
9816static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009817vec_lvrx(int __a, const vector pixel *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009818{
9819 return vec_perm((vector pixel)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009820 vec_ld(__a, __b),
9821 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009822}
9823
9824static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009825vec_lvrx(int __a, const int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009826{
9827 return vec_perm((vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009828 vec_ld(__a, __b),
9829 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009830}
9831
9832static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009833vec_lvrx(int __a, const vector int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009834{
9835 return vec_perm((vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009836 vec_ld(__a, __b),
9837 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009838}
9839
9840static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009841vec_lvrx(int __a, const unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009842{
9843 return vec_perm((vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009844 vec_ld(__a, __b),
9845 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009846}
9847
9848static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009849vec_lvrx(int __a, const vector unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009850{
9851 return vec_perm((vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009852 vec_ld(__a, __b),
9853 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009854}
9855
9856static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009857vec_lvrx(int __a, const vector bool int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009858{
9859 return vec_perm((vector bool int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009860 vec_ld(__a, __b),
9861 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009862}
9863
9864static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009865vec_lvrx(int __a, const float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009866{
9867 return vec_perm((vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009868 vec_ld(__a, __b),
9869 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009870}
9871
9872static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009873vec_lvrx(int __a, const vector float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009874{
9875 return vec_perm((vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009876 vec_ld(__a, __b),
9877 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009878}
9879
9880/* vec_lvrxl */
9881
9882static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009883vec_lvrxl(int __a, const signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009884{
9885 return vec_perm((vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009886 vec_ldl(__a, __b),
9887 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009888}
9889
9890static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009891vec_lvrxl(int __a, const vector signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009892{
9893 return vec_perm((vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009894 vec_ldl(__a, __b),
9895 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009896}
9897
9898static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009899vec_lvrxl(int __a, const unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009900{
9901 return vec_perm((vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009902 vec_ldl(__a, __b),
9903 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009904}
9905
9906static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009907vec_lvrxl(int __a, const vector unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009908{
9909 return vec_perm((vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009910 vec_ldl(__a, __b),
9911 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009912}
9913
9914static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009915vec_lvrxl(int __a, const vector bool char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009916{
9917 return vec_perm((vector bool char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009918 vec_ldl(__a, __b),
9919 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009920}
9921
9922static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009923vec_lvrxl(int __a, const short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009924{
9925 return vec_perm((vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009926 vec_ldl(__a, __b),
9927 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009928}
9929
9930static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009931vec_lvrxl(int __a, const vector short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009932{
9933 return vec_perm((vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009934 vec_ldl(__a, __b),
9935 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009936}
9937
9938static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009939vec_lvrxl(int __a, const unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009940{
9941 return vec_perm((vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009942 vec_ldl(__a, __b),
9943 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009944}
9945
9946static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009947vec_lvrxl(int __a, const vector unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009948{
9949 return vec_perm((vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009950 vec_ldl(__a, __b),
9951 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009952}
9953
9954static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009955vec_lvrxl(int __a, const vector bool short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009956{
9957 return vec_perm((vector bool short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009958 vec_ldl(__a, __b),
9959 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009960}
9961
9962static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009963vec_lvrxl(int __a, const vector pixel *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009964{
9965 return vec_perm((vector pixel)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009966 vec_ldl(__a, __b),
9967 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009968}
9969
9970static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009971vec_lvrxl(int __a, const int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009972{
9973 return vec_perm((vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009974 vec_ldl(__a, __b),
9975 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009976}
9977
9978static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009979vec_lvrxl(int __a, const vector int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009980{
9981 return vec_perm((vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009982 vec_ldl(__a, __b),
9983 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009984}
9985
9986static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009987vec_lvrxl(int __a, const unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009988{
9989 return vec_perm((vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009990 vec_ldl(__a, __b),
9991 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009992}
9993
9994static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009995vec_lvrxl(int __a, const vector unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009996{
9997 return vec_perm((vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009998 vec_ldl(__a, __b),
9999 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010000}
10001
10002static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010003vec_lvrxl(int __a, const vector bool int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010004{
10005 return vec_perm((vector bool int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010006 vec_ldl(__a, __b),
10007 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010008}
10009
10010static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010011vec_lvrxl(int __a, const float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010012{
10013 return vec_perm((vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010014 vec_ldl(__a, __b),
10015 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010016}
10017
10018static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010019vec_lvrxl(int __a, const vector float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010020{
10021 return vec_perm((vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +000010022 vec_ldl(__a, __b),
10023 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +000010024}
10025
10026/* vec_stvlx */
10027
10028static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010029vec_stvlx(vector signed char __a, int __b, signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010030{
David Blaikie3302f2b2013-01-16 23:08:36 +000010031 return vec_st(vec_perm(vec_lvrx(__b, __c),
10032 __a,
10033 vec_lvsr(__b, __c)),
10034 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010035}
10036
10037static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010038vec_stvlx(vector signed char __a, int __b, vector signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010039{
David Blaikie3302f2b2013-01-16 23:08:36 +000010040 return vec_st(vec_perm(vec_lvrx(__b, __c),
10041 __a,
10042 vec_lvsr(__b, (unsigned char *)__c)),
10043 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010044}
10045
10046static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010047vec_stvlx(vector unsigned char __a, int __b, unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010048{
David Blaikie3302f2b2013-01-16 23:08:36 +000010049 return vec_st(vec_perm(vec_lvrx(__b, __c),
10050 __a,
10051 vec_lvsr(__b, __c)),
10052 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010053}
10054
10055static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010056vec_stvlx(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010057{
David Blaikie3302f2b2013-01-16 23:08:36 +000010058 return vec_st(vec_perm(vec_lvrx(__b, __c),
10059 __a,
10060 vec_lvsr(__b, (unsigned char *)__c)),
10061 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010062}
10063
10064static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010065vec_stvlx(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010066{
David Blaikie3302f2b2013-01-16 23:08:36 +000010067 return vec_st(vec_perm(vec_lvrx(__b, __c),
10068 __a,
10069 vec_lvsr(__b, (unsigned char *)__c)),
10070 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010071}
10072
10073static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010074vec_stvlx(vector short __a, int __b, short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010075{
David Blaikie3302f2b2013-01-16 23:08:36 +000010076 return vec_st(vec_perm(vec_lvrx(__b, __c),
10077 __a,
10078 vec_lvsr(__b, __c)),
10079 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010080}
10081
10082static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010083vec_stvlx(vector short __a, int __b, vector short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010084{
David Blaikie3302f2b2013-01-16 23:08:36 +000010085 return vec_st(vec_perm(vec_lvrx(__b, __c),
10086 __a,
10087 vec_lvsr(__b, (unsigned char *)__c)),
10088 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010089}
10090
10091static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010092vec_stvlx(vector unsigned short __a, int __b, unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010093{
David Blaikie3302f2b2013-01-16 23:08:36 +000010094 return vec_st(vec_perm(vec_lvrx(__b, __c),
10095 __a,
10096 vec_lvsr(__b, __c)),
10097 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010098}
10099
10100static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010101vec_stvlx(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010102{
David Blaikie3302f2b2013-01-16 23:08:36 +000010103 return vec_st(vec_perm(vec_lvrx(__b, __c),
10104 __a,
10105 vec_lvsr(__b, (unsigned char *)__c)),
10106 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010107}
10108
10109static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010110vec_stvlx(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010111{
David Blaikie3302f2b2013-01-16 23:08:36 +000010112 return vec_st(vec_perm(vec_lvrx(__b, __c),
10113 __a,
10114 vec_lvsr(__b, (unsigned char *)__c)),
10115 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010116}
10117
10118static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010119vec_stvlx(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010120{
David Blaikie3302f2b2013-01-16 23:08:36 +000010121 return vec_st(vec_perm(vec_lvrx(__b, __c),
10122 __a,
10123 vec_lvsr(__b, (unsigned char *)__c)),
10124 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010125}
10126
10127static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010128vec_stvlx(vector int __a, int __b, int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010129{
David Blaikie3302f2b2013-01-16 23:08:36 +000010130 return vec_st(vec_perm(vec_lvrx(__b, __c),
10131 __a,
10132 vec_lvsr(__b, __c)),
10133 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010134}
10135
10136static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010137vec_stvlx(vector int __a, int __b, vector int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010138{
David Blaikie3302f2b2013-01-16 23:08:36 +000010139 return vec_st(vec_perm(vec_lvrx(__b, __c),
10140 __a,
10141 vec_lvsr(__b, (unsigned char *)__c)),
10142 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010143}
10144
10145static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010146vec_stvlx(vector unsigned int __a, int __b, unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010147{
David Blaikie3302f2b2013-01-16 23:08:36 +000010148 return vec_st(vec_perm(vec_lvrx(__b, __c),
10149 __a,
10150 vec_lvsr(__b, __c)),
10151 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010152}
10153
10154static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010155vec_stvlx(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010156{
David Blaikie3302f2b2013-01-16 23:08:36 +000010157 return vec_st(vec_perm(vec_lvrx(__b, __c),
10158 __a,
10159 vec_lvsr(__b, (unsigned char *)__c)),
10160 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010161}
10162
10163static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010164vec_stvlx(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010165{
David Blaikie3302f2b2013-01-16 23:08:36 +000010166 return vec_st(vec_perm(vec_lvrx(__b, __c),
10167 __a,
10168 vec_lvsr(__b, (unsigned char *)__c)),
10169 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010170}
10171
10172static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010173vec_stvlx(vector float __a, int __b, vector float *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010174{
David Blaikie3302f2b2013-01-16 23:08:36 +000010175 return vec_st(vec_perm(vec_lvrx(__b, __c),
10176 __a,
10177 vec_lvsr(__b, (unsigned char *)__c)),
10178 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010179}
10180
10181/* vec_stvlxl */
10182
10183static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010184vec_stvlxl(vector signed char __a, int __b, signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010185{
David Blaikie3302f2b2013-01-16 23:08:36 +000010186 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10187 __a,
10188 vec_lvsr(__b, __c)),
10189 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010190}
10191
10192static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010193vec_stvlxl(vector signed char __a, int __b, vector signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010194{
David Blaikie3302f2b2013-01-16 23:08:36 +000010195 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10196 __a,
10197 vec_lvsr(__b, (unsigned char *)__c)),
10198 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010199}
10200
10201static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010202vec_stvlxl(vector unsigned char __a, int __b, unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010203{
David Blaikie3302f2b2013-01-16 23:08:36 +000010204 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10205 __a,
10206 vec_lvsr(__b, __c)),
10207 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010208}
10209
10210static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010211vec_stvlxl(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010212{
David Blaikie3302f2b2013-01-16 23:08:36 +000010213 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10214 __a,
10215 vec_lvsr(__b, (unsigned char *)__c)),
10216 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010217}
10218
10219static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010220vec_stvlxl(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010221{
David Blaikie3302f2b2013-01-16 23:08:36 +000010222 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10223 __a,
10224 vec_lvsr(__b, (unsigned char *)__c)),
10225 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010226}
10227
10228static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010229vec_stvlxl(vector short __a, int __b, short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010230{
David Blaikie3302f2b2013-01-16 23:08:36 +000010231 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10232 __a,
10233 vec_lvsr(__b, __c)),
10234 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010235}
10236
10237static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010238vec_stvlxl(vector short __a, int __b, vector short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010239{
David Blaikie3302f2b2013-01-16 23:08:36 +000010240 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10241 __a,
10242 vec_lvsr(__b, (unsigned char *)__c)),
10243 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010244}
10245
10246static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010247vec_stvlxl(vector unsigned short __a, int __b, unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010248{
David Blaikie3302f2b2013-01-16 23:08:36 +000010249 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10250 __a,
10251 vec_lvsr(__b, __c)),
10252 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010253}
10254
10255static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010256vec_stvlxl(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010257{
David Blaikie3302f2b2013-01-16 23:08:36 +000010258 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10259 __a,
10260 vec_lvsr(__b, (unsigned char *)__c)),
10261 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010262}
10263
10264static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010265vec_stvlxl(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010266{
David Blaikie3302f2b2013-01-16 23:08:36 +000010267 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10268 __a,
10269 vec_lvsr(__b, (unsigned char *)__c)),
10270 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010271}
10272
10273static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010274vec_stvlxl(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010275{
David Blaikie3302f2b2013-01-16 23:08:36 +000010276 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10277 __a,
10278 vec_lvsr(__b, (unsigned char *)__c)),
10279 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010280}
10281
10282static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010283vec_stvlxl(vector int __a, int __b, int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010284{
David Blaikie3302f2b2013-01-16 23:08:36 +000010285 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10286 __a,
10287 vec_lvsr(__b, __c)),
10288 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010289}
10290
10291static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010292vec_stvlxl(vector int __a, int __b, vector int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010293{
David Blaikie3302f2b2013-01-16 23:08:36 +000010294 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10295 __a,
10296 vec_lvsr(__b, (unsigned char *)__c)),
10297 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010298}
10299
10300static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010301vec_stvlxl(vector unsigned int __a, int __b, unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010302{
David Blaikie3302f2b2013-01-16 23:08:36 +000010303 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10304 __a,
10305 vec_lvsr(__b, __c)),
10306 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010307}
10308
10309static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010310vec_stvlxl(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010311{
David Blaikie3302f2b2013-01-16 23:08:36 +000010312 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10313 __a,
10314 vec_lvsr(__b, (unsigned char *)__c)),
10315 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010316}
10317
10318static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010319vec_stvlxl(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010320{
David Blaikie3302f2b2013-01-16 23:08:36 +000010321 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10322 __a,
10323 vec_lvsr(__b, (unsigned char *)__c)),
10324 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010325}
10326
10327static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010328vec_stvlxl(vector float __a, int __b, vector float *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010329{
David Blaikie3302f2b2013-01-16 23:08:36 +000010330 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10331 __a,
10332 vec_lvsr(__b, (unsigned char *)__c)),
10333 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010334}
10335
10336/* vec_stvrx */
10337
10338static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010339vec_stvrx(vector signed char __a, int __b, signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010340{
David Blaikie3302f2b2013-01-16 23:08:36 +000010341 return vec_st(vec_perm(__a,
10342 vec_lvlx(__b, __c),
10343 vec_lvsr(__b, __c)),
10344 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010345}
10346
10347static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010348vec_stvrx(vector signed char __a, int __b, vector signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010349{
David Blaikie3302f2b2013-01-16 23:08:36 +000010350 return vec_st(vec_perm(__a,
10351 vec_lvlx(__b, __c),
10352 vec_lvsr(__b, (unsigned char *)__c)),
10353 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010354}
10355
10356static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010357vec_stvrx(vector unsigned char __a, int __b, unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010358{
David Blaikie3302f2b2013-01-16 23:08:36 +000010359 return vec_st(vec_perm(__a,
10360 vec_lvlx(__b, __c),
10361 vec_lvsr(__b, __c)),
10362 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010363}
10364
10365static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010366vec_stvrx(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010367{
David Blaikie3302f2b2013-01-16 23:08:36 +000010368 return vec_st(vec_perm(__a,
10369 vec_lvlx(__b, __c),
10370 vec_lvsr(__b, (unsigned char *)__c)),
10371 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010372}
10373
10374static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010375vec_stvrx(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010376{
David Blaikie3302f2b2013-01-16 23:08:36 +000010377 return vec_st(vec_perm(__a,
10378 vec_lvlx(__b, __c),
10379 vec_lvsr(__b, (unsigned char *)__c)),
10380 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010381}
10382
10383static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010384vec_stvrx(vector short __a, int __b, short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010385{
David Blaikie3302f2b2013-01-16 23:08:36 +000010386 return vec_st(vec_perm(__a,
10387 vec_lvlx(__b, __c),
10388 vec_lvsr(__b, __c)),
10389 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010390}
10391
10392static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010393vec_stvrx(vector short __a, int __b, vector short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010394{
David Blaikie3302f2b2013-01-16 23:08:36 +000010395 return vec_st(vec_perm(__a,
10396 vec_lvlx(__b, __c),
10397 vec_lvsr(__b, (unsigned char *)__c)),
10398 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010399}
10400
10401static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010402vec_stvrx(vector unsigned short __a, int __b, unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010403{
David Blaikie3302f2b2013-01-16 23:08:36 +000010404 return vec_st(vec_perm(__a,
10405 vec_lvlx(__b, __c),
10406 vec_lvsr(__b, __c)),
10407 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010408}
10409
10410static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010411vec_stvrx(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010412{
David Blaikie3302f2b2013-01-16 23:08:36 +000010413 return vec_st(vec_perm(__a,
10414 vec_lvlx(__b, __c),
10415 vec_lvsr(__b, (unsigned char *)__c)),
10416 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010417}
10418
10419static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010420vec_stvrx(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010421{
David Blaikie3302f2b2013-01-16 23:08:36 +000010422 return vec_st(vec_perm(__a,
10423 vec_lvlx(__b, __c),
10424 vec_lvsr(__b, (unsigned char *)__c)),
10425 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010426}
10427
10428static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010429vec_stvrx(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010430{
David Blaikie3302f2b2013-01-16 23:08:36 +000010431 return vec_st(vec_perm(__a,
10432 vec_lvlx(__b, __c),
10433 vec_lvsr(__b, (unsigned char *)__c)),
10434 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010435}
10436
10437static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010438vec_stvrx(vector int __a, int __b, int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010439{
David Blaikie3302f2b2013-01-16 23:08:36 +000010440 return vec_st(vec_perm(__a,
10441 vec_lvlx(__b, __c),
10442 vec_lvsr(__b, __c)),
10443 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010444}
10445
10446static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010447vec_stvrx(vector int __a, int __b, vector int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010448{
David Blaikie3302f2b2013-01-16 23:08:36 +000010449 return vec_st(vec_perm(__a,
10450 vec_lvlx(__b, __c),
10451 vec_lvsr(__b, (unsigned char *)__c)),
10452 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010453}
10454
10455static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010456vec_stvrx(vector unsigned int __a, int __b, unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010457{
David Blaikie3302f2b2013-01-16 23:08:36 +000010458 return vec_st(vec_perm(__a,
10459 vec_lvlx(__b, __c),
10460 vec_lvsr(__b, __c)),
10461 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010462}
10463
10464static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010465vec_stvrx(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010466{
David Blaikie3302f2b2013-01-16 23:08:36 +000010467 return vec_st(vec_perm(__a,
10468 vec_lvlx(__b, __c),
10469 vec_lvsr(__b, (unsigned char *)__c)),
10470 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010471}
10472
10473static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010474vec_stvrx(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010475{
David Blaikie3302f2b2013-01-16 23:08:36 +000010476 return vec_st(vec_perm(__a,
10477 vec_lvlx(__b, __c),
10478 vec_lvsr(__b, (unsigned char *)__c)),
10479 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010480}
10481
10482static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010483vec_stvrx(vector float __a, int __b, vector float *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010484{
David Blaikie3302f2b2013-01-16 23:08:36 +000010485 return vec_st(vec_perm(__a,
10486 vec_lvlx(__b, __c),
10487 vec_lvsr(__b, (unsigned char *)__c)),
10488 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010489}
10490
10491/* vec_stvrxl */
10492
10493static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010494vec_stvrxl(vector signed char __a, int __b, signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010495{
David Blaikie3302f2b2013-01-16 23:08:36 +000010496 return vec_stl(vec_perm(__a,
10497 vec_lvlx(__b, __c),
10498 vec_lvsr(__b, __c)),
10499 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010500}
10501
10502static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010503vec_stvrxl(vector signed char __a, int __b, vector signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010504{
David Blaikie3302f2b2013-01-16 23:08:36 +000010505 return vec_stl(vec_perm(__a,
10506 vec_lvlx(__b, __c),
10507 vec_lvsr(__b, (unsigned char *)__c)),
10508 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010509}
10510
10511static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010512vec_stvrxl(vector unsigned char __a, int __b, unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010513{
David Blaikie3302f2b2013-01-16 23:08:36 +000010514 return vec_stl(vec_perm(__a,
10515 vec_lvlx(__b, __c),
10516 vec_lvsr(__b, __c)),
10517 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010518}
10519
10520static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010521vec_stvrxl(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010522{
David Blaikie3302f2b2013-01-16 23:08:36 +000010523 return vec_stl(vec_perm(__a,
10524 vec_lvlx(__b, __c),
10525 vec_lvsr(__b, (unsigned char *)__c)),
10526 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010527}
10528
10529static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010530vec_stvrxl(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010531{
David Blaikie3302f2b2013-01-16 23:08:36 +000010532 return vec_stl(vec_perm(__a,
10533 vec_lvlx(__b, __c),
10534 vec_lvsr(__b, (unsigned char *)__c)),
10535 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010536}
10537
10538static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010539vec_stvrxl(vector short __a, int __b, short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010540{
David Blaikie3302f2b2013-01-16 23:08:36 +000010541 return vec_stl(vec_perm(__a,
10542 vec_lvlx(__b, __c),
10543 vec_lvsr(__b, __c)),
10544 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010545}
10546
10547static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010548vec_stvrxl(vector short __a, int __b, vector short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010549{
David Blaikie3302f2b2013-01-16 23:08:36 +000010550 return vec_stl(vec_perm(__a,
10551 vec_lvlx(__b, __c),
10552 vec_lvsr(__b, (unsigned char *)__c)),
10553 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010554}
10555
10556static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010557vec_stvrxl(vector unsigned short __a, int __b, unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010558{
David Blaikie3302f2b2013-01-16 23:08:36 +000010559 return vec_stl(vec_perm(__a,
10560 vec_lvlx(__b, __c),
10561 vec_lvsr(__b, __c)),
10562 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010563}
10564
10565static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010566vec_stvrxl(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010567{
David Blaikie3302f2b2013-01-16 23:08:36 +000010568 return vec_stl(vec_perm(__a,
10569 vec_lvlx(__b, __c),
10570 vec_lvsr(__b, (unsigned char *)__c)),
10571 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010572}
10573
10574static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010575vec_stvrxl(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010576{
David Blaikie3302f2b2013-01-16 23:08:36 +000010577 return vec_stl(vec_perm(__a,
10578 vec_lvlx(__b, __c),
10579 vec_lvsr(__b, (unsigned char *)__c)),
10580 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010581}
10582
10583static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010584vec_stvrxl(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010585{
David Blaikie3302f2b2013-01-16 23:08:36 +000010586 return vec_stl(vec_perm(__a,
10587 vec_lvlx(__b, __c),
10588 vec_lvsr(__b, (unsigned char *)__c)),
10589 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010590}
10591
10592static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010593vec_stvrxl(vector int __a, int __b, int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010594{
David Blaikie3302f2b2013-01-16 23:08:36 +000010595 return vec_stl(vec_perm(__a,
10596 vec_lvlx(__b, __c),
10597 vec_lvsr(__b, __c)),
10598 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010599}
10600
10601static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010602vec_stvrxl(vector int __a, int __b, vector int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010603{
David Blaikie3302f2b2013-01-16 23:08:36 +000010604 return vec_stl(vec_perm(__a,
10605 vec_lvlx(__b, __c),
10606 vec_lvsr(__b, (unsigned char *)__c)),
10607 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010608}
10609
10610static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010611vec_stvrxl(vector unsigned int __a, int __b, unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010612{
David Blaikie3302f2b2013-01-16 23:08:36 +000010613 return vec_stl(vec_perm(__a,
10614 vec_lvlx(__b, __c),
10615 vec_lvsr(__b, __c)),
10616 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010617}
10618
10619static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010620vec_stvrxl(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010621{
David Blaikie3302f2b2013-01-16 23:08:36 +000010622 return vec_stl(vec_perm(__a,
10623 vec_lvlx(__b, __c),
10624 vec_lvsr(__b, (unsigned char *)__c)),
10625 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010626}
10627
10628static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010629vec_stvrxl(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010630{
David Blaikie3302f2b2013-01-16 23:08:36 +000010631 return vec_stl(vec_perm(__a,
10632 vec_lvlx(__b, __c),
10633 vec_lvsr(__b, (unsigned char *)__c)),
10634 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010635}
10636
10637static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010638vec_stvrxl(vector float __a, int __b, vector float *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010639{
David Blaikie3302f2b2013-01-16 23:08:36 +000010640 return vec_stl(vec_perm(__a,
10641 vec_lvlx(__b, __c),
10642 vec_lvsr(__b, (unsigned char *)__c)),
10643 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010644}
10645
10646/* vec_promote */
10647
10648static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010649vec_promote(signed char __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010650{
David Blaikie3302f2b2013-01-16 23:08:36 +000010651 vector signed char __res = (vector signed char)(0);
10652 __res[__b] = __a;
10653 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010654}
10655
10656static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010657vec_promote(unsigned char __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010658{
David Blaikie3302f2b2013-01-16 23:08:36 +000010659 vector unsigned char __res = (vector unsigned char)(0);
10660 __res[__b] = __a;
10661 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010662}
10663
10664static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010665vec_promote(short __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010666{
David Blaikie3302f2b2013-01-16 23:08:36 +000010667 vector short __res = (vector short)(0);
10668 __res[__b] = __a;
10669 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010670}
10671
10672static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010673vec_promote(unsigned short __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010674{
David Blaikie3302f2b2013-01-16 23:08:36 +000010675 vector unsigned short __res = (vector unsigned short)(0);
10676 __res[__b] = __a;
10677 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010678}
10679
10680static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010681vec_promote(int __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010682{
David Blaikie3302f2b2013-01-16 23:08:36 +000010683 vector int __res = (vector int)(0);
10684 __res[__b] = __a;
10685 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010686}
10687
10688static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010689vec_promote(unsigned int __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010690{
David Blaikie3302f2b2013-01-16 23:08:36 +000010691 vector unsigned int __res = (vector unsigned int)(0);
10692 __res[__b] = __a;
10693 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010694}
10695
10696static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010697vec_promote(float __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010698{
David Blaikie3302f2b2013-01-16 23:08:36 +000010699 vector float __res = (vector float)(0);
10700 __res[__b] = __a;
10701 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010702}
10703
10704/* vec_splats */
10705
10706static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010707vec_splats(signed char __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000010708{
David Blaikie3302f2b2013-01-16 23:08:36 +000010709 return (vector signed char)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010710}
10711
10712static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010713vec_splats(unsigned char __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000010714{
David Blaikie3302f2b2013-01-16 23:08:36 +000010715 return (vector unsigned char)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010716}
10717
10718static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010719vec_splats(short __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000010720{
David Blaikie3302f2b2013-01-16 23:08:36 +000010721 return (vector short)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010722}
10723
10724static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010725vec_splats(unsigned short __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000010726{
David Blaikie3302f2b2013-01-16 23:08:36 +000010727 return (vector unsigned short)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010728}
10729
10730static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010731vec_splats(int __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000010732{
David Blaikie3302f2b2013-01-16 23:08:36 +000010733 return (vector int)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010734}
10735
10736static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010737vec_splats(unsigned int __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000010738{
David Blaikie3302f2b2013-01-16 23:08:36 +000010739 return (vector unsigned int)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010740}
10741
10742static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010743vec_splats(float __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000010744{
David Blaikie3302f2b2013-01-16 23:08:36 +000010745 return (vector float)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010746}
10747
Anton Yartsev79d6af32010-09-18 00:39:16 +000010748/* ----------------------------- predicates --------------------------------- */
Chris Lattnerdad40622010-04-14 03:54:58 +000010749
Chris Lattnerdad40622010-04-14 03:54:58 +000010750/* vec_all_eq */
10751
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010752static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010753vec_all_eq(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010754{
David Blaikie3302f2b2013-01-16 23:08:36 +000010755 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010756}
10757
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010758static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010759vec_all_eq(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010760{
David Blaikie3302f2b2013-01-16 23:08:36 +000010761 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010762}
10763
10764static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010765vec_all_eq(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010766{
David Blaikie3302f2b2013-01-16 23:08:36 +000010767 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010768}
10769
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010770static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010771vec_all_eq(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010772{
David Blaikie3302f2b2013-01-16 23:08:36 +000010773 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010774}
10775
10776static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010777vec_all_eq(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010778{
David Blaikie3302f2b2013-01-16 23:08:36 +000010779 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010780}
10781
10782static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010783vec_all_eq(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010784{
David Blaikie3302f2b2013-01-16 23:08:36 +000010785 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010786}
10787
10788static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010789vec_all_eq(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010790{
David Blaikie3302f2b2013-01-16 23:08:36 +000010791 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010792}
10793
10794static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010795vec_all_eq(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010796{
David Blaikie3302f2b2013-01-16 23:08:36 +000010797 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010798}
10799
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010800static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010801vec_all_eq(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010802{
David Blaikie3302f2b2013-01-16 23:08:36 +000010803 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010804}
10805
10806static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010807vec_all_eq(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010808{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010809 return
David Blaikie3302f2b2013-01-16 23:08:36 +000010810 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010811}
10812
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010813static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010814vec_all_eq(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010815{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010816 return
David Blaikie3302f2b2013-01-16 23:08:36 +000010817 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010818}
10819
10820static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010821vec_all_eq(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010822{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010823 return
David Blaikie3302f2b2013-01-16 23:08:36 +000010824 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010825}
10826
10827static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010828vec_all_eq(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010829{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010830 return
David Blaikie3302f2b2013-01-16 23:08:36 +000010831 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010832}
10833
10834static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010835vec_all_eq(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010836{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010837 return
David Blaikie3302f2b2013-01-16 23:08:36 +000010838 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010839}
10840
10841static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010842vec_all_eq(vector pixel __a, vector pixel __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010843{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010844 return
David Blaikie3302f2b2013-01-16 23:08:36 +000010845 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010846}
10847
10848static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010849vec_all_eq(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010850{
David Blaikie3302f2b2013-01-16 23:08:36 +000010851 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010852}
10853
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010854static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010855vec_all_eq(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010856{
David Blaikie3302f2b2013-01-16 23:08:36 +000010857 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010858}
10859
10860static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010861vec_all_eq(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010862{
David Blaikie3302f2b2013-01-16 23:08:36 +000010863 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010864}
10865
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010866static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010867vec_all_eq(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010868{
David Blaikie3302f2b2013-01-16 23:08:36 +000010869 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010870}
10871
10872static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010873vec_all_eq(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010874{
David Blaikie3302f2b2013-01-16 23:08:36 +000010875 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010876}
10877
10878static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010879vec_all_eq(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010880{
David Blaikie3302f2b2013-01-16 23:08:36 +000010881 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010882}
10883
10884static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010885vec_all_eq(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010886{
David Blaikie3302f2b2013-01-16 23:08:36 +000010887 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010888}
10889
10890static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010891vec_all_eq(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010892{
David Blaikie3302f2b2013-01-16 23:08:36 +000010893 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010894}
10895
10896/* vec_all_ge */
10897
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010898static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010899vec_all_ge(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010900{
David Blaikie3302f2b2013-01-16 23:08:36 +000010901 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010902}
10903
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010904static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010905vec_all_ge(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010906{
David Blaikie3302f2b2013-01-16 23:08:36 +000010907 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010908}
10909
10910static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010911vec_all_ge(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010912{
David Blaikie3302f2b2013-01-16 23:08:36 +000010913 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010914}
10915
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010916static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010917vec_all_ge(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010918{
David Blaikie3302f2b2013-01-16 23:08:36 +000010919 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010920}
10921
10922static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010923vec_all_ge(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010924{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010925 return __builtin_altivec_vcmpgtub_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000010926 (vector unsigned char)__b,
10927 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010928}
10929
10930static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010931vec_all_ge(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010932{
David Blaikie3302f2b2013-01-16 23:08:36 +000010933 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010934}
10935
10936static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010937vec_all_ge(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010938{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010939 return __builtin_altivec_vcmpgtub_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000010940 (vector unsigned char)__b,
10941 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010942}
10943
10944static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010945vec_all_ge(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010946{
David Blaikie3302f2b2013-01-16 23:08:36 +000010947 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010948}
10949
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010950static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010951vec_all_ge(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010952{
David Blaikie3302f2b2013-01-16 23:08:36 +000010953 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010954}
10955
10956static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010957vec_all_ge(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010958{
David Blaikie3302f2b2013-01-16 23:08:36 +000010959 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010960}
10961
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010962static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010963vec_all_ge(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010964{
David Blaikie3302f2b2013-01-16 23:08:36 +000010965 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010966}
10967
10968static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010969vec_all_ge(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010970{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010971 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000010972 (vector unsigned short)__b,
10973 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010974}
10975
10976static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010977vec_all_ge(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010978{
David Blaikie3302f2b2013-01-16 23:08:36 +000010979 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010980}
10981
10982static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010983vec_all_ge(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010984{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010985 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000010986 (vector unsigned short)__b,
10987 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010988}
10989
10990static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010991vec_all_ge(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010992{
David Blaikie3302f2b2013-01-16 23:08:36 +000010993 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010994}
10995
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010996static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010997vec_all_ge(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010998{
David Blaikie3302f2b2013-01-16 23:08:36 +000010999 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011000}
11001
11002static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011003vec_all_ge(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011004{
David Blaikie3302f2b2013-01-16 23:08:36 +000011005 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011006}
11007
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011008static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011009vec_all_ge(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011010{
David Blaikie3302f2b2013-01-16 23:08:36 +000011011 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011012}
11013
11014static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011015vec_all_ge(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011016{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011017 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011018 (vector unsigned int)__b,
11019 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011020}
11021
11022static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011023vec_all_ge(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011024{
David Blaikie3302f2b2013-01-16 23:08:36 +000011025 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011026}
11027
11028static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011029vec_all_ge(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011030{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011031 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011032 (vector unsigned int)__b,
11033 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011034}
11035
11036static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011037vec_all_ge(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011038{
David Blaikie3302f2b2013-01-16 23:08:36 +000011039 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011040}
11041
11042/* vec_all_gt */
11043
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011044static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011045vec_all_gt(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011046{
David Blaikie3302f2b2013-01-16 23:08:36 +000011047 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011048}
11049
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011050static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011051vec_all_gt(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011052{
David Blaikie3302f2b2013-01-16 23:08:36 +000011053 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011054}
11055
11056static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011057vec_all_gt(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011058{
David Blaikie3302f2b2013-01-16 23:08:36 +000011059 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011060}
11061
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011062static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011063vec_all_gt(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011064{
David Blaikie3302f2b2013-01-16 23:08:36 +000011065 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011066}
11067
11068static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011069vec_all_gt(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011070{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011071 return __builtin_altivec_vcmpgtub_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011072 (vector unsigned char)__a,
11073 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011074}
11075
11076static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011077vec_all_gt(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011078{
David Blaikie3302f2b2013-01-16 23:08:36 +000011079 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011080}
11081
11082static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011083vec_all_gt(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011084{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011085 return __builtin_altivec_vcmpgtub_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011086 (vector unsigned char)__a,
11087 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011088}
11089
11090static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011091vec_all_gt(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011092{
David Blaikie3302f2b2013-01-16 23:08:36 +000011093 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011094}
11095
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011096static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011097vec_all_gt(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011098{
David Blaikie3302f2b2013-01-16 23:08:36 +000011099 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011100}
11101
11102static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011103vec_all_gt(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011104{
David Blaikie3302f2b2013-01-16 23:08:36 +000011105 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011106}
11107
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011108static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011109vec_all_gt(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011110{
David Blaikie3302f2b2013-01-16 23:08:36 +000011111 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011112}
11113
11114static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011115vec_all_gt(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011116{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011117 return __builtin_altivec_vcmpgtuh_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011118 (vector unsigned short)__a,
11119 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011120}
11121
11122static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011123vec_all_gt(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011124{
David Blaikie3302f2b2013-01-16 23:08:36 +000011125 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011126}
11127
11128static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011129vec_all_gt(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011130{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011131 return __builtin_altivec_vcmpgtuh_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011132 (vector unsigned short)__a,
11133 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011134}
11135
11136static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011137vec_all_gt(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011138{
David Blaikie3302f2b2013-01-16 23:08:36 +000011139 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011140}
11141
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011142static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011143vec_all_gt(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011144{
David Blaikie3302f2b2013-01-16 23:08:36 +000011145 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011146}
11147
11148static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011149vec_all_gt(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011150{
David Blaikie3302f2b2013-01-16 23:08:36 +000011151 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011152}
11153
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011154static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011155vec_all_gt(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011156{
David Blaikie3302f2b2013-01-16 23:08:36 +000011157 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011158}
11159
11160static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011161vec_all_gt(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011162{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011163 return __builtin_altivec_vcmpgtuw_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011164 (vector unsigned int)__a,
11165 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011166}
11167
11168static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011169vec_all_gt(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011170{
David Blaikie3302f2b2013-01-16 23:08:36 +000011171 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011172}
11173
11174static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011175vec_all_gt(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011176{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011177 return __builtin_altivec_vcmpgtuw_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011178 (vector unsigned int)__a,
11179 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011180}
11181
11182static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011183vec_all_gt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011184{
David Blaikie3302f2b2013-01-16 23:08:36 +000011185 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011186}
11187
11188/* vec_all_in */
11189
11190static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000011191vec_all_in(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011192{
David Blaikie3302f2b2013-01-16 23:08:36 +000011193 return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011194}
11195
11196/* vec_all_le */
11197
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011198static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011199vec_all_le(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011200{
David Blaikie3302f2b2013-01-16 23:08:36 +000011201 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011202}
11203
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011204static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011205vec_all_le(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011206{
David Blaikie3302f2b2013-01-16 23:08:36 +000011207 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011208}
11209
11210static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011211vec_all_le(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011212{
David Blaikie3302f2b2013-01-16 23:08:36 +000011213 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011214}
11215
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011216static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011217vec_all_le(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011218{
David Blaikie3302f2b2013-01-16 23:08:36 +000011219 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011220}
11221
11222static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011223vec_all_le(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011224{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011225 return __builtin_altivec_vcmpgtub_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011226 (vector unsigned char)__a,
11227 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011228}
11229
11230static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011231vec_all_le(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011232{
David Blaikie3302f2b2013-01-16 23:08:36 +000011233 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011234}
11235
11236static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011237vec_all_le(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011238{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011239 return __builtin_altivec_vcmpgtub_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011240 (vector unsigned char)__a,
11241 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011242}
11243
11244static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011245vec_all_le(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011246{
David Blaikie3302f2b2013-01-16 23:08:36 +000011247 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011248}
11249
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011250static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011251vec_all_le(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011252{
David Blaikie3302f2b2013-01-16 23:08:36 +000011253 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011254}
11255
11256static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011257vec_all_le(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011258{
David Blaikie3302f2b2013-01-16 23:08:36 +000011259 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011260}
11261
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011262static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011263vec_all_le(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011264{
David Blaikie3302f2b2013-01-16 23:08:36 +000011265 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011266}
11267
11268static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011269vec_all_le(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011270{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011271 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011272 (vector unsigned short)__a,
11273 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011274}
11275
11276static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011277vec_all_le(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011278{
David Blaikie3302f2b2013-01-16 23:08:36 +000011279 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011280}
11281
11282static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011283vec_all_le(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011284{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011285 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011286 (vector unsigned short)__a,
11287 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011288}
11289
11290static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011291vec_all_le(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011292{
David Blaikie3302f2b2013-01-16 23:08:36 +000011293 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011294}
11295
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011296static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011297vec_all_le(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011298{
David Blaikie3302f2b2013-01-16 23:08:36 +000011299 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011300}
11301
11302static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011303vec_all_le(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011304{
David Blaikie3302f2b2013-01-16 23:08:36 +000011305 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011306}
11307
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011308static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011309vec_all_le(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011310{
David Blaikie3302f2b2013-01-16 23:08:36 +000011311 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011312}
11313
11314static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011315vec_all_le(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011316{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011317 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011318 (vector unsigned int)__a,
11319 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011320}
11321
11322static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011323vec_all_le(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011324{
David Blaikie3302f2b2013-01-16 23:08:36 +000011325 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011326}
11327
11328static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011329vec_all_le(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011330{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011331 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011332 (vector unsigned int)__a,
11333 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011334}
11335
11336static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011337vec_all_le(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011338{
David Blaikie3302f2b2013-01-16 23:08:36 +000011339 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011340}
11341
11342/* vec_all_lt */
11343
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011344static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011345vec_all_lt(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011346{
David Blaikie3302f2b2013-01-16 23:08:36 +000011347 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011348}
11349
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011350static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011351vec_all_lt(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011352{
David Blaikie3302f2b2013-01-16 23:08:36 +000011353 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011354}
11355
11356static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011357vec_all_lt(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011358{
David Blaikie3302f2b2013-01-16 23:08:36 +000011359 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011360}
11361
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011362static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011363vec_all_lt(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011364{
David Blaikie3302f2b2013-01-16 23:08:36 +000011365 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011366}
11367
11368static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011369vec_all_lt(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011370{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011371 return __builtin_altivec_vcmpgtub_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011372 (vector unsigned char)__b,
11373 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011374}
11375
11376static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011377vec_all_lt(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011378{
David Blaikie3302f2b2013-01-16 23:08:36 +000011379 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011380}
11381
11382static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011383vec_all_lt(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011384{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011385 return __builtin_altivec_vcmpgtub_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011386 (vector unsigned char)__b,
11387 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011388}
11389
11390static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011391vec_all_lt(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011392{
David Blaikie3302f2b2013-01-16 23:08:36 +000011393 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011394}
11395
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011396static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011397vec_all_lt(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011398{
David Blaikie3302f2b2013-01-16 23:08:36 +000011399 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011400}
11401
11402static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011403vec_all_lt(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011404{
David Blaikie3302f2b2013-01-16 23:08:36 +000011405 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011406}
11407
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011408static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011409vec_all_lt(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011410{
David Blaikie3302f2b2013-01-16 23:08:36 +000011411 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011412}
11413
11414static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011415vec_all_lt(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011416{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011417 return __builtin_altivec_vcmpgtuh_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011418 (vector unsigned short)__b,
11419 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011420}
11421
11422static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011423vec_all_lt(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011424{
David Blaikie3302f2b2013-01-16 23:08:36 +000011425 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011426}
11427
11428static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011429vec_all_lt(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011430{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011431 return __builtin_altivec_vcmpgtuh_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011432 (vector unsigned short)__b,
11433 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011434}
11435
11436static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011437vec_all_lt(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011438{
David Blaikie3302f2b2013-01-16 23:08:36 +000011439 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011440}
11441
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011442static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011443vec_all_lt(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011444{
David Blaikie3302f2b2013-01-16 23:08:36 +000011445 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011446}
11447
11448static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011449vec_all_lt(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011450{
David Blaikie3302f2b2013-01-16 23:08:36 +000011451 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011452}
11453
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011454static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011455vec_all_lt(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011456{
David Blaikie3302f2b2013-01-16 23:08:36 +000011457 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011458}
11459
11460static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011461vec_all_lt(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011462{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011463 return __builtin_altivec_vcmpgtuw_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011464 (vector unsigned int)__b,
11465 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011466}
11467
11468static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011469vec_all_lt(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011470{
David Blaikie3302f2b2013-01-16 23:08:36 +000011471 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011472}
11473
11474static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011475vec_all_lt(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011476{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011477 return __builtin_altivec_vcmpgtuw_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011478 (vector unsigned int)__b,
11479 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011480}
11481
11482static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011483vec_all_lt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011484{
David Blaikie3302f2b2013-01-16 23:08:36 +000011485 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011486}
11487
11488/* vec_all_nan */
11489
11490static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000011491vec_all_nan(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +000011492{
David Blaikie3302f2b2013-01-16 23:08:36 +000011493 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011494}
11495
11496/* vec_all_ne */
11497
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011498static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011499vec_all_ne(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011500{
David Blaikie3302f2b2013-01-16 23:08:36 +000011501 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011502}
11503
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011504static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011505vec_all_ne(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011506{
David Blaikie3302f2b2013-01-16 23:08:36 +000011507 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011508}
11509
11510static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011511vec_all_ne(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011512{
David Blaikie3302f2b2013-01-16 23:08:36 +000011513 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011514}
11515
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011516static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011517vec_all_ne(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011518{
David Blaikie3302f2b2013-01-16 23:08:36 +000011519 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011520}
11521
11522static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011523vec_all_ne(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011524{
David Blaikie3302f2b2013-01-16 23:08:36 +000011525 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011526}
11527
11528static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011529vec_all_ne(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011530{
David Blaikie3302f2b2013-01-16 23:08:36 +000011531 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011532}
11533
11534static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011535vec_all_ne(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011536{
David Blaikie3302f2b2013-01-16 23:08:36 +000011537 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011538}
11539
11540static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011541vec_all_ne(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011542{
David Blaikie3302f2b2013-01-16 23:08:36 +000011543 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011544}
11545
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011546static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011547vec_all_ne(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011548{
David Blaikie3302f2b2013-01-16 23:08:36 +000011549 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011550}
11551
11552static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011553vec_all_ne(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011554{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011555 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011556 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011557}
11558
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011559static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011560vec_all_ne(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011561{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011562 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011563 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011564}
11565
11566static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011567vec_all_ne(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011568{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011569 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011570 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011571}
11572
11573static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011574vec_all_ne(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011575{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011576 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011577 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011578}
11579
11580static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011581vec_all_ne(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011582{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011583 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011584 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011585}
11586
11587static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011588vec_all_ne(vector pixel __a, vector pixel __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011589{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011590 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011591 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011592}
11593
11594static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011595vec_all_ne(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011596{
David Blaikie3302f2b2013-01-16 23:08:36 +000011597 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011598}
11599
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011600static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011601vec_all_ne(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011602{
David Blaikie3302f2b2013-01-16 23:08:36 +000011603 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011604}
11605
11606static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011607vec_all_ne(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011608{
David Blaikie3302f2b2013-01-16 23:08:36 +000011609 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011610}
11611
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011612static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011613vec_all_ne(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011614{
David Blaikie3302f2b2013-01-16 23:08:36 +000011615 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011616}
11617
11618static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011619vec_all_ne(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011620{
David Blaikie3302f2b2013-01-16 23:08:36 +000011621 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011622}
11623
11624static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011625vec_all_ne(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011626{
David Blaikie3302f2b2013-01-16 23:08:36 +000011627 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011628}
11629
11630static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011631vec_all_ne(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011632{
David Blaikie3302f2b2013-01-16 23:08:36 +000011633 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011634}
11635
11636static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011637vec_all_ne(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011638{
David Blaikie3302f2b2013-01-16 23:08:36 +000011639 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011640}
11641
11642/* vec_all_nge */
11643
11644static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000011645vec_all_nge(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011646{
David Blaikie3302f2b2013-01-16 23:08:36 +000011647 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011648}
11649
11650/* vec_all_ngt */
11651
11652static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000011653vec_all_ngt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011654{
David Blaikie3302f2b2013-01-16 23:08:36 +000011655 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011656}
11657
11658/* vec_all_nle */
11659
11660static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000011661vec_all_nle(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011662{
David Blaikie3302f2b2013-01-16 23:08:36 +000011663 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011664}
11665
11666/* vec_all_nlt */
11667
11668static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000011669vec_all_nlt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011670{
David Blaikie3302f2b2013-01-16 23:08:36 +000011671 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011672}
11673
11674/* vec_all_numeric */
11675
11676static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000011677vec_all_numeric(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +000011678{
David Blaikie3302f2b2013-01-16 23:08:36 +000011679 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011680}
11681
11682/* vec_any_eq */
11683
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011684static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011685vec_any_eq(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011686{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011687 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011688 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011689}
11690
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011691static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011692vec_any_eq(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011693{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011694 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011695 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011696}
11697
11698static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011699vec_any_eq(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011700{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011701 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011702 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011703}
11704
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011705static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011706vec_any_eq(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011707{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011708 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011709 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011710}
11711
11712static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011713vec_any_eq(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011714{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011715 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011716 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011717}
11718
11719static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011720vec_any_eq(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011721{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011722 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011723 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011724}
11725
11726static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011727vec_any_eq(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011728{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011729 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011730 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011731}
11732
11733static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011734vec_any_eq(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011735{
David Blaikie3302f2b2013-01-16 23:08:36 +000011736 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011737}
11738
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011739static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011740vec_any_eq(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011741{
David Blaikie3302f2b2013-01-16 23:08:36 +000011742 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011743}
11744
11745static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011746vec_any_eq(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011747{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011748 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011749 (vector short)__a,
11750 (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011751}
11752
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011753static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011754vec_any_eq(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011755{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011756 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011757 (vector short)__a,
11758 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011759}
11760
11761static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011762vec_any_eq(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011763{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011764 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011765 (vector short)__a,
11766 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011767}
11768
11769static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011770vec_any_eq(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011771{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011772 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011773 (vector short)__a,
11774 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011775}
11776
11777static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011778vec_any_eq(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011779{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011780 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011781 (vector short)__a,
11782 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011783}
11784
11785static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011786vec_any_eq(vector pixel __a, vector pixel __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011787{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011788 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011789 (vector short)__a,
11790 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011791}
11792
11793static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011794vec_any_eq(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011795{
David Blaikie3302f2b2013-01-16 23:08:36 +000011796 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011797}
11798
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011799static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011800vec_any_eq(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011801{
David Blaikie3302f2b2013-01-16 23:08:36 +000011802 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011803}
11804
11805static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011806vec_any_eq(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011807{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011808 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011809 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011810}
11811
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011812static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011813vec_any_eq(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011814{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011815 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011816 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011817}
11818
11819static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011820vec_any_eq(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011821{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011822 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011823 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011824}
11825
11826static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011827vec_any_eq(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011828{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011829 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011830 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011831}
11832
11833static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011834vec_any_eq(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011835{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011836 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011837 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011838}
11839
11840static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011841vec_any_eq(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011842{
David Blaikie3302f2b2013-01-16 23:08:36 +000011843 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011844}
11845
11846/* vec_any_ge */
11847
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011848static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011849vec_any_ge(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011850{
David Blaikie3302f2b2013-01-16 23:08:36 +000011851 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011852}
11853
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011854static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011855vec_any_ge(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011856{
David Blaikie3302f2b2013-01-16 23:08:36 +000011857 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011858}
11859
11860static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011861vec_any_ge(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011862{
David Blaikie3302f2b2013-01-16 23:08:36 +000011863 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011864}
11865
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011866static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011867vec_any_ge(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011868{
David Blaikie3302f2b2013-01-16 23:08:36 +000011869 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011870}
11871
11872static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011873vec_any_ge(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011874{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011875 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011876 (vector unsigned char)__b,
11877 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011878}
11879
11880static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011881vec_any_ge(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011882{
David Blaikie3302f2b2013-01-16 23:08:36 +000011883 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011884}
11885
11886static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011887vec_any_ge(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011888{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011889 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011890 (vector unsigned char)__b,
11891 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011892}
11893
11894static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011895vec_any_ge(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011896{
David Blaikie3302f2b2013-01-16 23:08:36 +000011897 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011898}
11899
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011900static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011901vec_any_ge(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011902{
David Blaikie3302f2b2013-01-16 23:08:36 +000011903 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011904}
11905
11906static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011907vec_any_ge(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011908{
David Blaikie3302f2b2013-01-16 23:08:36 +000011909 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011910}
11911
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011912static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011913vec_any_ge(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011914{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011915 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011916 __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011917}
11918
11919static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011920vec_any_ge(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011921{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011922 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011923 (vector unsigned short)__b,
11924 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011925}
11926
11927static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011928vec_any_ge(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011929{
11930 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011931 __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011932}
11933
11934static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011935vec_any_ge(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011936{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011937 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011938 (vector unsigned short)__b,
11939 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011940}
11941
11942static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011943vec_any_ge(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011944{
David Blaikie3302f2b2013-01-16 23:08:36 +000011945 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011946}
11947
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011948static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011949vec_any_ge(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011950{
David Blaikie3302f2b2013-01-16 23:08:36 +000011951 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011952}
11953
11954static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011955vec_any_ge(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011956{
David Blaikie3302f2b2013-01-16 23:08:36 +000011957 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011958}
11959
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011960static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011961vec_any_ge(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011962{
David Blaikie3302f2b2013-01-16 23:08:36 +000011963 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011964}
11965
11966static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011967vec_any_ge(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011968{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011969 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011970 (vector unsigned int)__b,
11971 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011972}
11973
11974static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011975vec_any_ge(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011976{
David Blaikie3302f2b2013-01-16 23:08:36 +000011977 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011978}
11979
11980static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011981vec_any_ge(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011982{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011983 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011984 (vector unsigned int)__b,
11985 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011986}
11987
11988static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011989vec_any_ge(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011990{
David Blaikie3302f2b2013-01-16 23:08:36 +000011991 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011992}
11993
11994/* vec_any_gt */
11995
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011996static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011997vec_any_gt(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011998{
David Blaikie3302f2b2013-01-16 23:08:36 +000011999 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012000}
12001
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012002static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012003vec_any_gt(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012004{
David Blaikie3302f2b2013-01-16 23:08:36 +000012005 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012006}
12007
12008static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012009vec_any_gt(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012010{
David Blaikie3302f2b2013-01-16 23:08:36 +000012011 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012012}
12013
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012014static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012015vec_any_gt(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012016{
12017 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012018 __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012019}
12020
12021static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012022vec_any_gt(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012023{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012024 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012025 (vector unsigned char)__a,
12026 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012027}
12028
12029static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012030vec_any_gt(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012031{
12032 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012033 __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012034}
12035
12036static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012037vec_any_gt(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012038{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012039 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012040 (vector unsigned char)__a,
12041 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012042}
12043
12044static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012045vec_any_gt(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012046{
David Blaikie3302f2b2013-01-16 23:08:36 +000012047 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012048}
12049
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012050static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012051vec_any_gt(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012052{
David Blaikie3302f2b2013-01-16 23:08:36 +000012053 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012054}
12055
12056static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012057vec_any_gt(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012058{
David Blaikie3302f2b2013-01-16 23:08:36 +000012059 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012060}
12061
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012062static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012063vec_any_gt(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012064{
12065 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012066 __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012067}
12068
12069static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012070vec_any_gt(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012071{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012072 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012073 (vector unsigned short)__a,
12074 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012075}
12076
12077static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012078vec_any_gt(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012079{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012080 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012081 __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012082}
12083
12084static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012085vec_any_gt(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012086{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012087 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012088 (vector unsigned short)__a,
12089 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012090}
12091
12092static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012093vec_any_gt(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012094{
David Blaikie3302f2b2013-01-16 23:08:36 +000012095 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012096}
12097
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012098static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012099vec_any_gt(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012100{
David Blaikie3302f2b2013-01-16 23:08:36 +000012101 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012102}
12103
12104static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012105vec_any_gt(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012106{
David Blaikie3302f2b2013-01-16 23:08:36 +000012107 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012108}
12109
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012110static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012111vec_any_gt(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012112{
David Blaikie3302f2b2013-01-16 23:08:36 +000012113 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012114}
12115
12116static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012117vec_any_gt(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012118{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012119 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012120 (vector unsigned int)__a,
12121 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012122}
12123
12124static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012125vec_any_gt(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012126{
David Blaikie3302f2b2013-01-16 23:08:36 +000012127 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012128}
12129
12130static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012131vec_any_gt(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012132{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012133 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012134 (vector unsigned int)__a,
12135 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012136}
12137
12138static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012139vec_any_gt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012140{
David Blaikie3302f2b2013-01-16 23:08:36 +000012141 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012142}
12143
12144/* vec_any_le */
12145
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012146static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012147vec_any_le(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012148{
David Blaikie3302f2b2013-01-16 23:08:36 +000012149 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012150}
12151
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012152static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012153vec_any_le(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012154{
David Blaikie3302f2b2013-01-16 23:08:36 +000012155 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012156}
12157
12158static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012159vec_any_le(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012160{
David Blaikie3302f2b2013-01-16 23:08:36 +000012161 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012162}
12163
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012164static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012165vec_any_le(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012166{
12167 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012168 __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012169}
12170
12171static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012172vec_any_le(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012173{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012174 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012175 (vector unsigned char)__a,
12176 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012177}
12178
12179static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012180vec_any_le(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012181{
12182 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012183 __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012184}
12185
12186static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012187vec_any_le(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012188{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012189 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012190 (vector unsigned char)__a,
12191 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012192}
12193
12194static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012195vec_any_le(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012196{
David Blaikie3302f2b2013-01-16 23:08:36 +000012197 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012198}
12199
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012200static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012201vec_any_le(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012202{
David Blaikie3302f2b2013-01-16 23:08:36 +000012203 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012204}
12205
12206static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012207vec_any_le(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012208{
David Blaikie3302f2b2013-01-16 23:08:36 +000012209 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012210}
12211
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012212static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012213vec_any_le(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012214{
12215 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012216 __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012217}
12218
12219static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012220vec_any_le(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012221{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012222 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012223 (vector unsigned short)__a,
12224 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012225}
12226
12227static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012228vec_any_le(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012229{
12230 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012231 __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012232}
12233
12234static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012235vec_any_le(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012236{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012237 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012238 (vector unsigned short)__a,
12239 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012240}
12241
12242static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012243vec_any_le(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012244{
David Blaikie3302f2b2013-01-16 23:08:36 +000012245 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012246}
12247
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012248static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012249vec_any_le(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012250{
David Blaikie3302f2b2013-01-16 23:08:36 +000012251 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012252}
12253
12254static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012255vec_any_le(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012256{
David Blaikie3302f2b2013-01-16 23:08:36 +000012257 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012258}
12259
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012260static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012261vec_any_le(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012262{
David Blaikie3302f2b2013-01-16 23:08:36 +000012263 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012264}
12265
12266static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012267vec_any_le(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012268{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012269 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012270 (vector unsigned int)__a,
12271 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012272}
12273
12274static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012275vec_any_le(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_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012278}
12279
12280static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012281vec_any_le(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012282{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012283 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012284 (vector unsigned int)__a,
12285 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012286}
12287
12288static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012289vec_any_le(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012290{
David Blaikie3302f2b2013-01-16 23:08:36 +000012291 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012292}
12293
12294/* vec_any_lt */
12295
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012296static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012297vec_any_lt(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012298{
David Blaikie3302f2b2013-01-16 23:08:36 +000012299 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012300}
12301
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012302static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012303vec_any_lt(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012304{
David Blaikie3302f2b2013-01-16 23:08:36 +000012305 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012306}
12307
12308static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012309vec_any_lt(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012310{
David Blaikie3302f2b2013-01-16 23:08:36 +000012311 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012312}
12313
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012314static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012315vec_any_lt(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012316{
12317 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012318 __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012319}
12320
12321static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012322vec_any_lt(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012323{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012324 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012325 (vector unsigned char)__b,
12326 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012327}
12328
12329static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012330vec_any_lt(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012331{
12332 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012333 __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012334}
12335
12336static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012337vec_any_lt(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012338{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012339 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012340 (vector unsigned char)__b,
12341 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012342}
12343
12344static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012345vec_any_lt(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012346{
David Blaikie3302f2b2013-01-16 23:08:36 +000012347 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012348}
12349
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012350static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012351vec_any_lt(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012352{
David Blaikie3302f2b2013-01-16 23:08:36 +000012353 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012354}
12355
12356static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012357vec_any_lt(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012358{
David Blaikie3302f2b2013-01-16 23:08:36 +000012359 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012360}
12361
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012362static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012363vec_any_lt(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012364{
12365 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012366 __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012367}
12368
12369static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012370vec_any_lt(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012371{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012372 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012373 (vector unsigned short)__b,
12374 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012375}
12376
12377static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012378vec_any_lt(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012379{
12380 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012381 __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012382}
12383
12384static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012385vec_any_lt(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012386{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012387 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012388 (vector unsigned short)__b,
12389 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012390}
12391
12392static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012393vec_any_lt(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012394{
David Blaikie3302f2b2013-01-16 23:08:36 +000012395 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012396}
12397
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012398static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012399vec_any_lt(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012400{
David Blaikie3302f2b2013-01-16 23:08:36 +000012401 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012402}
12403
12404static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012405vec_any_lt(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012406{
David Blaikie3302f2b2013-01-16 23:08:36 +000012407 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012408}
12409
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012410static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012411vec_any_lt(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012412{
David Blaikie3302f2b2013-01-16 23:08:36 +000012413 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012414}
12415
12416static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012417vec_any_lt(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012418{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012419 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012420 (vector unsigned int)__b,
12421 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012422}
12423
12424static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012425vec_any_lt(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012426{
David Blaikie3302f2b2013-01-16 23:08:36 +000012427 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012428}
12429
12430static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012431vec_any_lt(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012432{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012433 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012434 (vector unsigned int)__b,
12435 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012436}
12437
12438static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012439vec_any_lt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012440{
David Blaikie3302f2b2013-01-16 23:08:36 +000012441 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012442}
12443
12444/* vec_any_nan */
12445
12446static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012447vec_any_nan(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +000012448{
David Blaikie3302f2b2013-01-16 23:08:36 +000012449 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012450}
12451
12452/* vec_any_ne */
12453
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012454static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012455vec_any_ne(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012456{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012457 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012458 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012459}
12460
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012461static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012462vec_any_ne(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012463{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012464 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012465 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012466}
12467
12468static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012469vec_any_ne(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012470{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012471 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012472 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012473}
12474
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012475static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012476vec_any_ne(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012477{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012478 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012479 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012480}
12481
12482static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012483vec_any_ne(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012484{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012485 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012486 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012487}
12488
12489static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012490vec_any_ne(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012491{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012492 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012493 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012494}
12495
12496static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012497vec_any_ne(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012498{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012499 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012500 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012501}
12502
12503static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012504vec_any_ne(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012505{
David Blaikie3302f2b2013-01-16 23:08:36 +000012506 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012507}
12508
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012509static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012510vec_any_ne(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012511{
David Blaikie3302f2b2013-01-16 23:08:36 +000012512 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012513}
12514
12515static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012516vec_any_ne(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012517{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012518 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012519 (vector short)__a,
12520 (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012521}
12522
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012523static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012524vec_any_ne(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012525{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012526 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012527 (vector short)__a,
12528 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012529}
12530
12531static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012532vec_any_ne(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012533{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012534 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012535 (vector short)__a,
12536 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012537}
12538
12539static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012540vec_any_ne(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012541{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012542 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012543 (vector short)__a,
12544 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012545}
12546
12547static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012548vec_any_ne(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012549{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012550 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012551 (vector short)__a,
12552 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012553}
12554
12555static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012556vec_any_ne(vector pixel __a, vector pixel __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012557{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012558 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012559 (vector short)__a,
12560 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012561}
12562
12563static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012564vec_any_ne(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012565{
David Blaikie3302f2b2013-01-16 23:08:36 +000012566 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012567}
12568
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012569static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012570vec_any_ne(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012571{
David Blaikie3302f2b2013-01-16 23:08:36 +000012572 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012573}
12574
12575static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012576vec_any_ne(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012577{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012578 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012579 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012580}
12581
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012582static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012583vec_any_ne(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012584{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012585 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012586 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012587}
12588
12589static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012590vec_any_ne(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012591{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012592 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012593 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012594}
12595
12596static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012597vec_any_ne(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012598{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012599 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012600 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012601}
12602
12603static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012604vec_any_ne(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012605{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012606 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012607 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012608}
12609
12610static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012611vec_any_ne(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012612{
David Blaikie3302f2b2013-01-16 23:08:36 +000012613 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012614}
12615
12616/* vec_any_nge */
12617
12618static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012619vec_any_nge(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012620{
David Blaikie3302f2b2013-01-16 23:08:36 +000012621 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012622}
12623
12624/* vec_any_ngt */
12625
12626static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012627vec_any_ngt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012628{
David Blaikie3302f2b2013-01-16 23:08:36 +000012629 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012630}
12631
12632/* vec_any_nle */
12633
12634static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012635vec_any_nle(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012636{
David Blaikie3302f2b2013-01-16 23:08:36 +000012637 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012638}
12639
12640/* vec_any_nlt */
12641
12642static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012643vec_any_nlt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012644{
David Blaikie3302f2b2013-01-16 23:08:36 +000012645 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012646}
12647
12648/* vec_any_numeric */
12649
12650static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012651vec_any_numeric(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +000012652{
David Blaikie3302f2b2013-01-16 23:08:36 +000012653 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012654}
12655
12656/* vec_any_out */
12657
12658static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012659vec_any_out(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012660{
David Blaikie3302f2b2013-01-16 23:08:36 +000012661 return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012662}
12663
Nemanja Ivanovic55e757d2015-03-04 21:48:22 +000012664/* Power 8 Crypto functions
12665Note: We diverge from the current GCC implementation with regard
12666to cryptography and related functions as follows:
12667- Only the SHA and AES instructions and builtins are disabled by -mno-crypto
12668- The remaining ones are only available on Power8 and up so
12669 require -mpower8-vector
12670The justification for this is that export requirements require that
12671Category:Vector.Crypto is optional (i.e. compliant hardware may not provide
12672support). As a result, we need to be able to turn off support for those.
12673The remaining ones (currently controlled by -mcrypto for GCC) still
12674need to be provided on compliant hardware even if Vector.Crypto is not
12675provided.
12676FIXME: the naming convention for the builtins will be adjusted due
12677to the inconsistency (__builtin_crypto_ prefix on builtins that cannot be
12678removed with -mno-crypto). This is under development.
12679*/
12680#ifdef __CRYPTO__
12681static vector unsigned long long __attribute__((__always_inline__))
12682__builtin_crypto_vsbox (vector unsigned long long __a)
12683{
12684 return __builtin_altivec_crypto_vsbox(__a);
12685}
12686
12687static vector unsigned long long __attribute__((__always_inline__))
12688__builtin_crypto_vcipher (vector unsigned long long __a,
12689 vector unsigned long long __b)
12690{
12691 return __builtin_altivec_crypto_vcipher(__a, __b);
12692}
12693
12694static vector unsigned long long __attribute__((__always_inline__))
12695__builtin_crypto_vcipherlast (vector unsigned long long __a,
12696 vector unsigned long long __b)
12697{
12698 return __builtin_altivec_crypto_vcipherlast(__a, __b);
12699}
12700
12701static vector unsigned long long __attribute__((__always_inline__))
12702__builtin_crypto_vncipher (vector unsigned long long __a,
12703 vector unsigned long long __b)
12704{
12705 return __builtin_altivec_crypto_vncipher(__a, __b);
12706}
12707
12708static vector unsigned long long __attribute__((__always_inline__))
12709__builtin_crypto_vncipherlast (vector unsigned long long __a,
12710 vector unsigned long long __b)
12711{
12712 return __builtin_altivec_crypto_vncipherlast(__a, __b);
12713}
12714
12715
12716#define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad
12717#define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw
12718#endif
12719
12720#ifdef __POWER8_VECTOR__
12721static vector unsigned char __ATTRS_o_ai
12722__builtin_crypto_vpermxor (vector unsigned char __a,
12723 vector unsigned char __b,
12724 vector unsigned char __c)
12725{
12726 return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
12727}
12728
12729static vector unsigned short __ATTRS_o_ai
12730__builtin_crypto_vpermxor (vector unsigned short __a,
12731 vector unsigned short __b,
12732 vector unsigned short __c)
12733{
12734 return (vector unsigned short)
12735 __builtin_altivec_crypto_vpermxor((vector unsigned char) __a,
12736 (vector unsigned char) __b,
12737 (vector unsigned char) __c);
12738}
12739
12740static vector unsigned int __ATTRS_o_ai
12741__builtin_crypto_vpermxor (vector unsigned int __a,
12742 vector unsigned int __b,
12743 vector unsigned int __c)
12744{
12745 return (vector unsigned int)
12746 __builtin_altivec_crypto_vpermxor((vector unsigned char) __a,
12747 (vector unsigned char) __b,
12748 (vector unsigned char) __c);
12749}
12750
12751static vector unsigned long long __ATTRS_o_ai
12752__builtin_crypto_vpermxor (vector unsigned long long __a,
12753 vector unsigned long long __b,
12754 vector unsigned long long __c)
12755{
12756 return (vector unsigned long long)
12757 __builtin_altivec_crypto_vpermxor((vector unsigned char) __a,
12758 (vector unsigned char) __b,
12759 (vector unsigned char) __c);
12760}
12761
12762static vector unsigned char __ATTRS_o_ai
12763__builtin_crypto_vpmsumb (vector unsigned char __a,
12764 vector unsigned char __b)
12765{
12766 return __builtin_altivec_crypto_vpmsumb(__a, __b);
12767}
12768
12769static vector unsigned short __ATTRS_o_ai
12770__builtin_crypto_vpmsumb (vector unsigned short __a,
12771 vector unsigned short __b)
12772{
12773 return __builtin_altivec_crypto_vpmsumh(__a, __b);
12774}
12775
12776static vector unsigned int __ATTRS_o_ai
12777__builtin_crypto_vpmsumb (vector unsigned int __a,
12778 vector unsigned int __b)
12779{
12780 return __builtin_altivec_crypto_vpmsumw(__a, __b);
12781}
12782
12783static vector unsigned long long __ATTRS_o_ai
12784__builtin_crypto_vpmsumb (vector unsigned long long __a,
12785 vector unsigned long long __b)
12786{
12787 return __builtin_altivec_crypto_vpmsumd(__a, __b);
12788}
12789#endif
12790
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012791#undef __ATTRS_o_ai
Chris Lattnerdad40622010-04-14 03:54:58 +000012792
12793#endif /* __ALTIVEC_H */