blob: 7dfb74e0698c847fb78252ab118c562a23116338 [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
1626/* vec_dss */
1627
1628static void __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001629vec_dss(int __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001630{
David Blaikie3302f2b2013-01-16 23:08:36 +00001631 __builtin_altivec_dss(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001632}
1633
1634/* vec_dssall */
1635
1636static void __attribute__((__always_inline__))
1637vec_dssall(void)
1638{
1639 __builtin_altivec_dssall();
1640}
1641
1642/* vec_dst */
1643
1644static void __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001645vec_dst(const void *__a, int __b, int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001646{
David Blaikie3302f2b2013-01-16 23:08:36 +00001647 __builtin_altivec_dst(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001648}
1649
1650/* vec_dstst */
1651
1652static void __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001653vec_dstst(const void *__a, int __b, int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001654{
David Blaikie3302f2b2013-01-16 23:08:36 +00001655 __builtin_altivec_dstst(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001656}
1657
1658/* vec_dststt */
1659
1660static void __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001661vec_dststt(const void *__a, int __b, int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001662{
David Blaikie3302f2b2013-01-16 23:08:36 +00001663 __builtin_altivec_dststt(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001664}
1665
1666/* vec_dstt */
1667
1668static void __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001669vec_dstt(const void *__a, int __b, int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001670{
David Blaikie3302f2b2013-01-16 23:08:36 +00001671 __builtin_altivec_dstt(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001672}
1673
1674/* vec_expte */
1675
1676static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001677vec_expte(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001678{
David Blaikie3302f2b2013-01-16 23:08:36 +00001679 return __builtin_altivec_vexptefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001680}
1681
1682/* vec_vexptefp */
1683
1684static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001685vec_vexptefp(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001686{
David Blaikie3302f2b2013-01-16 23:08:36 +00001687 return __builtin_altivec_vexptefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001688}
1689
1690/* vec_floor */
1691
1692static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001693vec_floor(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001694{
David Blaikie3302f2b2013-01-16 23:08:36 +00001695 return __builtin_altivec_vrfim(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001696}
1697
1698/* vec_vrfim */
1699
1700static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001701vec_vrfim(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001702{
David Blaikie3302f2b2013-01-16 23:08:36 +00001703 return __builtin_altivec_vrfim(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001704}
1705
1706/* vec_ld */
1707
1708static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001709vec_ld(int __a, const vector signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001710{
David Blaikie3302f2b2013-01-16 23:08:36 +00001711 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001712}
1713
1714static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001715vec_ld(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001716{
David Blaikie3302f2b2013-01-16 23:08:36 +00001717 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001718}
1719
1720static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001721vec_ld(int __a, const vector unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001722{
David Blaikie3302f2b2013-01-16 23:08:36 +00001723 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001724}
1725
1726static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001727vec_ld(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001728{
David Blaikie3302f2b2013-01-16 23:08:36 +00001729 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001730}
1731
Anton Yartsevfc83c602010-08-19 03:21:36 +00001732static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001733vec_ld(int __a, const vector bool char *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001734{
David Blaikie3302f2b2013-01-16 23:08:36 +00001735 return (vector bool char)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001736}
1737
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001738static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001739vec_ld(int __a, const vector short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001740{
David Blaikie3302f2b2013-01-16 23:08:36 +00001741 return (vector short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001742}
1743
1744static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001745vec_ld(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001746{
David Blaikie3302f2b2013-01-16 23:08:36 +00001747 return (vector short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001748}
1749
1750static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001751vec_ld(int __a, const vector unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001752{
David Blaikie3302f2b2013-01-16 23:08:36 +00001753 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001754}
1755
1756static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001757vec_ld(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001758{
David Blaikie3302f2b2013-01-16 23:08:36 +00001759 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001760}
1761
Anton Yartsevfc83c602010-08-19 03:21:36 +00001762static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001763vec_ld(int __a, const vector bool short *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001764{
David Blaikie3302f2b2013-01-16 23:08:36 +00001765 return (vector bool short)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001766}
1767
1768static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001769vec_ld(int __a, const vector pixel *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001770{
David Blaikie3302f2b2013-01-16 23:08:36 +00001771 return (vector pixel)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001772}
1773
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001774static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001775vec_ld(int __a, const vector int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001776{
David Blaikie3302f2b2013-01-16 23:08:36 +00001777 return (vector int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001778}
1779
1780static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001781vec_ld(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001782{
David Blaikie3302f2b2013-01-16 23:08:36 +00001783 return (vector int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001784}
1785
1786static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001787vec_ld(int __a, const vector unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001788{
David Blaikie3302f2b2013-01-16 23:08:36 +00001789 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001790}
1791
1792static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001793vec_ld(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001794{
David Blaikie3302f2b2013-01-16 23:08:36 +00001795 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001796}
1797
Anton Yartsevfc83c602010-08-19 03:21:36 +00001798static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001799vec_ld(int __a, const vector bool int *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001800{
David Blaikie3302f2b2013-01-16 23:08:36 +00001801 return (vector bool int)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001802}
1803
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001804static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001805vec_ld(int __a, const vector float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001806{
David Blaikie3302f2b2013-01-16 23:08:36 +00001807 return (vector float)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001808}
1809
1810static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001811vec_ld(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001812{
David Blaikie3302f2b2013-01-16 23:08:36 +00001813 return (vector float)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001814}
1815
1816/* vec_lvx */
1817
1818static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001819vec_lvx(int __a, const vector signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001820{
David Blaikie3302f2b2013-01-16 23:08:36 +00001821 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001822}
1823
1824static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001825vec_lvx(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001826{
David Blaikie3302f2b2013-01-16 23:08:36 +00001827 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001828}
1829
1830static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001831vec_lvx(int __a, const vector unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001832{
David Blaikie3302f2b2013-01-16 23:08:36 +00001833 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001834}
1835
1836static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001837vec_lvx(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001838{
David Blaikie3302f2b2013-01-16 23:08:36 +00001839 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001840}
1841
Anton Yartsevfc83c602010-08-19 03:21:36 +00001842static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001843vec_lvx(int __a, const vector bool char *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001844{
David Blaikie3302f2b2013-01-16 23:08:36 +00001845 return (vector bool char)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001846}
1847
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001848static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001849vec_lvx(int __a, const vector short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001850{
David Blaikie3302f2b2013-01-16 23:08:36 +00001851 return (vector short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001852}
1853
1854static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001855vec_lvx(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001856{
David Blaikie3302f2b2013-01-16 23:08:36 +00001857 return (vector short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001858}
1859
1860static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001861vec_lvx(int __a, const vector unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001862{
David Blaikie3302f2b2013-01-16 23:08:36 +00001863 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001864}
1865
1866static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001867vec_lvx(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001868{
David Blaikie3302f2b2013-01-16 23:08:36 +00001869 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001870}
1871
Anton Yartsevfc83c602010-08-19 03:21:36 +00001872static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001873vec_lvx(int __a, const vector bool short *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001874{
David Blaikie3302f2b2013-01-16 23:08:36 +00001875 return (vector bool short)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001876}
1877
1878static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001879vec_lvx(int __a, const vector pixel *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001880{
David Blaikie3302f2b2013-01-16 23:08:36 +00001881 return (vector pixel)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001882}
1883
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001884static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001885vec_lvx(int __a, const vector int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001886{
David Blaikie3302f2b2013-01-16 23:08:36 +00001887 return (vector int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001888}
1889
1890static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001891vec_lvx(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001892{
David Blaikie3302f2b2013-01-16 23:08:36 +00001893 return (vector int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001894}
1895
1896static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001897vec_lvx(int __a, const vector unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001898{
David Blaikie3302f2b2013-01-16 23:08:36 +00001899 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001900}
1901
1902static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001903vec_lvx(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001904{
David Blaikie3302f2b2013-01-16 23:08:36 +00001905 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001906}
1907
Anton Yartsevfc83c602010-08-19 03:21:36 +00001908static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001909vec_lvx(int __a, const vector bool int *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001910{
David Blaikie3302f2b2013-01-16 23:08:36 +00001911 return (vector bool int)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001912}
1913
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001914static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001915vec_lvx(int __a, const vector float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001916{
David Blaikie3302f2b2013-01-16 23:08:36 +00001917 return (vector float)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001918}
1919
1920static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001921vec_lvx(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001922{
David Blaikie3302f2b2013-01-16 23:08:36 +00001923 return (vector float)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001924}
1925
1926/* vec_lde */
1927
1928static vector signed char __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001929vec_lde(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001930{
David Blaikie3302f2b2013-01-16 23:08:36 +00001931 return (vector signed char)__builtin_altivec_lvebx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001932}
1933
1934static vector unsigned char __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001935vec_lde(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001936{
David Blaikie3302f2b2013-01-16 23:08:36 +00001937 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001938}
1939
1940static vector short __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001941vec_lde(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001942{
David Blaikie3302f2b2013-01-16 23:08:36 +00001943 return (vector short)__builtin_altivec_lvehx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001944}
1945
1946static vector unsigned short __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001947vec_lde(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001948{
David Blaikie3302f2b2013-01-16 23:08:36 +00001949 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001950}
1951
1952static vector int __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001953vec_lde(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001954{
David Blaikie3302f2b2013-01-16 23:08:36 +00001955 return (vector int)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001956}
1957
1958static vector unsigned int __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001959vec_lde(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001960{
David Blaikie3302f2b2013-01-16 23:08:36 +00001961 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001962}
1963
1964static vector float __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001965vec_lde(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001966{
David Blaikie3302f2b2013-01-16 23:08:36 +00001967 return (vector float)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001968}
1969
1970/* vec_lvebx */
1971
1972static vector signed char __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001973vec_lvebx(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001974{
David Blaikie3302f2b2013-01-16 23:08:36 +00001975 return (vector signed char)__builtin_altivec_lvebx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001976}
1977
1978static vector unsigned char __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001979vec_lvebx(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001980{
David Blaikie3302f2b2013-01-16 23:08:36 +00001981 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001982}
1983
1984/* vec_lvehx */
1985
1986static vector short __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001987vec_lvehx(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001988{
David Blaikie3302f2b2013-01-16 23:08:36 +00001989 return (vector short)__builtin_altivec_lvehx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001990}
1991
1992static vector unsigned short __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001993vec_lvehx(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001994{
David Blaikie3302f2b2013-01-16 23:08:36 +00001995 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001996}
1997
1998/* vec_lvewx */
1999
2000static vector int __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002001vec_lvewx(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002002{
David Blaikie3302f2b2013-01-16 23:08:36 +00002003 return (vector int)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002004}
2005
2006static vector unsigned int __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002007vec_lvewx(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002008{
David Blaikie3302f2b2013-01-16 23:08:36 +00002009 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002010}
2011
2012static vector float __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002013vec_lvewx(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002014{
David Blaikie3302f2b2013-01-16 23:08:36 +00002015 return (vector float)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002016}
2017
2018/* vec_ldl */
2019
2020static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002021vec_ldl(int __a, const vector signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002022{
David Blaikie3302f2b2013-01-16 23:08:36 +00002023 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002024}
2025
2026static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002027vec_ldl(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002028{
David Blaikie3302f2b2013-01-16 23:08:36 +00002029 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002030}
2031
2032static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002033vec_ldl(int __a, const vector unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002034{
David Blaikie3302f2b2013-01-16 23:08:36 +00002035 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002036}
2037
2038static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002039vec_ldl(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002040{
David Blaikie3302f2b2013-01-16 23:08:36 +00002041 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002042}
2043
Anton Yartsevfc83c602010-08-19 03:21:36 +00002044static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002045vec_ldl(int __a, const vector bool char *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002046{
David Blaikie3302f2b2013-01-16 23:08:36 +00002047 return (vector bool char)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002048}
2049
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002050static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002051vec_ldl(int __a, const vector short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002052{
David Blaikie3302f2b2013-01-16 23:08:36 +00002053 return (vector short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002054}
2055
2056static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002057vec_ldl(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002058{
David Blaikie3302f2b2013-01-16 23:08:36 +00002059 return (vector short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002060}
2061
2062static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002063vec_ldl(int __a, const vector unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002064{
David Blaikie3302f2b2013-01-16 23:08:36 +00002065 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002066}
2067
2068static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002069vec_ldl(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002070{
David Blaikie3302f2b2013-01-16 23:08:36 +00002071 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002072}
2073
Anton Yartsevfc83c602010-08-19 03:21:36 +00002074static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002075vec_ldl(int __a, const vector bool short *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002076{
David Blaikie3302f2b2013-01-16 23:08:36 +00002077 return (vector bool short)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002078}
2079
2080static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002081vec_ldl(int __a, const vector pixel *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002082{
David Blaikie3302f2b2013-01-16 23:08:36 +00002083 return (vector pixel short)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002084}
2085
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002086static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002087vec_ldl(int __a, const vector int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002088{
David Blaikie3302f2b2013-01-16 23:08:36 +00002089 return (vector int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002090}
2091
2092static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002093vec_ldl(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002094{
David Blaikie3302f2b2013-01-16 23:08:36 +00002095 return (vector int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002096}
2097
2098static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002099vec_ldl(int __a, const vector unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002100{
David Blaikie3302f2b2013-01-16 23:08:36 +00002101 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002102}
2103
2104static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002105vec_ldl(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002106{
David Blaikie3302f2b2013-01-16 23:08:36 +00002107 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002108}
2109
Anton Yartsevfc83c602010-08-19 03:21:36 +00002110static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002111vec_ldl(int __a, const vector bool int *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002112{
David Blaikie3302f2b2013-01-16 23:08:36 +00002113 return (vector bool int)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002114}
2115
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002116static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002117vec_ldl(int __a, const vector float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002118{
David Blaikie3302f2b2013-01-16 23:08:36 +00002119 return (vector float)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002120}
2121
2122static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002123vec_ldl(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002124{
David Blaikie3302f2b2013-01-16 23:08:36 +00002125 return (vector float)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002126}
2127
2128/* vec_lvxl */
2129
2130static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002131vec_lvxl(int __a, const vector signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002132{
David Blaikie3302f2b2013-01-16 23:08:36 +00002133 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002134}
2135
2136static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002137vec_lvxl(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002138{
David Blaikie3302f2b2013-01-16 23:08:36 +00002139 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002140}
2141
2142static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002143vec_lvxl(int __a, const vector unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002144{
David Blaikie3302f2b2013-01-16 23:08:36 +00002145 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002146}
2147
2148static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002149vec_lvxl(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002150{
David Blaikie3302f2b2013-01-16 23:08:36 +00002151 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002152}
2153
Anton Yartsevfc83c602010-08-19 03:21:36 +00002154static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002155vec_lvxl(int __a, const vector bool char *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002156{
David Blaikie3302f2b2013-01-16 23:08:36 +00002157 return (vector bool char)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002158}
2159
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002160static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002161vec_lvxl(int __a, const vector short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002162{
David Blaikie3302f2b2013-01-16 23:08:36 +00002163 return (vector short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002164}
2165
2166static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002167vec_lvxl(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002168{
David Blaikie3302f2b2013-01-16 23:08:36 +00002169 return (vector short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002170}
2171
2172static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002173vec_lvxl(int __a, const vector unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002174{
David Blaikie3302f2b2013-01-16 23:08:36 +00002175 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002176}
2177
2178static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002179vec_lvxl(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002180{
David Blaikie3302f2b2013-01-16 23:08:36 +00002181 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002182}
2183
Anton Yartsevfc83c602010-08-19 03:21:36 +00002184static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002185vec_lvxl(int __a, const vector bool short *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002186{
David Blaikie3302f2b2013-01-16 23:08:36 +00002187 return (vector bool short)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002188}
2189
2190static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002191vec_lvxl(int __a, const vector pixel *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002192{
David Blaikie3302f2b2013-01-16 23:08:36 +00002193 return (vector pixel)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002194}
2195
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002196static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002197vec_lvxl(int __a, const vector int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002198{
David Blaikie3302f2b2013-01-16 23:08:36 +00002199 return (vector int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002200}
2201
2202static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002203vec_lvxl(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002204{
David Blaikie3302f2b2013-01-16 23:08:36 +00002205 return (vector int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002206}
2207
2208static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002209vec_lvxl(int __a, const vector unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002210{
David Blaikie3302f2b2013-01-16 23:08:36 +00002211 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002212}
2213
2214static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002215vec_lvxl(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002216{
David Blaikie3302f2b2013-01-16 23:08:36 +00002217 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002218}
2219
Anton Yartsevfc83c602010-08-19 03:21:36 +00002220static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002221vec_lvxl(int __a, const vector bool int *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002222{
David Blaikie3302f2b2013-01-16 23:08:36 +00002223 return (vector bool int)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002224}
2225
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002226static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002227vec_lvxl(int __a, const vector float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002228{
David Blaikie3302f2b2013-01-16 23:08:36 +00002229 return (vector float)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002230}
2231
2232static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002233vec_lvxl(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002234{
David Blaikie3302f2b2013-01-16 23:08:36 +00002235 return (vector float)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002236}
2237
2238/* vec_loge */
2239
2240static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002241vec_loge(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002242{
David Blaikie3302f2b2013-01-16 23:08:36 +00002243 return __builtin_altivec_vlogefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002244}
2245
2246/* vec_vlogefp */
2247
2248static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002249vec_vlogefp(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002250{
David Blaikie3302f2b2013-01-16 23:08:36 +00002251 return __builtin_altivec_vlogefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002252}
2253
2254/* vec_lvsl */
2255
2256static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002257vec_lvsl(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002258{
David Blaikie3302f2b2013-01-16 23:08:36 +00002259 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002260}
2261
2262static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002263vec_lvsl(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002264{
David Blaikie3302f2b2013-01-16 23:08:36 +00002265 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002266}
2267
2268static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002269vec_lvsl(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002270{
David Blaikie3302f2b2013-01-16 23:08:36 +00002271 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002272}
2273
2274static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002275vec_lvsl(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002276{
David Blaikie3302f2b2013-01-16 23:08:36 +00002277 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002278}
2279
2280static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002281vec_lvsl(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002282{
David Blaikie3302f2b2013-01-16 23:08:36 +00002283 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002284}
2285
2286static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002287vec_lvsl(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002288{
David Blaikie3302f2b2013-01-16 23:08:36 +00002289 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002290}
2291
2292static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002293vec_lvsl(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002294{
David Blaikie3302f2b2013-01-16 23:08:36 +00002295 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002296}
2297
2298/* vec_lvsr */
2299
2300static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002301vec_lvsr(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002302{
David Blaikie3302f2b2013-01-16 23:08:36 +00002303 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002304}
2305
2306static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002307vec_lvsr(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002308{
David Blaikie3302f2b2013-01-16 23:08:36 +00002309 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002310}
2311
2312static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002313vec_lvsr(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002314{
David Blaikie3302f2b2013-01-16 23:08:36 +00002315 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002316}
2317
2318static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002319vec_lvsr(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002320{
David Blaikie3302f2b2013-01-16 23:08:36 +00002321 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002322}
2323
2324static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002325vec_lvsr(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002326{
David Blaikie3302f2b2013-01-16 23:08:36 +00002327 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002328}
2329
2330static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002331vec_lvsr(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002332{
David Blaikie3302f2b2013-01-16 23:08:36 +00002333 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002334}
2335
2336static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002337vec_lvsr(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002338{
David Blaikie3302f2b2013-01-16 23:08:36 +00002339 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002340}
2341
2342/* vec_madd */
2343
2344static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002345vec_madd(vector float __a, vector float __b, vector float __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002346{
David Blaikie3302f2b2013-01-16 23:08:36 +00002347 return __builtin_altivec_vmaddfp(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002348}
2349
2350/* vec_vmaddfp */
2351
2352static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002353vec_vmaddfp(vector float __a, vector float __b, vector float __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002354{
David Blaikie3302f2b2013-01-16 23:08:36 +00002355 return __builtin_altivec_vmaddfp(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002356}
2357
2358/* vec_madds */
2359
2360static vector signed short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002361vec_madds(vector signed short __a, vector signed short __b, vector signed short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002362{
David Blaikie3302f2b2013-01-16 23:08:36 +00002363 return __builtin_altivec_vmhaddshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002364}
2365
2366/* vec_vmhaddshs */
2367static vector signed short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002368vec_vmhaddshs(vector signed short __a,
2369 vector signed short __b,
2370 vector signed short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002371{
David Blaikie3302f2b2013-01-16 23:08:36 +00002372 return __builtin_altivec_vmhaddshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002373}
2374
Chris Lattnerdad40622010-04-14 03:54:58 +00002375/* vec_max */
2376
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002377static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002378vec_max(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002379{
David Blaikie3302f2b2013-01-16 23:08:36 +00002380 return __builtin_altivec_vmaxsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002381}
2382
Anton Yartsevfc83c602010-08-19 03:21:36 +00002383static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002384vec_max(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002385{
David Blaikie3302f2b2013-01-16 23:08:36 +00002386 return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002387}
2388
2389static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002390vec_max(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002391{
David Blaikie3302f2b2013-01-16 23:08:36 +00002392 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002393}
2394
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002395static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002396vec_max(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002397{
David Blaikie3302f2b2013-01-16 23:08:36 +00002398 return __builtin_altivec_vmaxub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002399}
2400
Anton Yartsevfc83c602010-08-19 03:21:36 +00002401static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002402vec_max(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002403{
David Blaikie3302f2b2013-01-16 23:08:36 +00002404 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002405}
2406
2407static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002408vec_max(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002409{
David Blaikie3302f2b2013-01-16 23:08:36 +00002410 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002411}
2412
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002413static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002414vec_max(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002415{
David Blaikie3302f2b2013-01-16 23:08:36 +00002416 return __builtin_altivec_vmaxsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002417}
2418
Anton Yartsevfc83c602010-08-19 03:21:36 +00002419static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002420vec_max(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002421{
David Blaikie3302f2b2013-01-16 23:08:36 +00002422 return __builtin_altivec_vmaxsh((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002423}
2424
2425static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002426vec_max(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002427{
David Blaikie3302f2b2013-01-16 23:08:36 +00002428 return __builtin_altivec_vmaxsh(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002429}
2430
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002431static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002432vec_max(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002433{
David Blaikie3302f2b2013-01-16 23:08:36 +00002434 return __builtin_altivec_vmaxuh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002435}
2436
Anton Yartsevfc83c602010-08-19 03:21:36 +00002437static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002438vec_max(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002439{
David Blaikie3302f2b2013-01-16 23:08:36 +00002440 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002441}
2442
2443static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002444vec_max(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002445{
David Blaikie3302f2b2013-01-16 23:08:36 +00002446 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002447}
2448
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002449static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002450vec_max(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002451{
David Blaikie3302f2b2013-01-16 23:08:36 +00002452 return __builtin_altivec_vmaxsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002453}
2454
Anton Yartsevfc83c602010-08-19 03:21:36 +00002455static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002456vec_max(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002457{
David Blaikie3302f2b2013-01-16 23:08:36 +00002458 return __builtin_altivec_vmaxsw((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002459}
2460
2461static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002462vec_max(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002463{
David Blaikie3302f2b2013-01-16 23:08:36 +00002464 return __builtin_altivec_vmaxsw(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002465}
2466
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002467static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002468vec_max(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002469{
David Blaikie3302f2b2013-01-16 23:08:36 +00002470 return __builtin_altivec_vmaxuw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002471}
2472
Anton Yartsevfc83c602010-08-19 03:21:36 +00002473static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002474vec_max(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002475{
David Blaikie3302f2b2013-01-16 23:08:36 +00002476 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002477}
2478
2479static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002480vec_max(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002481{
David Blaikie3302f2b2013-01-16 23:08:36 +00002482 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002483}
2484
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002485static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002486vec_max(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002487{
David Blaikie3302f2b2013-01-16 23:08:36 +00002488 return __builtin_altivec_vmaxfp(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002489}
2490
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002491/* vec_vmaxsb */
2492
Anton Yartsevfc83c602010-08-19 03:21:36 +00002493static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002494vec_vmaxsb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002495{
David Blaikie3302f2b2013-01-16 23:08:36 +00002496 return __builtin_altivec_vmaxsb(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002497}
2498
Anton Yartsevfc83c602010-08-19 03:21:36 +00002499static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002500vec_vmaxsb(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002501{
David Blaikie3302f2b2013-01-16 23:08:36 +00002502 return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002503}
2504
2505static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002506vec_vmaxsb(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002507{
David Blaikie3302f2b2013-01-16 23:08:36 +00002508 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002509}
2510
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002511/* vec_vmaxub */
2512
Anton Yartsevfc83c602010-08-19 03:21:36 +00002513static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002514vec_vmaxub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002515{
David Blaikie3302f2b2013-01-16 23:08:36 +00002516 return __builtin_altivec_vmaxub(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002517}
2518
Anton Yartsevfc83c602010-08-19 03:21:36 +00002519static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002520vec_vmaxub(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002521{
David Blaikie3302f2b2013-01-16 23:08:36 +00002522 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002523}
2524
2525static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002526vec_vmaxub(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002527{
David Blaikie3302f2b2013-01-16 23:08:36 +00002528 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002529}
2530
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002531/* vec_vmaxsh */
2532
Anton Yartsevfc83c602010-08-19 03:21:36 +00002533static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002534vec_vmaxsh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002535{
David Blaikie3302f2b2013-01-16 23:08:36 +00002536 return __builtin_altivec_vmaxsh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002537}
2538
Anton Yartsevfc83c602010-08-19 03:21:36 +00002539static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002540vec_vmaxsh(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002541{
David Blaikie3302f2b2013-01-16 23:08:36 +00002542 return __builtin_altivec_vmaxsh((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002543}
2544
2545static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002546vec_vmaxsh(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002547{
David Blaikie3302f2b2013-01-16 23:08:36 +00002548 return __builtin_altivec_vmaxsh(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002549}
2550
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002551/* vec_vmaxuh */
2552
Anton Yartsevfc83c602010-08-19 03:21:36 +00002553static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002554vec_vmaxuh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002555{
David Blaikie3302f2b2013-01-16 23:08:36 +00002556 return __builtin_altivec_vmaxuh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002557}
2558
Anton Yartsevfc83c602010-08-19 03:21:36 +00002559static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002560vec_vmaxuh(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002561{
David Blaikie3302f2b2013-01-16 23:08:36 +00002562 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002563}
2564
2565static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002566vec_vmaxuh(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002567{
David Blaikie3302f2b2013-01-16 23:08:36 +00002568 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002569}
2570
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002571/* vec_vmaxsw */
2572
Anton Yartsevfc83c602010-08-19 03:21:36 +00002573static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002574vec_vmaxsw(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002575{
David Blaikie3302f2b2013-01-16 23:08:36 +00002576 return __builtin_altivec_vmaxsw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002577}
2578
Anton Yartsevfc83c602010-08-19 03:21:36 +00002579static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002580vec_vmaxsw(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002581{
David Blaikie3302f2b2013-01-16 23:08:36 +00002582 return __builtin_altivec_vmaxsw((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002583}
2584
2585static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002586vec_vmaxsw(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002587{
David Blaikie3302f2b2013-01-16 23:08:36 +00002588 return __builtin_altivec_vmaxsw(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002589}
2590
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002591/* vec_vmaxuw */
2592
Anton Yartsevfc83c602010-08-19 03:21:36 +00002593static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002594vec_vmaxuw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002595{
David Blaikie3302f2b2013-01-16 23:08:36 +00002596 return __builtin_altivec_vmaxuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002597}
2598
Anton Yartsevfc83c602010-08-19 03:21:36 +00002599static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002600vec_vmaxuw(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002601{
David Blaikie3302f2b2013-01-16 23:08:36 +00002602 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002603}
2604
2605static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002606vec_vmaxuw(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002607{
David Blaikie3302f2b2013-01-16 23:08:36 +00002608 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002609}
2610
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002611/* vec_vmaxfp */
2612
2613static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002614vec_vmaxfp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002615{
David Blaikie3302f2b2013-01-16 23:08:36 +00002616 return __builtin_altivec_vmaxfp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002617}
2618
2619/* vec_mergeh */
2620
2621static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002622vec_mergeh(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002623{
David Blaikie3302f2b2013-01-16 23:08:36 +00002624 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002625 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2626 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2627}
2628
2629static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002630vec_mergeh(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002631{
David Blaikie3302f2b2013-01-16 23:08:36 +00002632 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002633 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2634 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2635}
2636
Anton Yartsev9e968982010-08-19 03:00:09 +00002637static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002638vec_mergeh(vector bool char __a, vector bool char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002639{
David Blaikie3302f2b2013-01-16 23:08:36 +00002640 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002641 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2642 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2643}
2644
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002645static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002646vec_mergeh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002647{
David Blaikie3302f2b2013-01-16 23:08:36 +00002648 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002649 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2650 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2651}
2652
2653static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002654vec_mergeh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002655{
David Blaikie3302f2b2013-01-16 23:08:36 +00002656 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002657 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2658 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2659}
2660
Anton Yartsev9e968982010-08-19 03:00:09 +00002661static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002662vec_mergeh(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002663{
David Blaikie3302f2b2013-01-16 23:08:36 +00002664 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002665 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2666 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2667}
2668
2669static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002670vec_mergeh(vector pixel __a, vector pixel __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002671{
David Blaikie3302f2b2013-01-16 23:08:36 +00002672 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002673 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2674 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2675}
2676
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002677static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002678vec_mergeh(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002679{
David Blaikie3302f2b2013-01-16 23:08:36 +00002680 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002681 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2682 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2683}
2684
2685static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002686vec_mergeh(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002687{
David Blaikie3302f2b2013-01-16 23:08:36 +00002688 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002689 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2690 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2691}
2692
Anton Yartsev9e968982010-08-19 03:00:09 +00002693static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002694vec_mergeh(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002695{
David Blaikie3302f2b2013-01-16 23:08:36 +00002696 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002697 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2698 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2699}
2700
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002701static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002702vec_mergeh(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002703{
David Blaikie3302f2b2013-01-16 23:08:36 +00002704 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002705 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2706 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2707}
2708
2709/* vec_vmrghb */
2710
2711#define __builtin_altivec_vmrghb vec_vmrghb
2712
2713static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002714vec_vmrghb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002715{
David Blaikie3302f2b2013-01-16 23:08:36 +00002716 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002717 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2718 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2719}
2720
2721static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002722vec_vmrghb(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002723{
David Blaikie3302f2b2013-01-16 23:08:36 +00002724 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002725 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2726 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2727}
2728
Anton Yartsev9e968982010-08-19 03:00:09 +00002729static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002730vec_vmrghb(vector bool char __a, vector bool char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002731{
David Blaikie3302f2b2013-01-16 23:08:36 +00002732 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002733 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2734 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2735}
2736
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002737/* vec_vmrghh */
2738
2739#define __builtin_altivec_vmrghh vec_vmrghh
2740
2741static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002742vec_vmrghh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002743{
David Blaikie3302f2b2013-01-16 23:08:36 +00002744 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002745 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2746 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2747}
2748
2749static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002750vec_vmrghh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002751{
David Blaikie3302f2b2013-01-16 23:08:36 +00002752 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002753 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2754 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2755}
2756
Anton Yartsev9e968982010-08-19 03:00:09 +00002757static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002758vec_vmrghh(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002759{
David Blaikie3302f2b2013-01-16 23:08:36 +00002760 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002761 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2762 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2763}
2764
2765static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002766vec_vmrghh(vector pixel __a, vector pixel __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002767{
David Blaikie3302f2b2013-01-16 23:08:36 +00002768 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002769 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2770 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2771}
2772
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002773/* vec_vmrghw */
2774
2775#define __builtin_altivec_vmrghw vec_vmrghw
2776
2777static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002778vec_vmrghw(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002779{
David Blaikie3302f2b2013-01-16 23:08:36 +00002780 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002781 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2782 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2783}
2784
2785static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002786vec_vmrghw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002787{
David Blaikie3302f2b2013-01-16 23:08:36 +00002788 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002789 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2790 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2791}
2792
Anton Yartsev9e968982010-08-19 03:00:09 +00002793static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002794vec_vmrghw(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002795{
David Blaikie3302f2b2013-01-16 23:08:36 +00002796 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002797 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2798 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2799}
2800
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002801static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002802vec_vmrghw(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002803{
David Blaikie3302f2b2013-01-16 23:08:36 +00002804 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002805 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2806 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2807}
2808
2809/* vec_mergel */
2810
2811static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002812vec_mergel(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002813{
David Blaikie3302f2b2013-01-16 23:08:36 +00002814 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002815 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
2816 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
2817}
2818
2819static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002820vec_mergel(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002821{
David Blaikie3302f2b2013-01-16 23:08:36 +00002822 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002823 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
2824 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
2825}
2826
Anton Yartsev9e968982010-08-19 03:00:09 +00002827static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002828vec_mergel(vector bool char __a, vector bool char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002829{
David Blaikie3302f2b2013-01-16 23:08:36 +00002830 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002831 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
2832 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
2833}
2834
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002835static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002836vec_mergel(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002837{
David Blaikie3302f2b2013-01-16 23:08:36 +00002838 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002839 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
2840 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
2841}
2842
2843static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002844vec_mergel(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002845{
David Blaikie3302f2b2013-01-16 23:08:36 +00002846 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002847 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
2848 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
2849}
2850
Anton Yartsev9e968982010-08-19 03:00:09 +00002851static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002852vec_mergel(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002853{
David Blaikie3302f2b2013-01-16 23:08:36 +00002854 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002855 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
2856 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
2857}
2858
2859static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002860vec_mergel(vector pixel __a, vector pixel __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002861{
David Blaikie3302f2b2013-01-16 23:08:36 +00002862 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002863 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
2864 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
2865}
2866
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002867static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002868vec_mergel(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002869{
David Blaikie3302f2b2013-01-16 23:08:36 +00002870 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002871 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
2872 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
2873}
2874
2875static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002876vec_mergel(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002877{
David Blaikie3302f2b2013-01-16 23:08:36 +00002878 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002879 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
2880 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
2881}
2882
Anton Yartsev9e968982010-08-19 03:00:09 +00002883static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002884vec_mergel(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002885{
David Blaikie3302f2b2013-01-16 23:08:36 +00002886 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002887 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
2888 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
2889}
2890
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002891static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002892vec_mergel(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002893{
David Blaikie3302f2b2013-01-16 23:08:36 +00002894 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002895 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
2896 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
2897}
2898
2899/* vec_vmrglb */
2900
2901#define __builtin_altivec_vmrglb vec_vmrglb
2902
2903static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002904vec_vmrglb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002905{
David Blaikie3302f2b2013-01-16 23:08:36 +00002906 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002907 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
2908 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
2909}
2910
2911static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002912vec_vmrglb(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002913{
David Blaikie3302f2b2013-01-16 23:08:36 +00002914 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002915 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
2916 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
2917}
2918
Anton Yartsev9e968982010-08-19 03:00:09 +00002919static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002920vec_vmrglb(vector bool char __a, vector bool char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002921{
David Blaikie3302f2b2013-01-16 23:08:36 +00002922 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002923 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
2924 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
2925}
2926
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002927/* vec_vmrglh */
2928
2929#define __builtin_altivec_vmrglh vec_vmrglh
2930
2931static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002932vec_vmrglh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002933{
David Blaikie3302f2b2013-01-16 23:08:36 +00002934 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002935 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
2936 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
2937}
2938
2939static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002940vec_vmrglh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002941{
David Blaikie3302f2b2013-01-16 23:08:36 +00002942 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002943 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
2944 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
2945}
2946
Anton Yartsev9e968982010-08-19 03:00:09 +00002947static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002948vec_vmrglh(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002949{
David Blaikie3302f2b2013-01-16 23:08:36 +00002950 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002951 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
2952 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
2953}
2954
2955static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002956vec_vmrglh(vector pixel __a, vector pixel __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002957{
David Blaikie3302f2b2013-01-16 23:08:36 +00002958 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002959 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
2960 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
2961}
2962
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002963/* vec_vmrglw */
2964
2965#define __builtin_altivec_vmrglw vec_vmrglw
2966
2967static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002968vec_vmrglw(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002969{
David Blaikie3302f2b2013-01-16 23:08:36 +00002970 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002971 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
2972 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
2973}
2974
2975static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002976vec_vmrglw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002977{
David Blaikie3302f2b2013-01-16 23:08:36 +00002978 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002979 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
2980 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
2981}
2982
Anton Yartsev9e968982010-08-19 03:00:09 +00002983static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002984vec_vmrglw(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002985{
David Blaikie3302f2b2013-01-16 23:08:36 +00002986 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002987 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
2988 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
2989}
2990
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002991static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002992vec_vmrglw(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002993{
David Blaikie3302f2b2013-01-16 23:08:36 +00002994 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002995 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
2996 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
2997}
2998
Chris Lattnerdad40622010-04-14 03:54:58 +00002999/* vec_mfvscr */
3000
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003001static vector unsigned short __attribute__((__always_inline__))
3002vec_mfvscr(void)
3003{
3004 return __builtin_altivec_mfvscr();
3005}
Chris Lattnerdad40622010-04-14 03:54:58 +00003006
3007/* vec_min */
3008
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003009static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003010vec_min(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003011{
David Blaikie3302f2b2013-01-16 23:08:36 +00003012 return __builtin_altivec_vminsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003013}
3014
Anton Yartsevfc83c602010-08-19 03:21:36 +00003015static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003016vec_min(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003017{
David Blaikie3302f2b2013-01-16 23:08:36 +00003018 return __builtin_altivec_vminsb((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003019}
3020
3021static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003022vec_min(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003023{
David Blaikie3302f2b2013-01-16 23:08:36 +00003024 return __builtin_altivec_vminsb(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003025}
3026
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003027static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003028vec_min(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003029{
David Blaikie3302f2b2013-01-16 23:08:36 +00003030 return __builtin_altivec_vminub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003031}
3032
Anton Yartsevfc83c602010-08-19 03:21:36 +00003033static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003034vec_min(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003035{
David Blaikie3302f2b2013-01-16 23:08:36 +00003036 return __builtin_altivec_vminub((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003037}
3038
3039static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003040vec_min(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003041{
David Blaikie3302f2b2013-01-16 23:08:36 +00003042 return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003043}
3044
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003045static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003046vec_min(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003047{
David Blaikie3302f2b2013-01-16 23:08:36 +00003048 return __builtin_altivec_vminsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003049}
3050
Anton Yartsevfc83c602010-08-19 03:21:36 +00003051static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003052vec_min(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003053{
David Blaikie3302f2b2013-01-16 23:08:36 +00003054 return __builtin_altivec_vminsh((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003055}
3056
3057static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003058vec_min(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003059{
David Blaikie3302f2b2013-01-16 23:08:36 +00003060 return __builtin_altivec_vminsh(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003061}
3062
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003063static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003064vec_min(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003065{
David Blaikie3302f2b2013-01-16 23:08:36 +00003066 return __builtin_altivec_vminuh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003067}
3068
Anton Yartsevfc83c602010-08-19 03:21:36 +00003069static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003070vec_min(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003071{
David Blaikie3302f2b2013-01-16 23:08:36 +00003072 return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003073}
3074
3075static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003076vec_min(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003077{
David Blaikie3302f2b2013-01-16 23:08:36 +00003078 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003079}
3080
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003081static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003082vec_min(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003083{
David Blaikie3302f2b2013-01-16 23:08:36 +00003084 return __builtin_altivec_vminsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003085}
3086
Anton Yartsevfc83c602010-08-19 03:21:36 +00003087static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003088vec_min(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003089{
David Blaikie3302f2b2013-01-16 23:08:36 +00003090 return __builtin_altivec_vminsw((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003091}
3092
3093static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003094vec_min(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003095{
David Blaikie3302f2b2013-01-16 23:08:36 +00003096 return __builtin_altivec_vminsw(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003097}
3098
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003099static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003100vec_min(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003101{
David Blaikie3302f2b2013-01-16 23:08:36 +00003102 return __builtin_altivec_vminuw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003103}
3104
Anton Yartsevfc83c602010-08-19 03:21:36 +00003105static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003106vec_min(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003107{
David Blaikie3302f2b2013-01-16 23:08:36 +00003108 return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003109}
3110
3111static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003112vec_min(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003113{
David Blaikie3302f2b2013-01-16 23:08:36 +00003114 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003115}
3116
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003117static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003118vec_min(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003119{
David Blaikie3302f2b2013-01-16 23:08:36 +00003120 return __builtin_altivec_vminfp(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003121}
3122
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003123/* vec_vminsb */
3124
Anton Yartsevfc83c602010-08-19 03:21:36 +00003125static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003126vec_vminsb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003127{
David Blaikie3302f2b2013-01-16 23:08:36 +00003128 return __builtin_altivec_vminsb(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003129}
3130
Anton Yartsevfc83c602010-08-19 03:21:36 +00003131static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003132vec_vminsb(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003133{
David Blaikie3302f2b2013-01-16 23:08:36 +00003134 return __builtin_altivec_vminsb((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003135}
3136
3137static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003138vec_vminsb(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003139{
David Blaikie3302f2b2013-01-16 23:08:36 +00003140 return __builtin_altivec_vminsb(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003141}
3142
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003143/* vec_vminub */
3144
Anton Yartsevfc83c602010-08-19 03:21:36 +00003145static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003146vec_vminub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003147{
David Blaikie3302f2b2013-01-16 23:08:36 +00003148 return __builtin_altivec_vminub(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003149}
3150
Anton Yartsevfc83c602010-08-19 03:21:36 +00003151static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003152vec_vminub(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003153{
David Blaikie3302f2b2013-01-16 23:08:36 +00003154 return __builtin_altivec_vminub((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003155}
3156
3157static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003158vec_vminub(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003159{
David Blaikie3302f2b2013-01-16 23:08:36 +00003160 return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003161}
3162
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003163/* vec_vminsh */
3164
Anton Yartsevfc83c602010-08-19 03:21:36 +00003165static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003166vec_vminsh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003167{
David Blaikie3302f2b2013-01-16 23:08:36 +00003168 return __builtin_altivec_vminsh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003169}
3170
Anton Yartsevfc83c602010-08-19 03:21:36 +00003171static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003172vec_vminsh(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003173{
David Blaikie3302f2b2013-01-16 23:08:36 +00003174 return __builtin_altivec_vminsh((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003175}
3176
3177static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003178vec_vminsh(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003179{
David Blaikie3302f2b2013-01-16 23:08:36 +00003180 return __builtin_altivec_vminsh(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003181}
3182
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003183/* vec_vminuh */
3184
Anton Yartsevfc83c602010-08-19 03:21:36 +00003185static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003186vec_vminuh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003187{
David Blaikie3302f2b2013-01-16 23:08:36 +00003188 return __builtin_altivec_vminuh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003189}
3190
Anton Yartsevfc83c602010-08-19 03:21:36 +00003191static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003192vec_vminuh(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003193{
David Blaikie3302f2b2013-01-16 23:08:36 +00003194 return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003195}
3196
3197static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003198vec_vminuh(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003199{
David Blaikie3302f2b2013-01-16 23:08:36 +00003200 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003201}
3202
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003203/* vec_vminsw */
3204
Anton Yartsevfc83c602010-08-19 03:21:36 +00003205static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003206vec_vminsw(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003207{
David Blaikie3302f2b2013-01-16 23:08:36 +00003208 return __builtin_altivec_vminsw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003209}
3210
Anton Yartsevfc83c602010-08-19 03:21:36 +00003211static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003212vec_vminsw(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003213{
David Blaikie3302f2b2013-01-16 23:08:36 +00003214 return __builtin_altivec_vminsw((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003215}
3216
3217static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003218vec_vminsw(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003219{
David Blaikie3302f2b2013-01-16 23:08:36 +00003220 return __builtin_altivec_vminsw(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003221}
3222
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003223/* vec_vminuw */
3224
Anton Yartsevfc83c602010-08-19 03:21:36 +00003225static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003226vec_vminuw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003227{
David Blaikie3302f2b2013-01-16 23:08:36 +00003228 return __builtin_altivec_vminuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003229}
3230
Anton Yartsevfc83c602010-08-19 03:21:36 +00003231static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003232vec_vminuw(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003233{
David Blaikie3302f2b2013-01-16 23:08:36 +00003234 return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003235}
3236
3237static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003238vec_vminuw(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003239{
David Blaikie3302f2b2013-01-16 23:08:36 +00003240 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003241}
3242
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003243/* vec_vminfp */
3244
3245static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003246vec_vminfp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003247{
David Blaikie3302f2b2013-01-16 23:08:36 +00003248 return __builtin_altivec_vminfp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003249}
3250
3251/* vec_mladd */
3252
3253#define __builtin_altivec_vmladduhm vec_mladd
3254
3255static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003256vec_mladd(vector short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003257{
David Blaikie3302f2b2013-01-16 23:08:36 +00003258 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003259}
3260
3261static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003262vec_mladd(vector short __a, vector unsigned short __b, vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003263{
David Blaikie3302f2b2013-01-16 23:08:36 +00003264 return __a * (vector short)__b + (vector short)__c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003265}
3266
3267static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003268vec_mladd(vector unsigned short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003269{
David Blaikie3302f2b2013-01-16 23:08:36 +00003270 return (vector short)__a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003271}
3272
3273static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003274vec_mladd(vector unsigned short __a,
3275 vector unsigned short __b,
3276 vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003277{
David Blaikie3302f2b2013-01-16 23:08:36 +00003278 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003279}
3280
3281/* vec_vmladduhm */
3282
3283static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003284vec_vmladduhm(vector short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003285{
David Blaikie3302f2b2013-01-16 23:08:36 +00003286 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003287}
3288
3289static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003290vec_vmladduhm(vector short __a, vector unsigned short __b, vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003291{
David Blaikie3302f2b2013-01-16 23:08:36 +00003292 return __a * (vector short)__b + (vector short)__c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003293}
3294
3295static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003296vec_vmladduhm(vector unsigned short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003297{
David Blaikie3302f2b2013-01-16 23:08:36 +00003298 return (vector short)__a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003299}
3300
3301static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003302vec_vmladduhm(vector unsigned short __a,
3303 vector unsigned short __b,
3304 vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003305{
David Blaikie3302f2b2013-01-16 23:08:36 +00003306 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003307}
3308
3309/* vec_mradds */
3310
3311static vector short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003312vec_mradds(vector short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003313{
David Blaikie3302f2b2013-01-16 23:08:36 +00003314 return __builtin_altivec_vmhraddshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003315}
3316
3317/* vec_vmhraddshs */
3318
3319static vector short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003320vec_vmhraddshs(vector short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003321{
David Blaikie3302f2b2013-01-16 23:08:36 +00003322 return __builtin_altivec_vmhraddshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003323}
3324
3325/* vec_msum */
3326
3327static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003328vec_msum(vector signed char __a, vector unsigned char __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003329{
David Blaikie3302f2b2013-01-16 23:08:36 +00003330 return __builtin_altivec_vmsummbm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003331}
3332
3333static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003334vec_msum(vector unsigned char __a, vector unsigned char __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003335{
David Blaikie3302f2b2013-01-16 23:08:36 +00003336 return __builtin_altivec_vmsumubm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003337}
3338
3339static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003340vec_msum(vector short __a, vector short __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003341{
David Blaikie3302f2b2013-01-16 23:08:36 +00003342 return __builtin_altivec_vmsumshm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003343}
3344
3345static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003346vec_msum(vector unsigned short __a,
3347 vector unsigned short __b,
3348 vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003349{
David Blaikie3302f2b2013-01-16 23:08:36 +00003350 return __builtin_altivec_vmsumuhm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003351}
3352
3353/* vec_vmsummbm */
3354
3355static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003356vec_vmsummbm(vector signed char __a, vector unsigned char __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003357{
David Blaikie3302f2b2013-01-16 23:08:36 +00003358 return __builtin_altivec_vmsummbm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003359}
3360
3361/* vec_vmsumubm */
3362
3363static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003364vec_vmsumubm(vector unsigned char __a,
3365 vector unsigned char __b,
3366 vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003367{
David Blaikie3302f2b2013-01-16 23:08:36 +00003368 return __builtin_altivec_vmsumubm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003369}
3370
3371/* vec_vmsumshm */
3372
3373static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003374vec_vmsumshm(vector short __a, vector short __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003375{
David Blaikie3302f2b2013-01-16 23:08:36 +00003376 return __builtin_altivec_vmsumshm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003377}
3378
3379/* vec_vmsumuhm */
3380
3381static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003382vec_vmsumuhm(vector unsigned short __a,
3383 vector unsigned short __b,
3384 vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003385{
David Blaikie3302f2b2013-01-16 23:08:36 +00003386 return __builtin_altivec_vmsumuhm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003387}
3388
3389/* vec_msums */
3390
3391static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003392vec_msums(vector short __a, vector short __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003393{
David Blaikie3302f2b2013-01-16 23:08:36 +00003394 return __builtin_altivec_vmsumshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003395}
3396
3397static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003398vec_msums(vector unsigned short __a,
3399 vector unsigned short __b,
3400 vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003401{
David Blaikie3302f2b2013-01-16 23:08:36 +00003402 return __builtin_altivec_vmsumuhs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003403}
3404
3405/* vec_vmsumshs */
3406
3407static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003408vec_vmsumshs(vector short __a, vector short __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003409{
David Blaikie3302f2b2013-01-16 23:08:36 +00003410 return __builtin_altivec_vmsumshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003411}
3412
3413/* vec_vmsumuhs */
3414
3415static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003416vec_vmsumuhs(vector unsigned short __a,
3417 vector unsigned short __b,
3418 vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003419{
David Blaikie3302f2b2013-01-16 23:08:36 +00003420 return __builtin_altivec_vmsumuhs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003421}
3422
Chris Lattnerdad40622010-04-14 03:54:58 +00003423/* vec_mtvscr */
3424
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003425static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003426vec_mtvscr(vector signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003427{
David Blaikie3302f2b2013-01-16 23:08:36 +00003428 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003429}
3430
3431static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003432vec_mtvscr(vector unsigned char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003433{
David Blaikie3302f2b2013-01-16 23:08:36 +00003434 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003435}
3436
3437static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003438vec_mtvscr(vector bool char __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003439{
David Blaikie3302f2b2013-01-16 23:08:36 +00003440 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003441}
3442
3443static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003444vec_mtvscr(vector short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003445{
David Blaikie3302f2b2013-01-16 23:08:36 +00003446 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003447}
3448
3449static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003450vec_mtvscr(vector unsigned short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003451{
David Blaikie3302f2b2013-01-16 23:08:36 +00003452 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003453}
3454
3455static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003456vec_mtvscr(vector bool short __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003457{
David Blaikie3302f2b2013-01-16 23:08:36 +00003458 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003459}
3460
3461static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003462vec_mtvscr(vector pixel __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003463{
David Blaikie3302f2b2013-01-16 23:08:36 +00003464 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003465}
3466
3467static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003468vec_mtvscr(vector int __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003469{
David Blaikie3302f2b2013-01-16 23:08:36 +00003470 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003471}
3472
3473static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003474vec_mtvscr(vector unsigned int __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003475{
David Blaikie3302f2b2013-01-16 23:08:36 +00003476 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003477}
3478
3479static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003480vec_mtvscr(vector bool int __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003481{
David Blaikie3302f2b2013-01-16 23:08:36 +00003482 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003483}
3484
3485static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003486vec_mtvscr(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003487{
David Blaikie3302f2b2013-01-16 23:08:36 +00003488 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003489}
3490
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003491/* The vmulos* and vmules* instructions have a big endian bias, so
3492 we must reverse the meaning of "even" and "odd" for little endian. */
3493
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003494/* vec_mule */
3495
3496static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003497vec_mule(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003498{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003499#ifdef __LITTLE_ENDIAN__
3500 return __builtin_altivec_vmulosb(__a, __b);
3501#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003502 return __builtin_altivec_vmulesb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003503#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003504}
3505
3506static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003507vec_mule(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003508{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003509#ifdef __LITTLE_ENDIAN__
3510 return __builtin_altivec_vmuloub(__a, __b);
3511#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003512 return __builtin_altivec_vmuleub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003513#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003514}
3515
3516static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003517vec_mule(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003518{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003519#ifdef __LITTLE_ENDIAN__
3520 return __builtin_altivec_vmulosh(__a, __b);
3521#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003522 return __builtin_altivec_vmulesh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003523#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003524}
3525
3526static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003527vec_mule(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003528{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003529#ifdef __LITTLE_ENDIAN__
3530 return __builtin_altivec_vmulouh(__a, __b);
3531#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003532 return __builtin_altivec_vmuleuh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003533#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003534}
3535
3536/* vec_vmulesb */
3537
3538static vector short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003539vec_vmulesb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003540{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003541#ifdef __LITTLE_ENDIAN__
3542 return __builtin_altivec_vmulosb(__a, __b);
3543#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003544 return __builtin_altivec_vmulesb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003545#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003546}
3547
3548/* vec_vmuleub */
3549
3550static vector unsigned short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003551vec_vmuleub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003552{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003553#ifdef __LITTLE_ENDIAN__
3554 return __builtin_altivec_vmuloub(__a, __b);
3555#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003556 return __builtin_altivec_vmuleub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003557#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003558}
3559
3560/* vec_vmulesh */
3561
3562static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003563vec_vmulesh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003564{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003565#ifdef __LITTLE_ENDIAN__
3566 return __builtin_altivec_vmulosh(__a, __b);
3567#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003568 return __builtin_altivec_vmulesh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003569#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003570}
3571
3572/* vec_vmuleuh */
3573
3574static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003575vec_vmuleuh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003576{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003577#ifdef __LITTLE_ENDIAN__
3578 return __builtin_altivec_vmulouh(__a, __b);
3579#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003580 return __builtin_altivec_vmuleuh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003581#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003582}
3583
3584/* vec_mulo */
3585
3586static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003587vec_mulo(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003588{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003589#ifdef __LITTLE_ENDIAN__
3590 return __builtin_altivec_vmulesb(__a, __b);
3591#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003592 return __builtin_altivec_vmulosb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003593#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003594}
3595
3596static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003597vec_mulo(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003598{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003599#ifdef __LITTLE_ENDIAN__
3600 return __builtin_altivec_vmuleub(__a, __b);
3601#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003602 return __builtin_altivec_vmuloub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003603#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003604}
3605
3606static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003607vec_mulo(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003608{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003609#ifdef __LITTLE_ENDIAN__
3610 return __builtin_altivec_vmulesh(__a, __b);
3611#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003612 return __builtin_altivec_vmulosh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003613#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003614}
3615
3616static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003617vec_mulo(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003618{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003619#ifdef __LITTLE_ENDIAN__
3620 return __builtin_altivec_vmuleuh(__a, __b);
3621#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003622 return __builtin_altivec_vmulouh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003623#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003624}
3625
3626/* vec_vmulosb */
3627
3628static vector short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003629vec_vmulosb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003630{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003631#ifdef __LITTLE_ENDIAN__
3632 return __builtin_altivec_vmulesb(__a, __b);
3633#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003634 return __builtin_altivec_vmulosb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003635#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003636}
3637
3638/* vec_vmuloub */
3639
3640static vector unsigned short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003641vec_vmuloub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003642{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003643#ifdef __LITTLE_ENDIAN__
3644 return __builtin_altivec_vmuleub(__a, __b);
3645#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003646 return __builtin_altivec_vmuloub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003647#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003648}
3649
3650/* vec_vmulosh */
3651
3652static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003653vec_vmulosh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003654{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003655#ifdef __LITTLE_ENDIAN__
3656 return __builtin_altivec_vmulesh(__a, __b);
3657#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003658 return __builtin_altivec_vmulosh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003659#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003660}
3661
3662/* vec_vmulouh */
3663
3664static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003665vec_vmulouh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003666{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003667#ifdef __LITTLE_ENDIAN__
3668 return __builtin_altivec_vmuleuh(__a, __b);
3669#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003670 return __builtin_altivec_vmulouh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003671#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003672}
3673
3674/* vec_nmsub */
3675
3676static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003677vec_nmsub(vector float __a, vector float __b, vector float __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003678{
David Blaikie3302f2b2013-01-16 23:08:36 +00003679 return __builtin_altivec_vnmsubfp(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003680}
3681
3682/* vec_vnmsubfp */
3683
3684static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003685vec_vnmsubfp(vector float __a, vector float __b, vector float __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003686{
David Blaikie3302f2b2013-01-16 23:08:36 +00003687 return __builtin_altivec_vnmsubfp(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003688}
3689
3690/* vec_nor */
3691
3692#define __builtin_altivec_vnor vec_nor
3693
3694static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003695vec_nor(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003696{
David Blaikie3302f2b2013-01-16 23:08:36 +00003697 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003698}
3699
3700static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003701vec_nor(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003702{
David Blaikie3302f2b2013-01-16 23:08:36 +00003703 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003704}
3705
Anton Yartsevfc83c602010-08-19 03:21:36 +00003706static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003707vec_nor(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003708{
David Blaikie3302f2b2013-01-16 23:08:36 +00003709 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003710}
3711
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003712static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003713vec_nor(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003714{
David Blaikie3302f2b2013-01-16 23:08:36 +00003715 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003716}
3717
3718static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003719vec_nor(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003720{
David Blaikie3302f2b2013-01-16 23:08:36 +00003721 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003722}
3723
Anton Yartsevfc83c602010-08-19 03:21:36 +00003724static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003725vec_nor(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003726{
David Blaikie3302f2b2013-01-16 23:08:36 +00003727 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003728}
3729
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003730static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003731vec_nor(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003732{
David Blaikie3302f2b2013-01-16 23:08:36 +00003733 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003734}
3735
3736static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003737vec_nor(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003738{
David Blaikie3302f2b2013-01-16 23:08:36 +00003739 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003740}
3741
Anton Yartsevfc83c602010-08-19 03:21:36 +00003742static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003743vec_nor(vector bool int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003744{
David Blaikie3302f2b2013-01-16 23:08:36 +00003745 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003746}
3747
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003748static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003749vec_nor(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003750{
David Blaikie3302f2b2013-01-16 23:08:36 +00003751 vector unsigned int __res = ~((vector unsigned int)__a | (vector unsigned int)__b);
3752 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003753}
3754
3755/* vec_vnor */
3756
3757static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003758vec_vnor(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003759{
David Blaikie3302f2b2013-01-16 23:08:36 +00003760 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003761}
3762
3763static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003764vec_vnor(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003765{
David Blaikie3302f2b2013-01-16 23:08:36 +00003766 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003767}
3768
Anton Yartsevfc83c602010-08-19 03:21:36 +00003769static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003770vec_vnor(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003771{
David Blaikie3302f2b2013-01-16 23:08:36 +00003772 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003773}
3774
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003775static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003776vec_vnor(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003777{
David Blaikie3302f2b2013-01-16 23:08:36 +00003778 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003779}
3780
3781static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003782vec_vnor(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003783{
David Blaikie3302f2b2013-01-16 23:08:36 +00003784 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003785}
3786
Anton Yartsevfc83c602010-08-19 03:21:36 +00003787static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003788vec_vnor(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003789{
David Blaikie3302f2b2013-01-16 23:08:36 +00003790 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003791}
3792
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003793static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003794vec_vnor(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003795{
David Blaikie3302f2b2013-01-16 23:08:36 +00003796 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003797}
3798
3799static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003800vec_vnor(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003801{
David Blaikie3302f2b2013-01-16 23:08:36 +00003802 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003803}
3804
Anton Yartsevfc83c602010-08-19 03:21:36 +00003805static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003806vec_vnor(vector bool int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003807{
David Blaikie3302f2b2013-01-16 23:08:36 +00003808 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003809}
3810
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003811static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003812vec_vnor(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003813{
David Blaikie3302f2b2013-01-16 23:08:36 +00003814 vector unsigned int __res = ~((vector unsigned int)__a | (vector unsigned int)__b);
3815 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003816}
3817
3818/* vec_or */
3819
3820#define __builtin_altivec_vor vec_or
3821
3822static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003823vec_or(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003824{
David Blaikie3302f2b2013-01-16 23:08:36 +00003825 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003826}
3827
Anton Yartsevfc83c602010-08-19 03:21:36 +00003828static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003829vec_or(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003830{
David Blaikie3302f2b2013-01-16 23:08:36 +00003831 return (vector signed char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003832}
3833
3834static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003835vec_or(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003836{
David Blaikie3302f2b2013-01-16 23:08:36 +00003837 return __a | (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003838}
3839
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003840static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003841vec_or(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003842{
David Blaikie3302f2b2013-01-16 23:08:36 +00003843 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003844}
3845
Anton Yartsevfc83c602010-08-19 03:21:36 +00003846static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003847vec_or(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003848{
David Blaikie3302f2b2013-01-16 23:08:36 +00003849 return (vector unsigned char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003850}
3851
3852static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003853vec_or(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003854{
David Blaikie3302f2b2013-01-16 23:08:36 +00003855 return __a | (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003856}
3857
3858static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003859vec_or(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003860{
David Blaikie3302f2b2013-01-16 23:08:36 +00003861 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003862}
3863
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003864static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003865vec_or(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003866{
David Blaikie3302f2b2013-01-16 23:08:36 +00003867 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003868}
3869
Anton Yartsevfc83c602010-08-19 03:21:36 +00003870static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003871vec_or(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003872{
David Blaikie3302f2b2013-01-16 23:08:36 +00003873 return (vector short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003874}
3875
3876static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003877vec_or(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003878{
David Blaikie3302f2b2013-01-16 23:08:36 +00003879 return __a | (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003880}
3881
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003882static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003883vec_or(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003884{
David Blaikie3302f2b2013-01-16 23:08:36 +00003885 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003886}
3887
Anton Yartsevfc83c602010-08-19 03:21:36 +00003888static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003889vec_or(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003890{
David Blaikie3302f2b2013-01-16 23:08:36 +00003891 return (vector unsigned short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003892}
3893
3894static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003895vec_or(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003896{
David Blaikie3302f2b2013-01-16 23:08:36 +00003897 return __a | (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003898}
3899
3900static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003901vec_or(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003902{
David Blaikie3302f2b2013-01-16 23:08:36 +00003903 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003904}
3905
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003906static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003907vec_or(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003908{
David Blaikie3302f2b2013-01-16 23:08:36 +00003909 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003910}
3911
Anton Yartsevfc83c602010-08-19 03:21:36 +00003912static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003913vec_or(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003914{
David Blaikie3302f2b2013-01-16 23:08:36 +00003915 return (vector int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003916}
3917
3918static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003919vec_or(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003920{
David Blaikie3302f2b2013-01-16 23:08:36 +00003921 return __a | (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003922}
3923
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003924static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003925vec_or(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003926{
David Blaikie3302f2b2013-01-16 23:08:36 +00003927 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003928}
3929
Anton Yartsevfc83c602010-08-19 03:21:36 +00003930static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003931vec_or(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003932{
David Blaikie3302f2b2013-01-16 23:08:36 +00003933 return (vector unsigned int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003934}
3935
3936static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003937vec_or(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003938{
David Blaikie3302f2b2013-01-16 23:08:36 +00003939 return __a | (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003940}
3941
3942static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003943vec_or(vector bool int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003944{
David Blaikie3302f2b2013-01-16 23:08:36 +00003945 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003946}
3947
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003948static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003949vec_or(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003950{
David Blaikie3302f2b2013-01-16 23:08:36 +00003951 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
3952 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003953}
3954
Anton Yartsevfc83c602010-08-19 03:21:36 +00003955static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003956vec_or(vector bool int __a, vector float __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003957{
David Blaikie3302f2b2013-01-16 23:08:36 +00003958 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
3959 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003960}
3961
3962static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003963vec_or(vector float __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003964{
David Blaikie3302f2b2013-01-16 23:08:36 +00003965 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
3966 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003967}
3968
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003969/* vec_vor */
3970
3971static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003972vec_vor(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003973{
David Blaikie3302f2b2013-01-16 23:08:36 +00003974 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003975}
3976
Anton Yartsevfc83c602010-08-19 03:21:36 +00003977static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003978vec_vor(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003979{
David Blaikie3302f2b2013-01-16 23:08:36 +00003980 return (vector signed char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003981}
3982
3983static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003984vec_vor(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003985{
David Blaikie3302f2b2013-01-16 23:08:36 +00003986 return __a | (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003987}
3988
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003989static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003990vec_vor(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003991{
David Blaikie3302f2b2013-01-16 23:08:36 +00003992 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003993}
3994
Anton Yartsevfc83c602010-08-19 03:21:36 +00003995static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003996vec_vor(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003997{
David Blaikie3302f2b2013-01-16 23:08:36 +00003998 return (vector unsigned char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00003999}
4000
4001static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004002vec_vor(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004003{
David Blaikie3302f2b2013-01-16 23:08:36 +00004004 return __a | (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004005}
4006
4007static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004008vec_vor(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004009{
David Blaikie3302f2b2013-01-16 23:08:36 +00004010 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004011}
4012
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004013static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004014vec_vor(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004015{
David Blaikie3302f2b2013-01-16 23:08:36 +00004016 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004017}
4018
Anton Yartsevfc83c602010-08-19 03:21:36 +00004019static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004020vec_vor(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004021{
David Blaikie3302f2b2013-01-16 23:08:36 +00004022 return (vector short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004023}
4024
4025static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004026vec_vor(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004027{
David Blaikie3302f2b2013-01-16 23:08:36 +00004028 return __a | (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004029}
4030
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004031static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004032vec_vor(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004033{
David Blaikie3302f2b2013-01-16 23:08:36 +00004034 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004035}
4036
Anton Yartsevfc83c602010-08-19 03:21:36 +00004037static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004038vec_vor(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004039{
David Blaikie3302f2b2013-01-16 23:08:36 +00004040 return (vector unsigned short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004041}
4042
4043static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004044vec_vor(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004045{
David Blaikie3302f2b2013-01-16 23:08:36 +00004046 return __a | (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004047}
4048
4049static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004050vec_vor(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004051{
David Blaikie3302f2b2013-01-16 23:08:36 +00004052 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004053}
4054
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004055static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004056vec_vor(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004057{
David Blaikie3302f2b2013-01-16 23:08:36 +00004058 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004059}
4060
Anton Yartsevfc83c602010-08-19 03:21:36 +00004061static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004062vec_vor(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004063{
David Blaikie3302f2b2013-01-16 23:08:36 +00004064 return (vector int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004065}
4066
4067static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004068vec_vor(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004069{
David Blaikie3302f2b2013-01-16 23:08:36 +00004070 return __a | (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004071}
4072
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004073static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004074vec_vor(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004075{
David Blaikie3302f2b2013-01-16 23:08:36 +00004076 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004077}
4078
Anton Yartsevfc83c602010-08-19 03:21:36 +00004079static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004080vec_vor(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004081{
David Blaikie3302f2b2013-01-16 23:08:36 +00004082 return (vector unsigned int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004083}
4084
4085static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004086vec_vor(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004087{
David Blaikie3302f2b2013-01-16 23:08:36 +00004088 return __a | (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004089}
4090
4091static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004092vec_vor(vector bool int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004093{
David Blaikie3302f2b2013-01-16 23:08:36 +00004094 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004095}
4096
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004097static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004098vec_vor(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004099{
David Blaikie3302f2b2013-01-16 23:08:36 +00004100 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4101 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004102}
4103
Anton Yartsevfc83c602010-08-19 03:21:36 +00004104static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004105vec_vor(vector bool int __a, vector float __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004106{
David Blaikie3302f2b2013-01-16 23:08:36 +00004107 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4108 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004109}
4110
4111static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004112vec_vor(vector float __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004113{
David Blaikie3302f2b2013-01-16 23:08:36 +00004114 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4115 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004116}
4117
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004118/* vec_pack */
4119
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004120/* The various vector pack instructions have a big-endian bias, so for
4121 little endian we must handle reversed element numbering. */
4122
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004123static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004124vec_pack(vector signed short __a, vector signed short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004125{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004126#ifdef __LITTLE_ENDIAN__
4127 return (vector signed char)vec_perm(__a, __b, (vector unsigned char)
4128 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4129 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4130#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004131 return (vector signed char)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004132 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4133 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004134#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004135}
4136
4137static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004138vec_pack(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004139{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004140#ifdef __LITTLE_ENDIAN__
4141 return (vector unsigned char)vec_perm(__a, __b, (vector unsigned char)
4142 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4143 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4144#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004145 return (vector unsigned char)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004146 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4147 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004148#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004149}
4150
Anton Yartsev9e968982010-08-19 03:00:09 +00004151static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004152vec_pack(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00004153{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004154#ifdef __LITTLE_ENDIAN__
4155 return (vector bool char)vec_perm(__a, __b, (vector unsigned char)
4156 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4157 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4158#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004159 return (vector bool char)vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00004160 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4161 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004162#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004163}
4164
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004165static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004166vec_pack(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004167{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004168#ifdef __LITTLE_ENDIAN__
4169 return (vector short)vec_perm(__a, __b, (vector unsigned char)
4170 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4171 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4172#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004173 return (vector short)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004174 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4175 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004176#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004177}
4178
4179static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004180vec_pack(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004181{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004182#ifdef __LITTLE_ENDIAN__
4183 return (vector unsigned short)vec_perm(__a, __b, (vector unsigned char)
4184 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4185 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4186#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004187 return (vector unsigned short)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004188 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4189 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004190#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004191}
4192
Anton Yartsev9e968982010-08-19 03:00:09 +00004193static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004194vec_pack(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00004195{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004196#ifdef __LITTLE_ENDIAN__
4197 return (vector unsigned short)vec_perm(__a, __b, (vector unsigned char)
4198 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4199 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4200#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004201 return (vector bool short)vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00004202 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4203 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004204#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004205}
4206
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004207/* vec_vpkuhum */
4208
4209#define __builtin_altivec_vpkuhum vec_vpkuhum
4210
4211static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004212vec_vpkuhum(vector signed short __a, vector signed short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004213{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004214#ifdef __LITTLE_ENDIAN__
4215 return (vector signed char)vec_perm(__a, __b, (vector unsigned char)
4216 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4217 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4218#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004219 return (vector signed char)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004220 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4221 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004222#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004223}
4224
4225static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004226vec_vpkuhum(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004227{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004228#ifdef __LITTLE_ENDIAN__
4229 return (vector unsigned char)vec_perm(__a, __b, (vector unsigned char)
4230 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4231 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4232#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004233 return (vector unsigned char)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004234 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4235 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004236#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004237}
4238
Anton Yartsev9e968982010-08-19 03:00:09 +00004239static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004240vec_vpkuhum(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00004241{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004242#ifdef __LITTLE_ENDIAN__
4243 return (vector bool char)vec_perm(__a, __b, (vector unsigned char)
4244 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4245 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4246#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004247 return (vector bool char)vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00004248 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4249 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004250#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004251}
4252
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004253/* vec_vpkuwum */
4254
4255#define __builtin_altivec_vpkuwum vec_vpkuwum
4256
4257static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004258vec_vpkuwum(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004259{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004260#ifdef __LITTLE_ENDIAN__
4261 return (vector short)vec_perm(__a, __b, (vector unsigned char)
4262 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4263 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4264#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004265 return (vector short)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004266 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4267 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004268#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004269}
4270
4271static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004272vec_vpkuwum(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004273{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004274#ifdef __LITTLE_ENDIAN__
4275 return (vector unsigned short)vec_perm(__a, __b, (vector unsigned char)
4276 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4277 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4278#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004279 return (vector unsigned short)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004280 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4281 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004282#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004283}
4284
Anton Yartsev9e968982010-08-19 03:00:09 +00004285static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004286vec_vpkuwum(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00004287{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004288#ifdef __LITTLE_ENDIAN__
4289 return (vector bool short)vec_perm(__a, __b, (vector unsigned char)
4290 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4291 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4292#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004293 return (vector bool short)vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00004294 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4295 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004296#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004297}
4298
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004299/* vec_packpx */
4300
4301static vector pixel __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004302vec_packpx(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004303{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004304#ifdef __LITTLE_ENDIAN__
4305 return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
4306#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004307 return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004308#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004309}
4310
4311/* vec_vpkpx */
4312
4313static vector pixel __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004314vec_vpkpx(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004315{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004316#ifdef __LITTLE_ENDIAN__
4317 return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
4318#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004319 return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004320#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004321}
4322
4323/* vec_packs */
4324
4325static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004326vec_packs(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004327{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004328#ifdef __LITTLE_ENDIAN__
4329 return __builtin_altivec_vpkshss(__b, __a);
4330#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004331 return __builtin_altivec_vpkshss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004332#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004333}
4334
4335static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004336vec_packs(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004337{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004338#ifdef __LITTLE_ENDIAN__
4339 return __builtin_altivec_vpkuhus(__b, __a);
4340#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004341 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004342#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004343}
4344
4345static vector signed short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004346vec_packs(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004347{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004348#ifdef __LITTLE_ENDIAN__
4349 return __builtin_altivec_vpkswss(__b, __a);
4350#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004351 return __builtin_altivec_vpkswss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004352#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004353}
4354
4355static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004356vec_packs(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004357{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004358#ifdef __LITTLE_ENDIAN__
4359 return __builtin_altivec_vpkuwus(__b, __a);
4360#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004361 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004362#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004363}
4364
4365/* vec_vpkshss */
4366
4367static vector signed char __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004368vec_vpkshss(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004369{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004370#ifdef __LITTLE_ENDIAN__
4371 return __builtin_altivec_vpkshss(__b, __a);
4372#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004373 return __builtin_altivec_vpkshss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004374#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004375}
4376
4377/* vec_vpkuhus */
4378
4379static vector unsigned char __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004380vec_vpkuhus(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004381{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004382#ifdef __LITTLE_ENDIAN__
4383 return __builtin_altivec_vpkuhus(__b, __a);
4384#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004385 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004386#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004387}
4388
4389/* vec_vpkswss */
4390
4391static vector signed short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004392vec_vpkswss(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004393{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004394#ifdef __LITTLE_ENDIAN__
4395 return __builtin_altivec_vpkswss(__b, __a);
4396#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004397 return __builtin_altivec_vpkswss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004398#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004399}
4400
4401/* vec_vpkuwus */
4402
4403static vector unsigned short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004404vec_vpkuwus(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004405{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004406#ifdef __LITTLE_ENDIAN__
4407 return __builtin_altivec_vpkuwus(__b, __a);
4408#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004409 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004410#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004411}
4412
4413/* vec_packsu */
4414
4415static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004416vec_packsu(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004417{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004418#ifdef __LITTLE_ENDIAN__
4419 return __builtin_altivec_vpkshus(__b, __a);
4420#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004421 return __builtin_altivec_vpkshus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004422#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004423}
4424
4425static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004426vec_packsu(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004427{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004428#ifdef __LITTLE_ENDIAN__
4429 return __builtin_altivec_vpkuhus(__b, __a);
4430#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004431 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004432#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004433}
4434
4435static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004436vec_packsu(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004437{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004438#ifdef __LITTLE_ENDIAN__
4439 return __builtin_altivec_vpkswus(__b, __a);
4440#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004441 return __builtin_altivec_vpkswus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004442#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004443}
4444
4445static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004446vec_packsu(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004447{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004448#ifdef __LITTLE_ENDIAN__
4449 return __builtin_altivec_vpkuwus(__b, __a);
4450#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004451 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004452#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004453}
4454
4455/* vec_vpkshus */
4456
4457static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004458vec_vpkshus(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004459{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004460#ifdef __LITTLE_ENDIAN__
4461 return __builtin_altivec_vpkshus(__b, __a);
4462#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004463 return __builtin_altivec_vpkshus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004464#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004465}
4466
4467static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004468vec_vpkshus(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004469{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004470#ifdef __LITTLE_ENDIAN__
4471 return __builtin_altivec_vpkuhus(__b, __a);
4472#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004473 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004474#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004475}
4476
4477/* vec_vpkswus */
4478
4479static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004480vec_vpkswus(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004481{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004482#ifdef __LITTLE_ENDIAN__
4483 return __builtin_altivec_vpkswus(__b, __a);
4484#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004485 return __builtin_altivec_vpkswus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004486#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004487}
4488
4489static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004490vec_vpkswus(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004491{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004492#ifdef __LITTLE_ENDIAN__
4493 return __builtin_altivec_vpkuwus(__b, __a);
4494#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004495 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004496#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004497}
4498
4499/* vec_perm */
4500
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004501// The vperm instruction is defined architecturally with a big-endian bias.
4502// For little endian, we swap the input operands and invert the permute
4503// control vector. Only the rightmost 5 bits matter, so we could use
4504// a vector of all 31s instead of all 255s to perform the inversion.
4505// However, when the PCV is not a constant, using 255 has an advantage
4506// in that the vec_xor can be recognized as a vec_nor (and for P8 and
4507// later, possibly a vec_nand).
4508
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004509vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004510vec_perm(vector signed char __a, vector signed char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004511{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004512#ifdef __LITTLE_ENDIAN__
4513 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4514 255,255,255,255,255,255,255,255};
4515 __d = vec_xor(__c, __d);
4516 return (vector signed char)
4517 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4518#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004519 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00004520 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004521#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004522}
4523
4524vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004525vec_perm(vector unsigned char __a,
4526 vector unsigned char __b,
4527 vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004528{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004529#ifdef __LITTLE_ENDIAN__
4530 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4531 255,255,255,255,255,255,255,255};
4532 __d = vec_xor(__c, __d);
4533 return (vector unsigned char)
4534 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4535#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004536 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00004537 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004538#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004539}
4540
Anton Yartsev9e968982010-08-19 03:00:09 +00004541vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004542vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00004543{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004544#ifdef __LITTLE_ENDIAN__
4545 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4546 255,255,255,255,255,255,255,255};
4547 __d = vec_xor(__c, __d);
4548 return (vector bool char)
4549 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4550#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004551 return (vector bool char)
David Blaikie3302f2b2013-01-16 23:08:36 +00004552 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004553#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004554}
4555
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004556vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004557vec_perm(vector short __a, vector short __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004558{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004559#ifdef __LITTLE_ENDIAN__
4560 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4561 255,255,255,255,255,255,255,255};
4562 __d = vec_xor(__c, __d);
4563 return (vector short)
4564 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4565#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004566 return (vector short)
David Blaikie3302f2b2013-01-16 23:08:36 +00004567 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004568#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004569}
4570
4571vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004572vec_perm(vector unsigned short __a,
4573 vector unsigned short __b,
4574 vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004575{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004576#ifdef __LITTLE_ENDIAN__
4577 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4578 255,255,255,255,255,255,255,255};
4579 __d = vec_xor(__c, __d);
4580 return (vector unsigned short)
4581 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4582#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004583 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00004584 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004585#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004586}
4587
Anton Yartsev9e968982010-08-19 03:00:09 +00004588vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004589vec_perm(vector bool short __a, vector bool short __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00004590{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004591#ifdef __LITTLE_ENDIAN__
4592 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4593 255,255,255,255,255,255,255,255};
4594 __d = vec_xor(__c, __d);
4595 return (vector bool short)
4596 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4597#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004598 return (vector bool short)
David Blaikie3302f2b2013-01-16 23:08:36 +00004599 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004600#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004601}
4602
4603vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004604vec_perm(vector pixel __a, vector pixel __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00004605{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004606#ifdef __LITTLE_ENDIAN__
4607 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4608 255,255,255,255,255,255,255,255};
4609 __d = vec_xor(__c, __d);
4610 return (vector pixel)
4611 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4612#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004613 return (vector pixel)
David Blaikie3302f2b2013-01-16 23:08:36 +00004614 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004615#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004616}
4617
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004618vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004619vec_perm(vector int __a, vector int __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004620{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004621#ifdef __LITTLE_ENDIAN__
4622 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4623 255,255,255,255,255,255,255,255};
4624 __d = vec_xor(__c, __d);
4625 return (vector int)__builtin_altivec_vperm_4si(__b, __a, __d);
4626#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004627 return (vector int)__builtin_altivec_vperm_4si(__a, __b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004628#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004629}
4630
4631vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004632vec_perm(vector unsigned int __a, vector unsigned int __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004633{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004634#ifdef __LITTLE_ENDIAN__
4635 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4636 255,255,255,255,255,255,255,255};
4637 __d = vec_xor(__c, __d);
4638 return (vector unsigned int)
4639 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4640#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004641 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00004642 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004643#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004644}
4645
Anton Yartsev9e968982010-08-19 03:00:09 +00004646vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004647vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00004648{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004649#ifdef __LITTLE_ENDIAN__
4650 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4651 255,255,255,255,255,255,255,255};
4652 __d = vec_xor(__c, __d);
4653 return (vector bool int)
4654 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4655#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004656 return (vector bool int)
David Blaikie3302f2b2013-01-16 23:08:36 +00004657 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004658#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004659}
4660
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004661vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004662vec_perm(vector float __a, vector float __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004663{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004664#ifdef __LITTLE_ENDIAN__
4665 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4666 255,255,255,255,255,255,255,255};
4667 __d = vec_xor(__c, __d);
4668 return (vector float)
4669 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4670#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004671 return (vector float)
David Blaikie3302f2b2013-01-16 23:08:36 +00004672 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004673#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004674}
4675
4676/* vec_vperm */
4677
Ulrich Weigand9936f132012-10-31 18:17:07 +00004678static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004679vec_vperm(vector signed char __a, vector signed char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004680{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004681 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004682}
4683
Ulrich Weigand9936f132012-10-31 18:17:07 +00004684static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004685vec_vperm(vector unsigned char __a,
4686 vector unsigned char __b,
4687 vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004688{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004689 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004690}
4691
Ulrich Weigand9936f132012-10-31 18:17:07 +00004692static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004693vec_vperm(vector bool char __a, vector bool char __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00004694{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004695 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00004696}
4697
Ulrich Weigand9936f132012-10-31 18:17:07 +00004698static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004699vec_vperm(vector short __a, vector short __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004700{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004701 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004702}
4703
Ulrich Weigand9936f132012-10-31 18:17:07 +00004704static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004705vec_vperm(vector unsigned short __a,
4706 vector unsigned short __b,
4707 vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004708{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004709 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004710}
4711
Ulrich Weigand9936f132012-10-31 18:17:07 +00004712static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004713vec_vperm(vector bool short __a, vector bool short __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00004714{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004715 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00004716}
4717
Ulrich Weigand9936f132012-10-31 18:17:07 +00004718static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004719vec_vperm(vector pixel __a, vector pixel __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00004720{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004721 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00004722}
4723
Ulrich Weigand9936f132012-10-31 18:17:07 +00004724static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004725vec_vperm(vector int __a, vector int __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004726{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004727 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004728}
4729
Ulrich Weigand9936f132012-10-31 18:17:07 +00004730static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004731vec_vperm(vector unsigned int __a, vector unsigned int __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004732{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004733 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004734}
4735
Ulrich Weigand9936f132012-10-31 18:17:07 +00004736static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004737vec_vperm(vector bool int __a, vector bool int __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00004738{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004739 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00004740}
4741
Ulrich Weigand9936f132012-10-31 18:17:07 +00004742static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004743vec_vperm(vector float __a, vector float __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004744{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004745 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004746}
4747
4748/* vec_re */
4749
Ulrich Weigand9936f132012-10-31 18:17:07 +00004750static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004751vec_re(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004752{
David Blaikie3302f2b2013-01-16 23:08:36 +00004753 return __builtin_altivec_vrefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004754}
4755
4756/* vec_vrefp */
4757
Ulrich Weigand9936f132012-10-31 18:17:07 +00004758static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004759vec_vrefp(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004760{
David Blaikie3302f2b2013-01-16 23:08:36 +00004761 return __builtin_altivec_vrefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004762}
4763
4764/* vec_rl */
4765
4766static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004767vec_rl(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004768{
David Blaikie3302f2b2013-01-16 23:08:36 +00004769 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004770}
4771
4772static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004773vec_rl(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004774{
David Blaikie3302f2b2013-01-16 23:08:36 +00004775 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004776}
4777
4778static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004779vec_rl(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004780{
David Blaikie3302f2b2013-01-16 23:08:36 +00004781 return __builtin_altivec_vrlh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004782}
4783
4784static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004785vec_rl(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004786{
David Blaikie3302f2b2013-01-16 23:08:36 +00004787 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004788}
4789
4790static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004791vec_rl(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004792{
David Blaikie3302f2b2013-01-16 23:08:36 +00004793 return __builtin_altivec_vrlw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004794}
4795
4796static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004797vec_rl(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004798{
David Blaikie3302f2b2013-01-16 23:08:36 +00004799 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004800}
4801
4802/* vec_vrlb */
4803
4804static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004805vec_vrlb(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004806{
David Blaikie3302f2b2013-01-16 23:08:36 +00004807 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004808}
4809
4810static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004811vec_vrlb(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004812{
David Blaikie3302f2b2013-01-16 23:08:36 +00004813 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004814}
4815
4816/* vec_vrlh */
4817
4818static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004819vec_vrlh(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004820{
David Blaikie3302f2b2013-01-16 23:08:36 +00004821 return __builtin_altivec_vrlh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004822}
4823
4824static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004825vec_vrlh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004826{
David Blaikie3302f2b2013-01-16 23:08:36 +00004827 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004828}
4829
4830/* vec_vrlw */
4831
4832static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004833vec_vrlw(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004834{
David Blaikie3302f2b2013-01-16 23:08:36 +00004835 return __builtin_altivec_vrlw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004836}
4837
4838static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004839vec_vrlw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004840{
David Blaikie3302f2b2013-01-16 23:08:36 +00004841 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004842}
4843
4844/* vec_round */
4845
4846static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004847vec_round(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004848{
David Blaikie3302f2b2013-01-16 23:08:36 +00004849 return __builtin_altivec_vrfin(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004850}
4851
4852/* vec_vrfin */
4853
4854static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004855vec_vrfin(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004856{
David Blaikie3302f2b2013-01-16 23:08:36 +00004857 return __builtin_altivec_vrfin(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004858}
4859
4860/* vec_rsqrte */
4861
4862static __vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004863vec_rsqrte(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004864{
David Blaikie3302f2b2013-01-16 23:08:36 +00004865 return __builtin_altivec_vrsqrtefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004866}
4867
4868/* vec_vrsqrtefp */
4869
4870static __vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004871vec_vrsqrtefp(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004872{
David Blaikie3302f2b2013-01-16 23:08:36 +00004873 return __builtin_altivec_vrsqrtefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004874}
4875
4876/* vec_sel */
4877
4878#define __builtin_altivec_vsel_4si vec_sel
4879
4880static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004881vec_sel(vector signed char __a, vector signed char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004882{
David Blaikie3302f2b2013-01-16 23:08:36 +00004883 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004884}
4885
Anton Yartsevfc83c602010-08-19 03:21:36 +00004886static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004887vec_sel(vector signed char __a, vector signed char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004888{
David Blaikie3302f2b2013-01-16 23:08:36 +00004889 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00004890}
4891
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004892static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004893vec_sel(vector unsigned char __a, vector unsigned char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004894{
David Blaikie3302f2b2013-01-16 23:08:36 +00004895 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004896}
4897
Anton Yartsevfc83c602010-08-19 03:21:36 +00004898static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004899vec_sel(vector unsigned char __a, vector unsigned char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004900{
David Blaikie3302f2b2013-01-16 23:08:36 +00004901 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00004902}
4903
4904static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004905vec_sel(vector bool char __a, vector bool char __b, vector unsigned char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004906{
David Blaikie3302f2b2013-01-16 23:08:36 +00004907 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00004908}
4909
4910static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004911vec_sel(vector bool char __a, vector bool char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004912{
David Blaikie3302f2b2013-01-16 23:08:36 +00004913 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00004914}
4915
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004916static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004917vec_sel(vector short __a, vector short __b, vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004918{
David Blaikie3302f2b2013-01-16 23:08:36 +00004919 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004920}
4921
Anton Yartsevfc83c602010-08-19 03:21:36 +00004922static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004923vec_sel(vector short __a, vector short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004924{
David Blaikie3302f2b2013-01-16 23:08:36 +00004925 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00004926}
4927
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004928static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004929vec_sel(vector unsigned short __a,
4930 vector unsigned short __b,
4931 vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004932{
David Blaikie3302f2b2013-01-16 23:08:36 +00004933 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004934}
4935
Anton Yartsevfc83c602010-08-19 03:21:36 +00004936static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004937vec_sel(vector unsigned short __a, vector unsigned short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004938{
David Blaikie3302f2b2013-01-16 23:08:36 +00004939 return (__a & ~(vector unsigned short)__c) | (__b & (vector unsigned short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00004940}
4941
4942static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004943vec_sel(vector bool short __a, vector bool short __b, vector unsigned short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004944{
David Blaikie3302f2b2013-01-16 23:08:36 +00004945 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00004946}
4947
4948static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004949vec_sel(vector bool short __a, vector bool short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004950{
David Blaikie3302f2b2013-01-16 23:08:36 +00004951 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00004952}
4953
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004954static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004955vec_sel(vector int __a, vector int __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004956{
David Blaikie3302f2b2013-01-16 23:08:36 +00004957 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004958}
4959
Anton Yartsevfc83c602010-08-19 03:21:36 +00004960static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004961vec_sel(vector int __a, vector int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004962{
David Blaikie3302f2b2013-01-16 23:08:36 +00004963 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00004964}
4965
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004966static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004967vec_sel(vector unsigned int __a, vector unsigned int __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004968{
David Blaikie3302f2b2013-01-16 23:08:36 +00004969 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004970}
4971
Anton Yartsevfc83c602010-08-19 03:21:36 +00004972static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004973vec_sel(vector unsigned int __a, vector unsigned int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004974{
David Blaikie3302f2b2013-01-16 23:08:36 +00004975 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00004976}
4977
4978static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004979vec_sel(vector bool int __a, vector bool int __b, vector unsigned int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004980{
David Blaikie3302f2b2013-01-16 23:08:36 +00004981 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00004982}
4983
4984static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004985vec_sel(vector bool int __a, vector bool int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004986{
David Blaikie3302f2b2013-01-16 23:08:36 +00004987 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00004988}
4989
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004990static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004991vec_sel(vector float __a, vector float __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004992{
David Blaikie3302f2b2013-01-16 23:08:36 +00004993 vector int __res = ((vector int)__a & ~(vector int)__c)
4994 | ((vector int)__b & (vector int)__c);
4995 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004996}
4997
Anton Yartsevfc83c602010-08-19 03:21:36 +00004998static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004999vec_sel(vector float __a, vector float __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005000{
David Blaikie3302f2b2013-01-16 23:08:36 +00005001 vector int __res = ((vector int)__a & ~(vector int)__c)
5002 | ((vector int)__b & (vector int)__c);
5003 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00005004}
5005
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005006/* vec_vsel */
5007
5008static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005009vec_vsel(vector signed char __a, vector signed char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005010{
David Blaikie3302f2b2013-01-16 23:08:36 +00005011 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005012}
5013
Anton Yartsevfc83c602010-08-19 03:21:36 +00005014static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005015vec_vsel(vector signed char __a, vector signed char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005016{
David Blaikie3302f2b2013-01-16 23:08:36 +00005017 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005018}
5019
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005020static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005021vec_vsel(vector unsigned char __a, vector unsigned char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005022{
David Blaikie3302f2b2013-01-16 23:08:36 +00005023 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005024}
5025
Anton Yartsevfc83c602010-08-19 03:21:36 +00005026static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005027vec_vsel(vector unsigned char __a, vector unsigned char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005028{
David Blaikie3302f2b2013-01-16 23:08:36 +00005029 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005030}
5031
5032static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005033vec_vsel(vector bool char __a, vector bool char __b, vector unsigned char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005034{
David Blaikie3302f2b2013-01-16 23:08:36 +00005035 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005036}
5037
5038static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005039vec_vsel(vector bool char __a, vector bool char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005040{
David Blaikie3302f2b2013-01-16 23:08:36 +00005041 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005042}
5043
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005044static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005045vec_vsel(vector short __a, vector short __b, vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005046{
David Blaikie3302f2b2013-01-16 23:08:36 +00005047 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005048}
5049
Anton Yartsevfc83c602010-08-19 03:21:36 +00005050static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005051vec_vsel(vector short __a, vector short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005052{
David Blaikie3302f2b2013-01-16 23:08:36 +00005053 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005054}
5055
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005056static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005057vec_vsel(vector unsigned short __a,
5058 vector unsigned short __b,
5059 vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005060{
David Blaikie3302f2b2013-01-16 23:08:36 +00005061 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005062}
5063
Anton Yartsevfc83c602010-08-19 03:21:36 +00005064static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005065vec_vsel(vector unsigned short __a, vector unsigned short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005066{
David Blaikie3302f2b2013-01-16 23:08:36 +00005067 return (__a & ~(vector unsigned short)__c) | (__b & (vector unsigned short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005068}
5069
5070static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005071vec_vsel(vector bool short __a, vector bool short __b, vector unsigned short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005072{
David Blaikie3302f2b2013-01-16 23:08:36 +00005073 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005074}
5075
5076static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005077vec_vsel(vector bool short __a, vector bool short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005078{
David Blaikie3302f2b2013-01-16 23:08:36 +00005079 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005080}
5081
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005082static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005083vec_vsel(vector int __a, vector int __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005084{
David Blaikie3302f2b2013-01-16 23:08:36 +00005085 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005086}
5087
Anton Yartsevfc83c602010-08-19 03:21:36 +00005088static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005089vec_vsel(vector int __a, vector int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005090{
David Blaikie3302f2b2013-01-16 23:08:36 +00005091 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005092}
5093
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005094static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005095vec_vsel(vector unsigned int __a, vector unsigned int __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005096{
David Blaikie3302f2b2013-01-16 23:08:36 +00005097 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005098}
5099
Anton Yartsevfc83c602010-08-19 03:21:36 +00005100static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005101vec_vsel(vector unsigned int __a, vector unsigned int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005102{
David Blaikie3302f2b2013-01-16 23:08:36 +00005103 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005104}
5105
5106static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005107vec_vsel(vector bool int __a, vector bool int __b, vector unsigned int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005108{
David Blaikie3302f2b2013-01-16 23:08:36 +00005109 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005110}
5111
5112static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005113vec_vsel(vector bool int __a, vector bool int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005114{
David Blaikie3302f2b2013-01-16 23:08:36 +00005115 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005116}
5117
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005118static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005119vec_vsel(vector float __a, vector float __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005120{
David Blaikie3302f2b2013-01-16 23:08:36 +00005121 vector int __res = ((vector int)__a & ~(vector int)__c)
5122 | ((vector int)__b & (vector int)__c);
5123 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005124}
5125
Anton Yartsevfc83c602010-08-19 03:21:36 +00005126static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005127vec_vsel(vector float __a, vector float __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005128{
David Blaikie3302f2b2013-01-16 23:08:36 +00005129 vector int __res = ((vector int)__a & ~(vector int)__c)
5130 | ((vector int)__b & (vector int)__c);
5131 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00005132}
5133
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005134/* vec_sl */
5135
5136static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005137vec_sl(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005138{
David Blaikie3302f2b2013-01-16 23:08:36 +00005139 return __a << (vector signed char)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005140}
5141
5142static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005143vec_sl(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005144{
David Blaikie3302f2b2013-01-16 23:08:36 +00005145 return __a << __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005146}
5147
5148static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005149vec_sl(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005150{
David Blaikie3302f2b2013-01-16 23:08:36 +00005151 return __a << (vector short)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005152}
5153
5154static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005155vec_sl(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005156{
David Blaikie3302f2b2013-01-16 23:08:36 +00005157 return __a << __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005158}
5159
5160static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005161vec_sl(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005162{
David Blaikie3302f2b2013-01-16 23:08:36 +00005163 return __a << (vector int)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005164}
5165
5166static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005167vec_sl(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005168{
David Blaikie3302f2b2013-01-16 23:08:36 +00005169 return __a << __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005170}
5171
5172/* vec_vslb */
5173
5174#define __builtin_altivec_vslb vec_vslb
5175
5176static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005177vec_vslb(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005178{
David Blaikie3302f2b2013-01-16 23:08:36 +00005179 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005180}
5181
5182static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005183vec_vslb(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005184{
David Blaikie3302f2b2013-01-16 23:08:36 +00005185 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005186}
5187
5188/* vec_vslh */
5189
5190#define __builtin_altivec_vslh vec_vslh
5191
5192static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005193vec_vslh(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005194{
David Blaikie3302f2b2013-01-16 23:08:36 +00005195 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005196}
5197
5198static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005199vec_vslh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005200{
David Blaikie3302f2b2013-01-16 23:08:36 +00005201 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005202}
5203
5204/* vec_vslw */
5205
5206#define __builtin_altivec_vslw vec_vslw
5207
5208static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005209vec_vslw(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005210{
David Blaikie3302f2b2013-01-16 23:08:36 +00005211 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005212}
5213
5214static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005215vec_vslw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005216{
David Blaikie3302f2b2013-01-16 23:08:36 +00005217 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005218}
5219
5220/* vec_sld */
5221
5222#define __builtin_altivec_vsldoi_4si vec_sld
5223
5224static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005225vec_sld(vector signed char __a, vector signed char __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005226{
David Blaikie3302f2b2013-01-16 23:08:36 +00005227 return vec_perm(__a, __b, (vector unsigned char)
5228 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5229 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005230}
5231
5232static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005233vec_sld(vector unsigned char __a, vector unsigned char __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005234{
David Blaikie3302f2b2013-01-16 23:08:36 +00005235 return vec_perm(__a, __b, (vector unsigned char)
5236 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5237 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005238}
5239
5240static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005241vec_sld(vector short __a, vector short __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005242{
David Blaikie3302f2b2013-01-16 23:08:36 +00005243 return vec_perm(__a, __b, (vector unsigned char)
5244 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5245 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005246}
5247
5248static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005249vec_sld(vector unsigned short __a, vector unsigned short __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005250{
David Blaikie3302f2b2013-01-16 23:08:36 +00005251 return vec_perm(__a, __b, (vector unsigned char)
5252 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5253 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Yartsev9e968982010-08-19 03:00:09 +00005254}
5255
5256static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005257vec_sld(vector pixel __a, vector pixel __b, unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00005258{
David Blaikie3302f2b2013-01-16 23:08:36 +00005259 return vec_perm(__a, __b, (vector unsigned char)
5260 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5261 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005262}
5263
5264static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005265vec_sld(vector int __a, vector int __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005266{
David Blaikie3302f2b2013-01-16 23:08:36 +00005267 return vec_perm(__a, __b, (vector unsigned char)
5268 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5269 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005270}
5271
5272static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005273vec_sld(vector unsigned int __a, vector unsigned int __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005274{
David Blaikie3302f2b2013-01-16 23:08:36 +00005275 return vec_perm(__a, __b, (vector unsigned char)
5276 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5277 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005278}
5279
5280static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005281vec_sld(vector float __a, vector float __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005282{
David Blaikie3302f2b2013-01-16 23:08:36 +00005283 return vec_perm(__a, __b, (vector unsigned char)
5284 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5285 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005286}
5287
5288/* vec_vsldoi */
5289
5290static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005291vec_vsldoi(vector signed char __a, vector signed char __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005292{
David Blaikie3302f2b2013-01-16 23:08:36 +00005293 return vec_perm(__a, __b, (vector unsigned char)
5294 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5295 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005296}
5297
5298static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005299vec_vsldoi(vector unsigned char __a, vector unsigned char __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005300{
David Blaikie3302f2b2013-01-16 23:08:36 +00005301 return vec_perm(__a, __b, (vector unsigned char)
5302 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5303 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005304}
5305
5306static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005307vec_vsldoi(vector short __a, vector short __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005308{
David Blaikie3302f2b2013-01-16 23:08:36 +00005309 return vec_perm(__a, __b, (vector unsigned char)
5310 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5311 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005312}
5313
5314static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005315vec_vsldoi(vector unsigned short __a, vector unsigned short __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005316{
David Blaikie3302f2b2013-01-16 23:08:36 +00005317 return vec_perm(__a, __b, (vector unsigned char)
5318 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5319 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Yartsev9e968982010-08-19 03:00:09 +00005320}
5321
5322static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005323vec_vsldoi(vector pixel __a, vector pixel __b, unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00005324{
David Blaikie3302f2b2013-01-16 23:08:36 +00005325 return vec_perm(__a, __b, (vector unsigned char)
5326 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5327 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005328}
5329
5330static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005331vec_vsldoi(vector int __a, vector int __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005332{
David Blaikie3302f2b2013-01-16 23:08:36 +00005333 return vec_perm(__a, __b, (vector unsigned char)
5334 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5335 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005336}
5337
5338static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005339vec_vsldoi(vector unsigned int __a, vector unsigned int __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005340{
David Blaikie3302f2b2013-01-16 23:08:36 +00005341 return vec_perm(__a, __b, (vector unsigned char)
5342 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5343 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005344}
5345
5346static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005347vec_vsldoi(vector float __a, vector float __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005348{
David Blaikie3302f2b2013-01-16 23:08:36 +00005349 return vec_perm(__a, __b, (vector unsigned char)
5350 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5351 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005352}
5353
5354/* vec_sll */
5355
5356static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005357vec_sll(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005358{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005359 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005360 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005361}
5362
5363static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005364vec_sll(vector signed char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005365{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005366 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005367 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005368}
5369
5370static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005371vec_sll(vector signed char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005372{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005373 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005374 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005375}
5376
5377static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005378vec_sll(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005379{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005380 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005381 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005382}
5383
5384static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005385vec_sll(vector unsigned char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005386{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005387 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005388 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005389}
5390
5391static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005392vec_sll(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005393{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005394 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005395 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005396}
5397
Anton Yartsevfc83c602010-08-19 03:21:36 +00005398static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005399vec_sll(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005400{
David Blaikie3302f2b2013-01-16 23:08:36 +00005401 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005402}
5403
5404static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005405vec_sll(vector bool char __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005406{
David Blaikie3302f2b2013-01-16 23:08:36 +00005407 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005408}
5409
5410static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005411vec_sll(vector bool char __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005412{
David Blaikie3302f2b2013-01-16 23:08:36 +00005413 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005414}
5415
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005416static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005417vec_sll(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005418{
David Blaikie3302f2b2013-01-16 23:08:36 +00005419 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005420}
5421
5422static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005423vec_sll(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005424{
David Blaikie3302f2b2013-01-16 23:08:36 +00005425 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005426}
5427
5428static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005429vec_sll(vector short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005430{
David Blaikie3302f2b2013-01-16 23:08:36 +00005431 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005432}
5433
5434static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005435vec_sll(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005436{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005437 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00005438 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005439}
5440
5441static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005442vec_sll(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005443{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005444 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00005445 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005446}
5447
5448static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005449vec_sll(vector unsigned short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005450{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005451 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00005452 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005453}
5454
Anton Yartsevfc83c602010-08-19 03:21:36 +00005455static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005456vec_sll(vector bool short __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005457{
David Blaikie3302f2b2013-01-16 23:08:36 +00005458 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005459}
5460
5461static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005462vec_sll(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005463{
David Blaikie3302f2b2013-01-16 23:08:36 +00005464 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005465}
5466
5467static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005468vec_sll(vector bool short __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005469{
David Blaikie3302f2b2013-01-16 23:08:36 +00005470 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005471}
5472
5473static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005474vec_sll(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005475{
David Blaikie3302f2b2013-01-16 23:08:36 +00005476 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005477}
5478
5479static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005480vec_sll(vector pixel __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005481{
David Blaikie3302f2b2013-01-16 23:08:36 +00005482 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005483}
5484
5485static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005486vec_sll(vector pixel __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005487{
David Blaikie3302f2b2013-01-16 23:08:36 +00005488 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005489}
5490
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005491static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005492vec_sll(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005493{
David Blaikie3302f2b2013-01-16 23:08:36 +00005494 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005495}
5496
5497static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005498vec_sll(vector int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005499{
David Blaikie3302f2b2013-01-16 23:08:36 +00005500 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005501}
5502
5503static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005504vec_sll(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005505{
David Blaikie3302f2b2013-01-16 23:08:36 +00005506 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005507}
5508
5509static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005510vec_sll(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005511{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005512 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00005513 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005514}
5515
5516static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005517vec_sll(vector unsigned int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005518{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005519 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00005520 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005521}
5522
5523static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005524vec_sll(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005525{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005526 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00005527 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005528}
5529
Anton Yartsevfc83c602010-08-19 03:21:36 +00005530static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005531vec_sll(vector bool int __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005532{
David Blaikie3302f2b2013-01-16 23:08:36 +00005533 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005534}
5535
5536static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005537vec_sll(vector bool int __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005538{
David Blaikie3302f2b2013-01-16 23:08:36 +00005539 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005540}
5541
5542static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005543vec_sll(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005544{
David Blaikie3302f2b2013-01-16 23:08:36 +00005545 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005546}
5547
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005548/* vec_vsl */
5549
5550static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005551vec_vsl(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005552{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005553 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005554 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005555}
5556
5557static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005558vec_vsl(vector signed char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005559{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005560 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005561 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005562}
5563
5564static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005565vec_vsl(vector signed char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005566{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005567 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005568 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005569}
5570
5571static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005572vec_vsl(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005573{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005574 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005575 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005576}
5577
5578static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005579vec_vsl(vector unsigned char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005580{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005581 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005582 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005583}
5584
5585static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005586vec_vsl(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005587{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005588 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005589 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005590}
5591
Anton Yartsevfc83c602010-08-19 03:21:36 +00005592static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005593vec_vsl(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005594{
David Blaikie3302f2b2013-01-16 23:08:36 +00005595 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005596}
5597
5598static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005599vec_vsl(vector bool char __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005600{
David Blaikie3302f2b2013-01-16 23:08:36 +00005601 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005602}
5603
5604static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005605vec_vsl(vector bool char __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005606{
David Blaikie3302f2b2013-01-16 23:08:36 +00005607 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005608}
5609
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005610static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005611vec_vsl(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005612{
David Blaikie3302f2b2013-01-16 23:08:36 +00005613 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005614}
5615
5616static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005617vec_vsl(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005618{
David Blaikie3302f2b2013-01-16 23:08:36 +00005619 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005620}
5621
5622static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005623vec_vsl(vector short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005624{
David Blaikie3302f2b2013-01-16 23:08:36 +00005625 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005626}
5627
5628static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005629vec_vsl(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005630{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005631 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00005632 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005633}
5634
5635static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005636vec_vsl(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005637{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005638 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00005639 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005640}
5641
5642static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005643vec_vsl(vector unsigned short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005644{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005645 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00005646 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005647}
5648
Anton Yartsevfc83c602010-08-19 03:21:36 +00005649static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005650vec_vsl(vector bool short __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005651{
David Blaikie3302f2b2013-01-16 23:08:36 +00005652 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005653}
5654
5655static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005656vec_vsl(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005657{
David Blaikie3302f2b2013-01-16 23:08:36 +00005658 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005659}
5660
5661static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005662vec_vsl(vector bool short __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005663{
David Blaikie3302f2b2013-01-16 23:08:36 +00005664 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005665}
5666
5667static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005668vec_vsl(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005669{
David Blaikie3302f2b2013-01-16 23:08:36 +00005670 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005671}
5672
5673static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005674vec_vsl(vector pixel __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005675{
David Blaikie3302f2b2013-01-16 23:08:36 +00005676 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005677}
5678
5679static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005680vec_vsl(vector pixel __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005681{
David Blaikie3302f2b2013-01-16 23:08:36 +00005682 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005683}
5684
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005685static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005686vec_vsl(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005687{
David Blaikie3302f2b2013-01-16 23:08:36 +00005688 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005689}
5690
5691static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005692vec_vsl(vector int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005693{
David Blaikie3302f2b2013-01-16 23:08:36 +00005694 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005695}
5696
5697static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005698vec_vsl(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005699{
David Blaikie3302f2b2013-01-16 23:08:36 +00005700 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005701}
5702
5703static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005704vec_vsl(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005705{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005706 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00005707 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005708}
5709
5710static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005711vec_vsl(vector unsigned int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005712{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005713 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00005714 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005715}
5716
5717static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005718vec_vsl(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005719{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005720 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00005721 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005722}
5723
Anton Yartsevfc83c602010-08-19 03:21:36 +00005724static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005725vec_vsl(vector bool int __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005726{
David Blaikie3302f2b2013-01-16 23:08:36 +00005727 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005728}
5729
5730static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005731vec_vsl(vector bool int __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005732{
David Blaikie3302f2b2013-01-16 23:08:36 +00005733 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005734}
5735
5736static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005737vec_vsl(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005738{
David Blaikie3302f2b2013-01-16 23:08:36 +00005739 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005740}
5741
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005742/* vec_slo */
5743
5744static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005745vec_slo(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005746{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005747 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005748 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005749}
5750
5751static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005752vec_slo(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005753{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005754 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005755 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005756}
5757
5758static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005759vec_slo(vector unsigned char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005760{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005761 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005762 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005763}
5764
5765static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005766vec_slo(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005767{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005768 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005769 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005770}
5771
5772static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005773vec_slo(vector short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005774{
David Blaikie3302f2b2013-01-16 23:08:36 +00005775 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005776}
5777
5778static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005779vec_slo(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005780{
David Blaikie3302f2b2013-01-16 23:08:36 +00005781 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005782}
5783
5784static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005785vec_slo(vector unsigned short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005786{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005787 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00005788 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005789}
5790
5791static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005792vec_slo(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005793{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005794 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00005795 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005796}
5797
Anton Yartsevfc83c602010-08-19 03:21:36 +00005798static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005799vec_slo(vector pixel __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005800{
David Blaikie3302f2b2013-01-16 23:08:36 +00005801 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005802}
5803
5804static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005805vec_slo(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005806{
David Blaikie3302f2b2013-01-16 23:08:36 +00005807 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005808}
5809
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005810static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005811vec_slo(vector int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005812{
David Blaikie3302f2b2013-01-16 23:08:36 +00005813 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005814}
5815
5816static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005817vec_slo(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005818{
David Blaikie3302f2b2013-01-16 23:08:36 +00005819 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005820}
5821
5822static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005823vec_slo(vector unsigned int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005824{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005825 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00005826 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005827}
5828
5829static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005830vec_slo(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005831{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005832 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00005833 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005834}
5835
5836static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005837vec_slo(vector float __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005838{
David Blaikie3302f2b2013-01-16 23:08:36 +00005839 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005840}
5841
5842static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005843vec_slo(vector float __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005844{
David Blaikie3302f2b2013-01-16 23:08:36 +00005845 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005846}
5847
5848/* vec_vslo */
5849
5850static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005851vec_vslo(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005852{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005853 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005854 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005855}
5856
5857static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005858vec_vslo(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005859{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005860 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005861 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005862}
5863
5864static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005865vec_vslo(vector unsigned char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005866{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005867 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005868 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005869}
5870
5871static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005872vec_vslo(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005873{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005874 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005875 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005876}
5877
5878static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005879vec_vslo(vector short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005880{
David Blaikie3302f2b2013-01-16 23:08:36 +00005881 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005882}
5883
5884static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005885vec_vslo(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005886{
David Blaikie3302f2b2013-01-16 23:08:36 +00005887 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005888}
5889
5890static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005891vec_vslo(vector unsigned short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005892{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005893 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00005894 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005895}
5896
5897static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005898vec_vslo(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005899{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005900 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00005901 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005902}
5903
Anton Yartsevfc83c602010-08-19 03:21:36 +00005904static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005905vec_vslo(vector pixel __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005906{
David Blaikie3302f2b2013-01-16 23:08:36 +00005907 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005908}
5909
5910static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005911vec_vslo(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005912{
David Blaikie3302f2b2013-01-16 23:08:36 +00005913 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005914}
5915
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005916static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005917vec_vslo(vector int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005918{
David Blaikie3302f2b2013-01-16 23:08:36 +00005919 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005920}
5921
5922static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005923vec_vslo(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005924{
David Blaikie3302f2b2013-01-16 23:08:36 +00005925 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005926}
5927
5928static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005929vec_vslo(vector unsigned int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005930{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005931 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00005932 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005933}
5934
5935static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005936vec_vslo(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005937{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005938 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00005939 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005940}
5941
5942static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005943vec_vslo(vector float __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005944{
David Blaikie3302f2b2013-01-16 23:08:36 +00005945 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005946}
5947
5948static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005949vec_vslo(vector float __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005950{
David Blaikie3302f2b2013-01-16 23:08:36 +00005951 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005952}
5953
5954/* vec_splat */
5955
5956static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005957vec_splat(vector signed char __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005958{
David Blaikie3302f2b2013-01-16 23:08:36 +00005959 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005960}
5961
5962static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005963vec_splat(vector unsigned char __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005964{
David Blaikie3302f2b2013-01-16 23:08:36 +00005965 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Yartsev9e968982010-08-19 03:00:09 +00005966}
5967
5968static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005969vec_splat(vector bool char __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00005970{
David Blaikie3302f2b2013-01-16 23:08:36 +00005971 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005972}
5973
5974static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005975vec_splat(vector short __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005976{
David Blaikie3302f2b2013-01-16 23:08:36 +00005977 __b *= 2;
5978 unsigned char b1=__b+1;
5979 return vec_perm(__a, __a, (vector unsigned char)
5980 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005981}
5982
5983static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005984vec_splat(vector unsigned short __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005985{
David Blaikie3302f2b2013-01-16 23:08:36 +00005986 __b *= 2;
5987 unsigned char b1=__b+1;
5988 return vec_perm(__a, __a, (vector unsigned char)
5989 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00005990}
5991
5992static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005993vec_splat(vector bool short __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00005994{
David Blaikie3302f2b2013-01-16 23:08:36 +00005995 __b *= 2;
5996 unsigned char b1=__b+1;
5997 return vec_perm(__a, __a, (vector unsigned char)
5998 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00005999}
6000
6001static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006002vec_splat(vector pixel __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006003{
David Blaikie3302f2b2013-01-16 23:08:36 +00006004 __b *= 2;
6005 unsigned char b1=__b+1;
6006 return vec_perm(__a, __a, (vector unsigned char)
6007 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006008}
6009
6010static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006011vec_splat(vector int __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006012{
David Blaikie3302f2b2013-01-16 23:08:36 +00006013 __b *= 4;
6014 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6015 return vec_perm(__a, __a, (vector unsigned char)
6016 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006017}
6018
6019static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006020vec_splat(vector unsigned int __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006021{
David Blaikie3302f2b2013-01-16 23:08:36 +00006022 __b *= 4;
6023 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6024 return vec_perm(__a, __a, (vector unsigned char)
6025 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Yartsev9e968982010-08-19 03:00:09 +00006026}
6027
6028static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006029vec_splat(vector bool int __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006030{
David Blaikie3302f2b2013-01-16 23:08:36 +00006031 __b *= 4;
6032 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6033 return vec_perm(__a, __a, (vector unsigned char)
6034 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006035}
6036
6037static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006038vec_splat(vector float __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006039{
David Blaikie3302f2b2013-01-16 23:08:36 +00006040 __b *= 4;
6041 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6042 return vec_perm(__a, __a, (vector unsigned char)
6043 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006044}
6045
6046/* vec_vspltb */
6047
6048#define __builtin_altivec_vspltb vec_vspltb
6049
6050static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006051vec_vspltb(vector signed char __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006052{
David Blaikie3302f2b2013-01-16 23:08:36 +00006053 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006054}
6055
6056static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006057vec_vspltb(vector unsigned char __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006058{
David Blaikie3302f2b2013-01-16 23:08:36 +00006059 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Yartsev9e968982010-08-19 03:00:09 +00006060}
6061
6062static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006063vec_vspltb(vector bool char __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006064{
David Blaikie3302f2b2013-01-16 23:08:36 +00006065 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006066}
6067
6068/* vec_vsplth */
6069
6070#define __builtin_altivec_vsplth vec_vsplth
6071
6072static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006073vec_vsplth(vector short __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006074{
David Blaikie3302f2b2013-01-16 23:08:36 +00006075 __b *= 2;
6076 unsigned char b1=__b+1;
6077 return vec_perm(__a, __a, (vector unsigned char)
6078 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006079}
6080
6081static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006082vec_vsplth(vector unsigned short __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006083{
David Blaikie3302f2b2013-01-16 23:08:36 +00006084 __b *= 2;
6085 unsigned char b1=__b+1;
6086 return vec_perm(__a, __a, (vector unsigned char)
6087 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00006088}
6089
6090static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006091vec_vsplth(vector bool short __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006092{
David Blaikie3302f2b2013-01-16 23:08:36 +00006093 __b *= 2;
6094 unsigned char b1=__b+1;
6095 return vec_perm(__a, __a, (vector unsigned char)
6096 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00006097}
6098
6099static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006100vec_vsplth(vector pixel __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006101{
David Blaikie3302f2b2013-01-16 23:08:36 +00006102 __b *= 2;
6103 unsigned char b1=__b+1;
6104 return vec_perm(__a, __a, (vector unsigned char)
6105 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006106}
6107
6108/* vec_vspltw */
6109
6110#define __builtin_altivec_vspltw vec_vspltw
6111
6112static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006113vec_vspltw(vector int __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006114{
David Blaikie3302f2b2013-01-16 23:08:36 +00006115 __b *= 4;
6116 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6117 return vec_perm(__a, __a, (vector unsigned char)
6118 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006119}
6120
6121static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006122vec_vspltw(vector unsigned int __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006123{
David Blaikie3302f2b2013-01-16 23:08:36 +00006124 __b *= 4;
6125 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6126 return vec_perm(__a, __a, (vector unsigned char)
6127 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Yartsev9e968982010-08-19 03:00:09 +00006128}
6129
6130static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006131vec_vspltw(vector bool int __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006132{
David Blaikie3302f2b2013-01-16 23:08:36 +00006133 __b *= 4;
6134 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6135 return vec_perm(__a, __a, (vector unsigned char)
6136 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006137}
6138
6139static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006140vec_vspltw(vector float __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006141{
David Blaikie3302f2b2013-01-16 23:08:36 +00006142 __b *= 4;
6143 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6144 return vec_perm(__a, __a, (vector unsigned char)
6145 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006146}
6147
6148/* vec_splat_s8 */
6149
6150#define __builtin_altivec_vspltisb vec_splat_s8
6151
6152// FIXME: parameter should be treated as 5-bit signed literal
6153static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006154vec_splat_s8(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006155{
David Blaikie3302f2b2013-01-16 23:08:36 +00006156 return (vector signed char)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006157}
6158
6159/* vec_vspltisb */
6160
6161// FIXME: parameter should be treated as 5-bit signed literal
6162static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006163vec_vspltisb(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006164{
David Blaikie3302f2b2013-01-16 23:08:36 +00006165 return (vector signed char)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006166}
6167
6168/* vec_splat_s16 */
6169
6170#define __builtin_altivec_vspltish vec_splat_s16
6171
6172// FIXME: parameter should be treated as 5-bit signed literal
6173static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006174vec_splat_s16(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006175{
David Blaikie3302f2b2013-01-16 23:08:36 +00006176 return (vector short)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006177}
6178
6179/* vec_vspltish */
6180
6181// FIXME: parameter should be treated as 5-bit signed literal
6182static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006183vec_vspltish(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006184{
David Blaikie3302f2b2013-01-16 23:08:36 +00006185 return (vector short)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006186}
6187
6188/* vec_splat_s32 */
6189
6190#define __builtin_altivec_vspltisw vec_splat_s32
6191
6192// FIXME: parameter should be treated as 5-bit signed literal
6193static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006194vec_splat_s32(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006195{
David Blaikie3302f2b2013-01-16 23:08:36 +00006196 return (vector int)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006197}
6198
6199/* vec_vspltisw */
6200
6201// FIXME: parameter should be treated as 5-bit signed literal
6202static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006203vec_vspltisw(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006204{
David Blaikie3302f2b2013-01-16 23:08:36 +00006205 return (vector int)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006206}
6207
6208/* vec_splat_u8 */
6209
6210// FIXME: parameter should be treated as 5-bit signed literal
6211static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006212vec_splat_u8(unsigned char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006213{
David Blaikie3302f2b2013-01-16 23:08:36 +00006214 return (vector unsigned char)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006215}
6216
6217/* vec_splat_u16 */
6218
6219// FIXME: parameter should be treated as 5-bit signed literal
6220static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006221vec_splat_u16(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006222{
David Blaikie3302f2b2013-01-16 23:08:36 +00006223 return (vector unsigned short)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006224}
6225
6226/* vec_splat_u32 */
6227
6228// FIXME: parameter should be treated as 5-bit signed literal
6229static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006230vec_splat_u32(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006231{
David Blaikie3302f2b2013-01-16 23:08:36 +00006232 return (vector unsigned int)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006233}
6234
6235/* vec_sr */
6236
6237static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006238vec_sr(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006239{
David Blaikie3302f2b2013-01-16 23:08:36 +00006240 return __a >> (vector signed char)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006241}
6242
6243static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006244vec_sr(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006245{
David Blaikie3302f2b2013-01-16 23:08:36 +00006246 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006247}
6248
6249static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006250vec_sr(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006251{
David Blaikie3302f2b2013-01-16 23:08:36 +00006252 return __a >> (vector short)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006253}
6254
6255static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006256vec_sr(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006257{
David Blaikie3302f2b2013-01-16 23:08:36 +00006258 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006259}
6260
6261static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006262vec_sr(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006263{
David Blaikie3302f2b2013-01-16 23:08:36 +00006264 return __a >> (vector int)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006265}
6266
6267static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006268vec_sr(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006269{
David Blaikie3302f2b2013-01-16 23:08:36 +00006270 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006271}
6272
6273/* vec_vsrb */
6274
6275#define __builtin_altivec_vsrb vec_vsrb
6276
6277static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006278vec_vsrb(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006279{
David Blaikie3302f2b2013-01-16 23:08:36 +00006280 return __a >> (vector signed char)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006281}
6282
6283static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006284vec_vsrb(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006285{
David Blaikie3302f2b2013-01-16 23:08:36 +00006286 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006287}
6288
6289/* vec_vsrh */
6290
6291#define __builtin_altivec_vsrh vec_vsrh
6292
6293static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006294vec_vsrh(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006295{
David Blaikie3302f2b2013-01-16 23:08:36 +00006296 return __a >> (vector short)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006297}
6298
6299static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006300vec_vsrh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006301{
David Blaikie3302f2b2013-01-16 23:08:36 +00006302 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006303}
6304
6305/* vec_vsrw */
6306
6307#define __builtin_altivec_vsrw vec_vsrw
6308
6309static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006310vec_vsrw(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006311{
David Blaikie3302f2b2013-01-16 23:08:36 +00006312 return __a >> (vector int)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006313}
6314
6315static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006316vec_vsrw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006317{
David Blaikie3302f2b2013-01-16 23:08:36 +00006318 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006319}
6320
6321/* vec_sra */
6322
6323static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006324vec_sra(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006325{
David Blaikie3302f2b2013-01-16 23:08:36 +00006326 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006327}
6328
6329static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006330vec_sra(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006331{
David Blaikie3302f2b2013-01-16 23:08:36 +00006332 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006333}
6334
6335static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006336vec_sra(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006337{
David Blaikie3302f2b2013-01-16 23:08:36 +00006338 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006339}
6340
6341static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006342vec_sra(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006343{
David Blaikie3302f2b2013-01-16 23:08:36 +00006344 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006345}
6346
6347static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006348vec_sra(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006349{
David Blaikie3302f2b2013-01-16 23:08:36 +00006350 return __builtin_altivec_vsraw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006351}
6352
6353static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006354vec_sra(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006355{
David Blaikie3302f2b2013-01-16 23:08:36 +00006356 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006357}
6358
6359/* vec_vsrab */
6360
6361static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006362vec_vsrab(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006363{
David Blaikie3302f2b2013-01-16 23:08:36 +00006364 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006365}
6366
6367static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006368vec_vsrab(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006369{
David Blaikie3302f2b2013-01-16 23:08:36 +00006370 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006371}
6372
6373/* vec_vsrah */
6374
6375static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006376vec_vsrah(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006377{
David Blaikie3302f2b2013-01-16 23:08:36 +00006378 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006379}
6380
6381static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006382vec_vsrah(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006383{
David Blaikie3302f2b2013-01-16 23:08:36 +00006384 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006385}
6386
6387/* vec_vsraw */
6388
6389static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006390vec_vsraw(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006391{
David Blaikie3302f2b2013-01-16 23:08:36 +00006392 return __builtin_altivec_vsraw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006393}
6394
6395static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006396vec_vsraw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006397{
David Blaikie3302f2b2013-01-16 23:08:36 +00006398 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006399}
6400
6401/* vec_srl */
6402
6403static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006404vec_srl(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006405{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006406 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006407 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006408}
6409
6410static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006411vec_srl(vector signed char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006412{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006413 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006414 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006415}
6416
6417static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006418vec_srl(vector signed char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006419{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006420 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006421 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006422}
6423
6424static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006425vec_srl(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006426{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006427 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006428 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006429}
6430
6431static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006432vec_srl(vector unsigned char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006433{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006434 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006435 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006436}
6437
6438static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006439vec_srl(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006440{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006441 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006442 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006443}
6444
Anton Yartsevfc83c602010-08-19 03:21:36 +00006445static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006446vec_srl(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006447{
David Blaikie3302f2b2013-01-16 23:08:36 +00006448 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006449}
6450
6451static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006452vec_srl(vector bool char __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006453{
David Blaikie3302f2b2013-01-16 23:08:36 +00006454 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006455}
6456
6457static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006458vec_srl(vector bool char __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006459{
David Blaikie3302f2b2013-01-16 23:08:36 +00006460 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006461}
6462
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006463static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006464vec_srl(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006465{
David Blaikie3302f2b2013-01-16 23:08:36 +00006466 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006467}
6468
6469static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006470vec_srl(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006471{
David Blaikie3302f2b2013-01-16 23:08:36 +00006472 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006473}
6474
6475static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006476vec_srl(vector short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006477{
David Blaikie3302f2b2013-01-16 23:08:36 +00006478 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006479}
6480
6481static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006482vec_srl(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006483{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006484 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006485 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006486}
6487
6488static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006489vec_srl(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006490{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006491 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006492 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006493}
6494
6495static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006496vec_srl(vector unsigned short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006497{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006498 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006499 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006500}
6501
Anton Yartsevfc83c602010-08-19 03:21:36 +00006502static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006503vec_srl(vector bool short __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006504{
David Blaikie3302f2b2013-01-16 23:08:36 +00006505 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006506}
6507
6508static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006509vec_srl(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006510{
David Blaikie3302f2b2013-01-16 23:08:36 +00006511 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006512}
6513
6514static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006515vec_srl(vector bool short __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006516{
David Blaikie3302f2b2013-01-16 23:08:36 +00006517 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006518}
6519
6520static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006521vec_srl(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006522{
David Blaikie3302f2b2013-01-16 23:08:36 +00006523 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006524}
6525
6526static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006527vec_srl(vector pixel __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006528{
David Blaikie3302f2b2013-01-16 23:08:36 +00006529 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006530}
6531
6532static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006533vec_srl(vector pixel __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006534{
David Blaikie3302f2b2013-01-16 23:08:36 +00006535 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006536}
6537
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006538static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006539vec_srl(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006540{
David Blaikie3302f2b2013-01-16 23:08:36 +00006541 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006542}
6543
6544static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006545vec_srl(vector int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006546{
David Blaikie3302f2b2013-01-16 23:08:36 +00006547 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006548}
6549
6550static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006551vec_srl(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006552{
David Blaikie3302f2b2013-01-16 23:08:36 +00006553 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006554}
6555
6556static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006557vec_srl(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006558{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006559 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006560 __builtin_altivec_vsr((vector int)__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_srl(vector unsigned int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006565{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006566 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006567 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006568}
6569
6570static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006571vec_srl(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006572{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006573 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006574 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006575}
6576
Anton Yartsevfc83c602010-08-19 03:21:36 +00006577static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006578vec_srl(vector bool int __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006579{
David Blaikie3302f2b2013-01-16 23:08:36 +00006580 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006581}
6582
6583static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006584vec_srl(vector bool int __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006585{
David Blaikie3302f2b2013-01-16 23:08:36 +00006586 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006587}
6588
6589static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006590vec_srl(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006591{
David Blaikie3302f2b2013-01-16 23:08:36 +00006592 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006593}
6594
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006595/* vec_vsr */
6596
6597static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006598vec_vsr(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006599{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006600 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006601 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006602}
6603
6604static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006605vec_vsr(vector signed char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006606{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006607 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006608 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006609}
6610
6611static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006612vec_vsr(vector signed char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006613{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006614 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006615 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006616}
6617
6618static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006619vec_vsr(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006620{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006621 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006622 __builtin_altivec_vsr((vector int)__a, (vector int)__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_vsr(vector unsigned char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006627{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006628 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006629 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006630}
6631
6632static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006633vec_vsr(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006634{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006635 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006636 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006637}
6638
Anton Yartsevfc83c602010-08-19 03:21:36 +00006639static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006640vec_vsr(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006641{
David Blaikie3302f2b2013-01-16 23:08:36 +00006642 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006643}
6644
6645static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006646vec_vsr(vector bool char __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006647{
David Blaikie3302f2b2013-01-16 23:08:36 +00006648 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006649}
6650
6651static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006652vec_vsr(vector bool char __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006653{
David Blaikie3302f2b2013-01-16 23:08:36 +00006654 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006655}
6656
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006657static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006658vec_vsr(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006659{
David Blaikie3302f2b2013-01-16 23:08:36 +00006660 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006661}
6662
6663static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006664vec_vsr(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006665{
David Blaikie3302f2b2013-01-16 23:08:36 +00006666 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006667}
6668
6669static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006670vec_vsr(vector short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006671{
David Blaikie3302f2b2013-01-16 23:08:36 +00006672 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006673}
6674
6675static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006676vec_vsr(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006677{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006678 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006679 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006680}
6681
6682static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006683vec_vsr(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006684{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006685 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006686 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006687}
6688
6689static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006690vec_vsr(vector unsigned short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006691{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006692 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006693 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006694}
6695
Anton Yartsevfc83c602010-08-19 03:21:36 +00006696static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006697vec_vsr(vector bool short __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006698{
David Blaikie3302f2b2013-01-16 23:08:36 +00006699 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006700}
6701
6702static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006703vec_vsr(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006704{
David Blaikie3302f2b2013-01-16 23:08:36 +00006705 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006706}
6707
6708static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006709vec_vsr(vector bool short __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006710{
David Blaikie3302f2b2013-01-16 23:08:36 +00006711 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006712}
6713
6714static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006715vec_vsr(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006716{
David Blaikie3302f2b2013-01-16 23:08:36 +00006717 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006718}
6719
6720static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006721vec_vsr(vector pixel __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006722{
David Blaikie3302f2b2013-01-16 23:08:36 +00006723 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006724}
6725
6726static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006727vec_vsr(vector pixel __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006728{
David Blaikie3302f2b2013-01-16 23:08:36 +00006729 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006730}
6731
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006732static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006733vec_vsr(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006734{
David Blaikie3302f2b2013-01-16 23:08:36 +00006735 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006736}
6737
6738static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006739vec_vsr(vector int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006740{
David Blaikie3302f2b2013-01-16 23:08:36 +00006741 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006742}
6743
6744static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006745vec_vsr(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006746{
David Blaikie3302f2b2013-01-16 23:08:36 +00006747 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006748}
6749
6750static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006751vec_vsr(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006752{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006753 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006754 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006755}
6756
6757static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006758vec_vsr(vector unsigned int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006759{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006760 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006761 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006762}
6763
6764static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006765vec_vsr(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006766{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006767 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006768 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006769}
6770
Anton Yartsevfc83c602010-08-19 03:21:36 +00006771static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006772vec_vsr(vector bool int __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006773{
David Blaikie3302f2b2013-01-16 23:08:36 +00006774 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006775}
6776
6777static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006778vec_vsr(vector bool int __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006779{
David Blaikie3302f2b2013-01-16 23:08:36 +00006780 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006781}
6782
6783static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006784vec_vsr(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006785{
David Blaikie3302f2b2013-01-16 23:08:36 +00006786 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006787}
6788
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006789/* vec_sro */
6790
6791static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006792vec_sro(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006793{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006794 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006795 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006796}
6797
6798static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006799vec_sro(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006800{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006801 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006802 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006803}
6804
6805static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006806vec_sro(vector unsigned char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006807{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006808 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006809 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006810}
6811
6812static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006813vec_sro(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006814{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006815 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006816 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006817}
6818
6819static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006820vec_sro(vector short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006821{
David Blaikie3302f2b2013-01-16 23:08:36 +00006822 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006823}
6824
6825static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006826vec_sro(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006827{
David Blaikie3302f2b2013-01-16 23:08:36 +00006828 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006829}
6830
6831static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006832vec_sro(vector unsigned short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006833{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006834 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006835 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006836}
6837
6838static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006839vec_sro(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006840{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006841 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006842 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006843}
6844
Anton Yartsevfc83c602010-08-19 03:21:36 +00006845static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006846vec_sro(vector pixel __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006847{
David Blaikie3302f2b2013-01-16 23:08:36 +00006848 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006849}
6850
6851static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006852vec_sro(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006853{
David Blaikie3302f2b2013-01-16 23:08:36 +00006854 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006855}
6856
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006857static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006858vec_sro(vector int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006859{
David Blaikie3302f2b2013-01-16 23:08:36 +00006860 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006861}
6862
6863static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006864vec_sro(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006865{
David Blaikie3302f2b2013-01-16 23:08:36 +00006866 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006867}
6868
6869static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006870vec_sro(vector unsigned int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006871{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006872 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006873 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006874}
6875
6876static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006877vec_sro(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006878{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006879 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006880 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006881}
6882
6883static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006884vec_sro(vector float __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006885{
David Blaikie3302f2b2013-01-16 23:08:36 +00006886 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006887}
6888
6889static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006890vec_sro(vector float __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006891{
David Blaikie3302f2b2013-01-16 23:08:36 +00006892 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006893}
6894
6895/* vec_vsro */
6896
6897static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006898vec_vsro(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006899{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006900 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006901 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006902}
6903
6904static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006905vec_vsro(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006906{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006907 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006908 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006909}
6910
6911static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006912vec_vsro(vector unsigned char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006913{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006914 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006915 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006916}
6917
6918static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006919vec_vsro(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006920{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006921 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006922 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006923}
6924
6925static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006926vec_vsro(vector short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006927{
David Blaikie3302f2b2013-01-16 23:08:36 +00006928 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006929}
6930
6931static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006932vec_vsro(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006933{
David Blaikie3302f2b2013-01-16 23:08:36 +00006934 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006935}
6936
6937static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006938vec_vsro(vector unsigned short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006939{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006940 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006941 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006942}
6943
6944static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006945vec_vsro(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006946{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006947 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006948 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006949}
6950
Anton Yartsevfc83c602010-08-19 03:21:36 +00006951static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006952vec_vsro(vector pixel __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006953{
David Blaikie3302f2b2013-01-16 23:08:36 +00006954 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006955}
6956
6957static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006958vec_vsro(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006959{
David Blaikie3302f2b2013-01-16 23:08:36 +00006960 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006961}
6962
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006963static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006964vec_vsro(vector int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006965{
David Blaikie3302f2b2013-01-16 23:08:36 +00006966 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006967}
6968
6969static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006970vec_vsro(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006971{
David Blaikie3302f2b2013-01-16 23:08:36 +00006972 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006973}
6974
6975static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006976vec_vsro(vector unsigned int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006977{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006978 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006979 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006980}
6981
6982static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006983vec_vsro(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006984{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006985 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006986 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006987}
6988
6989static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006990vec_vsro(vector float __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006991{
David Blaikie3302f2b2013-01-16 23:08:36 +00006992 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006993}
6994
6995static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006996vec_vsro(vector float __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006997{
David Blaikie3302f2b2013-01-16 23:08:36 +00006998 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006999}
7000
7001/* vec_st */
7002
7003static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007004vec_st(vector signed char __a, int __b, vector signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007005{
David Blaikie3302f2b2013-01-16 23:08:36 +00007006 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007007}
7008
7009static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007010vec_st(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007011{
David Blaikie3302f2b2013-01-16 23:08:36 +00007012 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007013}
7014
7015static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007016vec_st(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007017{
David Blaikie3302f2b2013-01-16 23:08:36 +00007018 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007019}
7020
7021static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007022vec_st(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007023{
David Blaikie3302f2b2013-01-16 23:08:36 +00007024 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007025}
7026
7027static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007028vec_st(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007029{
David Blaikie3302f2b2013-01-16 23:08:36 +00007030 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007031}
7032
7033static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007034vec_st(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007035{
David Blaikie3302f2b2013-01-16 23:08:36 +00007036 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007037}
7038
7039static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007040vec_st(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007041{
David Blaikie3302f2b2013-01-16 23:08:36 +00007042 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007043}
7044
7045static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007046vec_st(vector short __a, int __b, vector short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007047{
David Blaikie3302f2b2013-01-16 23:08:36 +00007048 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007049}
7050
7051static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007052vec_st(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007053{
David Blaikie3302f2b2013-01-16 23:08:36 +00007054 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007055}
7056
7057static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007058vec_st(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007059{
David Blaikie3302f2b2013-01-16 23:08:36 +00007060 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007061}
7062
7063static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007064vec_st(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007065{
David Blaikie3302f2b2013-01-16 23:08:36 +00007066 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007067}
7068
7069static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007070vec_st(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007071{
David Blaikie3302f2b2013-01-16 23:08:36 +00007072 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007073}
7074
7075static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007076vec_st(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007077{
David Blaikie3302f2b2013-01-16 23:08:36 +00007078 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007079}
7080
7081static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007082vec_st(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007083{
David Blaikie3302f2b2013-01-16 23:08:36 +00007084 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007085}
7086
7087static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007088vec_st(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007089{
David Blaikie3302f2b2013-01-16 23:08:36 +00007090 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007091}
7092
7093static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007094vec_st(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007095{
David Blaikie3302f2b2013-01-16 23:08:36 +00007096 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007097}
7098
7099static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007100vec_st(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007101{
David Blaikie3302f2b2013-01-16 23:08:36 +00007102 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007103}
7104
7105static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007106vec_st(vector int __a, int __b, vector int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007107{
David Blaikie3302f2b2013-01-16 23:08:36 +00007108 __builtin_altivec_stvx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007109}
7110
7111static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007112vec_st(vector int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007113{
David Blaikie3302f2b2013-01-16 23:08:36 +00007114 __builtin_altivec_stvx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007115}
7116
7117static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007118vec_st(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007119{
David Blaikie3302f2b2013-01-16 23:08:36 +00007120 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007121}
7122
7123static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007124vec_st(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007125{
David Blaikie3302f2b2013-01-16 23:08:36 +00007126 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007127}
7128
7129static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007130vec_st(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007131{
David Blaikie3302f2b2013-01-16 23:08:36 +00007132 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007133}
7134
7135static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007136vec_st(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007137{
David Blaikie3302f2b2013-01-16 23:08:36 +00007138 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007139}
7140
7141static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007142vec_st(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007143{
David Blaikie3302f2b2013-01-16 23:08:36 +00007144 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007145}
7146
7147static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007148vec_st(vector float __a, int __b, vector float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007149{
David Blaikie3302f2b2013-01-16 23:08:36 +00007150 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007151}
7152
7153static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007154vec_st(vector float __a, int __b, float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007155{
David Blaikie3302f2b2013-01-16 23:08:36 +00007156 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007157}
7158
7159/* vec_stvx */
7160
7161static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007162vec_stvx(vector signed char __a, int __b, vector signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007163{
David Blaikie3302f2b2013-01-16 23:08:36 +00007164 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007165}
7166
7167static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007168vec_stvx(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007169{
David Blaikie3302f2b2013-01-16 23:08:36 +00007170 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007171}
7172
7173static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007174vec_stvx(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007175{
David Blaikie3302f2b2013-01-16 23:08:36 +00007176 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007177}
7178
7179static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007180vec_stvx(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007181{
David Blaikie3302f2b2013-01-16 23:08:36 +00007182 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007183}
7184
7185static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007186vec_stvx(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007187{
David Blaikie3302f2b2013-01-16 23:08:36 +00007188 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007189}
7190
7191static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007192vec_stvx(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007193{
David Blaikie3302f2b2013-01-16 23:08:36 +00007194 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007195}
7196
7197static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007198vec_stvx(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007199{
David Blaikie3302f2b2013-01-16 23:08:36 +00007200 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007201}
7202
7203static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007204vec_stvx(vector short __a, int __b, vector short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007205{
David Blaikie3302f2b2013-01-16 23:08:36 +00007206 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007207}
7208
7209static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007210vec_stvx(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007211{
David Blaikie3302f2b2013-01-16 23:08:36 +00007212 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007213}
7214
7215static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007216vec_stvx(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007217{
David Blaikie3302f2b2013-01-16 23:08:36 +00007218 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007219}
7220
7221static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007222vec_stvx(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007223{
David Blaikie3302f2b2013-01-16 23:08:36 +00007224 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007225}
7226
7227static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007228vec_stvx(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007229{
David Blaikie3302f2b2013-01-16 23:08:36 +00007230 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007231}
7232
7233static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007234vec_stvx(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007235{
David Blaikie3302f2b2013-01-16 23:08:36 +00007236 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007237}
7238
7239static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007240vec_stvx(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007241{
David Blaikie3302f2b2013-01-16 23:08:36 +00007242 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007243}
7244
7245static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007246vec_stvx(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007247{
David Blaikie3302f2b2013-01-16 23:08:36 +00007248 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007249}
7250
7251static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007252vec_stvx(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007253{
David Blaikie3302f2b2013-01-16 23:08:36 +00007254 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007255}
7256
7257static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007258vec_stvx(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007259{
David Blaikie3302f2b2013-01-16 23:08:36 +00007260 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007261}
7262
7263static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007264vec_stvx(vector int __a, int __b, vector int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007265{
David Blaikie3302f2b2013-01-16 23:08:36 +00007266 __builtin_altivec_stvx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007267}
7268
7269static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007270vec_stvx(vector int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007271{
David Blaikie3302f2b2013-01-16 23:08:36 +00007272 __builtin_altivec_stvx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007273}
7274
7275static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007276vec_stvx(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007277{
David Blaikie3302f2b2013-01-16 23:08:36 +00007278 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007279}
7280
7281static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007282vec_stvx(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007283{
David Blaikie3302f2b2013-01-16 23:08:36 +00007284 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007285}
7286
7287static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007288vec_stvx(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007289{
David Blaikie3302f2b2013-01-16 23:08:36 +00007290 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007291}
7292
7293static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007294vec_stvx(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007295{
David Blaikie3302f2b2013-01-16 23:08:36 +00007296 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007297}
7298
7299static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007300vec_stvx(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007301{
David Blaikie3302f2b2013-01-16 23:08:36 +00007302 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007303}
7304
7305static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007306vec_stvx(vector float __a, int __b, vector float *__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_stvx(vector float __a, int __b, float *__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
7317/* vec_ste */
7318
7319static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007320vec_ste(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007321{
David Blaikie3302f2b2013-01-16 23:08:36 +00007322 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007323}
7324
7325static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007326vec_ste(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007327{
David Blaikie3302f2b2013-01-16 23:08:36 +00007328 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007329}
7330
7331static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007332vec_ste(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007333{
David Blaikie3302f2b2013-01-16 23:08:36 +00007334 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007335}
7336
7337static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007338vec_ste(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007339{
David Blaikie3302f2b2013-01-16 23:08:36 +00007340 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007341}
7342
7343static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007344vec_ste(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007345{
David Blaikie3302f2b2013-01-16 23:08:36 +00007346 __builtin_altivec_stvehx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007347}
7348
7349static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007350vec_ste(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007351{
David Blaikie3302f2b2013-01-16 23:08:36 +00007352 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007353}
7354
7355static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007356vec_ste(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007357{
David Blaikie3302f2b2013-01-16 23:08:36 +00007358 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007359}
7360
7361static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007362vec_ste(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007363{
David Blaikie3302f2b2013-01-16 23:08:36 +00007364 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007365}
7366
7367static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007368vec_ste(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007369{
David Blaikie3302f2b2013-01-16 23:08:36 +00007370 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007371}
7372
7373static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007374vec_ste(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007375{
David Blaikie3302f2b2013-01-16 23:08:36 +00007376 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007377}
7378
7379static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007380vec_ste(vector int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007381{
David Blaikie3302f2b2013-01-16 23:08:36 +00007382 __builtin_altivec_stvewx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007383}
7384
7385static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007386vec_ste(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007387{
David Blaikie3302f2b2013-01-16 23:08:36 +00007388 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007389}
7390
7391static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007392vec_ste(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007393{
David Blaikie3302f2b2013-01-16 23:08:36 +00007394 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007395}
7396
7397static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007398vec_ste(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007399{
David Blaikie3302f2b2013-01-16 23:08:36 +00007400 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007401}
7402
7403static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007404vec_ste(vector float __a, int __b, float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007405{
David Blaikie3302f2b2013-01-16 23:08:36 +00007406 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007407}
7408
7409/* vec_stvebx */
7410
7411static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007412vec_stvebx(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007413{
David Blaikie3302f2b2013-01-16 23:08:36 +00007414 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007415}
7416
7417static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007418vec_stvebx(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007419{
David Blaikie3302f2b2013-01-16 23:08:36 +00007420 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007421}
7422
Anton Yartsevfc83c602010-08-19 03:21:36 +00007423static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007424vec_stvebx(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007425{
David Blaikie3302f2b2013-01-16 23:08:36 +00007426 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007427}
7428
7429static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007430vec_stvebx(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007431{
David Blaikie3302f2b2013-01-16 23:08:36 +00007432 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007433}
7434
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007435/* vec_stvehx */
7436
7437static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007438vec_stvehx(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007439{
David Blaikie3302f2b2013-01-16 23:08:36 +00007440 __builtin_altivec_stvehx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007441}
7442
7443static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007444vec_stvehx(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007445{
David Blaikie3302f2b2013-01-16 23:08:36 +00007446 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007447}
7448
Anton Yartsevfc83c602010-08-19 03:21:36 +00007449static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007450vec_stvehx(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007451{
David Blaikie3302f2b2013-01-16 23:08:36 +00007452 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007453}
7454
7455static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007456vec_stvehx(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007457{
David Blaikie3302f2b2013-01-16 23:08:36 +00007458 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007459}
7460
7461static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007462vec_stvehx(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007463{
David Blaikie3302f2b2013-01-16 23:08:36 +00007464 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007465}
7466
7467static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007468vec_stvehx(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007469{
David Blaikie3302f2b2013-01-16 23:08:36 +00007470 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007471}
7472
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007473/* vec_stvewx */
7474
7475static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007476vec_stvewx(vector int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007477{
David Blaikie3302f2b2013-01-16 23:08:36 +00007478 __builtin_altivec_stvewx(__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_stvewx(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007483{
David Blaikie3302f2b2013-01-16 23:08:36 +00007484 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007485}
7486
7487static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007488vec_stvewx(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007489{
David Blaikie3302f2b2013-01-16 23:08:36 +00007490 __builtin_altivec_stvewx((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_stvewx(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007495{
David Blaikie3302f2b2013-01-16 23:08:36 +00007496 __builtin_altivec_stvewx((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_stvewx(vector float __a, int __b, float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007501{
David Blaikie3302f2b2013-01-16 23:08:36 +00007502 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007503}
7504
7505/* vec_stl */
7506
7507static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007508vec_stl(vector signed char __a, int __b, vector signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007509{
David Blaikie3302f2b2013-01-16 23:08:36 +00007510 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007511}
7512
7513static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007514vec_stl(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007515{
David Blaikie3302f2b2013-01-16 23:08:36 +00007516 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007517}
7518
7519static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007520vec_stl(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007521{
David Blaikie3302f2b2013-01-16 23:08:36 +00007522 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007523}
7524
7525static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007526vec_stl(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007527{
David Blaikie3302f2b2013-01-16 23:08:36 +00007528 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007529}
7530
7531static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007532vec_stl(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007533{
David Blaikie3302f2b2013-01-16 23:08:36 +00007534 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007535}
7536
7537static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007538vec_stl(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007539{
David Blaikie3302f2b2013-01-16 23:08:36 +00007540 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007541}
7542
7543static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007544vec_stl(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007545{
David Blaikie3302f2b2013-01-16 23:08:36 +00007546 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007547}
7548
7549static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007550vec_stl(vector short __a, int __b, vector short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007551{
David Blaikie3302f2b2013-01-16 23:08:36 +00007552 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007553}
7554
7555static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007556vec_stl(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007557{
David Blaikie3302f2b2013-01-16 23:08:36 +00007558 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007559}
7560
7561static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007562vec_stl(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007563{
David Blaikie3302f2b2013-01-16 23:08:36 +00007564 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007565}
7566
7567static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007568vec_stl(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007569{
David Blaikie3302f2b2013-01-16 23:08:36 +00007570 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007571}
7572
7573static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007574vec_stl(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007575{
David Blaikie3302f2b2013-01-16 23:08:36 +00007576 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007577}
7578
7579static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007580vec_stl(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007581{
David Blaikie3302f2b2013-01-16 23:08:36 +00007582 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007583}
7584
7585static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007586vec_stl(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007587{
David Blaikie3302f2b2013-01-16 23:08:36 +00007588 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007589}
7590
7591static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007592vec_stl(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007593{
David Blaikie3302f2b2013-01-16 23:08:36 +00007594 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007595}
7596
7597static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007598vec_stl(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007599{
David Blaikie3302f2b2013-01-16 23:08:36 +00007600 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007601}
7602
7603static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007604vec_stl(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007605{
David Blaikie3302f2b2013-01-16 23:08:36 +00007606 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007607}
7608
7609static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007610vec_stl(vector int __a, int __b, vector int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007611{
David Blaikie3302f2b2013-01-16 23:08:36 +00007612 __builtin_altivec_stvxl(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007613}
7614
7615static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007616vec_stl(vector int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007617{
David Blaikie3302f2b2013-01-16 23:08:36 +00007618 __builtin_altivec_stvxl(__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_stl(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007623{
David Blaikie3302f2b2013-01-16 23:08:36 +00007624 __builtin_altivec_stvxl((vector int)__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_stl(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007629{
David Blaikie3302f2b2013-01-16 23:08:36 +00007630 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007631}
7632
7633static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007634vec_stl(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007635{
David Blaikie3302f2b2013-01-16 23:08:36 +00007636 __builtin_altivec_stvxl((vector int)__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_stl(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007641{
David Blaikie3302f2b2013-01-16 23:08:36 +00007642 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007643}
7644
7645static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007646vec_stl(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007647{
David Blaikie3302f2b2013-01-16 23:08:36 +00007648 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007649}
7650
7651static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007652vec_stl(vector float __a, int __b, vector float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007653{
David Blaikie3302f2b2013-01-16 23:08:36 +00007654 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007655}
7656
7657static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007658vec_stl(vector float __a, int __b, float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007659{
David Blaikie3302f2b2013-01-16 23:08:36 +00007660 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007661}
7662
7663/* vec_stvxl */
7664
7665static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007666vec_stvxl(vector signed char __a, int __b, vector signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007667{
David Blaikie3302f2b2013-01-16 23:08:36 +00007668 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007669}
7670
7671static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007672vec_stvxl(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007673{
David Blaikie3302f2b2013-01-16 23:08:36 +00007674 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007675}
7676
7677static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007678vec_stvxl(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007679{
David Blaikie3302f2b2013-01-16 23:08:36 +00007680 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007681}
7682
7683static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007684vec_stvxl(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007685{
David Blaikie3302f2b2013-01-16 23:08:36 +00007686 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007687}
7688
7689static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007690vec_stvxl(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007691{
David Blaikie3302f2b2013-01-16 23:08:36 +00007692 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007693}
7694
7695static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007696vec_stvxl(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007697{
David Blaikie3302f2b2013-01-16 23:08:36 +00007698 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007699}
7700
7701static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007702vec_stvxl(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007703{
David Blaikie3302f2b2013-01-16 23:08:36 +00007704 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007705}
7706
7707static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007708vec_stvxl(vector short __a, int __b, vector short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007709{
David Blaikie3302f2b2013-01-16 23:08:36 +00007710 __builtin_altivec_stvxl((vector int)__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_stvxl(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007715{
David Blaikie3302f2b2013-01-16 23:08:36 +00007716 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007717}
7718
7719static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007720vec_stvxl(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007721{
David Blaikie3302f2b2013-01-16 23:08:36 +00007722 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007723}
7724
7725static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007726vec_stvxl(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007727{
David Blaikie3302f2b2013-01-16 23:08:36 +00007728 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007729}
7730
7731static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007732vec_stvxl(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007733{
David Blaikie3302f2b2013-01-16 23:08:36 +00007734 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007735}
7736
7737static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007738vec_stvxl(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007739{
David Blaikie3302f2b2013-01-16 23:08:36 +00007740 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007741}
7742
7743static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007744vec_stvxl(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007745{
David Blaikie3302f2b2013-01-16 23:08:36 +00007746 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007747}
7748
7749static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007750vec_stvxl(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007751{
David Blaikie3302f2b2013-01-16 23:08:36 +00007752 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007753}
7754
7755static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007756vec_stvxl(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007757{
David Blaikie3302f2b2013-01-16 23:08:36 +00007758 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007759}
7760
7761static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007762vec_stvxl(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007763{
David Blaikie3302f2b2013-01-16 23:08:36 +00007764 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007765}
7766
7767static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007768vec_stvxl(vector int __a, int __b, vector int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007769{
David Blaikie3302f2b2013-01-16 23:08:36 +00007770 __builtin_altivec_stvxl(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007771}
7772
7773static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007774vec_stvxl(vector int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007775{
David Blaikie3302f2b2013-01-16 23:08:36 +00007776 __builtin_altivec_stvxl(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007777}
7778
7779static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007780vec_stvxl(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007781{
David Blaikie3302f2b2013-01-16 23:08:36 +00007782 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007783}
7784
7785static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007786vec_stvxl(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007787{
David Blaikie3302f2b2013-01-16 23:08:36 +00007788 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007789}
7790
7791static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007792vec_stvxl(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007793{
David Blaikie3302f2b2013-01-16 23:08:36 +00007794 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007795}
7796
7797static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007798vec_stvxl(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007799{
David Blaikie3302f2b2013-01-16 23:08:36 +00007800 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007801}
7802
7803static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007804vec_stvxl(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007805{
David Blaikie3302f2b2013-01-16 23:08:36 +00007806 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007807}
7808
7809static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007810vec_stvxl(vector float __a, int __b, vector float *__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_stvxl(vector float __a, int __b, float *__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
7821/* vec_sub */
7822
7823static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007824vec_sub(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007825{
David Blaikie3302f2b2013-01-16 23:08:36 +00007826 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007827}
7828
Anton Yartsevfc83c602010-08-19 03:21:36 +00007829static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007830vec_sub(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007831{
David Blaikie3302f2b2013-01-16 23:08:36 +00007832 return (vector signed char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007833}
7834
7835static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007836vec_sub(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007837{
David Blaikie3302f2b2013-01-16 23:08:36 +00007838 return __a - (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007839}
7840
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007841static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007842vec_sub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007843{
David Blaikie3302f2b2013-01-16 23:08:36 +00007844 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007845}
7846
Anton Yartsevfc83c602010-08-19 03:21:36 +00007847static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007848vec_sub(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007849{
David Blaikie3302f2b2013-01-16 23:08:36 +00007850 return (vector unsigned char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007851}
7852
7853static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007854vec_sub(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007855{
David Blaikie3302f2b2013-01-16 23:08:36 +00007856 return __a - (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007857}
7858
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007859static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007860vec_sub(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007861{
David Blaikie3302f2b2013-01-16 23:08:36 +00007862 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007863}
7864
Anton Yartsevfc83c602010-08-19 03:21:36 +00007865static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007866vec_sub(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007867{
David Blaikie3302f2b2013-01-16 23:08:36 +00007868 return (vector short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007869}
7870
7871static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007872vec_sub(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007873{
David Blaikie3302f2b2013-01-16 23:08:36 +00007874 return __a - (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007875}
7876
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007877static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007878vec_sub(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007879{
David Blaikie3302f2b2013-01-16 23:08:36 +00007880 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007881}
7882
Anton Yartsevfc83c602010-08-19 03:21:36 +00007883static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007884vec_sub(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007885{
David Blaikie3302f2b2013-01-16 23:08:36 +00007886 return (vector unsigned short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007887}
7888
7889static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007890vec_sub(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007891{
David Blaikie3302f2b2013-01-16 23:08:36 +00007892 return __a - (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007893}
7894
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007895static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007896vec_sub(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007897{
David Blaikie3302f2b2013-01-16 23:08:36 +00007898 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007899}
7900
Anton Yartsevfc83c602010-08-19 03:21:36 +00007901static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007902vec_sub(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007903{
David Blaikie3302f2b2013-01-16 23:08:36 +00007904 return (vector int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007905}
7906
7907static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007908vec_sub(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007909{
David Blaikie3302f2b2013-01-16 23:08:36 +00007910 return __a - (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007911}
7912
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007913static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007914vec_sub(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007915{
David Blaikie3302f2b2013-01-16 23:08:36 +00007916 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007917}
7918
Anton Yartsevfc83c602010-08-19 03:21:36 +00007919static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007920vec_sub(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007921{
David Blaikie3302f2b2013-01-16 23:08:36 +00007922 return (vector unsigned int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007923}
7924
7925static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007926vec_sub(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007927{
David Blaikie3302f2b2013-01-16 23:08:36 +00007928 return __a - (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007929}
7930
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007931static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007932vec_sub(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007933{
David Blaikie3302f2b2013-01-16 23:08:36 +00007934 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007935}
7936
7937/* vec_vsububm */
7938
7939#define __builtin_altivec_vsububm vec_vsububm
7940
7941static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007942vec_vsububm(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007943{
David Blaikie3302f2b2013-01-16 23:08:36 +00007944 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007945}
7946
Anton Yartsevfc83c602010-08-19 03:21:36 +00007947static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007948vec_vsububm(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007949{
David Blaikie3302f2b2013-01-16 23:08:36 +00007950 return (vector signed char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007951}
7952
7953static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007954vec_vsububm(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007955{
David Blaikie3302f2b2013-01-16 23:08:36 +00007956 return __a - (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007957}
7958
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007959static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007960vec_vsububm(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007961{
David Blaikie3302f2b2013-01-16 23:08:36 +00007962 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007963}
7964
Anton Yartsevfc83c602010-08-19 03:21:36 +00007965static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007966vec_vsububm(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007967{
David Blaikie3302f2b2013-01-16 23:08:36 +00007968 return (vector unsigned char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007969}
7970
7971static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007972vec_vsububm(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007973{
David Blaikie3302f2b2013-01-16 23:08:36 +00007974 return __a - (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007975}
7976
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007977/* vec_vsubuhm */
7978
7979#define __builtin_altivec_vsubuhm vec_vsubuhm
7980
7981static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007982vec_vsubuhm(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007983{
David Blaikie3302f2b2013-01-16 23:08:36 +00007984 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007985}
7986
Anton Yartsevfc83c602010-08-19 03:21:36 +00007987static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007988vec_vsubuhm(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007989{
David Blaikie3302f2b2013-01-16 23:08:36 +00007990 return (vector short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007991}
7992
7993static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007994vec_vsubuhm(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007995{
David Blaikie3302f2b2013-01-16 23:08:36 +00007996 return __a - (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00007997}
7998
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007999static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008000vec_vsubuhm(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008001{
David Blaikie3302f2b2013-01-16 23:08:36 +00008002 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008003}
8004
Anton Yartsevfc83c602010-08-19 03:21:36 +00008005static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008006vec_vsubuhm(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008007{
David Blaikie3302f2b2013-01-16 23:08:36 +00008008 return (vector unsigned short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008009}
8010
8011static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008012vec_vsubuhm(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008013{
David Blaikie3302f2b2013-01-16 23:08:36 +00008014 return __a - (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008015}
8016
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008017/* vec_vsubuwm */
8018
8019#define __builtin_altivec_vsubuwm vec_vsubuwm
8020
8021static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008022vec_vsubuwm(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008023{
David Blaikie3302f2b2013-01-16 23:08:36 +00008024 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008025}
8026
Anton Yartsevfc83c602010-08-19 03:21:36 +00008027static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008028vec_vsubuwm(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008029{
David Blaikie3302f2b2013-01-16 23:08:36 +00008030 return (vector int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008031}
8032
8033static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008034vec_vsubuwm(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008035{
David Blaikie3302f2b2013-01-16 23:08:36 +00008036 return __a - (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008037}
8038
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008039static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008040vec_vsubuwm(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008041{
David Blaikie3302f2b2013-01-16 23:08:36 +00008042 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008043}
8044
Anton Yartsevfc83c602010-08-19 03:21:36 +00008045static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008046vec_vsubuwm(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008047{
David Blaikie3302f2b2013-01-16 23:08:36 +00008048 return (vector unsigned int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008049}
8050
8051static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008052vec_vsubuwm(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008053{
David Blaikie3302f2b2013-01-16 23:08:36 +00008054 return __a - (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008055}
8056
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008057/* vec_vsubfp */
8058
8059#define __builtin_altivec_vsubfp vec_vsubfp
8060
8061static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008062vec_vsubfp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008063{
David Blaikie3302f2b2013-01-16 23:08:36 +00008064 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008065}
8066
8067/* vec_subc */
8068
8069static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008070vec_subc(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008071{
David Blaikie3302f2b2013-01-16 23:08:36 +00008072 return __builtin_altivec_vsubcuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008073}
8074
8075/* vec_vsubcuw */
8076
8077static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008078vec_vsubcuw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008079{
David Blaikie3302f2b2013-01-16 23:08:36 +00008080 return __builtin_altivec_vsubcuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008081}
8082
8083/* vec_subs */
8084
8085static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008086vec_subs(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008087{
David Blaikie3302f2b2013-01-16 23:08:36 +00008088 return __builtin_altivec_vsubsbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008089}
8090
Anton Yartsevfc83c602010-08-19 03:21:36 +00008091static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008092vec_subs(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008093{
David Blaikie3302f2b2013-01-16 23:08:36 +00008094 return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008095}
8096
8097static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008098vec_subs(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008099{
David Blaikie3302f2b2013-01-16 23:08:36 +00008100 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008101}
8102
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008103static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008104vec_subs(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008105{
David Blaikie3302f2b2013-01-16 23:08:36 +00008106 return __builtin_altivec_vsububs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008107}
8108
Anton Yartsevfc83c602010-08-19 03:21:36 +00008109static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008110vec_subs(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008111{
David Blaikie3302f2b2013-01-16 23:08:36 +00008112 return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008113}
8114
8115static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008116vec_subs(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008117{
David Blaikie3302f2b2013-01-16 23:08:36 +00008118 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008119}
8120
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008121static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008122vec_subs(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008123{
David Blaikie3302f2b2013-01-16 23:08:36 +00008124 return __builtin_altivec_vsubshs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008125}
8126
Anton Yartsevfc83c602010-08-19 03:21:36 +00008127static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008128vec_subs(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008129{
David Blaikie3302f2b2013-01-16 23:08:36 +00008130 return __builtin_altivec_vsubshs((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008131}
8132
8133static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008134vec_subs(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008135{
David Blaikie3302f2b2013-01-16 23:08:36 +00008136 return __builtin_altivec_vsubshs(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008137}
8138
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008139static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008140vec_subs(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008141{
David Blaikie3302f2b2013-01-16 23:08:36 +00008142 return __builtin_altivec_vsubuhs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008143}
8144
Anton Yartsevfc83c602010-08-19 03:21:36 +00008145static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008146vec_subs(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008147{
David Blaikie3302f2b2013-01-16 23:08:36 +00008148 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008149}
8150
8151static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008152vec_subs(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008153{
David Blaikie3302f2b2013-01-16 23:08:36 +00008154 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008155}
8156
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008157static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008158vec_subs(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008159{
David Blaikie3302f2b2013-01-16 23:08:36 +00008160 return __builtin_altivec_vsubsws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008161}
8162
Anton Yartsevfc83c602010-08-19 03:21:36 +00008163static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008164vec_subs(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008165{
David Blaikie3302f2b2013-01-16 23:08:36 +00008166 return __builtin_altivec_vsubsws((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008167}
8168
8169static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008170vec_subs(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008171{
David Blaikie3302f2b2013-01-16 23:08:36 +00008172 return __builtin_altivec_vsubsws(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008173}
8174
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008175static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008176vec_subs(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008177{
David Blaikie3302f2b2013-01-16 23:08:36 +00008178 return __builtin_altivec_vsubuws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008179}
8180
Anton Yartsevfc83c602010-08-19 03:21:36 +00008181static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008182vec_subs(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008183{
David Blaikie3302f2b2013-01-16 23:08:36 +00008184 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008185}
8186
8187static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008188vec_subs(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008189{
David Blaikie3302f2b2013-01-16 23:08:36 +00008190 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008191}
8192
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008193/* vec_vsubsbs */
8194
Anton Yartsevfc83c602010-08-19 03:21:36 +00008195static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008196vec_vsubsbs(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008197{
David Blaikie3302f2b2013-01-16 23:08:36 +00008198 return __builtin_altivec_vsubsbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008199}
8200
Anton Yartsevfc83c602010-08-19 03:21:36 +00008201static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008202vec_vsubsbs(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008203{
David Blaikie3302f2b2013-01-16 23:08:36 +00008204 return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008205}
8206
8207static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008208vec_vsubsbs(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008209{
David Blaikie3302f2b2013-01-16 23:08:36 +00008210 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008211}
8212
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008213/* vec_vsububs */
8214
Anton Yartsevfc83c602010-08-19 03:21:36 +00008215static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008216vec_vsububs(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008217{
David Blaikie3302f2b2013-01-16 23:08:36 +00008218 return __builtin_altivec_vsububs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008219}
8220
Anton Yartsevfc83c602010-08-19 03:21:36 +00008221static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008222vec_vsububs(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008223{
David Blaikie3302f2b2013-01-16 23:08:36 +00008224 return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008225}
8226
8227static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008228vec_vsububs(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008229{
David Blaikie3302f2b2013-01-16 23:08:36 +00008230 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008231}
8232
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008233/* vec_vsubshs */
8234
Anton Yartsevfc83c602010-08-19 03:21:36 +00008235static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008236vec_vsubshs(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008237{
David Blaikie3302f2b2013-01-16 23:08:36 +00008238 return __builtin_altivec_vsubshs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008239}
8240
Anton Yartsevfc83c602010-08-19 03:21:36 +00008241static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008242vec_vsubshs(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008243{
David Blaikie3302f2b2013-01-16 23:08:36 +00008244 return __builtin_altivec_vsubshs((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008245}
8246
8247static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008248vec_vsubshs(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008249{
David Blaikie3302f2b2013-01-16 23:08:36 +00008250 return __builtin_altivec_vsubshs(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008251}
8252
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008253/* vec_vsubuhs */
8254
Anton Yartsevfc83c602010-08-19 03:21:36 +00008255static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008256vec_vsubuhs(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008257{
David Blaikie3302f2b2013-01-16 23:08:36 +00008258 return __builtin_altivec_vsubuhs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008259}
8260
Anton Yartsevfc83c602010-08-19 03:21:36 +00008261static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008262vec_vsubuhs(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008263{
David Blaikie3302f2b2013-01-16 23:08:36 +00008264 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008265}
8266
8267static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008268vec_vsubuhs(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008269{
David Blaikie3302f2b2013-01-16 23:08:36 +00008270 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008271}
8272
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008273/* vec_vsubsws */
8274
Anton Yartsevfc83c602010-08-19 03:21:36 +00008275static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008276vec_vsubsws(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008277{
David Blaikie3302f2b2013-01-16 23:08:36 +00008278 return __builtin_altivec_vsubsws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008279}
8280
Anton Yartsevfc83c602010-08-19 03:21:36 +00008281static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008282vec_vsubsws(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008283{
David Blaikie3302f2b2013-01-16 23:08:36 +00008284 return __builtin_altivec_vsubsws((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008285}
8286
8287static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008288vec_vsubsws(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008289{
David Blaikie3302f2b2013-01-16 23:08:36 +00008290 return __builtin_altivec_vsubsws(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008291}
8292
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008293/* vec_vsubuws */
8294
Anton Yartsevfc83c602010-08-19 03:21:36 +00008295static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008296vec_vsubuws(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008297{
David Blaikie3302f2b2013-01-16 23:08:36 +00008298 return __builtin_altivec_vsubuws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008299}
8300
Anton Yartsevfc83c602010-08-19 03:21:36 +00008301static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008302vec_vsubuws(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008303{
David Blaikie3302f2b2013-01-16 23:08:36 +00008304 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008305}
8306
8307static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008308vec_vsubuws(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008309{
David Blaikie3302f2b2013-01-16 23:08:36 +00008310 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008311}
8312
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008313/* vec_sum4s */
8314
8315static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008316vec_sum4s(vector signed char __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008317{
David Blaikie3302f2b2013-01-16 23:08:36 +00008318 return __builtin_altivec_vsum4sbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008319}
8320
8321static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008322vec_sum4s(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008323{
David Blaikie3302f2b2013-01-16 23:08:36 +00008324 return __builtin_altivec_vsum4ubs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008325}
8326
8327static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008328vec_sum4s(vector signed short __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008329{
David Blaikie3302f2b2013-01-16 23:08:36 +00008330 return __builtin_altivec_vsum4shs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008331}
8332
8333/* vec_vsum4sbs */
8334
8335static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008336vec_vsum4sbs(vector signed char __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008337{
David Blaikie3302f2b2013-01-16 23:08:36 +00008338 return __builtin_altivec_vsum4sbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008339}
8340
8341/* vec_vsum4ubs */
8342
8343static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008344vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008345{
David Blaikie3302f2b2013-01-16 23:08:36 +00008346 return __builtin_altivec_vsum4ubs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008347}
8348
8349/* vec_vsum4shs */
8350
8351static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008352vec_vsum4shs(vector signed short __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008353{
David Blaikie3302f2b2013-01-16 23:08:36 +00008354 return __builtin_altivec_vsum4shs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008355}
8356
8357/* vec_sum2s */
8358
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008359/* The vsum2sws instruction has a big-endian bias, so that the second
8360 input vector and the result always reference big-endian elements
8361 1 and 3 (little-endian element 0 and 2). For ease of porting the
8362 programmer wants elements 1 and 3 in both cases, so for little
8363 endian we must perform some permutes. */
8364
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008365static vector signed int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008366vec_sum2s(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008367{
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008368#ifdef __LITTLE_ENDIAN__
8369 vector int __c = (vector signed int)
8370 vec_perm(__b, __b, (vector unsigned char)
8371 (4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11));
8372 __c = __builtin_altivec_vsum2sws(__a, __c);
8373 return (vector signed int)
8374 vec_perm(__c, __c, (vector unsigned char)
8375 (4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11));
8376#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008377 return __builtin_altivec_vsum2sws(__a, __b);
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008378#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008379}
8380
8381/* vec_vsum2sws */
8382
8383static vector signed int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008384vec_vsum2sws(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008385{
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008386#ifdef __LITTLE_ENDIAN__
8387 vector int __c = (vector signed int)
8388 vec_perm(__b, __b, (vector unsigned char)
8389 (4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11));
8390 __c = __builtin_altivec_vsum2sws(__a, __c);
8391 return (vector signed int)
8392 vec_perm(__c, __c, (vector unsigned char)
8393 (4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11));
8394#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008395 return __builtin_altivec_vsum2sws(__a, __b);
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008396#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008397}
8398
8399/* vec_sums */
8400
8401static vector signed int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008402vec_sums(vector signed int __a, vector signed int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008403{
David Blaikie3302f2b2013-01-16 23:08:36 +00008404 return __builtin_altivec_vsumsws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008405}
8406
8407/* vec_vsumsws */
8408
8409static vector signed int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008410vec_vsumsws(vector signed int __a, vector signed int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008411{
David Blaikie3302f2b2013-01-16 23:08:36 +00008412 return __builtin_altivec_vsumsws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008413}
8414
8415/* vec_trunc */
8416
8417static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008418vec_trunc(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008419{
David Blaikie3302f2b2013-01-16 23:08:36 +00008420 return __builtin_altivec_vrfiz(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008421}
8422
8423/* vec_vrfiz */
8424
8425static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008426vec_vrfiz(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008427{
David Blaikie3302f2b2013-01-16 23:08:36 +00008428 return __builtin_altivec_vrfiz(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008429}
8430
8431/* vec_unpackh */
8432
8433static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008434vec_unpackh(vector signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008435{
David Blaikie3302f2b2013-01-16 23:08:36 +00008436 return __builtin_altivec_vupkhsb((vector char)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008437}
8438
Anton Yartsevfc83c602010-08-19 03:21:36 +00008439static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008440vec_unpackh(vector bool char __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008441{
David Blaikie3302f2b2013-01-16 23:08:36 +00008442 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008443}
8444
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008445static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008446vec_unpackh(vector short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008447{
David Blaikie3302f2b2013-01-16 23:08:36 +00008448 return __builtin_altivec_vupkhsh(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008449}
8450
Anton Yartsevfc83c602010-08-19 03:21:36 +00008451static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008452vec_unpackh(vector bool short __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008453{
David Blaikie3302f2b2013-01-16 23:08:36 +00008454 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008455}
8456
8457static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008458vec_unpackh(vector pixel __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008459{
David Blaikie3302f2b2013-01-16 23:08:36 +00008460 return (vector unsigned int)__builtin_altivec_vupkhsh((vector short)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008461}
8462
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008463/* vec_vupkhsb */
8464
Anton Yartsevfc83c602010-08-19 03:21:36 +00008465static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008466vec_vupkhsb(vector signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008467{
David Blaikie3302f2b2013-01-16 23:08:36 +00008468 return __builtin_altivec_vupkhsb((vector char)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008469}
8470
Anton Yartsevfc83c602010-08-19 03:21:36 +00008471static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008472vec_vupkhsb(vector bool char __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008473{
David Blaikie3302f2b2013-01-16 23:08:36 +00008474 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008475}
8476
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008477/* vec_vupkhsh */
8478
Anton Yartsevfc83c602010-08-19 03:21:36 +00008479static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008480vec_vupkhsh(vector short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008481{
David Blaikie3302f2b2013-01-16 23:08:36 +00008482 return __builtin_altivec_vupkhsh(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008483}
8484
Anton Yartsevfc83c602010-08-19 03:21:36 +00008485static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008486vec_vupkhsh(vector bool short __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008487{
David Blaikie3302f2b2013-01-16 23:08:36 +00008488 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008489}
8490
8491static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008492vec_vupkhsh(vector pixel __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008493{
David Blaikie3302f2b2013-01-16 23:08:36 +00008494 return (vector unsigned int)__builtin_altivec_vupkhsh((vector short)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008495}
8496
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008497/* vec_unpackl */
8498
8499static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008500vec_unpackl(vector signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008501{
David Blaikie3302f2b2013-01-16 23:08:36 +00008502 return __builtin_altivec_vupklsb((vector char)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008503}
8504
Anton Yartsevfc83c602010-08-19 03:21:36 +00008505static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008506vec_unpackl(vector bool char __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008507{
David Blaikie3302f2b2013-01-16 23:08:36 +00008508 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008509}
8510
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008511static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008512vec_unpackl(vector short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008513{
David Blaikie3302f2b2013-01-16 23:08:36 +00008514 return __builtin_altivec_vupklsh(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008515}
8516
Anton Yartsevfc83c602010-08-19 03:21:36 +00008517static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008518vec_unpackl(vector bool short __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008519{
David Blaikie3302f2b2013-01-16 23:08:36 +00008520 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008521}
8522
8523static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008524vec_unpackl(vector pixel __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008525{
David Blaikie3302f2b2013-01-16 23:08:36 +00008526 return (vector unsigned int)__builtin_altivec_vupklsh((vector short)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008527}
8528
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008529/* vec_vupklsb */
8530
Anton Yartsevfc83c602010-08-19 03:21:36 +00008531static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008532vec_vupklsb(vector signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008533{
David Blaikie3302f2b2013-01-16 23:08:36 +00008534 return __builtin_altivec_vupklsb((vector char)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008535}
8536
Anton Yartsevfc83c602010-08-19 03:21:36 +00008537static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008538vec_vupklsb(vector bool char __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008539{
David Blaikie3302f2b2013-01-16 23:08:36 +00008540 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008541}
8542
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008543/* vec_vupklsh */
8544
Anton Yartsevfc83c602010-08-19 03:21:36 +00008545static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008546vec_vupklsh(vector short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008547{
David Blaikie3302f2b2013-01-16 23:08:36 +00008548 return __builtin_altivec_vupklsh(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008549}
8550
Anton Yartsevfc83c602010-08-19 03:21:36 +00008551static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008552vec_vupklsh(vector bool short __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008553{
David Blaikie3302f2b2013-01-16 23:08:36 +00008554 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008555}
8556
8557static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008558vec_vupklsh(vector pixel __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008559{
David Blaikie3302f2b2013-01-16 23:08:36 +00008560 return (vector unsigned int)__builtin_altivec_vupklsh((vector short)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008561}
8562
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008563/* vec_xor */
8564
8565#define __builtin_altivec_vxor vec_xor
8566
8567static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008568vec_xor(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008569{
David Blaikie3302f2b2013-01-16 23:08:36 +00008570 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008571}
8572
Anton Yartsevfc83c602010-08-19 03:21:36 +00008573static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008574vec_xor(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008575{
David Blaikie3302f2b2013-01-16 23:08:36 +00008576 return (vector signed char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008577}
8578
8579static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008580vec_xor(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008581{
David Blaikie3302f2b2013-01-16 23:08:36 +00008582 return __a ^ (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008583}
8584
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008585static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008586vec_xor(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008587{
David Blaikie3302f2b2013-01-16 23:08:36 +00008588 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008589}
8590
Anton Yartsevfc83c602010-08-19 03:21:36 +00008591static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008592vec_xor(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008593{
David Blaikie3302f2b2013-01-16 23:08:36 +00008594 return (vector unsigned char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008595}
8596
8597static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008598vec_xor(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008599{
David Blaikie3302f2b2013-01-16 23:08:36 +00008600 return __a ^ (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008601}
8602
8603static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008604vec_xor(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008605{
David Blaikie3302f2b2013-01-16 23:08:36 +00008606 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008607}
8608
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008609static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008610vec_xor(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008611{
David Blaikie3302f2b2013-01-16 23:08:36 +00008612 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008613}
8614
Anton Yartsevfc83c602010-08-19 03:21:36 +00008615static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008616vec_xor(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008617{
David Blaikie3302f2b2013-01-16 23:08:36 +00008618 return (vector short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008619}
8620
8621static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008622vec_xor(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008623{
David Blaikie3302f2b2013-01-16 23:08:36 +00008624 return __a ^ (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008625}
8626
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008627static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008628vec_xor(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008629{
David Blaikie3302f2b2013-01-16 23:08:36 +00008630 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008631}
8632
Anton Yartsevfc83c602010-08-19 03:21:36 +00008633static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008634vec_xor(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008635{
David Blaikie3302f2b2013-01-16 23:08:36 +00008636 return (vector unsigned short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008637}
8638
8639static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008640vec_xor(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008641{
David Blaikie3302f2b2013-01-16 23:08:36 +00008642 return __a ^ (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008643}
8644
8645static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008646vec_xor(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008647{
David Blaikie3302f2b2013-01-16 23:08:36 +00008648 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008649}
8650
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008651static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008652vec_xor(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008653{
David Blaikie3302f2b2013-01-16 23:08:36 +00008654 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008655}
8656
Anton Yartsevfc83c602010-08-19 03:21:36 +00008657static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008658vec_xor(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008659{
David Blaikie3302f2b2013-01-16 23:08:36 +00008660 return (vector int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008661}
8662
8663static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008664vec_xor(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008665{
David Blaikie3302f2b2013-01-16 23:08:36 +00008666 return __a ^ (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008667}
8668
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008669static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008670vec_xor(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008671{
David Blaikie3302f2b2013-01-16 23:08:36 +00008672 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008673}
8674
Anton Yartsevfc83c602010-08-19 03:21:36 +00008675static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008676vec_xor(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008677{
David Blaikie3302f2b2013-01-16 23:08:36 +00008678 return (vector unsigned int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008679}
8680
8681static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008682vec_xor(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008683{
David Blaikie3302f2b2013-01-16 23:08:36 +00008684 return __a ^ (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008685}
8686
8687static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008688vec_xor(vector bool int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008689{
David Blaikie3302f2b2013-01-16 23:08:36 +00008690 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008691}
8692
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008693static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008694vec_xor(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008695{
David Blaikie3302f2b2013-01-16 23:08:36 +00008696 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
8697 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008698}
8699
Anton Yartsevfc83c602010-08-19 03:21:36 +00008700static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008701vec_xor(vector bool int __a, vector float __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008702{
David Blaikie3302f2b2013-01-16 23:08:36 +00008703 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
8704 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008705}
8706
8707static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008708vec_xor(vector float __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008709{
David Blaikie3302f2b2013-01-16 23:08:36 +00008710 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
8711 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008712}
8713
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008714/* vec_vxor */
8715
8716static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008717vec_vxor(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008718{
David Blaikie3302f2b2013-01-16 23:08:36 +00008719 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008720}
8721
Anton Yartsevfc83c602010-08-19 03:21:36 +00008722static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008723vec_vxor(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008724{
David Blaikie3302f2b2013-01-16 23:08:36 +00008725 return (vector signed char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008726}
8727
8728static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008729vec_vxor(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008730{
David Blaikie3302f2b2013-01-16 23:08:36 +00008731 return __a ^ (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008732}
8733
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008734static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008735vec_vxor(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008736{
David Blaikie3302f2b2013-01-16 23:08:36 +00008737 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008738}
8739
Anton Yartsevfc83c602010-08-19 03:21:36 +00008740static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008741vec_vxor(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008742{
David Blaikie3302f2b2013-01-16 23:08:36 +00008743 return (vector unsigned char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008744}
8745
8746static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008747vec_vxor(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008748{
David Blaikie3302f2b2013-01-16 23:08:36 +00008749 return __a ^ (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008750}
8751
8752static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008753vec_vxor(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008754{
David Blaikie3302f2b2013-01-16 23:08:36 +00008755 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008756}
8757
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008758static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008759vec_vxor(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008760{
David Blaikie3302f2b2013-01-16 23:08:36 +00008761 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008762}
8763
Anton Yartsevfc83c602010-08-19 03:21:36 +00008764static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008765vec_vxor(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008766{
David Blaikie3302f2b2013-01-16 23:08:36 +00008767 return (vector short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008768}
8769
8770static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008771vec_vxor(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008772{
David Blaikie3302f2b2013-01-16 23:08:36 +00008773 return __a ^ (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008774}
8775
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008776static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008777vec_vxor(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008778{
David Blaikie3302f2b2013-01-16 23:08:36 +00008779 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008780}
8781
Anton Yartsevfc83c602010-08-19 03:21:36 +00008782static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008783vec_vxor(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008784{
David Blaikie3302f2b2013-01-16 23:08:36 +00008785 return (vector unsigned short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008786}
8787
8788static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008789vec_vxor(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008790{
David Blaikie3302f2b2013-01-16 23:08:36 +00008791 return __a ^ (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008792}
8793
8794static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008795vec_vxor(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008796{
David Blaikie3302f2b2013-01-16 23:08:36 +00008797 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008798}
8799
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008800static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008801vec_vxor(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008802{
David Blaikie3302f2b2013-01-16 23:08:36 +00008803 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008804}
8805
Anton Yartsevfc83c602010-08-19 03:21:36 +00008806static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008807vec_vxor(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008808{
David Blaikie3302f2b2013-01-16 23:08:36 +00008809 return (vector int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008810}
8811
8812static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008813vec_vxor(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008814{
David Blaikie3302f2b2013-01-16 23:08:36 +00008815 return __a ^ (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008816}
8817
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008818static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008819vec_vxor(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008820{
David Blaikie3302f2b2013-01-16 23:08:36 +00008821 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008822}
8823
Anton Yartsevfc83c602010-08-19 03:21:36 +00008824static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008825vec_vxor(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008826{
David Blaikie3302f2b2013-01-16 23:08:36 +00008827 return (vector unsigned int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008828}
8829
8830static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008831vec_vxor(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008832{
David Blaikie3302f2b2013-01-16 23:08:36 +00008833 return __a ^ (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008834}
8835
8836static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008837vec_vxor(vector bool int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008838{
David Blaikie3302f2b2013-01-16 23:08:36 +00008839 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008840}
8841
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008842static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008843vec_vxor(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008844{
David Blaikie3302f2b2013-01-16 23:08:36 +00008845 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
8846 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008847}
Chris Lattnerdad40622010-04-14 03:54:58 +00008848
Anton Yartsevfc83c602010-08-19 03:21:36 +00008849static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008850vec_vxor(vector bool int __a, vector float __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008851{
David Blaikie3302f2b2013-01-16 23:08:36 +00008852 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
8853 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008854}
8855
8856static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008857vec_vxor(vector float __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008858{
David Blaikie3302f2b2013-01-16 23:08:36 +00008859 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
8860 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008861}
8862
Anton Yartsev79d6af32010-09-18 00:39:16 +00008863/* ------------------------ extensions for CBEA ----------------------------- */
Anton Yartsev73d40232010-10-14 14:37:46 +00008864
8865/* vec_extract */
8866
8867static signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008868vec_extract(vector signed char __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00008869{
David Blaikie3302f2b2013-01-16 23:08:36 +00008870 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00008871}
8872
8873static unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008874vec_extract(vector unsigned char __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00008875{
David Blaikie3302f2b2013-01-16 23:08:36 +00008876 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00008877}
8878
8879static short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008880vec_extract(vector short __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00008881{
David Blaikie3302f2b2013-01-16 23:08:36 +00008882 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00008883}
8884
8885static unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008886vec_extract(vector unsigned short __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00008887{
David Blaikie3302f2b2013-01-16 23:08:36 +00008888 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00008889}
8890
8891static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008892vec_extract(vector int __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00008893{
David Blaikie3302f2b2013-01-16 23:08:36 +00008894 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00008895}
8896
8897static unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008898vec_extract(vector unsigned int __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00008899{
David Blaikie3302f2b2013-01-16 23:08:36 +00008900 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00008901}
8902
8903static float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008904vec_extract(vector float __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00008905{
David Blaikie3302f2b2013-01-16 23:08:36 +00008906 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00008907}
8908
8909/* vec_insert */
8910
8911static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008912vec_insert(signed char __a, vector signed char __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00008913{
David Blaikie3302f2b2013-01-16 23:08:36 +00008914 __b[__c] = __a;
8915 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00008916}
8917
8918static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008919vec_insert(unsigned char __a, vector unsigned char __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00008920{
David Blaikie3302f2b2013-01-16 23:08:36 +00008921 __b[__c] = __a;
8922 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00008923}
8924
8925static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008926vec_insert(short __a, vector short __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00008927{
David Blaikie3302f2b2013-01-16 23:08:36 +00008928 __b[__c] = __a;
8929 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00008930}
8931
8932static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008933vec_insert(unsigned short __a, vector unsigned short __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00008934{
David Blaikie3302f2b2013-01-16 23:08:36 +00008935 __b[__c] = __a;
8936 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00008937}
8938
8939static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008940vec_insert(int __a, vector int __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00008941{
David Blaikie3302f2b2013-01-16 23:08:36 +00008942 __b[__c] = __a;
8943 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00008944}
8945
8946static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008947vec_insert(unsigned int __a, vector unsigned int __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00008948{
David Blaikie3302f2b2013-01-16 23:08:36 +00008949 __b[__c] = __a;
8950 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00008951}
8952
8953static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008954vec_insert(float __a, vector float __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00008955{
David Blaikie3302f2b2013-01-16 23:08:36 +00008956 __b[__c] = __a;
8957 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00008958}
8959
8960/* vec_lvlx */
8961
8962static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008963vec_lvlx(int __a, const signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00008964{
David Blaikie3302f2b2013-01-16 23:08:36 +00008965 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00008966 (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00008967 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00008968}
8969
8970static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008971vec_lvlx(int __a, const vector signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00008972{
David Blaikie3302f2b2013-01-16 23:08:36 +00008973 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00008974 (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00008975 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00008976}
8977
8978static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008979vec_lvlx(int __a, const unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00008980{
David Blaikie3302f2b2013-01-16 23:08:36 +00008981 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00008982 (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00008983 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00008984}
8985
8986static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008987vec_lvlx(int __a, const vector unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00008988{
David Blaikie3302f2b2013-01-16 23:08:36 +00008989 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00008990 (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00008991 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00008992}
8993
8994static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008995vec_lvlx(int __a, const vector bool char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00008996{
David Blaikie3302f2b2013-01-16 23:08:36 +00008997 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00008998 (vector bool char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00008999 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009000}
9001
9002static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009003vec_lvlx(int __a, const short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009004{
David Blaikie3302f2b2013-01-16 23:08:36 +00009005 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009006 (vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009007 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009008}
9009
9010static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009011vec_lvlx(int __a, const vector short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009012{
David Blaikie3302f2b2013-01-16 23:08:36 +00009013 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009014 (vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009015 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009016}
9017
9018static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009019vec_lvlx(int __a, const unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009020{
David Blaikie3302f2b2013-01-16 23:08:36 +00009021 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009022 (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009023 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009024}
9025
9026static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009027vec_lvlx(int __a, const vector unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009028{
David Blaikie3302f2b2013-01-16 23:08:36 +00009029 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009030 (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009031 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009032}
9033
9034static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009035vec_lvlx(int __a, const vector bool short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009036{
David Blaikie3302f2b2013-01-16 23:08:36 +00009037 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009038 (vector bool short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009039 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009040}
9041
9042static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009043vec_lvlx(int __a, const vector pixel *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009044{
David Blaikie3302f2b2013-01-16 23:08:36 +00009045 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009046 (vector pixel)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009047 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009048}
9049
9050static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009051vec_lvlx(int __a, const int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009052{
David Blaikie3302f2b2013-01-16 23:08:36 +00009053 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009054 (vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009055 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009056}
9057
9058static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009059vec_lvlx(int __a, const vector int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009060{
David Blaikie3302f2b2013-01-16 23:08:36 +00009061 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009062 (vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009063 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009064}
9065
9066static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009067vec_lvlx(int __a, const unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009068{
David Blaikie3302f2b2013-01-16 23:08:36 +00009069 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009070 (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009071 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009072}
9073
9074static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009075vec_lvlx(int __a, const vector unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009076{
David Blaikie3302f2b2013-01-16 23:08:36 +00009077 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009078 (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009079 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009080}
9081
9082static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009083vec_lvlx(int __a, const vector bool int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009084{
David Blaikie3302f2b2013-01-16 23:08:36 +00009085 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009086 (vector bool int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009087 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009088}
9089
9090static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009091vec_lvlx(int __a, const float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009092{
David Blaikie3302f2b2013-01-16 23:08:36 +00009093 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009094 (vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009095 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009096}
9097
9098static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009099vec_lvlx(int __a, const vector float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009100{
David Blaikie3302f2b2013-01-16 23:08:36 +00009101 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009102 (vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009103 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009104}
9105
9106/* vec_lvlxl */
9107
9108static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009109vec_lvlxl(int __a, const signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009110{
David Blaikie3302f2b2013-01-16 23:08:36 +00009111 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009112 (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009113 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009114}
9115
9116static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009117vec_lvlxl(int __a, const vector signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009118{
David Blaikie3302f2b2013-01-16 23:08:36 +00009119 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009120 (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009121 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009122}
9123
9124static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009125vec_lvlxl(int __a, const unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009126{
David Blaikie3302f2b2013-01-16 23:08:36 +00009127 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009128 (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009129 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009130}
9131
9132static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009133vec_lvlxl(int __a, const vector unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009134{
David Blaikie3302f2b2013-01-16 23:08:36 +00009135 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009136 (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009137 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009138}
9139
9140static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009141vec_lvlxl(int __a, const vector bool char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009142{
David Blaikie3302f2b2013-01-16 23:08:36 +00009143 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009144 (vector bool char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009145 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009146}
9147
9148static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009149vec_lvlxl(int __a, const short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009150{
David Blaikie3302f2b2013-01-16 23:08:36 +00009151 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009152 (vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009153 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009154}
9155
9156static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009157vec_lvlxl(int __a, const vector short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009158{
David Blaikie3302f2b2013-01-16 23:08:36 +00009159 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009160 (vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009161 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009162}
9163
9164static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009165vec_lvlxl(int __a, const unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009166{
David Blaikie3302f2b2013-01-16 23:08:36 +00009167 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009168 (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009169 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009170}
9171
9172static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009173vec_lvlxl(int __a, const vector unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009174{
David Blaikie3302f2b2013-01-16 23:08:36 +00009175 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009176 (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009177 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009178}
9179
9180static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009181vec_lvlxl(int __a, const vector bool short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009182{
David Blaikie3302f2b2013-01-16 23:08:36 +00009183 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009184 (vector bool short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009185 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009186}
9187
9188static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009189vec_lvlxl(int __a, const vector pixel *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009190{
David Blaikie3302f2b2013-01-16 23:08:36 +00009191 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009192 (vector pixel)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009193 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009194}
9195
9196static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009197vec_lvlxl(int __a, const int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009198{
David Blaikie3302f2b2013-01-16 23:08:36 +00009199 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009200 (vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009201 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009202}
9203
9204static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009205vec_lvlxl(int __a, const vector int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009206{
David Blaikie3302f2b2013-01-16 23:08:36 +00009207 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009208 (vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009209 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009210}
9211
9212static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009213vec_lvlxl(int __a, const unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009214{
David Blaikie3302f2b2013-01-16 23:08:36 +00009215 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009216 (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009217 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009218}
9219
9220static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009221vec_lvlxl(int __a, const vector unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009222{
David Blaikie3302f2b2013-01-16 23:08:36 +00009223 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009224 (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009225 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009226}
9227
9228static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009229vec_lvlxl(int __a, const vector bool int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009230{
David Blaikie3302f2b2013-01-16 23:08:36 +00009231 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009232 (vector bool int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009233 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009234}
9235
9236static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009237vec_lvlxl(int __a, const float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009238{
David Blaikie3302f2b2013-01-16 23:08:36 +00009239 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009240 (vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009241 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009242}
9243
9244static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009245vec_lvlxl(int __a, vector float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009246{
David Blaikie3302f2b2013-01-16 23:08:36 +00009247 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009248 (vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009249 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009250}
9251
9252/* vec_lvrx */
9253
9254static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009255vec_lvrx(int __a, const signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009256{
9257 return vec_perm((vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009258 vec_ld(__a, __b),
9259 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009260}
9261
9262static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009263vec_lvrx(int __a, const vector signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009264{
9265 return vec_perm((vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009266 vec_ld(__a, __b),
9267 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009268}
9269
9270static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009271vec_lvrx(int __a, const unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009272{
9273 return vec_perm((vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009274 vec_ld(__a, __b),
9275 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009276}
9277
9278static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009279vec_lvrx(int __a, const vector unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009280{
9281 return vec_perm((vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009282 vec_ld(__a, __b),
9283 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009284}
9285
9286static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009287vec_lvrx(int __a, const vector bool char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009288{
9289 return vec_perm((vector bool char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009290 vec_ld(__a, __b),
9291 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009292}
9293
9294static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009295vec_lvrx(int __a, const short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009296{
9297 return vec_perm((vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009298 vec_ld(__a, __b),
9299 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009300}
9301
9302static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009303vec_lvrx(int __a, const vector short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009304{
9305 return vec_perm((vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009306 vec_ld(__a, __b),
9307 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009308}
9309
9310static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009311vec_lvrx(int __a, const unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009312{
9313 return vec_perm((vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009314 vec_ld(__a, __b),
9315 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009316}
9317
9318static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009319vec_lvrx(int __a, const vector unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009320{
9321 return vec_perm((vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009322 vec_ld(__a, __b),
9323 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009324}
9325
9326static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009327vec_lvrx(int __a, const vector bool short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009328{
9329 return vec_perm((vector bool short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009330 vec_ld(__a, __b),
9331 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009332}
9333
9334static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009335vec_lvrx(int __a, const vector pixel *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009336{
9337 return vec_perm((vector pixel)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009338 vec_ld(__a, __b),
9339 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009340}
9341
9342static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009343vec_lvrx(int __a, const int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009344{
9345 return vec_perm((vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009346 vec_ld(__a, __b),
9347 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009348}
9349
9350static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009351vec_lvrx(int __a, const vector int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009352{
9353 return vec_perm((vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009354 vec_ld(__a, __b),
9355 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009356}
9357
9358static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009359vec_lvrx(int __a, const unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009360{
9361 return vec_perm((vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009362 vec_ld(__a, __b),
9363 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009364}
9365
9366static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009367vec_lvrx(int __a, const vector unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009368{
9369 return vec_perm((vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009370 vec_ld(__a, __b),
9371 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009372}
9373
9374static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009375vec_lvrx(int __a, const vector bool int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009376{
9377 return vec_perm((vector bool int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009378 vec_ld(__a, __b),
9379 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009380}
9381
9382static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009383vec_lvrx(int __a, const float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009384{
9385 return vec_perm((vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009386 vec_ld(__a, __b),
9387 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009388}
9389
9390static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009391vec_lvrx(int __a, const vector float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009392{
9393 return vec_perm((vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009394 vec_ld(__a, __b),
9395 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009396}
9397
9398/* vec_lvrxl */
9399
9400static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009401vec_lvrxl(int __a, const signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009402{
9403 return vec_perm((vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009404 vec_ldl(__a, __b),
9405 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009406}
9407
9408static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009409vec_lvrxl(int __a, const vector signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009410{
9411 return vec_perm((vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009412 vec_ldl(__a, __b),
9413 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009414}
9415
9416static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009417vec_lvrxl(int __a, const unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009418{
9419 return vec_perm((vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009420 vec_ldl(__a, __b),
9421 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009422}
9423
9424static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009425vec_lvrxl(int __a, const vector unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009426{
9427 return vec_perm((vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009428 vec_ldl(__a, __b),
9429 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009430}
9431
9432static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009433vec_lvrxl(int __a, const vector bool char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009434{
9435 return vec_perm((vector bool char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009436 vec_ldl(__a, __b),
9437 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009438}
9439
9440static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009441vec_lvrxl(int __a, const short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009442{
9443 return vec_perm((vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009444 vec_ldl(__a, __b),
9445 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009446}
9447
9448static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009449vec_lvrxl(int __a, const vector short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009450{
9451 return vec_perm((vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009452 vec_ldl(__a, __b),
9453 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009454}
9455
9456static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009457vec_lvrxl(int __a, const unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009458{
9459 return vec_perm((vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009460 vec_ldl(__a, __b),
9461 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009462}
9463
9464static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009465vec_lvrxl(int __a, const vector unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009466{
9467 return vec_perm((vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009468 vec_ldl(__a, __b),
9469 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009470}
9471
9472static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009473vec_lvrxl(int __a, const vector bool short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009474{
9475 return vec_perm((vector bool short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009476 vec_ldl(__a, __b),
9477 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009478}
9479
9480static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009481vec_lvrxl(int __a, const vector pixel *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009482{
9483 return vec_perm((vector pixel)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009484 vec_ldl(__a, __b),
9485 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009486}
9487
9488static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009489vec_lvrxl(int __a, const int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009490{
9491 return vec_perm((vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009492 vec_ldl(__a, __b),
9493 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009494}
9495
9496static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009497vec_lvrxl(int __a, const vector int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009498{
9499 return vec_perm((vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009500 vec_ldl(__a, __b),
9501 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009502}
9503
9504static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009505vec_lvrxl(int __a, const unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009506{
9507 return vec_perm((vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009508 vec_ldl(__a, __b),
9509 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009510}
9511
9512static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009513vec_lvrxl(int __a, const vector unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009514{
9515 return vec_perm((vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009516 vec_ldl(__a, __b),
9517 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009518}
9519
9520static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009521vec_lvrxl(int __a, const vector bool int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009522{
9523 return vec_perm((vector bool int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009524 vec_ldl(__a, __b),
9525 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009526}
9527
9528static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009529vec_lvrxl(int __a, const float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009530{
9531 return vec_perm((vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009532 vec_ldl(__a, __b),
9533 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009534}
9535
9536static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009537vec_lvrxl(int __a, const vector float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009538{
9539 return vec_perm((vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009540 vec_ldl(__a, __b),
9541 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009542}
9543
9544/* vec_stvlx */
9545
9546static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009547vec_stvlx(vector signed char __a, int __b, signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009548{
David Blaikie3302f2b2013-01-16 23:08:36 +00009549 return vec_st(vec_perm(vec_lvrx(__b, __c),
9550 __a,
9551 vec_lvsr(__b, __c)),
9552 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009553}
9554
9555static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009556vec_stvlx(vector signed char __a, int __b, vector signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009557{
David Blaikie3302f2b2013-01-16 23:08:36 +00009558 return vec_st(vec_perm(vec_lvrx(__b, __c),
9559 __a,
9560 vec_lvsr(__b, (unsigned char *)__c)),
9561 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009562}
9563
9564static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009565vec_stvlx(vector unsigned char __a, int __b, unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009566{
David Blaikie3302f2b2013-01-16 23:08:36 +00009567 return vec_st(vec_perm(vec_lvrx(__b, __c),
9568 __a,
9569 vec_lvsr(__b, __c)),
9570 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009571}
9572
9573static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009574vec_stvlx(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009575{
David Blaikie3302f2b2013-01-16 23:08:36 +00009576 return vec_st(vec_perm(vec_lvrx(__b, __c),
9577 __a,
9578 vec_lvsr(__b, (unsigned char *)__c)),
9579 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009580}
9581
9582static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009583vec_stvlx(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009584{
David Blaikie3302f2b2013-01-16 23:08:36 +00009585 return vec_st(vec_perm(vec_lvrx(__b, __c),
9586 __a,
9587 vec_lvsr(__b, (unsigned char *)__c)),
9588 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009589}
9590
9591static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009592vec_stvlx(vector short __a, int __b, short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009593{
David Blaikie3302f2b2013-01-16 23:08:36 +00009594 return vec_st(vec_perm(vec_lvrx(__b, __c),
9595 __a,
9596 vec_lvsr(__b, __c)),
9597 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009598}
9599
9600static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009601vec_stvlx(vector short __a, int __b, vector short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009602{
David Blaikie3302f2b2013-01-16 23:08:36 +00009603 return vec_st(vec_perm(vec_lvrx(__b, __c),
9604 __a,
9605 vec_lvsr(__b, (unsigned char *)__c)),
9606 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009607}
9608
9609static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009610vec_stvlx(vector unsigned short __a, int __b, unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009611{
David Blaikie3302f2b2013-01-16 23:08:36 +00009612 return vec_st(vec_perm(vec_lvrx(__b, __c),
9613 __a,
9614 vec_lvsr(__b, __c)),
9615 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009616}
9617
9618static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009619vec_stvlx(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009620{
David Blaikie3302f2b2013-01-16 23:08:36 +00009621 return vec_st(vec_perm(vec_lvrx(__b, __c),
9622 __a,
9623 vec_lvsr(__b, (unsigned char *)__c)),
9624 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009625}
9626
9627static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009628vec_stvlx(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009629{
David Blaikie3302f2b2013-01-16 23:08:36 +00009630 return vec_st(vec_perm(vec_lvrx(__b, __c),
9631 __a,
9632 vec_lvsr(__b, (unsigned char *)__c)),
9633 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009634}
9635
9636static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009637vec_stvlx(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009638{
David Blaikie3302f2b2013-01-16 23:08:36 +00009639 return vec_st(vec_perm(vec_lvrx(__b, __c),
9640 __a,
9641 vec_lvsr(__b, (unsigned char *)__c)),
9642 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009643}
9644
9645static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009646vec_stvlx(vector int __a, int __b, int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009647{
David Blaikie3302f2b2013-01-16 23:08:36 +00009648 return vec_st(vec_perm(vec_lvrx(__b, __c),
9649 __a,
9650 vec_lvsr(__b, __c)),
9651 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009652}
9653
9654static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009655vec_stvlx(vector int __a, int __b, vector int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009656{
David Blaikie3302f2b2013-01-16 23:08:36 +00009657 return vec_st(vec_perm(vec_lvrx(__b, __c),
9658 __a,
9659 vec_lvsr(__b, (unsigned char *)__c)),
9660 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009661}
9662
9663static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009664vec_stvlx(vector unsigned int __a, int __b, unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009665{
David Blaikie3302f2b2013-01-16 23:08:36 +00009666 return vec_st(vec_perm(vec_lvrx(__b, __c),
9667 __a,
9668 vec_lvsr(__b, __c)),
9669 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009670}
9671
9672static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009673vec_stvlx(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009674{
David Blaikie3302f2b2013-01-16 23:08:36 +00009675 return vec_st(vec_perm(vec_lvrx(__b, __c),
9676 __a,
9677 vec_lvsr(__b, (unsigned char *)__c)),
9678 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009679}
9680
9681static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009682vec_stvlx(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009683{
David Blaikie3302f2b2013-01-16 23:08:36 +00009684 return vec_st(vec_perm(vec_lvrx(__b, __c),
9685 __a,
9686 vec_lvsr(__b, (unsigned char *)__c)),
9687 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009688}
9689
9690static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009691vec_stvlx(vector float __a, int __b, vector float *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009692{
David Blaikie3302f2b2013-01-16 23:08:36 +00009693 return vec_st(vec_perm(vec_lvrx(__b, __c),
9694 __a,
9695 vec_lvsr(__b, (unsigned char *)__c)),
9696 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009697}
9698
9699/* vec_stvlxl */
9700
9701static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009702vec_stvlxl(vector signed char __a, int __b, signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009703{
David Blaikie3302f2b2013-01-16 23:08:36 +00009704 return vec_stl(vec_perm(vec_lvrx(__b, __c),
9705 __a,
9706 vec_lvsr(__b, __c)),
9707 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009708}
9709
9710static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009711vec_stvlxl(vector signed char __a, int __b, vector signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009712{
David Blaikie3302f2b2013-01-16 23:08:36 +00009713 return vec_stl(vec_perm(vec_lvrx(__b, __c),
9714 __a,
9715 vec_lvsr(__b, (unsigned char *)__c)),
9716 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009717}
9718
9719static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009720vec_stvlxl(vector unsigned char __a, int __b, unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009721{
David Blaikie3302f2b2013-01-16 23:08:36 +00009722 return vec_stl(vec_perm(vec_lvrx(__b, __c),
9723 __a,
9724 vec_lvsr(__b, __c)),
9725 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009726}
9727
9728static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009729vec_stvlxl(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009730{
David Blaikie3302f2b2013-01-16 23:08:36 +00009731 return vec_stl(vec_perm(vec_lvrx(__b, __c),
9732 __a,
9733 vec_lvsr(__b, (unsigned char *)__c)),
9734 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009735}
9736
9737static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009738vec_stvlxl(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009739{
David Blaikie3302f2b2013-01-16 23:08:36 +00009740 return vec_stl(vec_perm(vec_lvrx(__b, __c),
9741 __a,
9742 vec_lvsr(__b, (unsigned char *)__c)),
9743 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009744}
9745
9746static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009747vec_stvlxl(vector short __a, int __b, short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009748{
David Blaikie3302f2b2013-01-16 23:08:36 +00009749 return vec_stl(vec_perm(vec_lvrx(__b, __c),
9750 __a,
9751 vec_lvsr(__b, __c)),
9752 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009753}
9754
9755static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009756vec_stvlxl(vector short __a, int __b, vector short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009757{
David Blaikie3302f2b2013-01-16 23:08:36 +00009758 return vec_stl(vec_perm(vec_lvrx(__b, __c),
9759 __a,
9760 vec_lvsr(__b, (unsigned char *)__c)),
9761 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009762}
9763
9764static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009765vec_stvlxl(vector unsigned short __a, int __b, unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009766{
David Blaikie3302f2b2013-01-16 23:08:36 +00009767 return vec_stl(vec_perm(vec_lvrx(__b, __c),
9768 __a,
9769 vec_lvsr(__b, __c)),
9770 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009771}
9772
9773static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009774vec_stvlxl(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009775{
David Blaikie3302f2b2013-01-16 23:08:36 +00009776 return vec_stl(vec_perm(vec_lvrx(__b, __c),
9777 __a,
9778 vec_lvsr(__b, (unsigned char *)__c)),
9779 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009780}
9781
9782static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009783vec_stvlxl(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009784{
David Blaikie3302f2b2013-01-16 23:08:36 +00009785 return vec_stl(vec_perm(vec_lvrx(__b, __c),
9786 __a,
9787 vec_lvsr(__b, (unsigned char *)__c)),
9788 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009789}
9790
9791static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009792vec_stvlxl(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009793{
David Blaikie3302f2b2013-01-16 23:08:36 +00009794 return vec_stl(vec_perm(vec_lvrx(__b, __c),
9795 __a,
9796 vec_lvsr(__b, (unsigned char *)__c)),
9797 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009798}
9799
9800static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009801vec_stvlxl(vector int __a, int __b, int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009802{
David Blaikie3302f2b2013-01-16 23:08:36 +00009803 return vec_stl(vec_perm(vec_lvrx(__b, __c),
9804 __a,
9805 vec_lvsr(__b, __c)),
9806 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009807}
9808
9809static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009810vec_stvlxl(vector int __a, int __b, vector int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009811{
David Blaikie3302f2b2013-01-16 23:08:36 +00009812 return vec_stl(vec_perm(vec_lvrx(__b, __c),
9813 __a,
9814 vec_lvsr(__b, (unsigned char *)__c)),
9815 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009816}
9817
9818static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009819vec_stvlxl(vector unsigned int __a, int __b, unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009820{
David Blaikie3302f2b2013-01-16 23:08:36 +00009821 return vec_stl(vec_perm(vec_lvrx(__b, __c),
9822 __a,
9823 vec_lvsr(__b, __c)),
9824 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009825}
9826
9827static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009828vec_stvlxl(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009829{
David Blaikie3302f2b2013-01-16 23:08:36 +00009830 return vec_stl(vec_perm(vec_lvrx(__b, __c),
9831 __a,
9832 vec_lvsr(__b, (unsigned char *)__c)),
9833 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009834}
9835
9836static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009837vec_stvlxl(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009838{
David Blaikie3302f2b2013-01-16 23:08:36 +00009839 return vec_stl(vec_perm(vec_lvrx(__b, __c),
9840 __a,
9841 vec_lvsr(__b, (unsigned char *)__c)),
9842 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009843}
9844
9845static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009846vec_stvlxl(vector float __a, int __b, vector float *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009847{
David Blaikie3302f2b2013-01-16 23:08:36 +00009848 return vec_stl(vec_perm(vec_lvrx(__b, __c),
9849 __a,
9850 vec_lvsr(__b, (unsigned char *)__c)),
9851 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009852}
9853
9854/* vec_stvrx */
9855
9856static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009857vec_stvrx(vector signed char __a, int __b, signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009858{
David Blaikie3302f2b2013-01-16 23:08:36 +00009859 return vec_st(vec_perm(__a,
9860 vec_lvlx(__b, __c),
9861 vec_lvsr(__b, __c)),
9862 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009863}
9864
9865static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009866vec_stvrx(vector signed char __a, int __b, vector signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009867{
David Blaikie3302f2b2013-01-16 23:08:36 +00009868 return vec_st(vec_perm(__a,
9869 vec_lvlx(__b, __c),
9870 vec_lvsr(__b, (unsigned char *)__c)),
9871 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009872}
9873
9874static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009875vec_stvrx(vector unsigned char __a, int __b, unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009876{
David Blaikie3302f2b2013-01-16 23:08:36 +00009877 return vec_st(vec_perm(__a,
9878 vec_lvlx(__b, __c),
9879 vec_lvsr(__b, __c)),
9880 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009881}
9882
9883static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009884vec_stvrx(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009885{
David Blaikie3302f2b2013-01-16 23:08:36 +00009886 return vec_st(vec_perm(__a,
9887 vec_lvlx(__b, __c),
9888 vec_lvsr(__b, (unsigned char *)__c)),
9889 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009890}
9891
9892static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009893vec_stvrx(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009894{
David Blaikie3302f2b2013-01-16 23:08:36 +00009895 return vec_st(vec_perm(__a,
9896 vec_lvlx(__b, __c),
9897 vec_lvsr(__b, (unsigned char *)__c)),
9898 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009899}
9900
9901static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009902vec_stvrx(vector short __a, int __b, short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009903{
David Blaikie3302f2b2013-01-16 23:08:36 +00009904 return vec_st(vec_perm(__a,
9905 vec_lvlx(__b, __c),
9906 vec_lvsr(__b, __c)),
9907 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009908}
9909
9910static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009911vec_stvrx(vector short __a, int __b, vector short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009912{
David Blaikie3302f2b2013-01-16 23:08:36 +00009913 return vec_st(vec_perm(__a,
9914 vec_lvlx(__b, __c),
9915 vec_lvsr(__b, (unsigned char *)__c)),
9916 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009917}
9918
9919static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009920vec_stvrx(vector unsigned short __a, int __b, unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009921{
David Blaikie3302f2b2013-01-16 23:08:36 +00009922 return vec_st(vec_perm(__a,
9923 vec_lvlx(__b, __c),
9924 vec_lvsr(__b, __c)),
9925 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009926}
9927
9928static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009929vec_stvrx(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009930{
David Blaikie3302f2b2013-01-16 23:08:36 +00009931 return vec_st(vec_perm(__a,
9932 vec_lvlx(__b, __c),
9933 vec_lvsr(__b, (unsigned char *)__c)),
9934 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009935}
9936
9937static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009938vec_stvrx(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009939{
David Blaikie3302f2b2013-01-16 23:08:36 +00009940 return vec_st(vec_perm(__a,
9941 vec_lvlx(__b, __c),
9942 vec_lvsr(__b, (unsigned char *)__c)),
9943 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009944}
9945
9946static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009947vec_stvrx(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009948{
David Blaikie3302f2b2013-01-16 23:08:36 +00009949 return vec_st(vec_perm(__a,
9950 vec_lvlx(__b, __c),
9951 vec_lvsr(__b, (unsigned char *)__c)),
9952 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009953}
9954
9955static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009956vec_stvrx(vector int __a, int __b, int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009957{
David Blaikie3302f2b2013-01-16 23:08:36 +00009958 return vec_st(vec_perm(__a,
9959 vec_lvlx(__b, __c),
9960 vec_lvsr(__b, __c)),
9961 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009962}
9963
9964static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009965vec_stvrx(vector int __a, int __b, vector int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009966{
David Blaikie3302f2b2013-01-16 23:08:36 +00009967 return vec_st(vec_perm(__a,
9968 vec_lvlx(__b, __c),
9969 vec_lvsr(__b, (unsigned char *)__c)),
9970 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009971}
9972
9973static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009974vec_stvrx(vector unsigned int __a, int __b, unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009975{
David Blaikie3302f2b2013-01-16 23:08:36 +00009976 return vec_st(vec_perm(__a,
9977 vec_lvlx(__b, __c),
9978 vec_lvsr(__b, __c)),
9979 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009980}
9981
9982static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009983vec_stvrx(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009984{
David Blaikie3302f2b2013-01-16 23:08:36 +00009985 return vec_st(vec_perm(__a,
9986 vec_lvlx(__b, __c),
9987 vec_lvsr(__b, (unsigned char *)__c)),
9988 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009989}
9990
9991static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009992vec_stvrx(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009993{
David Blaikie3302f2b2013-01-16 23:08:36 +00009994 return vec_st(vec_perm(__a,
9995 vec_lvlx(__b, __c),
9996 vec_lvsr(__b, (unsigned char *)__c)),
9997 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009998}
9999
10000static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010001vec_stvrx(vector float __a, int __b, vector float *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010002{
David Blaikie3302f2b2013-01-16 23:08:36 +000010003 return vec_st(vec_perm(__a,
10004 vec_lvlx(__b, __c),
10005 vec_lvsr(__b, (unsigned char *)__c)),
10006 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010007}
10008
10009/* vec_stvrxl */
10010
10011static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010012vec_stvrxl(vector signed char __a, int __b, signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010013{
David Blaikie3302f2b2013-01-16 23:08:36 +000010014 return vec_stl(vec_perm(__a,
10015 vec_lvlx(__b, __c),
10016 vec_lvsr(__b, __c)),
10017 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010018}
10019
10020static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010021vec_stvrxl(vector signed char __a, int __b, vector signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010022{
David Blaikie3302f2b2013-01-16 23:08:36 +000010023 return vec_stl(vec_perm(__a,
10024 vec_lvlx(__b, __c),
10025 vec_lvsr(__b, (unsigned char *)__c)),
10026 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010027}
10028
10029static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010030vec_stvrxl(vector unsigned char __a, int __b, unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010031{
David Blaikie3302f2b2013-01-16 23:08:36 +000010032 return vec_stl(vec_perm(__a,
10033 vec_lvlx(__b, __c),
10034 vec_lvsr(__b, __c)),
10035 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010036}
10037
10038static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010039vec_stvrxl(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010040{
David Blaikie3302f2b2013-01-16 23:08:36 +000010041 return vec_stl(vec_perm(__a,
10042 vec_lvlx(__b, __c),
10043 vec_lvsr(__b, (unsigned char *)__c)),
10044 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010045}
10046
10047static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010048vec_stvrxl(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010049{
David Blaikie3302f2b2013-01-16 23:08:36 +000010050 return vec_stl(vec_perm(__a,
10051 vec_lvlx(__b, __c),
10052 vec_lvsr(__b, (unsigned char *)__c)),
10053 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010054}
10055
10056static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010057vec_stvrxl(vector short __a, int __b, short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010058{
David Blaikie3302f2b2013-01-16 23:08:36 +000010059 return vec_stl(vec_perm(__a,
10060 vec_lvlx(__b, __c),
10061 vec_lvsr(__b, __c)),
10062 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010063}
10064
10065static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010066vec_stvrxl(vector short __a, int __b, vector short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010067{
David Blaikie3302f2b2013-01-16 23:08:36 +000010068 return vec_stl(vec_perm(__a,
10069 vec_lvlx(__b, __c),
10070 vec_lvsr(__b, (unsigned char *)__c)),
10071 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010072}
10073
10074static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010075vec_stvrxl(vector unsigned short __a, int __b, unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010076{
David Blaikie3302f2b2013-01-16 23:08:36 +000010077 return vec_stl(vec_perm(__a,
10078 vec_lvlx(__b, __c),
10079 vec_lvsr(__b, __c)),
10080 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010081}
10082
10083static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010084vec_stvrxl(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010085{
David Blaikie3302f2b2013-01-16 23:08:36 +000010086 return vec_stl(vec_perm(__a,
10087 vec_lvlx(__b, __c),
10088 vec_lvsr(__b, (unsigned char *)__c)),
10089 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010090}
10091
10092static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010093vec_stvrxl(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010094{
David Blaikie3302f2b2013-01-16 23:08:36 +000010095 return vec_stl(vec_perm(__a,
10096 vec_lvlx(__b, __c),
10097 vec_lvsr(__b, (unsigned char *)__c)),
10098 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010099}
10100
10101static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010102vec_stvrxl(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010103{
David Blaikie3302f2b2013-01-16 23:08:36 +000010104 return vec_stl(vec_perm(__a,
10105 vec_lvlx(__b, __c),
10106 vec_lvsr(__b, (unsigned char *)__c)),
10107 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010108}
10109
10110static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010111vec_stvrxl(vector int __a, int __b, int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010112{
David Blaikie3302f2b2013-01-16 23:08:36 +000010113 return vec_stl(vec_perm(__a,
10114 vec_lvlx(__b, __c),
10115 vec_lvsr(__b, __c)),
10116 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010117}
10118
10119static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010120vec_stvrxl(vector int __a, int __b, vector int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010121{
David Blaikie3302f2b2013-01-16 23:08:36 +000010122 return vec_stl(vec_perm(__a,
10123 vec_lvlx(__b, __c),
10124 vec_lvsr(__b, (unsigned char *)__c)),
10125 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010126}
10127
10128static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010129vec_stvrxl(vector unsigned int __a, int __b, unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010130{
David Blaikie3302f2b2013-01-16 23:08:36 +000010131 return vec_stl(vec_perm(__a,
10132 vec_lvlx(__b, __c),
10133 vec_lvsr(__b, __c)),
10134 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010135}
10136
10137static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010138vec_stvrxl(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010139{
David Blaikie3302f2b2013-01-16 23:08:36 +000010140 return vec_stl(vec_perm(__a,
10141 vec_lvlx(__b, __c),
10142 vec_lvsr(__b, (unsigned char *)__c)),
10143 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010144}
10145
10146static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010147vec_stvrxl(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010148{
David Blaikie3302f2b2013-01-16 23:08:36 +000010149 return vec_stl(vec_perm(__a,
10150 vec_lvlx(__b, __c),
10151 vec_lvsr(__b, (unsigned char *)__c)),
10152 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010153}
10154
10155static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010156vec_stvrxl(vector float __a, int __b, vector float *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010157{
David Blaikie3302f2b2013-01-16 23:08:36 +000010158 return vec_stl(vec_perm(__a,
10159 vec_lvlx(__b, __c),
10160 vec_lvsr(__b, (unsigned char *)__c)),
10161 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010162}
10163
10164/* vec_promote */
10165
10166static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010167vec_promote(signed char __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010168{
David Blaikie3302f2b2013-01-16 23:08:36 +000010169 vector signed char __res = (vector signed char)(0);
10170 __res[__b] = __a;
10171 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010172}
10173
10174static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010175vec_promote(unsigned char __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010176{
David Blaikie3302f2b2013-01-16 23:08:36 +000010177 vector unsigned char __res = (vector unsigned char)(0);
10178 __res[__b] = __a;
10179 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010180}
10181
10182static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010183vec_promote(short __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010184{
David Blaikie3302f2b2013-01-16 23:08:36 +000010185 vector short __res = (vector short)(0);
10186 __res[__b] = __a;
10187 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010188}
10189
10190static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010191vec_promote(unsigned short __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010192{
David Blaikie3302f2b2013-01-16 23:08:36 +000010193 vector unsigned short __res = (vector unsigned short)(0);
10194 __res[__b] = __a;
10195 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010196}
10197
10198static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010199vec_promote(int __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010200{
David Blaikie3302f2b2013-01-16 23:08:36 +000010201 vector int __res = (vector int)(0);
10202 __res[__b] = __a;
10203 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010204}
10205
10206static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010207vec_promote(unsigned int __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010208{
David Blaikie3302f2b2013-01-16 23:08:36 +000010209 vector unsigned int __res = (vector unsigned int)(0);
10210 __res[__b] = __a;
10211 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010212}
10213
10214static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010215vec_promote(float __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010216{
David Blaikie3302f2b2013-01-16 23:08:36 +000010217 vector float __res = (vector float)(0);
10218 __res[__b] = __a;
10219 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010220}
10221
10222/* vec_splats */
10223
10224static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010225vec_splats(signed char __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000010226{
David Blaikie3302f2b2013-01-16 23:08:36 +000010227 return (vector signed char)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010228}
10229
10230static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010231vec_splats(unsigned char __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000010232{
David Blaikie3302f2b2013-01-16 23:08:36 +000010233 return (vector unsigned char)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010234}
10235
10236static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010237vec_splats(short __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000010238{
David Blaikie3302f2b2013-01-16 23:08:36 +000010239 return (vector short)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010240}
10241
10242static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010243vec_splats(unsigned short __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000010244{
David Blaikie3302f2b2013-01-16 23:08:36 +000010245 return (vector unsigned short)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010246}
10247
10248static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010249vec_splats(int __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000010250{
David Blaikie3302f2b2013-01-16 23:08:36 +000010251 return (vector int)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010252}
10253
10254static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010255vec_splats(unsigned int __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000010256{
David Blaikie3302f2b2013-01-16 23:08:36 +000010257 return (vector unsigned int)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010258}
10259
10260static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010261vec_splats(float __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000010262{
David Blaikie3302f2b2013-01-16 23:08:36 +000010263 return (vector float)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010264}
10265
Anton Yartsev79d6af32010-09-18 00:39:16 +000010266/* ----------------------------- predicates --------------------------------- */
Chris Lattnerdad40622010-04-14 03:54:58 +000010267
Chris Lattnerdad40622010-04-14 03:54:58 +000010268/* vec_all_eq */
10269
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010270static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010271vec_all_eq(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010272{
David Blaikie3302f2b2013-01-16 23:08:36 +000010273 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010274}
10275
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010276static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010277vec_all_eq(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010278{
David Blaikie3302f2b2013-01-16 23:08:36 +000010279 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010280}
10281
10282static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010283vec_all_eq(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010284{
David Blaikie3302f2b2013-01-16 23:08:36 +000010285 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010286}
10287
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010288static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010289vec_all_eq(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010290{
David Blaikie3302f2b2013-01-16 23:08:36 +000010291 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010292}
10293
10294static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010295vec_all_eq(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010296{
David Blaikie3302f2b2013-01-16 23:08:36 +000010297 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010298}
10299
10300static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010301vec_all_eq(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010302{
David Blaikie3302f2b2013-01-16 23:08:36 +000010303 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010304}
10305
10306static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010307vec_all_eq(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010308{
David Blaikie3302f2b2013-01-16 23:08:36 +000010309 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010310}
10311
10312static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010313vec_all_eq(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010314{
David Blaikie3302f2b2013-01-16 23:08:36 +000010315 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010316}
10317
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010318static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010319vec_all_eq(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010320{
David Blaikie3302f2b2013-01-16 23:08:36 +000010321 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010322}
10323
10324static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010325vec_all_eq(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010326{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010327 return
David Blaikie3302f2b2013-01-16 23:08:36 +000010328 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010329}
10330
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010331static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010332vec_all_eq(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010333{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010334 return
David Blaikie3302f2b2013-01-16 23:08:36 +000010335 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010336}
10337
10338static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010339vec_all_eq(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010340{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010341 return
David Blaikie3302f2b2013-01-16 23:08:36 +000010342 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010343}
10344
10345static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010346vec_all_eq(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010347{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010348 return
David Blaikie3302f2b2013-01-16 23:08:36 +000010349 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010350}
10351
10352static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010353vec_all_eq(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010354{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010355 return
David Blaikie3302f2b2013-01-16 23:08:36 +000010356 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010357}
10358
10359static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010360vec_all_eq(vector pixel __a, vector pixel __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010361{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010362 return
David Blaikie3302f2b2013-01-16 23:08:36 +000010363 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010364}
10365
10366static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010367vec_all_eq(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010368{
David Blaikie3302f2b2013-01-16 23:08:36 +000010369 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010370}
10371
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010372static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010373vec_all_eq(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010374{
David Blaikie3302f2b2013-01-16 23:08:36 +000010375 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010376}
10377
10378static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010379vec_all_eq(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010380{
David Blaikie3302f2b2013-01-16 23:08:36 +000010381 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010382}
10383
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010384static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010385vec_all_eq(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010386{
David Blaikie3302f2b2013-01-16 23:08:36 +000010387 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010388}
10389
10390static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010391vec_all_eq(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010392{
David Blaikie3302f2b2013-01-16 23:08:36 +000010393 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010394}
10395
10396static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010397vec_all_eq(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010398{
David Blaikie3302f2b2013-01-16 23:08:36 +000010399 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010400}
10401
10402static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010403vec_all_eq(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010404{
David Blaikie3302f2b2013-01-16 23:08:36 +000010405 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010406}
10407
10408static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010409vec_all_eq(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010410{
David Blaikie3302f2b2013-01-16 23:08:36 +000010411 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010412}
10413
10414/* vec_all_ge */
10415
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010416static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010417vec_all_ge(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010418{
David Blaikie3302f2b2013-01-16 23:08:36 +000010419 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010420}
10421
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010422static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010423vec_all_ge(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010424{
David Blaikie3302f2b2013-01-16 23:08:36 +000010425 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010426}
10427
10428static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010429vec_all_ge(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010430{
David Blaikie3302f2b2013-01-16 23:08:36 +000010431 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010432}
10433
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010434static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010435vec_all_ge(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010436{
David Blaikie3302f2b2013-01-16 23:08:36 +000010437 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010438}
10439
10440static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010441vec_all_ge(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010442{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010443 return __builtin_altivec_vcmpgtub_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000010444 (vector unsigned char)__b,
10445 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010446}
10447
10448static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010449vec_all_ge(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010450{
David Blaikie3302f2b2013-01-16 23:08:36 +000010451 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010452}
10453
10454static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010455vec_all_ge(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010456{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010457 return __builtin_altivec_vcmpgtub_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000010458 (vector unsigned char)__b,
10459 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010460}
10461
10462static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010463vec_all_ge(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010464{
David Blaikie3302f2b2013-01-16 23:08:36 +000010465 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010466}
10467
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010468static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010469vec_all_ge(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010470{
David Blaikie3302f2b2013-01-16 23:08:36 +000010471 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010472}
10473
10474static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010475vec_all_ge(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010476{
David Blaikie3302f2b2013-01-16 23:08:36 +000010477 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010478}
10479
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010480static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010481vec_all_ge(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010482{
David Blaikie3302f2b2013-01-16 23:08:36 +000010483 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010484}
10485
10486static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010487vec_all_ge(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010488{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010489 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000010490 (vector unsigned short)__b,
10491 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010492}
10493
10494static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010495vec_all_ge(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010496{
David Blaikie3302f2b2013-01-16 23:08:36 +000010497 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010498}
10499
10500static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010501vec_all_ge(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010502{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010503 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000010504 (vector unsigned short)__b,
10505 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010506}
10507
10508static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010509vec_all_ge(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010510{
David Blaikie3302f2b2013-01-16 23:08:36 +000010511 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010512}
10513
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010514static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010515vec_all_ge(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010516{
David Blaikie3302f2b2013-01-16 23:08:36 +000010517 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010518}
10519
10520static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010521vec_all_ge(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010522{
David Blaikie3302f2b2013-01-16 23:08:36 +000010523 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010524}
10525
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010526static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010527vec_all_ge(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010528{
David Blaikie3302f2b2013-01-16 23:08:36 +000010529 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010530}
10531
10532static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010533vec_all_ge(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010534{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010535 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000010536 (vector unsigned int)__b,
10537 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010538}
10539
10540static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010541vec_all_ge(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010542{
David Blaikie3302f2b2013-01-16 23:08:36 +000010543 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010544}
10545
10546static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010547vec_all_ge(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010548{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010549 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000010550 (vector unsigned int)__b,
10551 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010552}
10553
10554static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010555vec_all_ge(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010556{
David Blaikie3302f2b2013-01-16 23:08:36 +000010557 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010558}
10559
10560/* vec_all_gt */
10561
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010562static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010563vec_all_gt(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010564{
David Blaikie3302f2b2013-01-16 23:08:36 +000010565 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010566}
10567
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010568static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010569vec_all_gt(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010570{
David Blaikie3302f2b2013-01-16 23:08:36 +000010571 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010572}
10573
10574static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010575vec_all_gt(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010576{
David Blaikie3302f2b2013-01-16 23:08:36 +000010577 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010578}
10579
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010580static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010581vec_all_gt(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010582{
David Blaikie3302f2b2013-01-16 23:08:36 +000010583 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010584}
10585
10586static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010587vec_all_gt(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010588{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010589 return __builtin_altivec_vcmpgtub_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000010590 (vector unsigned char)__a,
10591 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010592}
10593
10594static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010595vec_all_gt(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010596{
David Blaikie3302f2b2013-01-16 23:08:36 +000010597 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010598}
10599
10600static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010601vec_all_gt(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010602{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010603 return __builtin_altivec_vcmpgtub_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000010604 (vector unsigned char)__a,
10605 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010606}
10607
10608static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010609vec_all_gt(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010610{
David Blaikie3302f2b2013-01-16 23:08:36 +000010611 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010612}
10613
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010614static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010615vec_all_gt(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010616{
David Blaikie3302f2b2013-01-16 23:08:36 +000010617 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010618}
10619
10620static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010621vec_all_gt(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010622{
David Blaikie3302f2b2013-01-16 23:08:36 +000010623 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010624}
10625
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010626static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010627vec_all_gt(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010628{
David Blaikie3302f2b2013-01-16 23:08:36 +000010629 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010630}
10631
10632static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010633vec_all_gt(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010634{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010635 return __builtin_altivec_vcmpgtuh_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000010636 (vector unsigned short)__a,
10637 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010638}
10639
10640static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010641vec_all_gt(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010642{
David Blaikie3302f2b2013-01-16 23:08:36 +000010643 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010644}
10645
10646static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010647vec_all_gt(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010648{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010649 return __builtin_altivec_vcmpgtuh_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000010650 (vector unsigned short)__a,
10651 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010652}
10653
10654static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010655vec_all_gt(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010656{
David Blaikie3302f2b2013-01-16 23:08:36 +000010657 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010658}
10659
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010660static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010661vec_all_gt(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010662{
David Blaikie3302f2b2013-01-16 23:08:36 +000010663 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010664}
10665
10666static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010667vec_all_gt(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010668{
David Blaikie3302f2b2013-01-16 23:08:36 +000010669 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010670}
10671
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010672static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010673vec_all_gt(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010674{
David Blaikie3302f2b2013-01-16 23:08:36 +000010675 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010676}
10677
10678static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010679vec_all_gt(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010680{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010681 return __builtin_altivec_vcmpgtuw_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000010682 (vector unsigned int)__a,
10683 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010684}
10685
10686static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010687vec_all_gt(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010688{
David Blaikie3302f2b2013-01-16 23:08:36 +000010689 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010690}
10691
10692static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010693vec_all_gt(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010694{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010695 return __builtin_altivec_vcmpgtuw_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000010696 (vector unsigned int)__a,
10697 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010698}
10699
10700static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010701vec_all_gt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010702{
David Blaikie3302f2b2013-01-16 23:08:36 +000010703 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010704}
10705
10706/* vec_all_in */
10707
10708static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000010709vec_all_in(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010710{
David Blaikie3302f2b2013-01-16 23:08:36 +000010711 return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010712}
10713
10714/* vec_all_le */
10715
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010716static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010717vec_all_le(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010718{
David Blaikie3302f2b2013-01-16 23:08:36 +000010719 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010720}
10721
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010722static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010723vec_all_le(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010724{
David Blaikie3302f2b2013-01-16 23:08:36 +000010725 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010726}
10727
10728static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010729vec_all_le(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010730{
David Blaikie3302f2b2013-01-16 23:08:36 +000010731 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010732}
10733
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010734static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010735vec_all_le(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010736{
David Blaikie3302f2b2013-01-16 23:08:36 +000010737 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010738}
10739
10740static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010741vec_all_le(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010742{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010743 return __builtin_altivec_vcmpgtub_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000010744 (vector unsigned char)__a,
10745 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010746}
10747
10748static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010749vec_all_le(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010750{
David Blaikie3302f2b2013-01-16 23:08:36 +000010751 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010752}
10753
10754static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010755vec_all_le(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010756{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010757 return __builtin_altivec_vcmpgtub_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000010758 (vector unsigned char)__a,
10759 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010760}
10761
10762static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010763vec_all_le(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010764{
David Blaikie3302f2b2013-01-16 23:08:36 +000010765 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010766}
10767
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010768static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010769vec_all_le(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010770{
David Blaikie3302f2b2013-01-16 23:08:36 +000010771 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010772}
10773
10774static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010775vec_all_le(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010776{
David Blaikie3302f2b2013-01-16 23:08:36 +000010777 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010778}
10779
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010780static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010781vec_all_le(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010782{
David Blaikie3302f2b2013-01-16 23:08:36 +000010783 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010784}
10785
10786static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010787vec_all_le(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010788{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010789 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000010790 (vector unsigned short)__a,
10791 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010792}
10793
10794static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010795vec_all_le(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010796{
David Blaikie3302f2b2013-01-16 23:08:36 +000010797 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010798}
10799
10800static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010801vec_all_le(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010802{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010803 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000010804 (vector unsigned short)__a,
10805 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010806}
10807
10808static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010809vec_all_le(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010810{
David Blaikie3302f2b2013-01-16 23:08:36 +000010811 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010812}
10813
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010814static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010815vec_all_le(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010816{
David Blaikie3302f2b2013-01-16 23:08:36 +000010817 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010818}
10819
10820static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010821vec_all_le(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010822{
David Blaikie3302f2b2013-01-16 23:08:36 +000010823 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010824}
10825
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010826static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010827vec_all_le(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010828{
David Blaikie3302f2b2013-01-16 23:08:36 +000010829 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010830}
10831
10832static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010833vec_all_le(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010834{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010835 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000010836 (vector unsigned int)__a,
10837 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010838}
10839
10840static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010841vec_all_le(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010842{
David Blaikie3302f2b2013-01-16 23:08:36 +000010843 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010844}
10845
10846static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010847vec_all_le(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010848{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010849 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000010850 (vector unsigned int)__a,
10851 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010852}
10853
10854static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010855vec_all_le(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010856{
David Blaikie3302f2b2013-01-16 23:08:36 +000010857 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010858}
10859
10860/* vec_all_lt */
10861
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010862static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010863vec_all_lt(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010864{
David Blaikie3302f2b2013-01-16 23:08:36 +000010865 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010866}
10867
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010868static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010869vec_all_lt(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010870{
David Blaikie3302f2b2013-01-16 23:08:36 +000010871 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010872}
10873
10874static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010875vec_all_lt(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010876{
David Blaikie3302f2b2013-01-16 23:08:36 +000010877 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010878}
10879
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010880static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010881vec_all_lt(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010882{
David Blaikie3302f2b2013-01-16 23:08:36 +000010883 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010884}
10885
10886static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010887vec_all_lt(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010888{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010889 return __builtin_altivec_vcmpgtub_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000010890 (vector unsigned char)__b,
10891 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010892}
10893
10894static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010895vec_all_lt(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010896{
David Blaikie3302f2b2013-01-16 23:08:36 +000010897 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010898}
10899
10900static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010901vec_all_lt(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010902{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010903 return __builtin_altivec_vcmpgtub_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000010904 (vector unsigned char)__b,
10905 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010906}
10907
10908static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010909vec_all_lt(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010910{
David Blaikie3302f2b2013-01-16 23:08:36 +000010911 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010912}
10913
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010914static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010915vec_all_lt(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010916{
David Blaikie3302f2b2013-01-16 23:08:36 +000010917 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010918}
10919
10920static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010921vec_all_lt(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010922{
David Blaikie3302f2b2013-01-16 23:08:36 +000010923 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010924}
10925
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010926static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010927vec_all_lt(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010928{
David Blaikie3302f2b2013-01-16 23:08:36 +000010929 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010930}
10931
10932static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010933vec_all_lt(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010934{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010935 return __builtin_altivec_vcmpgtuh_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000010936 (vector unsigned short)__b,
10937 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010938}
10939
10940static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010941vec_all_lt(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010942{
David Blaikie3302f2b2013-01-16 23:08:36 +000010943 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010944}
10945
10946static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010947vec_all_lt(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010948{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010949 return __builtin_altivec_vcmpgtuh_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000010950 (vector unsigned short)__b,
10951 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010952}
10953
10954static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010955vec_all_lt(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010956{
David Blaikie3302f2b2013-01-16 23:08:36 +000010957 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010958}
10959
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010960static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010961vec_all_lt(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010962{
David Blaikie3302f2b2013-01-16 23:08:36 +000010963 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010964}
10965
10966static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010967vec_all_lt(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010968{
David Blaikie3302f2b2013-01-16 23:08:36 +000010969 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010970}
10971
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010972static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010973vec_all_lt(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010974{
David Blaikie3302f2b2013-01-16 23:08:36 +000010975 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010976}
10977
10978static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010979vec_all_lt(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010980{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010981 return __builtin_altivec_vcmpgtuw_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000010982 (vector unsigned int)__b,
10983 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010984}
10985
10986static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010987vec_all_lt(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010988{
David Blaikie3302f2b2013-01-16 23:08:36 +000010989 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010990}
10991
10992static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010993vec_all_lt(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010994{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010995 return __builtin_altivec_vcmpgtuw_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000010996 (vector unsigned int)__b,
10997 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010998}
10999
11000static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011001vec_all_lt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011002{
David Blaikie3302f2b2013-01-16 23:08:36 +000011003 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011004}
11005
11006/* vec_all_nan */
11007
11008static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000011009vec_all_nan(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +000011010{
David Blaikie3302f2b2013-01-16 23:08:36 +000011011 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011012}
11013
11014/* vec_all_ne */
11015
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011016static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011017vec_all_ne(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011018{
David Blaikie3302f2b2013-01-16 23:08:36 +000011019 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011020}
11021
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011022static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011023vec_all_ne(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011024{
David Blaikie3302f2b2013-01-16 23:08:36 +000011025 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011026}
11027
11028static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011029vec_all_ne(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011030{
David Blaikie3302f2b2013-01-16 23:08:36 +000011031 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011032}
11033
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011034static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011035vec_all_ne(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011036{
David Blaikie3302f2b2013-01-16 23:08:36 +000011037 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011038}
11039
11040static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011041vec_all_ne(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011042{
David Blaikie3302f2b2013-01-16 23:08:36 +000011043 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011044}
11045
11046static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011047vec_all_ne(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011048{
David Blaikie3302f2b2013-01-16 23:08:36 +000011049 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011050}
11051
11052static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011053vec_all_ne(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011054{
David Blaikie3302f2b2013-01-16 23:08:36 +000011055 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011056}
11057
11058static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011059vec_all_ne(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011060{
David Blaikie3302f2b2013-01-16 23:08:36 +000011061 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011062}
11063
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011064static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011065vec_all_ne(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011066{
David Blaikie3302f2b2013-01-16 23:08:36 +000011067 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011068}
11069
11070static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011071vec_all_ne(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011072{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011073 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011074 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011075}
11076
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011077static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011078vec_all_ne(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011079{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011080 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011081 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011082}
11083
11084static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011085vec_all_ne(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011086{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011087 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011088 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011089}
11090
11091static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011092vec_all_ne(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011093{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011094 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011095 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011096}
11097
11098static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011099vec_all_ne(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011100{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011101 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011102 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011103}
11104
11105static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011106vec_all_ne(vector pixel __a, vector pixel __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011107{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011108 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011109 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011110}
11111
11112static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011113vec_all_ne(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011114{
David Blaikie3302f2b2013-01-16 23:08:36 +000011115 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011116}
11117
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011118static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011119vec_all_ne(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011120{
David Blaikie3302f2b2013-01-16 23:08:36 +000011121 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011122}
11123
11124static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011125vec_all_ne(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011126{
David Blaikie3302f2b2013-01-16 23:08:36 +000011127 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011128}
11129
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011130static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011131vec_all_ne(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011132{
David Blaikie3302f2b2013-01-16 23:08:36 +000011133 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011134}
11135
11136static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011137vec_all_ne(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011138{
David Blaikie3302f2b2013-01-16 23:08:36 +000011139 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011140}
11141
11142static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011143vec_all_ne(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011144{
David Blaikie3302f2b2013-01-16 23:08:36 +000011145 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__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_ne(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011150{
David Blaikie3302f2b2013-01-16 23:08:36 +000011151 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011152}
11153
11154static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011155vec_all_ne(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011156{
David Blaikie3302f2b2013-01-16 23:08:36 +000011157 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011158}
11159
11160/* vec_all_nge */
11161
11162static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000011163vec_all_nge(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011164{
David Blaikie3302f2b2013-01-16 23:08:36 +000011165 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011166}
11167
11168/* vec_all_ngt */
11169
11170static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000011171vec_all_ngt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011172{
David Blaikie3302f2b2013-01-16 23:08:36 +000011173 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011174}
11175
11176/* vec_all_nle */
11177
11178static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000011179vec_all_nle(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011180{
David Blaikie3302f2b2013-01-16 23:08:36 +000011181 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011182}
11183
11184/* vec_all_nlt */
11185
11186static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000011187vec_all_nlt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011188{
David Blaikie3302f2b2013-01-16 23:08:36 +000011189 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011190}
11191
11192/* vec_all_numeric */
11193
11194static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000011195vec_all_numeric(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +000011196{
David Blaikie3302f2b2013-01-16 23:08:36 +000011197 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011198}
11199
11200/* vec_any_eq */
11201
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011202static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011203vec_any_eq(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011204{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011205 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011206 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011207}
11208
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011209static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011210vec_any_eq(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011211{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011212 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011213 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011214}
11215
11216static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011217vec_any_eq(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011218{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011219 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011220 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011221}
11222
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011223static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011224vec_any_eq(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011225{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011226 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011227 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011228}
11229
11230static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011231vec_any_eq(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011232{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011233 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011234 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011235}
11236
11237static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011238vec_any_eq(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011239{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011240 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011241 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011242}
11243
11244static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011245vec_any_eq(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011246{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011247 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011248 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011249}
11250
11251static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011252vec_any_eq(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011253{
David Blaikie3302f2b2013-01-16 23:08:36 +000011254 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011255}
11256
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011257static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011258vec_any_eq(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011259{
David Blaikie3302f2b2013-01-16 23:08:36 +000011260 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011261}
11262
11263static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011264vec_any_eq(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011265{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011266 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011267 (vector short)__a,
11268 (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011269}
11270
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011271static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011272vec_any_eq(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011273{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011274 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011275 (vector short)__a,
11276 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011277}
11278
11279static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011280vec_any_eq(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011281{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011282 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011283 (vector short)__a,
11284 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011285}
11286
11287static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011288vec_any_eq(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011289{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011290 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011291 (vector short)__a,
11292 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011293}
11294
11295static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011296vec_any_eq(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011297{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011298 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011299 (vector short)__a,
11300 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011301}
11302
11303static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011304vec_any_eq(vector pixel __a, vector pixel __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011305{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011306 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011307 (vector short)__a,
11308 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011309}
11310
11311static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011312vec_any_eq(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011313{
David Blaikie3302f2b2013-01-16 23:08:36 +000011314 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011315}
11316
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011317static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011318vec_any_eq(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011319{
David Blaikie3302f2b2013-01-16 23:08:36 +000011320 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011321}
11322
11323static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011324vec_any_eq(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011325{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011326 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011327 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011328}
11329
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011330static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011331vec_any_eq(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011332{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011333 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011334 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011335}
11336
11337static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011338vec_any_eq(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011339{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011340 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011341 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011342}
11343
11344static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011345vec_any_eq(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011346{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011347 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011348 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011349}
11350
11351static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011352vec_any_eq(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011353{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011354 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011355 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011356}
11357
11358static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011359vec_any_eq(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011360{
David Blaikie3302f2b2013-01-16 23:08:36 +000011361 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011362}
11363
11364/* vec_any_ge */
11365
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011366static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011367vec_any_ge(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011368{
David Blaikie3302f2b2013-01-16 23:08:36 +000011369 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011370}
11371
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011372static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011373vec_any_ge(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011374{
David Blaikie3302f2b2013-01-16 23:08:36 +000011375 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011376}
11377
11378static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011379vec_any_ge(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011380{
David Blaikie3302f2b2013-01-16 23:08:36 +000011381 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011382}
11383
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011384static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011385vec_any_ge(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011386{
David Blaikie3302f2b2013-01-16 23:08:36 +000011387 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011388}
11389
11390static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011391vec_any_ge(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011392{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011393 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011394 (vector unsigned char)__b,
11395 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011396}
11397
11398static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011399vec_any_ge(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011400{
David Blaikie3302f2b2013-01-16 23:08:36 +000011401 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011402}
11403
11404static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011405vec_any_ge(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011406{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011407 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011408 (vector unsigned char)__b,
11409 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011410}
11411
11412static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011413vec_any_ge(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011414{
David Blaikie3302f2b2013-01-16 23:08:36 +000011415 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011416}
11417
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011418static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011419vec_any_ge(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011420{
David Blaikie3302f2b2013-01-16 23:08:36 +000011421 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011422}
11423
11424static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011425vec_any_ge(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011426{
David Blaikie3302f2b2013-01-16 23:08:36 +000011427 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011428}
11429
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011430static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011431vec_any_ge(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011432{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011433 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011434 __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011435}
11436
11437static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011438vec_any_ge(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011439{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011440 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011441 (vector unsigned short)__b,
11442 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011443}
11444
11445static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011446vec_any_ge(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011447{
11448 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011449 __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011450}
11451
11452static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011453vec_any_ge(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011454{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011455 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011456 (vector unsigned short)__b,
11457 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011458}
11459
11460static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011461vec_any_ge(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011462{
David Blaikie3302f2b2013-01-16 23:08:36 +000011463 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011464}
11465
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011466static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011467vec_any_ge(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011468{
David Blaikie3302f2b2013-01-16 23:08:36 +000011469 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011470}
11471
11472static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011473vec_any_ge(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011474{
David Blaikie3302f2b2013-01-16 23:08:36 +000011475 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011476}
11477
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011478static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011479vec_any_ge(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011480{
David Blaikie3302f2b2013-01-16 23:08:36 +000011481 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011482}
11483
11484static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011485vec_any_ge(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011486{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011487 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011488 (vector unsigned int)__b,
11489 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011490}
11491
11492static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011493vec_any_ge(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011494{
David Blaikie3302f2b2013-01-16 23:08:36 +000011495 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011496}
11497
11498static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011499vec_any_ge(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011500{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011501 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011502 (vector unsigned int)__b,
11503 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011504}
11505
11506static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011507vec_any_ge(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011508{
David Blaikie3302f2b2013-01-16 23:08:36 +000011509 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011510}
11511
11512/* vec_any_gt */
11513
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011514static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011515vec_any_gt(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011516{
David Blaikie3302f2b2013-01-16 23:08:36 +000011517 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011518}
11519
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011520static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011521vec_any_gt(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011522{
David Blaikie3302f2b2013-01-16 23:08:36 +000011523 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011524}
11525
11526static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011527vec_any_gt(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011528{
David Blaikie3302f2b2013-01-16 23:08:36 +000011529 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011530}
11531
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011532static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011533vec_any_gt(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011534{
11535 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011536 __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011537}
11538
11539static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011540vec_any_gt(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011541{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011542 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011543 (vector unsigned char)__a,
11544 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011545}
11546
11547static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011548vec_any_gt(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011549{
11550 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011551 __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011552}
11553
11554static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011555vec_any_gt(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011556{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011557 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011558 (vector unsigned char)__a,
11559 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011560}
11561
11562static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011563vec_any_gt(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011564{
David Blaikie3302f2b2013-01-16 23:08:36 +000011565 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011566}
11567
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011568static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011569vec_any_gt(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011570{
David Blaikie3302f2b2013-01-16 23:08:36 +000011571 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011572}
11573
11574static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011575vec_any_gt(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011576{
David Blaikie3302f2b2013-01-16 23:08:36 +000011577 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011578}
11579
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011580static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011581vec_any_gt(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011582{
11583 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011584 __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011585}
11586
11587static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011588vec_any_gt(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011589{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011590 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011591 (vector unsigned short)__a,
11592 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011593}
11594
11595static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011596vec_any_gt(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011597{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011598 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011599 __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011600}
11601
11602static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011603vec_any_gt(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011604{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011605 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011606 (vector unsigned short)__a,
11607 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011608}
11609
11610static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011611vec_any_gt(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011612{
David Blaikie3302f2b2013-01-16 23:08:36 +000011613 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011614}
11615
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011616static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011617vec_any_gt(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011618{
David Blaikie3302f2b2013-01-16 23:08:36 +000011619 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011620}
11621
11622static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011623vec_any_gt(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011624{
David Blaikie3302f2b2013-01-16 23:08:36 +000011625 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011626}
11627
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011628static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011629vec_any_gt(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011630{
David Blaikie3302f2b2013-01-16 23:08:36 +000011631 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011632}
11633
11634static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011635vec_any_gt(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011636{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011637 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011638 (vector unsigned int)__a,
11639 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011640}
11641
11642static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011643vec_any_gt(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011644{
David Blaikie3302f2b2013-01-16 23:08:36 +000011645 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011646}
11647
11648static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011649vec_any_gt(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011650{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011651 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011652 (vector unsigned int)__a,
11653 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011654}
11655
11656static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011657vec_any_gt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011658{
David Blaikie3302f2b2013-01-16 23:08:36 +000011659 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011660}
11661
11662/* vec_any_le */
11663
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011664static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011665vec_any_le(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011666{
David Blaikie3302f2b2013-01-16 23:08:36 +000011667 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011668}
11669
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011670static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011671vec_any_le(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011672{
David Blaikie3302f2b2013-01-16 23:08:36 +000011673 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011674}
11675
11676static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011677vec_any_le(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011678{
David Blaikie3302f2b2013-01-16 23:08:36 +000011679 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011680}
11681
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011682static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011683vec_any_le(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011684{
11685 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011686 __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011687}
11688
11689static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011690vec_any_le(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011691{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011692 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011693 (vector unsigned char)__a,
11694 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011695}
11696
11697static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011698vec_any_le(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011699{
11700 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011701 __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011702}
11703
11704static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011705vec_any_le(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011706{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011707 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011708 (vector unsigned char)__a,
11709 (vector unsigned 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_le(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011714{
David Blaikie3302f2b2013-01-16 23:08:36 +000011715 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011716}
11717
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011718static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011719vec_any_le(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011720{
David Blaikie3302f2b2013-01-16 23:08:36 +000011721 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011722}
11723
11724static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011725vec_any_le(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011726{
David Blaikie3302f2b2013-01-16 23:08:36 +000011727 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011728}
11729
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011730static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011731vec_any_le(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011732{
11733 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011734 __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011735}
11736
11737static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011738vec_any_le(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011739{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011740 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011741 (vector unsigned short)__a,
11742 (vector unsigned 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_le(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011747{
11748 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011749 __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011750}
11751
11752static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011753vec_any_le(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011754{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011755 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011756 (vector unsigned short)__a,
11757 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011758}
11759
11760static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011761vec_any_le(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011762{
David Blaikie3302f2b2013-01-16 23:08:36 +000011763 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011764}
11765
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011766static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011767vec_any_le(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011768{
David Blaikie3302f2b2013-01-16 23:08:36 +000011769 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011770}
11771
11772static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011773vec_any_le(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011774{
David Blaikie3302f2b2013-01-16 23:08:36 +000011775 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011776}
11777
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011778static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011779vec_any_le(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011780{
David Blaikie3302f2b2013-01-16 23:08:36 +000011781 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011782}
11783
11784static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011785vec_any_le(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011786{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011787 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011788 (vector unsigned int)__a,
11789 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011790}
11791
11792static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011793vec_any_le(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011794{
David Blaikie3302f2b2013-01-16 23:08:36 +000011795 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011796}
11797
11798static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011799vec_any_le(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011800{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011801 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011802 (vector unsigned int)__a,
11803 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011804}
11805
11806static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011807vec_any_le(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011808{
David Blaikie3302f2b2013-01-16 23:08:36 +000011809 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011810}
11811
11812/* vec_any_lt */
11813
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011814static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011815vec_any_lt(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011816{
David Blaikie3302f2b2013-01-16 23:08:36 +000011817 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011818}
11819
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011820static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011821vec_any_lt(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011822{
David Blaikie3302f2b2013-01-16 23:08:36 +000011823 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011824}
11825
11826static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011827vec_any_lt(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011828{
David Blaikie3302f2b2013-01-16 23:08:36 +000011829 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011830}
11831
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011832static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011833vec_any_lt(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011834{
11835 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011836 __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011837}
11838
11839static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011840vec_any_lt(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011841{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011842 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011843 (vector unsigned char)__b,
11844 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011845}
11846
11847static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011848vec_any_lt(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011849{
11850 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011851 __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011852}
11853
11854static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011855vec_any_lt(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011856{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011857 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011858 (vector unsigned char)__b,
11859 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011860}
11861
11862static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011863vec_any_lt(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011864{
David Blaikie3302f2b2013-01-16 23:08:36 +000011865 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011866}
11867
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011868static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011869vec_any_lt(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011870{
David Blaikie3302f2b2013-01-16 23:08:36 +000011871 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011872}
11873
11874static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011875vec_any_lt(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011876{
David Blaikie3302f2b2013-01-16 23:08:36 +000011877 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011878}
11879
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011880static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011881vec_any_lt(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011882{
11883 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011884 __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011885}
11886
11887static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011888vec_any_lt(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011889{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011890 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011891 (vector unsigned short)__b,
11892 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011893}
11894
11895static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011896vec_any_lt(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011897{
11898 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011899 __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011900}
11901
11902static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011903vec_any_lt(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011904{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011905 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011906 (vector unsigned short)__b,
11907 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011908}
11909
11910static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011911vec_any_lt(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011912{
David Blaikie3302f2b2013-01-16 23:08:36 +000011913 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011914}
11915
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011916static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011917vec_any_lt(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011918{
David Blaikie3302f2b2013-01-16 23:08:36 +000011919 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011920}
11921
11922static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011923vec_any_lt(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011924{
David Blaikie3302f2b2013-01-16 23:08:36 +000011925 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011926}
11927
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011928static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011929vec_any_lt(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011930{
David Blaikie3302f2b2013-01-16 23:08:36 +000011931 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011932}
11933
11934static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011935vec_any_lt(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011936{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011937 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011938 (vector unsigned int)__b,
11939 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011940}
11941
11942static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011943vec_any_lt(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011944{
David Blaikie3302f2b2013-01-16 23:08:36 +000011945 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011946}
11947
11948static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011949vec_any_lt(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011950{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011951 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011952 (vector unsigned int)__b,
11953 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011954}
11955
11956static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011957vec_any_lt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011958{
David Blaikie3302f2b2013-01-16 23:08:36 +000011959 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011960}
11961
11962/* vec_any_nan */
11963
11964static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000011965vec_any_nan(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +000011966{
David Blaikie3302f2b2013-01-16 23:08:36 +000011967 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011968}
11969
11970/* vec_any_ne */
11971
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011972static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011973vec_any_ne(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011974{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011975 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011976 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011977}
11978
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011979static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011980vec_any_ne(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011981{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011982 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011983 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011984}
11985
11986static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011987vec_any_ne(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011988{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011989 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011990 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011991}
11992
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011993static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011994vec_any_ne(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011995{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011996 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011997 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011998}
11999
12000static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012001vec_any_ne(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012002{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012003 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012004 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012005}
12006
12007static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012008vec_any_ne(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012009{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012010 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012011 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012012}
12013
12014static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012015vec_any_ne(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012016{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012017 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012018 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector 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_ne(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012023{
David Blaikie3302f2b2013-01-16 23:08:36 +000012024 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012025}
12026
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012027static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012028vec_any_ne(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012029{
David Blaikie3302f2b2013-01-16 23:08:36 +000012030 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012031}
12032
12033static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012034vec_any_ne(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012035{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012036 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012037 (vector short)__a,
12038 (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012039}
12040
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012041static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012042vec_any_ne(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012043{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012044 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012045 (vector short)__a,
12046 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012047}
12048
12049static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012050vec_any_ne(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012051{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012052 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012053 (vector short)__a,
12054 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012055}
12056
12057static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012058vec_any_ne(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012059{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012060 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012061 (vector short)__a,
12062 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012063}
12064
12065static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012066vec_any_ne(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012067{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012068 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012069 (vector short)__a,
12070 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012071}
12072
12073static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012074vec_any_ne(vector pixel __a, vector pixel __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012075{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012076 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012077 (vector short)__a,
12078 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012079}
12080
12081static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012082vec_any_ne(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012083{
David Blaikie3302f2b2013-01-16 23:08:36 +000012084 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012085}
12086
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012087static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012088vec_any_ne(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012089{
David Blaikie3302f2b2013-01-16 23:08:36 +000012090 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012091}
12092
12093static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012094vec_any_ne(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012095{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012096 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012097 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012098}
12099
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012100static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012101vec_any_ne(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012102{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012103 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012104 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012105}
12106
12107static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012108vec_any_ne(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012109{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012110 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012111 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012112}
12113
12114static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012115vec_any_ne(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012116{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012117 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012118 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012119}
12120
12121static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012122vec_any_ne(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012123{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012124 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012125 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012126}
12127
12128static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012129vec_any_ne(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012130{
David Blaikie3302f2b2013-01-16 23:08:36 +000012131 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012132}
12133
12134/* vec_any_nge */
12135
12136static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012137vec_any_nge(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012138{
David Blaikie3302f2b2013-01-16 23:08:36 +000012139 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012140}
12141
12142/* vec_any_ngt */
12143
12144static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012145vec_any_ngt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012146{
David Blaikie3302f2b2013-01-16 23:08:36 +000012147 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012148}
12149
12150/* vec_any_nle */
12151
12152static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012153vec_any_nle(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012154{
David Blaikie3302f2b2013-01-16 23:08:36 +000012155 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012156}
12157
12158/* vec_any_nlt */
12159
12160static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012161vec_any_nlt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012162{
David Blaikie3302f2b2013-01-16 23:08:36 +000012163 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012164}
12165
12166/* vec_any_numeric */
12167
12168static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012169vec_any_numeric(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +000012170{
David Blaikie3302f2b2013-01-16 23:08:36 +000012171 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012172}
12173
12174/* vec_any_out */
12175
12176static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012177vec_any_out(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012178{
David Blaikie3302f2b2013-01-16 23:08:36 +000012179 return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012180}
12181
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012182#undef __ATTRS_o_ai
Chris Lattnerdad40622010-04-14 03:54:58 +000012183
12184#endif /* __ALTIVEC_H */